diff options
| author | Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> | 2023-10-18 17:03:23 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-18 18:03:23 +0200 |
| commit | fbdbb388c369fae549cfde3eed38b536f7461d90 (patch) | |
| tree | b46f7fc949d7e4c6e3be910b81ed725e6dc1648e /src/main/java/gtPlusPlus/xmod/forestry | |
| parent | b670446fdf49991093b485f0aa14050039632775 (diff) | |
| download | GT5-Unofficial-fbdbb388c369fae549cfde3eed38b536f7461d90.tar.gz GT5-Unofficial-fbdbb388c369fae549cfde3eed38b536f7461d90.tar.bz2 GT5-Unofficial-fbdbb388c369fae549cfde3eed38b536f7461d90.zip | |
Cleaning up (#767)
* Kill playerAPI
* Gut more events and compat that is now obsolete
* Remove commented out code
* Remove final modifier from methods
* Make more stuff final
* Remove slow building ring
* Protected -> private in final classes
* More cleaning
* More cleaning v2
* Purging
* Clean DevHelper
* Clean DevHelper 2
* delete DevHelper
* remove useless IFMLLoadingPlugin.MCVersion annotation from @Mod files
* check for obfuscation only once in the IFMLloadingPlugin.injectData
* don't instantiate the static class ASMConfig
* delete unused and empty implementation of IFMLCallHook
* delete empty class
* delete ClassesToTransform class that just holds the class names constants
* delete unused methods and unsless logging in dummymod container
* delete unused transformer ClassTransformer_TT_ThaumicRestorer
* spotless
* Clean
* Clean utils
* Build checkpoint
* Purge
* Stage 2
* Stage 3
* Stage 4
* Stage 5
* Stage 6
* Spotless
* Imports
* Stage idk
* Stage 1
* Fix issue
* Spotless
* Format numbers
---------
Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com>
Co-authored-by: Alexdoru <57050655+Alexdoru@users.noreply.github.com>
Co-authored-by: Connor Colenso <colen@CONNORSPC>
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/forestry')
11 files changed, 71 insertions, 152 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/forestry/HANDLER_FR.java b/src/main/java/gtPlusPlus/xmod/forestry/HANDLER_FR.java index 0b9702acb1..80d1620f02 100644 --- a/src/main/java/gtPlusPlus/xmod/forestry/HANDLER_FR.java +++ b/src/main/java/gtPlusPlus/xmod/forestry/HANDLER_FR.java @@ -3,12 +3,7 @@ package gtPlusPlus.xmod.forestry; import static gregtech.api.enums.Mods.ExtraTrees; import static gregtech.api.enums.Mods.Forestry; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import net.minecraft.block.Block; import net.minecraft.item.ItemStack; -import net.minecraft.world.World; import binnie.extratrees.genetics.ExtraTreeSpecies; import cpw.mods.fml.common.Optional; @@ -43,39 +38,6 @@ public class HANDLER_FR { } } - public static boolean createBlockBreakParticles(final World world, final int x, final int y, final int z, - final Block block) { - if (Forestry.isModLoaded()) { - createBlockBreakParticles_INTERNAL(world, x, y, z, block); - } - return false; - } - - @Optional.Method(modid = Mods.Names.FORESTRY) - private static void createBlockBreakParticles_INTERNAL(final World world, final int x, final int y, final int z, - final Block block) { - if (Forestry.isModLoaded()) { - Class oClass; - try { - oClass = ReflectionUtils.getClass("forestry.core.proxy.ProxyCommon"); - Object oProxy = ReflectionUtils.getField(oClass, "common"); - if (oProxy != null && oClass.isInstance(oProxy)) { - Method mParticles = ReflectionUtils.getMethod( - oClass, - "addBlockDestroyEffects", - World.class, - int.class, - int.class, - int.class, - Block.class, - int.class); - mParticles.invoke(oProxy, world, x, y, z, block, 0); - } - } catch (SecurityException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException e) {} - } - } - @Optional.Method(modid = Mods.Names.FORESTRY) private static void mapForestrySaplingToLog() { for (TreeDefinition value : TreeDefinition.values()) { diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/CustomCombs.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/CustomCombs.java index 031061bfc3..94f61296d6 100644 --- a/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/CustomCombs.java +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/CustomCombs.java @@ -34,7 +34,7 @@ public enum CustomCombs { SALT("salt", true, Materials.Salt, 75), SAND("sand", true, Materials.Sand, 100),; - private static int[][] colours = new int[][] { + private static final int[][] colours = new int[][] { { Utils.rgbtoHexValue(75, 75, 75), Utils.rgbtoHexValue(125, 125, 125) }, // SILICON { Utils.rgbtoHexValue(55, 55, 55), Utils.rgbtoHexValue(75, 75, 75) }, // RUBBER { Utils.rgbtoHexValue(245, 245, 245), Utils.rgbtoHexValue(175, 175, 175) }, // PLASTIC @@ -65,9 +65,9 @@ public enum CustomCombs { { 0xEBA1EB, 0xF2C3F2 }, { 0x62626D, 0x161620 }, { 0xE6E6E6, 0xFFFFCC }, { 0xDADADA, 0xD1D1E0 }, { 0x19AF19, 0x169E16 }, { 0x335C33, 0x6B8F00 }, { 0x003300, 0x002400 }, }; public boolean showInList; - public Materials material; - public int chance; - private String name; + public final Materials material; + public final int chance; + private final String name; private CustomCombs(String pName, boolean show, Materials material, int chance) { this.name = pName; diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_CombType.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_CombType.java index 3495869c97..4bc47fa7bd 100644 --- a/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_CombType.java +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_CombType.java @@ -13,13 +13,13 @@ public enum GTPP_CombType { FORCE(1, "Force", true, 30, Utils.rgbtoHexValue(250, 250, 20), Utils.rgbtoHexValue(200, 200, 5)); public boolean mShowInList; - public Material mMaterial; - public int mChance; - public int mID; + public final Material mMaterial; + public final int mChance; + public final int mID; - private String mName; - private String mNameUnlocal; - private int[] mColour; + private final String mName; + private final String mNameUnlocal; + private final int[] mColour; private static void map(int aId, GTPP_CombType aType) { GTPP_Bees.sCombMappings.put(aId, aType); diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_DropType.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_DropType.java index cbf448b7f6..6f43d4a43e 100644 --- a/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_DropType.java +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_DropType.java @@ -13,13 +13,13 @@ public enum GTPP_DropType { FORCE(1, "Force", true, Utils.rgbtoHexValue(250, 250, 20), Utils.rgbtoHexValue(200, 200, 5)); public boolean mShowInList; - public Material mMaterial; + public final Material mMaterial; public int mChance; - public int mID; + public final int mID; - private String mName; - private String mNameUnlocal; - private int[] mColour; + private final String mName; + private final String mNameUnlocal; + private final int[] mColour; private static void map(int aId, GTPP_DropType aType) { GTPP_Bees.sDropMappings.put(aId, aType); diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PollenType.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PollenType.java index ec49643001..acca5b810f 100644 --- a/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PollenType.java +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PollenType.java @@ -12,13 +12,13 @@ public enum GTPP_PollenType { DRAGONBLOOD(0, "Dragon Blood", true, Utils.rgbtoHexValue(220, 20, 20), Utils.rgbtoHexValue(20, 20, 20)); public boolean mShowInList; - public Material mMaterial; + public final Material mMaterial; public int mChance; - public int mID; + public final int mID; - private String mName; - private String mNameUnlocal; - private int[] mColour; + private final String mName; + private final String mNameUnlocal; + private final int[] mColour; private static void map(int aId, GTPP_PollenType aType) { GTPP_Bees.sPollenMappings.put(aId, aType); diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PropolisType.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PropolisType.java index b857827d62..b76d79d387 100644 --- a/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PropolisType.java +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PropolisType.java @@ -13,13 +13,13 @@ public enum GTPP_PropolisType { FORCE(1, "Force", true, Utils.rgbtoHexValue(250, 250, 20)); public boolean mShowInList; - public Material mMaterial; + public final Material mMaterial; public int mChance; - public int mID; + public final int mID; - private String mName; - private String mNameUnlocal; - private int mColour; + private final String mName; + private final String mNameUnlocal; + private final int mColour; private static void map(int aId, GTPP_PropolisType aType) { GTPP_Bees.sPropolisMappings.put(aId, aType); diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/items/FR_ItemRegistry.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/items/FR_ItemRegistry.java index 8af5b97b00..ab8771e6db 100644 --- a/src/main/java/gtPlusPlus/xmod/forestry/bees/items/FR_ItemRegistry.java +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/items/FR_ItemRegistry.java @@ -22,9 +22,6 @@ import gregtech.api.enums.Mods; public class FR_ItemRegistry { // ----- Apiary Frames ---------------------- - // public static FR_ItemHiveFrame frameUntreated; - // public static FR_ItemHiveFrame frameImpregnated; - // public static FR_ItemHiveFrame frameProven; // Magic Bee Frame Items public static MB_ItemFrame hiveFrameAccelerated; diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/items/FR_StringUtil.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/items/FR_StringUtil.java index 8ce963fa7a..c63401aecf 100644 --- a/src/main/java/gtPlusPlus/xmod/forestry/bees/items/FR_StringUtil.java +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/items/FR_StringUtil.java @@ -11,10 +11,4 @@ public class FR_StringUtil { return StatCollector.translateToFallback(key); } - public static String getLocalizedString(final String key, final Object... objects) { - if (StatCollector.canTranslate(key)) { - return String.format(StatCollector.translateToLocal(key), objects); - } - return String.format(StatCollector.translateToFallback(key), objects); - } } diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BeeDefinition.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BeeDefinition.java index 6fea628473..dcfd524840 100644 --- a/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BeeDefinition.java +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BeeDefinition.java @@ -146,82 +146,49 @@ public enum GTPP_BeeDefinition implements IBeeDefinition { } } - protected static IAlleleBeeEffect getEffect(byte modid, String name) { - String s; - switch (modid) { - case GTPP_Bees.EXTRABEES: - s = "extrabees.effect." + name; - break; - case GTPP_Bees.GENDUSTRY: - s = "gendustry.effect." + name; - break; - case GTPP_Bees.MAGICBEES: - s = "magicbees.effect" + name; - break; - case GTPP_Bees.GREGTECH: - s = "gregtech.effect" + name; - break; - default: - s = "forestry.effect" + name; - break; - } + private static IAlleleBeeEffect getEffect(byte modid, String name) { + String s = switch (modid) { + case GTPP_Bees.EXTRABEES -> "extrabees.effect." + name; + case GTPP_Bees.GENDUSTRY -> "gendustry.effect." + name; + case GTPP_Bees.MAGICBEES -> "magicbees.effect" + name; + case GTPP_Bees.GREGTECH -> "gregtech.effect" + name; + default -> "forestry.effect" + name; + }; return (IAlleleBeeEffect) AlleleManager.alleleRegistry.getAllele(s); } - protected static IAlleleFlowers getFlowers(byte modid, String name) { - String s; - switch (modid) { - case GTPP_Bees.EXTRABEES: - s = "extrabees.flower." + name; - break; - case GTPP_Bees.GENDUSTRY: - s = "gendustry.flower." + name; - break; - case GTPP_Bees.MAGICBEES: - s = "magicbees.flower" + name; - break; - case GTPP_Bees.GREGTECH: - s = "gregtech.flower" + name; - break; - default: - s = "forestry.flowers" + name; - break; - } + private static IAlleleFlowers getFlowers(byte modid, String name) { + String s = switch (modid) { + case GTPP_Bees.EXTRABEES -> "extrabees.flower." + name; + case GTPP_Bees.GENDUSTRY -> "gendustry.flower." + name; + case GTPP_Bees.MAGICBEES -> "magicbees.flower" + name; + case GTPP_Bees.GREGTECH -> "gregtech.flower" + name; + default -> "forestry.flowers" + name; + }; return (IAlleleFlowers) AlleleManager.alleleRegistry.getAllele(s); } - protected static IAlleleBeeSpecies getSpecies(byte modid, String name) { - String s; - switch (modid) { - case GTPP_Bees.EXTRABEES: - s = "extrabees.species." + name; - break; - case GTPP_Bees.GENDUSTRY: - s = "gendustry.bee." + name; - break; - case GTPP_Bees.MAGICBEES: - s = "magicbees.species" + name; - break; - case GTPP_Bees.GREGTECH: - s = "gregtech.species" + name; - break; - default: - s = "forestry.species" + name; - break; - } + private static IAlleleBeeSpecies getSpecies(byte modid, String name) { + String s = switch (modid) { + case GTPP_Bees.EXTRABEES -> "extrabees.species." + name; + case GTPP_Bees.GENDUSTRY -> "gendustry.bee." + name; + case GTPP_Bees.MAGICBEES -> "magicbees.species" + name; + case GTPP_Bees.GREGTECH -> "gregtech.species" + name; + default -> "forestry.species" + name; + }; IAlleleBeeSpecies ret = (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele(s); return ret; } - protected final void setSpeciesProperties(GTPP_AlleleBeeSpecies species2) { + private final void setSpeciesProperties(GTPP_AlleleBeeSpecies species2) { this.mSpeciesProperties.accept(species2); } - protected final void setAlleles(IAllele[] template) { + private final void setAlleles(IAllele[] template) { this.mAlleles.accept(template); } - protected final void registerMutations() { + private final void registerMutations() { this.mMutations.accept(this); } @@ -237,27 +204,27 @@ public enum GTPP_BeeDefinition implements IBeeDefinition { BeeManager.beeRoot.registerTemplate(template); } - protected final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2, + private final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2, int chance) { return registerMutation(parent1, parent2, chance, 1f); } - protected final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, IAlleleBeeSpecies parent2, + private final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, IAlleleBeeSpecies parent2, int chance) { return registerMutation(parent1, parent2, chance, 1f); } - protected final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, GTPP_BeeDefinition parent2, + private final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, GTPP_BeeDefinition parent2, int chance) { return registerMutation(parent1, parent2, chance, 1f); } - protected final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, GTPP_BeeDefinition parent2, + private final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, GTPP_BeeDefinition parent2, int chance) { return registerMutation(parent1, parent2, chance, 1f); } - protected final IBeeMutationCustom registerMutation(String parent1, String parent2, int chance) { + private final IBeeMutationCustom registerMutation(String parent1, String parent2, int chance) { return registerMutation(getGregtechBeeType(parent1), getGregtechBeeType(parent2), chance, 1f); } @@ -266,28 +233,27 @@ public enum GTPP_BeeDefinition implements IBeeDefinition { * chancedivider This new function allows Mutation percentages under 1%. Set them as a fraction with chance / * chancedivider */ - protected final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2, - int chance, float chancedivider) { + private final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2, int chance, + float chancedivider) { return new GTPP_Bee_Mutation(parent1, parent2, this.getTemplate(), chance, chancedivider); } - protected final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, IAlleleBeeSpecies parent2, - int chance, float chancedivider) { + private final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, IAlleleBeeSpecies parent2, int chance, + float chancedivider) { return registerMutation(parent1.species, parent2, chance, chancedivider); } - protected final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, GTPP_BeeDefinition parent2, - int chance, float chancedivider) { + private final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, GTPP_BeeDefinition parent2, int chance, + float chancedivider) { return registerMutation(parent1, parent2.species, chance, chancedivider); } - protected final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, GTPP_BeeDefinition parent2, + private final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, GTPP_BeeDefinition parent2, int chance, float chancedivider) { return registerMutation(parent1.species, parent2, chance, chancedivider); } - protected final IBeeMutationCustom registerMutation(String parent1, String parent2, int chance, - float chancedivider) { + private final IBeeMutationCustom registerMutation(String parent1, String parent2, int chance, float chancedivider) { return registerMutation(getGregtechBeeType(parent1), getGregtechBeeType(parent2), chance, chancedivider); } diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bees.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bees.java index 69d9319884..77b7d57954 100644 --- a/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bees.java +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bees.java @@ -30,11 +30,11 @@ public class GTPP_Bees { public static GTPP_Drop drop; public static GTPP_Comb combs; - public static HashMap<String, Material> sMaterialMappings = new HashMap<String, Material>(); - public static HashMap<Integer, GTPP_PropolisType> sPropolisMappings = new HashMap<Integer, GTPP_PropolisType>(); - public static HashMap<Integer, GTPP_PollenType> sPollenMappings = new HashMap<Integer, GTPP_PollenType>(); - public static HashMap<Integer, GTPP_DropType> sDropMappings = new HashMap<Integer, GTPP_DropType>(); - public static HashMap<Integer, GTPP_CombType> sCombMappings = new HashMap<Integer, GTPP_CombType>(); + public static HashMap<String, Material> sMaterialMappings = new HashMap<>(); + public static HashMap<Integer, GTPP_PropolisType> sPropolisMappings = new HashMap<>(); + public static HashMap<Integer, GTPP_PollenType> sPollenMappings = new HashMap<>(); + public static HashMap<Integer, GTPP_DropType> sDropMappings = new HashMap<>(); + public static HashMap<Integer, GTPP_CombType> sCombMappings = new HashMap<>(); public GTPP_Bees() { if (Forestry.isModLoaded() && GT_Mod.gregtechproxy.mGTBees) { diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BranchDefinition.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BranchDefinition.java index 4c367e25d4..39af813dec 100644 --- a/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BranchDefinition.java +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BranchDefinition.java @@ -73,7 +73,7 @@ public enum GTPP_BranchDefinition { return Arrays.copyOf(defaultTemplate, defaultTemplate.length); } - protected final void setBranchProperties(IAllele[] template) { + private final void setBranchProperties(IAllele[] template) { this.mBranchProperties.accept(template); } |
