aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/growthcraft
diff options
context:
space:
mode:
authorboubou19 <miisterunknown@gmail.com>2023-04-09 01:08:26 +0200
committerGitHub <noreply@github.com>2023-04-09 01:08:26 +0200
commit26caa265b7eae49767947e1ff4e6cfc8166b07f5 (patch)
tree0fc0332da7a843cf153bf75fcc2e20601bbf18ee /src/main/java/gtPlusPlus/xmod/growthcraft
parentc33b3ba66194c7441fbd437530d21a51aa4395d5 (diff)
downloadGT5-Unofficial-26caa265b7eae49767947e1ff4e6cfc8166b07f5.tar.gz
GT5-Unofficial-26caa265b7eae49767947e1ff4e6cfc8166b07f5.tar.bz2
GT5-Unofficial-26caa265b7eae49767947e1ff4e6cfc8166b07f5.zip
clean up GT++ code (#589)
* yeet big reactor support * yeet IC2 classic support * yeet pneumaticraft support * yeet More Planets support * yeet Immersive Engineering support * yeet Psychedilicraft support * yeet Beyond Reality Core support * sort mods to see what must be purged * yeet simply jetpacks * yeet RFTools * yeet xReliquary * yeet RedTech * yeet Mekanism * yeet GrowthCraft * yeet ihl * leftover cleaning * yeet thermal fondation support * yeet compact windmills support * spotless * remove constants from LoadedMods (part 1 / 2) * spotless * remove constants from LoadedMods (part 2 / 2) * use mod id enum instead of strings + optimize imports * Loaded.isModLoaded -> enum * restore RA init * missing ! * start organizing recipes stuff * fix crash on world load in dev * remove unused class * remove HazmatUtils.java * move all the removals * remove enableHarderRecipesForHighTierCasings and usages(disabled in the pack) * move some pyrolyse oven recipes to its own file * sa * bump GT version * bump GT5U version * spotless apply * use Everglades entry from the mod enum --------- Co-authored-by: miozune <miozune@gmail.com> Co-authored-by: Martin Robertz <dream-master@gmx.net>
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/growthcraft')
-rw-r--r--src/main/java/gtPlusPlus/xmod/growthcraft/HANDLER_GC.java21
-rw-r--r--src/main/java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java203
-rw-r--r--src/main/java/gtPlusPlus/xmod/growthcraft/fishtrap/Growthcraft_New.java83
-rw-r--r--src/main/java/gtPlusPlus/xmod/growthcraft/fishtrap/Growthcraft_Old.java83
4 files changed, 0 insertions, 390 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/growthcraft/HANDLER_GC.java b/src/main/java/gtPlusPlus/xmod/growthcraft/HANDLER_GC.java
deleted file mode 100644
index 6dc79aa906..0000000000
--- a/src/main/java/gtPlusPlus/xmod/growthcraft/HANDLER_GC.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package gtPlusPlus.xmod.growthcraft;
-
-import gtPlusPlus.core.lib.LoadedMods;
-
-public class HANDLER_GC {
-
- // Run me during Pre-Init
- public static void preInit() {
- if (LoadedMods.Growthcraft) {
- // Register_Booze.preInit();
- }
- }
-
- public static void init() {
- if (LoadedMods.Growthcraft) {}
- }
-
- public static void postInit() {
- if (LoadedMods.Growthcraft) {}
- }
-}
diff --git a/src/main/java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java b/src/main/java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java
deleted file mode 100644
index 2cf1032c4b..0000000000
--- a/src/main/java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java
+++ /dev/null
@@ -1,203 +0,0 @@
-package gtPlusPlus.xmod.growthcraft.fishtrap;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import net.minecraft.item.ItemStack;
-
-import gregtech.api.enums.GT_Values;
-import gregtech.api.util.GT_ModHandler;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.lib.LoadedMods;
-import gtPlusPlus.core.util.minecraft.FluidUtils;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.core.util.reflect.ReflectionUtils;
-
-public class FishTrapHandler {
-
- private static final String[] fishTypes = { "fish", "junk", "treasure" };
- private static Object mFishingRegistry;
- private static Growthcraft_Old mHandler;
-
- public static Object getFishingRegistry() {
- if (mFishingRegistry != null) {
- return mFishingRegistry;
- } else {
- return setFishTrapRegistry();
- }
- }
-
- private static final Object setFishTrapRegistry() {
- Class mFishingRegistryClass;
- try {
- mFishingRegistryClass = ReflectionUtils.getClass("growthcraft.api.fishtrap.FishTrapRegistry");
- final Method mFishingRegistryMethod = mFishingRegistryClass.getDeclaredMethod("getInstance");
- mFishingRegistry = mFishingRegistryMethod.invoke(null);
- if (mFishingRegistry != null) {
- return mFishingRegistry;
- }
- } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
- | InvocationTargetException e) {}
- return null;
- }
-
- protected static void addFish(final String lootType, final ItemStack lootStack, final int lootChance) {
-
- if (mFishingRegistry == null) {
- setFishTrapRegistry();
- }
- if (mHandler == null) {
- mHandler = new Growthcraft_Old();
- }
-
- final String GCVersion = LoadedMods.getModVersion("Growthcraft");
- final String[] versionString = GCVersion.split("//.");
-
- if (LoadedMods.getModVersion("Growthcraft").contains("2.3.1") || versionString[1].equals("3")) {
- if (lootType.equals(fishTypes[0])) {
- mHandler.addTrapFish(lootStack, lootChance);
- Logger.INFO("Added " + lootStack.getDisplayName() + " as an extra Fish for Growthcraft Fishtraps.");
- } else if (lootType.equals(fishTypes[1])) {
- mHandler.addTrapJunk(lootStack, lootChance);
- Logger.INFO("Added " + lootStack.getDisplayName() + " as extra Junk for Growthcraft Fishtraps.");
- } else if (lootType.equals(fishTypes[2])) {
- mHandler.addTrapTreasure(lootStack, lootChance);
- Logger.INFO("Added " + lootStack.getDisplayName() + " as extra Treasure for Growthcraft Fishtraps.");
- } else {
- return;
- }
- } /*
- * else if (LoadedMods.getModVersion("Growthcraft").contains("2.7.2")){ if (lootType.equals(fishTypes[0])){
- * Growthcraft_New.addTrapFish(lootStack, lootChance);
- * Utils.LOG_INFO("Added "+lootStack.getDisplayName()+" as an extra Fish for Growthcraft Fishtraps."); } else
- * if (lootType.equals(fishTypes[1])){ Growthcraft_New.addTrapJunk(lootStack, lootChance);
- * Utils.LOG_INFO("Added "+lootStack.getDisplayName()+" as extra Junk for Growthcraft Fishtraps."); } else if
- * (lootType.equals(fishTypes[2])){ Growthcraft_New.addTrapTreasure(lootStack, lootChance);
- * Utils.LOG_INFO("Added "+lootStack.getDisplayName()+" as extra Treasure for Growthcraft Fishtraps."); } else
- * { return; } }
- */ else {
- Logger.INFO(
- "Extra Fish loot for Growthcraft Fishtraps disabled. Found V."
- + LoadedMods.getModVersion("Growthcraft"));
- }
- }
-
- // FishTrapHandler.pamsHarvestCraftCompat();
- static final String prefix = "food";
- static final String suffix = "raw";
- static final String seaweed = "cropSeaweed";
- static final String greenheartFish = "foodGreenheartfish";
- private static final String[] harvestcraftFish = { "Anchovy", "Bass", "Calamari", "Carp", "Catfish", "Charr",
- "Clam", "Crab", "Crayfish", "Eel", "Frog", "Grouper", "Herring", "Jellyfish", "Mudfish", "Octopus", "Perch",
- "Scallop", "Shrimp", "Snail", "Snapper", "Tilapia", "Trout", "Tuna", "Turtle", "Walley" };
-
- public static void pamsHarvestCraftCompat() {
- for (int i = 0; i < harvestcraftFish.length; i++) {
- final String itemName = prefix + harvestcraftFish[i] + suffix;
- final int lootChance = getLootChance(harvestcraftFish[i]);
- if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken(itemName, 1) != null) {
- // addFish("fish", ItemUtils.getItemStackOfAmountFromOreDict(itemName, 1), lootChance);
- addGregtechMaceratorRecipe(ItemUtils.getItemStackOfAmountFromOreDict(itemName, 1));
- addGregtechCentrifugeRecipe(ItemUtils.getItemStackOfAmountFromOreDict(itemName, 1));
- addGregtechFluidRecipe(ItemUtils.getItemStackOfAmountFromOreDict(itemName, 1));
- }
- }
- if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken(greenheartFish, 1) != null) {
- // addFish("fish", ItemUtils.getItemStackOfAmountFromOreDict(greenheartFish, 1),
- // getLootChance(greenheartFish));
- addGregtechMaceratorRecipe(ItemUtils.getItemStackOfAmountFromOreDict(greenheartFish, 1));
- addGregtechCentrifugeRecipe(ItemUtils.getItemStackOfAmountFromOreDict(greenheartFish, 1));
- addGregtechFluidRecipe(ItemUtils.getItemStackOfAmountFromOreDict(greenheartFish, 1));
- }
- if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken(seaweed, 1) != null) {
- // addFish("junk", ItemUtils.getItemStackOfAmountFromOreDict(seaweed, 1), getLootChance(seaweed));
- }
- }
-
- private static int getLootChance(final String name) {
- if (name.equals(harvestcraftFish[0])) {
- return 20;
- } else if (name.equals(harvestcraftFish[1])) {
- return 10;
- } else if (name.equals(harvestcraftFish[2])) {
- return 15;
- } else if (name.equals(harvestcraftFish[3])) {
- return 55;
- } else if (name.equals(harvestcraftFish[4])) {
- return 5;
- } else if (name.equals(harvestcraftFish[5])) {
- return 8;
- } else if (name.equals(harvestcraftFish[6])) {
- return 11;
- } else if (name.equals(harvestcraftFish[7])) {
- return 11;
- } else if (name.equals(harvestcraftFish[8])) {
- return 15;
- } else if (name.equals(harvestcraftFish[9])) {
- return 1;
- } else if (name.equals(harvestcraftFish[10])) {
- return 5;
- } else if (name.equals(harvestcraftFish[11])) {
- return 10;
- } else if (name.equals(harvestcraftFish[12])) {
- return 25;
- } else if (name.equals(harvestcraftFish[13])) {
- return 15;
- } else if (name.equals(harvestcraftFish[14])) {
- return 20;
- } // "Perch", "Scallop", "Shrimp", "Snail", "Snapper", "Tilapia", "Trout", "Tuna", "Turtle", "Walleye"};
- else if (name.equals(harvestcraftFish[15])) {
- return 22;
- } else if (name.equals(harvestcraftFish[16])) {
- return 10;
- } else if (name.equals(harvestcraftFish[17])) {
- return 35;
- } else if (name.equals(harvestcraftFish[18])) {
- return 3;
- } else if (name.equals(harvestcraftFish[19])) {
- return 20;
- } else if (name.equals(harvestcraftFish[20])) {
- return 4;
- } else if (name.equals(harvestcraftFish[21])) {
- return 40;
- } else if (name.equals(harvestcraftFish[22])) {
- return 30;
- } else if (name.equals(harvestcraftFish[23])) {
- return 5;
- } else if (name.equals(harvestcraftFish[24])) {
- return 8;
- } else {
- return 25;
- }
- }
-
- private static void addGregtechCentrifugeRecipe(final ItemStack input) {
- GT_Values.RA.addCentrifugeRecipe(
- input,
- null,
- null,
- FluidUtils.getFluidStack("methane", 96),
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- 19 * 20,
- 5);
- }
-
- private static void addGregtechMaceratorRecipe(final ItemStack input) {
- GT_ModHandler.addPulverisationRecipe(
- input,
- ItemUtils.getItemStackOfAmountFromOreDict("dustMeatRaw", 1),
- ItemUtils.getItemStackOfAmountFromOreDict("dustTinyBone", 1),
- 0);
- }
-
- private static void addGregtechFluidRecipe(final ItemStack input) {
- CORE.RA.addFluidExtractionRecipe(input, FluidUtils.getFluidStack("fishoil", 50), 16, 4);
- }
-}
diff --git a/src/main/java/gtPlusPlus/xmod/growthcraft/fishtrap/Growthcraft_New.java b/src/main/java/gtPlusPlus/xmod/growthcraft/fishtrap/Growthcraft_New.java
deleted file mode 100644
index bd1481f6b3..0000000000
--- a/src/main/java/gtPlusPlus/xmod/growthcraft/fishtrap/Growthcraft_New.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package gtPlusPlus.xmod.growthcraft.fishtrap;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import net.minecraft.item.ItemStack;
-
-public class Growthcraft_New {
-
- Method addTrapJunk;
- Method addTrapTreasure;
- Method addTrapFish;
- Object FishTrapRegistryO;
-
- public Growthcraft_New() {
- setFishTrapRegistry();
- }
-
- void setFishTrapRegistry() {
- try {
- Class<?> FishTrapRegistryClass = Class
- .forName("gtPlusPlus.xmod.growthcraft.fishtrap.FishTrapHandler.mFishingRegistry");
- Class<?> FishTrapEntry = Class.forName("growthcraft.api.fishtrap.FishTrapEntry");
- if (FishTrapRegistryClass.isInstance(FishTrapHandler.getFishingRegistry())) {
- addTrapJunk = FishTrapRegistryClass.getDeclaredMethod("addTrapJunk", FishTrapEntry);
- addTrapTreasure = FishTrapRegistryClass.getDeclaredMethod("addTrapTreasure", FishTrapEntry);
- addTrapFish = FishTrapRegistryClass.getDeclaredMethod("addTrapFish", FishTrapEntry);
- FishTrapRegistryO = FishTrapHandler.getFishingRegistry();
- }
- } catch (ClassNotFoundException | NoSuchMethodException | SecurityException e) {
- e.printStackTrace();
- }
- }
-
- private Object createFishTrapEntry(ItemStack loot, int chance) {
- try {
- Class<?> FishTrapEntry = Class.forName("growthcraft.api.fishtrap.FishTrapEntry");
- Object o = FishTrapEntry.getConstructor(ItemStack.class, int.class);
- if (FishTrapEntry != null) {
- Constructor[] constructors = FishTrapEntry.getDeclaredConstructors();
- constructors[0].setAccessible(true);
- Object x = constructors[0].newInstance(loot, chance);
- if (x != null) {
- return x;
- }
- }
- } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException
- | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {}
-
- return null;
- }
-
- private boolean invoke(Method m, ItemStack o, int p) {
- try {
- Object I = createFishTrapEntry(o, p);
- m.invoke(FishTrapRegistryO, I);
- return true;
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {}
- return false;
- }
-
- public void addTrapJunk(final ItemStack loot, final int lootChance) {
- // FishTrapRegistry.instance().addTrapJunk(new FishTrapEntry(loot, lootChance));
- if (addTrapJunk != null) {
- invoke(addTrapJunk, loot, lootChance);
- }
- }
-
- public void addTrapTreasure(final ItemStack loot, final int lootChance) {
- // FishTrapRegistry.instance().addTrapTreasure(new FishTrapEntry(loot, lootChance));
- if (addTrapTreasure != null) {
- invoke(addTrapTreasure, loot, lootChance);
- }
- }
-
- public void addTrapFish(final ItemStack loot, final int lootChance) {
- // FishTrapRegistry.instance().addTrapFish(new FishTrapEntry(loot, lootChance));
- if (addTrapFish != null) {
- invoke(addTrapFish, loot, lootChance);
- }
- }
-}
diff --git a/src/main/java/gtPlusPlus/xmod/growthcraft/fishtrap/Growthcraft_Old.java b/src/main/java/gtPlusPlus/xmod/growthcraft/fishtrap/Growthcraft_Old.java
deleted file mode 100644
index 0d1fd8e7dd..0000000000
--- a/src/main/java/gtPlusPlus/xmod/growthcraft/fishtrap/Growthcraft_Old.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package gtPlusPlus.xmod.growthcraft.fishtrap;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import net.minecraft.item.ItemStack;
-
-public class Growthcraft_Old {
-
- Method addTrapJunk;
- Method addTrapTreasure;
- Method addTrapFish;
- Object FishTrapRegistryO;
-
- public Growthcraft_Old() {
- setFishTrapRegistry();
- }
-
- void setFishTrapRegistry() {
- try {
- Class<?> FishTrapRegistryClass = Class
- .forName("gtPlusPlus.xmod.growthcraft.fishtrap.FishTrapHandler.mFishingRegistry");
- Class<?> FishTrapEntry = Class.forName("growthcraft.api.fishtrap.FishTrapEntry");
- if (FishTrapRegistryClass.isInstance(FishTrapHandler.getFishingRegistry())) {
- addTrapJunk = FishTrapRegistryClass.getDeclaredMethod("addTrapJunk", FishTrapEntry);
- addTrapTreasure = FishTrapRegistryClass.getDeclaredMethod("addTrapTreasure", FishTrapEntry);
- addTrapFish = FishTrapRegistryClass.getDeclaredMethod("addTrapFish", FishTrapEntry);
- FishTrapRegistryO = FishTrapHandler.getFishingRegistry();
- }
- } catch (ClassNotFoundException | NoSuchMethodException | SecurityException e) {
- e.printStackTrace();
- }
- }
-
- private Object createFishTrapEntry(ItemStack loot, int chance) {
- try {
- Class<?> FishTrapEntry = Class.forName("growthcraft.api.fishtrap.FishTrapEntry");
- Object o = FishTrapEntry.getConstructor(ItemStack.class, int.class);
- if (FishTrapEntry != null) {
- Constructor[] constructors = FishTrapEntry.getDeclaredConstructors();
- constructors[0].setAccessible(true);
- Object x = constructors[0].newInstance(loot, chance);
- if (x != null) {
- return x;
- }
- }
- } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException
- | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {}
-
- return null;
- }
-
- private boolean invoke(Method m, ItemStack o, int p) {
- try {
- Object I = createFishTrapEntry(o, p);
- m.invoke(FishTrapRegistryO, I);
- return true;
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {}
- return false;
- }
-
- public void addTrapJunk(final ItemStack loot, final int lootChance) {
- // FishTrapRegistry.instance().addTrapJunk(new FishTrapEntry(loot, lootChance));
- if (addTrapJunk != null) {
- invoke(addTrapJunk, loot, lootChance);
- }
- }
-
- public void addTrapTreasure(final ItemStack loot, final int lootChance) {
- // FishTrapRegistry.instance().addTrapTreasure(new FishTrapEntry(loot, lootChance));
- if (addTrapTreasure != null) {
- invoke(addTrapTreasure, loot, lootChance);
- }
- }
-
- public void addTrapFish(final ItemStack loot, final int lootChance) {
- // FishTrapRegistry.instance().addTrapFish(new FishTrapEntry(loot, lootChance));
- if (addTrapFish != null) {
- invoke(addTrapFish, loot, lootChance);
- }
- }
-}