-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
now depends on GTNHLib Signed-off-by: unilock <[email protected]>
- Loading branch information
Showing
27 changed files
with
312 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
src/main/java/cc/unilock/legacyfixes/EarlyMixinLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
package cc.unilock.legacyfixes; | ||
|
||
import com.gtnewhorizon.gtnhlib.config.ConfigException; | ||
import com.gtnewhorizon.gtnhlib.config.ConfigurationManager; | ||
import com.gtnewhorizon.gtnhmixins.IEarlyMixinLoader; | ||
import cpw.mods.fml.common.Loader; | ||
import cpw.mods.fml.relauncher.FMLLaunchHandler; | ||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
@IFMLLoadingPlugin.MCVersion("1.7.10") | ||
public class EarlyMixinLoader implements IFMLLoadingPlugin, IEarlyMixinLoader { | ||
static { | ||
try { | ||
ConfigurationManager.registerConfig(LegacyFixesConfig.class); | ||
} catch (ConfigException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
@Override | ||
public String getMixinConfig() { | ||
return "mixins.legacyfixes.early.json"; | ||
} | ||
|
||
@Override | ||
public List<String> getMixins(Set<String> loadedCoreMods) { | ||
List<String> mixins = new ArrayList<>(); | ||
|
||
if (LegacyFixesConfig.apatheticMobs) { | ||
mixins.add("apatheticMobs.EntityAITargetMixin"); | ||
mixins.add("apatheticMobs.EntityCreatureMixin"); | ||
} | ||
if (LegacyFixesConfig.bedSpawnFix) { | ||
mixins.add("bedSpawnFix.BlockBedMixin"); | ||
mixins.add("bedSpawnFix.EntityPlayerAccessor"); | ||
} | ||
if (LegacyFixesConfig.hungerless) { | ||
if (Loader.isModLoaded("AppleCore")) { | ||
LegacyFixes.LOGGER.error("LegacyFixes failed to enable hungerless with AppleCore installed!"); | ||
} else { | ||
mixins.add("hungerless.FoodStatsMixin"); | ||
} | ||
} | ||
if (LegacyFixesConfig.jumpClimbing) { | ||
if (LegacyFixesConfig.slideClimbing) { | ||
LegacyFixes.LOGGER.error("LegacyFixes failed to enable jumpClimbing with slideClimbing enabled!"); | ||
} else { | ||
mixins.add("jumpClimbing.EntityLivingBaseMixin"); | ||
} | ||
} | ||
if (LegacyFixesConfig.keepXP) { | ||
mixins.add("keepXP.EntityLivingBaseMixin"); | ||
mixins.add("keepXP.EntityPlayerMixin"); | ||
} | ||
if (LegacyFixesConfig.mc5694Fix) { | ||
mixins.add("mc5694Fix.ItemInWorldManagerMixin"); | ||
} | ||
if (LegacyFixesConfig.noTrample) { | ||
mixins.add("noTrample.BlockFarmlandMixin"); | ||
} | ||
if (LegacyFixesConfig.slideClimbing) { | ||
if (LegacyFixesConfig.jumpClimbing) { | ||
LegacyFixes.LOGGER.error("LegacyFixes failed to enable slideClimbing with jumpClimbing enabled!"); | ||
} else { | ||
mixins.add("slideClimbing.EntityLivingBaseMixin"); | ||
} | ||
} | ||
|
||
if (FMLLaunchHandler.side().isClient()) { | ||
if (LegacyFixesConfig.chatLinebreakFix) { | ||
mixins.add("client.chatLinebreakFix.GuiNewChatMixin"); | ||
} | ||
if (LegacyFixesConfig.nnbspFix) { | ||
mixins.add("client.nnbspFix.FontRendererMixin"); | ||
} | ||
if (LegacyFixesConfig.rmbClear) { | ||
mixins.add("client.rmbClear.GuiTextFieldMixin"); | ||
} | ||
if (LegacyFixesConfig.sortedEnchantments) { | ||
mixins.add("client.sortedEnchantments.ItemEnchantedBookMixin"); | ||
mixins.add("client.sortedEnchantments.ItemStackMixin"); | ||
mixins.add("client.sortedEnchantments.NBTTagListAccessor"); | ||
} | ||
} | ||
|
||
return mixins; | ||
} | ||
|
||
@Override | ||
public String[] getASMTransformerClass() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String getModContainerClass() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String getSetupClass() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void injectData(Map<String, Object> data) { | ||
// NO-OP | ||
} | ||
|
||
@Override | ||
public String getAccessTransformerClass() { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 54 additions & 38 deletions
92
src/main/java/cc/unilock/legacyfixes/LegacyFixesConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,59 @@ | ||
package cc.unilock.legacyfixes; | ||
|
||
import net.minecraftforge.common.config.Configuration; | ||
|
||
import java.io.File; | ||
import com.gtnewhorizon.gtnhlib.config.Config; | ||
|
||
@Config(modid = "legacyfixes") | ||
@Config.RequiresMcRestart | ||
public class LegacyFixesConfig { | ||
public static boolean apatheticMobs = false; | ||
public static boolean bedSpawnFix = true; | ||
public static boolean chatLinebreakFix = false; | ||
public static boolean doubleDoors = true; | ||
public static boolean hungerless = false; | ||
public static boolean jumpClimbing = true; | ||
public static boolean keepXP = false; | ||
public static boolean mc5694Fix = true; | ||
public static boolean nnbspFix = true; | ||
public static boolean noTrample = false; | ||
public static boolean rmbClear = true; | ||
public static boolean slideClimbing = false; | ||
public static boolean sortedEnchantments = true; | ||
|
||
public static void synchronizeConfiguration(File configFile) { | ||
Configuration configuration = new Configuration(configFile); | ||
|
||
apatheticMobs = configuration.getBoolean("apatheticMobs", Configuration.CATEGORY_GENERAL, apatheticMobs, "Prevents mobs from attacking / targeting players"); | ||
bedSpawnFix = configuration.getBoolean("bedSpawnFix", Configuration.CATEGORY_GENERAL, bedSpawnFix, "Allows beds to set a player's spawn point during the day (as in 1.15+)"); | ||
chatLinebreakFix = configuration.getBoolean("chatLinebreakFix", Configuration.CATEGORY_GENERAL, chatLinebreakFix, "Fixes line breaks in chat not rendering properly, but breaks certain formatting in fixed chat messages"); | ||
doubleDoors = configuration.getBoolean("doubleDoors", Configuration.CATEGORY_GENERAL, doubleDoors, "Makes double doors open simultaneously"); | ||
hungerless = configuration.getBoolean("hungerless", Configuration.CATEGORY_GENERAL, hungerless, "Makes the hunger system always act as if the difficulty is set to Peaceful (incompat with AppleCore)"); | ||
jumpClimbing = configuration.getBoolean("jumpClimbing", Configuration.CATEGORY_GENERAL, jumpClimbing, "Allows climbing ladders by jumping (incompat with slideClimbing)"); | ||
keepXP = configuration.getBoolean("keepXP", Configuration.CATEGORY_GENERAL, keepXP, "Players keep their experience level / points on death"); | ||
mc5694Fix = configuration.getBoolean("mc5694Fix", Configuration.CATEGORY_GENERAL, mc5694Fix, "Try to fix MC-5694 (\"High efficiency tools / fast mining destroys some blocks client-side only\")"); | ||
noTrample = configuration.getBoolean("noTrample", Configuration.CATEGORY_GENERAL, noTrample, "Prevents trampling farmland (completely)"); | ||
nnbspFix = configuration.getBoolean("nnbspFix", Configuration.CATEGORY_GENERAL, nnbspFix, "Fixes the \"NNBSP\" character in DateFormat outputs in Java 20+, as in the singleplayer world selection menu"); | ||
rmbClear = configuration.getBoolean("rmbClear", Configuration.CATEGORY_GENERAL, rmbClear, "Allows clearing text fields by right-clicking them"); | ||
slideClimbing = configuration.getBoolean("slideClimbing", Configuration.CATEGORY_GENERAL, slideClimbing, "Allows traversing ladders by looking up or down (incompat with jumpClimbing)"); | ||
sortedEnchantments = configuration.getBoolean("sortedEnchantments", Configuration.CATEGORY_GENERAL, sortedEnchantments, "Sorts enchantments in item tooltips (alphabetically)"); | ||
|
||
if (configuration.hasChanged()) { | ||
configuration.save(); | ||
} | ||
} | ||
@Config.Comment("Prevents mobs from attacking / targeting players") | ||
@Config.DefaultBoolean(false) | ||
public static boolean apatheticMobs; | ||
|
||
@Config.Comment("Allows beds to set a player's spawn point during the day (as in 1.15+)") | ||
@Config.DefaultBoolean(true) | ||
public static boolean bedSpawnFix; | ||
|
||
@Config.Comment("Fixes line breaks in chat not rendering properly, but breaks certain formatting in fixed chat messages") | ||
@Config.DefaultBoolean(false) | ||
public static boolean chatLinebreakFix; | ||
|
||
@Config.Comment("Makes double doors open simultaneously") | ||
@Config.DefaultBoolean(true) | ||
public static boolean doubleDoors; | ||
|
||
@Config.Comment("Makes the hunger system always act as if the difficulty is set to Peaceful (incompat with AppleCore)") | ||
@Config.DefaultBoolean(false) | ||
public static boolean hungerless; | ||
|
||
@Config.Comment("Allows climbing ladders by jumping (incompat with slideClimbing)") | ||
@Config.DefaultBoolean(true) | ||
public static boolean jumpClimbing; | ||
|
||
@Config.Comment("Players keep their experience level / points on death") | ||
@Config.DefaultBoolean(false) | ||
public static boolean keepXP; | ||
|
||
@Config.Comment("Try to fix MC-5694 (\"High efficiency tools / fast mining destroys some blocks client-side only\")") | ||
@Config.DefaultBoolean(true) | ||
public static boolean mc5694Fix; | ||
|
||
@Config.Comment("Fixes the \"NNBSP\" character in DateFormat outputs in Java 20+, as in the singleplayer world selection menu") | ||
@Config.DefaultBoolean(true) | ||
public static boolean nnbspFix; | ||
|
||
@Config.Comment("Prevents trampling farmland (completely)") | ||
@Config.DefaultBoolean(false) | ||
public static boolean noTrample; | ||
|
||
@Config.Comment("Allows clearing text fields by right-clicking them") | ||
@Config.DefaultBoolean(true) | ||
public static boolean rmbClear; | ||
|
||
@Config.Comment("Allows traversing ladders by looking up or down (incompat with jumpClimbing)") | ||
@Config.DefaultBoolean(false) | ||
public static boolean slideClimbing; | ||
|
||
@Config.Comment("Sorts enchantments in item tooltips (alphabetically)") | ||
@Config.DefaultBoolean(true) | ||
public static boolean sortedEnchantments; | ||
} |
87 changes: 0 additions & 87 deletions
87
src/main/java/cc/unilock/legacyfixes/mixin/EntityLivingBaseMixin.java
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...egacyfixes/mixin/EntityAITargetMixin.java → ...ly/apatheticMobs/EntityAITargetMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...egacyfixes/mixin/EntityCreatureMixin.java → ...ly/apatheticMobs/EntityCreatureMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...lock/legacyfixes/mixin/BlockBedMixin.java → ...ixin/early/bedSpawnFix/BlockBedMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../mixin/accessor/EntityPlayerAccessor.java → ...rly/bedSpawnFix/EntityPlayerAccessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...cyfixes/mixin/client/GuiNewChatMixin.java → ...ent/chatLinebreakFix/GuiNewChatMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...fixes/mixin/client/FontRendererMixin.java → ...ly/client/nnbspFix/FontRendererMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...fixes/mixin/client/GuiTextFieldMixin.java → ...ly/client/rmbClear/GuiTextFieldMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../mixin/client/ItemEnchantedBookMixin.java → ...dEnchantments/ItemEnchantedBookMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...acyfixes/mixin/client/ItemStackMixin.java → ...nt/sortedEnchantments/ItemStackMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...n/client/accessor/NBTTagListAccessor.java → ...ortedEnchantments/NBTTagListAccessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ock/legacyfixes/mixin/FoodStatsMixin.java → ...ixin/early/hungerless/FoodStatsMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.