Skip to content

Commit

Permalink
no fml rejection message
Browse files Browse the repository at this point in the history
closes #1
  • Loading branch information
phit committed Feb 10, 2020
1 parent dbc461c commit 8477916
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modGroup=net.stonebound
modVersion=1.1.2-SNAPSHOT
modVersion=1.2.0
modBaseName=customreject
forgeVersion=1.12.2-14.23.5
forgeBuild=2838
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/net/stonebound/customreject/CustomReject.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.apache.logging.log4j.Logger;

@Mod(modid = CustomReject.MODID, name = "Custom Mod Rejection", version = "1.1.2", acceptableRemoteVersions = "*")
@Mod(modid = CustomReject.MODID, name = "Custom Mod Rejection", version = "1.2.0", acceptableRemoteVersions = "*")
public class CustomReject {
public static final String MODID = "creject";
private static Logger logger;
Expand All @@ -36,5 +36,10 @@ public static class ModConfig {

@Comment("Include default mismatch message [default: true]")
public static boolean includeMismatchedMods = true;

@Comment("Rejection Message if no FML was found on the client [default: \"This server has mods that require FML/Forge to be installed on "
+ "the client. Contact your server admin for more details.\"]")
public static String rejectionMessageNoFML = "This server has mods that require FML/Forge to be installed on the client. Contact your server "
+ "admin for more details.";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package net.stonebound.customreject.mixin;

import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.stonebound.customreject.CustomReject;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;

@Mixin(value = FMLCommonHandler.class, priority = 1001, remap = false)
public class MixinFMLCommonHandler {
@ModifyVariable(method = "handleServerHandshake",
at = @At(value = "STORE", ordinal = 1), name = "text")
private TextComponentString text(TextComponentString text) {
return new TextComponentString(CustomReject.ModConfig.rejectionMessageNoFML);
}
}

3 changes: 2 additions & 1 deletion src/main/resources/mixins.customreject.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"compatibilityLevel": "JAVA_8",
"refmap": "mixins.customreject.refmap.json",
"mixins": [
"MixinFMLNetworkHandler"
"MixinFMLNetworkHandler",
"MixinFMLCommonHandler"
]
}

0 comments on commit 8477916

Please sign in to comment.