aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/bop
diff options
context:
space:
mode:
authorAlexdoru <57050655+Alexdoru@users.noreply.github.com>2024-09-07 05:40:03 +0200
committerGitHub <noreply@github.com>2024-09-07 03:40:03 +0000
commit82604eadb847335e4b4ddf2e90a28b325786837b (patch)
treeb5c34fa3ab38181fc47ec20c8537a5db34e285e1 /src/main/java/gtPlusPlus/xmod/bop
parentba7a419aacf0b0eb33afbde5663640a0908b77ce (diff)
downloadGT5-Unofficial-82604eadb847335e4b4ddf2e90a28b325786837b.tar.gz
GT5-Unofficial-82604eadb847335e4b4ddf2e90a28b325786837b.tar.bz2
GT5-Unofficial-82604eadb847335e4b4ddf2e90a28b325786837b.zip
Remove a bunch more reflection (#3074)
Co-authored-by: boubou19 <miisterunknown@gmail.com>
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/bop')
-rw-r--r--src/main/java/gtPlusPlus/xmod/bop/BiomesOPlentyHandler.java169
1 files changed, 9 insertions, 160 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/bop/BiomesOPlentyHandler.java b/src/main/java/gtPlusPlus/xmod/bop/BiomesOPlentyHandler.java
index b1e97782af..272b2dacf5 100644
--- a/src/main/java/gtPlusPlus/xmod/bop/BiomesOPlentyHandler.java
+++ b/src/main/java/gtPlusPlus/xmod/bop/BiomesOPlentyHandler.java
@@ -1,178 +1,27 @@
package gtPlusPlus.xmod.bop;
-import static gregtech.api.enums.Mods.BiomesOPlenty;
-
-import java.lang.reflect.Field;
-
-import net.minecraft.block.Block;
-import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import biomesoplenty.api.content.BOPCItems;
+import gregtech.api.enums.Mods;
import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.core.util.reflect.ReflectionUtils;
import gtPlusPlus.xmod.bop.blocks.BOPBlockRegistrator;
public class BiomesOPlentyHandler {
- public static Item mPineCone;
-
- public static Block logs1;
- public static Block logs2;
- public static Block logs3;
- public static Block logs4;
-
- public static Block leaves1;
- public static Block leaves2;
- public static Block leaves3;
- public static Block leaves4;
-
- public static Block colorizedLeaves1;
- public static Block colorizedLeaves2;
-
- public static Block saplings;
- public static Block colorizedSaplings;
-
public static void preInit() {
BOPBlockRegistrator.run();
- if (BiomesOPlenty.isModLoaded()) {
- setFields();
- registerPineconeToOreDict();
+ if (Mods.BiomesOPlenty.isModLoaded()) {
+ if (BOPCItems.misc != null) {
+ ItemStack aPinecone = ItemUtils.simpleMetaStack(BOPCItems.misc, 13, 1);
+ if (aPinecone != null) {
+ ItemUtils.addItemToOreDictionary(aPinecone, "pinecone");
+ }
+ }
}
}
public static void postInit() {
BOPBlockRegistrator.recipes();
}
-
- private static void registerPineconeToOreDict() {
- if (mPineCone != null) {
- ItemStack aPinecone = ItemUtils.simpleMetaStack(mPineCone, 13, 1);
- if (aPinecone != null) {
- ItemUtils.addItemToOreDictionary(aPinecone, "pinecone");
- }
- }
- }
-
- public static ItemStack getStack(Block aBlock, int aMeta, int aSize) {
- return ItemUtils.simpleMetaStack(aBlock, aMeta, aSize);
- }
-
- // BOPCBlocks.logs4 - 0
- // BOPCBlocks.colorizedLeaves2 - 1
-
- private static void setFields() {
- Field aBopMiscItem = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCItems"), "misc");
-
- Field aBopBlock1 = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "logs1");
- Field aBopBlock2 = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "logs2");
- Field aBopBlock3 = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "logs3");
- Field aBopBlock4 = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "logs4");
-
- Field aBopLeaves1 = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "leaves1");
- Field aBopLeaves2 = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "leaves2");
- Field aBopLeaves3 = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "leaves3");
- Field aBopLeaves4 = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "leaves4");
-
- Field aBopColouredLeaves1 = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "colorizedLeaves1");
- Field aBopColouredLeaves2 = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "colorizedLeaves2");
-
- Field aBopSapling = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "saplings");
- Field aBopColouredSapling = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "colorizedSaplings");
-
- if (aBopMiscItem != null) {
- Item aMiscItem = ReflectionUtils.getFieldValue(aBopMiscItem);
- if (aMiscItem != null) {
- mPineCone = aMiscItem;
- }
- }
-
- if (aBopBlock1 != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopBlock1);
- if (aBlock != null) {
- logs1 = aBlock;
- }
- }
- if (aBopBlock2 != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopBlock2);
- if (aBlock != null) {
- logs2 = aBlock;
- }
- }
- if (aBopBlock3 != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopBlock3);
- if (aBlock != null) {
- logs3 = aBlock;
- }
- }
- if (aBopBlock4 != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopBlock4);
- if (aBlock != null) {
- logs4 = aBlock;
- }
- }
-
- if (aBopLeaves1 != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves1);
- if (aBlock != null) {
- leaves1 = aBlock;
- }
- }
- if (aBopLeaves2 != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves2);
- if (aBlock != null) {
- leaves2 = aBlock;
- }
- }
- if (aBopLeaves3 != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves3);
- if (aBlock != null) {
- leaves3 = aBlock;
- }
- }
- if (aBopLeaves4 != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves4);
- if (aBlock != null) {
- leaves4 = aBlock;
- }
- }
-
- if (aBopColouredLeaves1 != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopColouredLeaves1);
- if (aBlock != null) {
- colorizedLeaves1 = aBlock;
- }
- }
- if (aBopColouredLeaves2 != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopColouredLeaves2);
- if (aBlock != null) {
- colorizedLeaves2 = aBlock;
- }
- }
-
- if (aBopSapling != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopSapling);
- if (aBlock != null) {
- saplings = aBlock;
- }
- }
- if (aBopColouredSapling != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopColouredSapling);
- if (aBlock != null) {
- colorizedSaplings = aBlock;
- }
- }
- }
}