From 5a83c3d229a3b562aa1162115f437e5c9b69ad3e Mon Sep 17 00:00:00 2001 From: Mary <33456283+FourIsTheNumber@users.noreply.github.com> Date: Mon, 16 Sep 2024 00:28:31 -0400 Subject: [PATCH 01/42] Fix air intake and reservoir hatch tooltips (#3206) --- .../metatileentity/implementations/MTEHatchFluidGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchFluidGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchFluidGenerator.java index 638176c4b5e..3a5640cd882 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchFluidGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchFluidGenerator.java @@ -52,7 +52,7 @@ public synchronized String[] getDescription() { System.arraycopy(mDescriptionArray, 0, desc, 0, mDescriptionArray.length); System.arraycopy(hatchTierString, 0, desc, mDescriptionArray.length, 1); System.arraycopy(aCustomTips, 0, desc, mDescriptionArray.length + 1, aCustomTips.length); - desc[mDescriptionArray.length + aCustomTips.length] = GTPPCore.GT_Tooltip.get(); + desc[mDescriptionArray.length + aCustomTips.length + 1] = GTPPCore.GT_Tooltip.get(); return desc; } From 914e518fd4db7042daeb0975f3555ad7933b0f39 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Mon, 16 Sep 2024 09:03:15 +0200 Subject: [PATCH 02/42] fix the check preventing the keyboard transformer from transforming lwjgl3's Keyboard (#3205) Co-authored-by: boubou19 --- src/main/java/gregtech/asm/GTCorePlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/gregtech/asm/GTCorePlugin.java b/src/main/java/gregtech/asm/GTCorePlugin.java index 17359a3988a..38d7548836f 100644 --- a/src/main/java/gregtech/asm/GTCorePlugin.java +++ b/src/main/java/gregtech/asm/GTCorePlugin.java @@ -85,7 +85,7 @@ public List getMixins(Set loadedCoreMods) { public static boolean islwjgl3Present() { if (islwjgl3Present == null) { try { - final String className = "org.lwjgl.system.Platform"; + final String className = "org/lwjgl/system/Platform.class"; islwjgl3Present = ClassLoader.getSystemClassLoader() .getResource(className) != null; } catch (Exception e) { From 0fb538c2682dcfb049ccee789aa0fe9fe1d29394 Mon Sep 17 00:00:00 2001 From: Mary <33456283+FourIsTheNumber@users.noreply.github.com> Date: Mon, 16 Sep 2024 04:12:45 -0400 Subject: [PATCH 03/42] Allow unsafe oredicts to be shown in nei (#3202) Co-authored-by: Martin Robertz --- src/main/java/gregtech/api/util/GTOreDictUnificator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/gregtech/api/util/GTOreDictUnificator.java b/src/main/java/gregtech/api/util/GTOreDictUnificator.java index 8060c5e49b1..2a7ee085378 100644 --- a/src/main/java/gregtech/api/util/GTOreDictUnificator.java +++ b/src/main/java/gregtech/api/util/GTOreDictUnificator.java @@ -324,7 +324,7 @@ public static List getNonUnifiedStacks(Object obj) { List tList = sUnificationTable.get(aStack); if (tList != null) { for (ItemStack tStack : tList) { - ItemStack tStack1 = GTUtility.copyAmount(aStack.stackSize, tStack); + ItemStack tStack1 = GTUtility.copyAmountUnsafe(aStack.stackSize, tStack); rList.add(tStack1); } } From a1954354cc0ae6a0e4c52b399f5fc986cbd0f012 Mon Sep 17 00:00:00 2001 From: Martin Robertz Date: Mon, 16 Sep 2024 11:25:26 +0200 Subject: [PATCH 04/42] update --- dependencies.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index 45b1fb753d3..6692c5f5b1c 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -36,7 +36,7 @@ dependencies { api("com.github.GTNewHorizons:StructureLib:1.3.4:dev") api("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev") - api("com.github.GTNewHorizons:NotEnoughItems:2.6.36-GTNH:dev") + api("com.github.GTNewHorizons:NotEnoughItems:2.6.38-GTNH:dev") api("com.github.GTNewHorizons:NotEnoughIds:2.1.2:dev") api("com.github.GTNewHorizons:GTNHLib:0.5.11:dev") api("com.github.GTNewHorizons:ModularUI:1.2.5:dev") @@ -69,7 +69,7 @@ dependencies { compileOnly("TGregworks:TGregworks:1.7.10-GTNH-1.0.27:deobf") {transitive = false} compileOnly("com.github.GTNewHorizons:ThaumicBases:1.7.5:dev") { transitive = false } compileOnly("com.github.GTNewHorizons:EnderCore:0.4.6:dev") { transitive = false } - compileOnly('com.github.GTNewHorizons:VisualProspecting:1.3.16:dev') { transitive = false } + compileOnly('com.github.GTNewHorizons:VisualProspecting:1.3.17:dev') { transitive = false } compileOnly("com.github.GTNewHorizons:Galaxy-Space-GTNH:1.1.93-GTNH:dev") { transitive = false } compileOnlyApi("com.github.GTNewHorizons:Galacticraft:3.2.4-GTNH:dev") { transitive = false } @@ -95,7 +95,7 @@ dependencies { compileOnly rfg.deobf("curse.maven:biomes-o-plenty-220318:2499612") compileOnly('com.github.GTNewHorizons:SC2:2.2.0:dev') {transitive=false} - compileOnly('com.github.GTNewHorizons:Binnie:2.4.1:dev') {transitive = false} + compileOnly('com.github.GTNewHorizons:Binnie:2.4.2:dev') {transitive = false} compileOnly('curse.maven:PlayerAPI-228969:2248928') {transitive=false} compileOnly('com.github.GTNewHorizons:BlockRenderer6343:1.2.14:dev'){transitive=false} @@ -108,7 +108,7 @@ dependencies { // runtimeOnlyNonPublishable("com.github.GTNewHorizons:ForestryMC:4.9.16:dev") // runtimeOnlyNonPublishable('com.github.GTNewHorizons:neiaddons:1.16.0:dev') // runtimeOnlyNonPublishable('com.github.GTNewHorizons:MagicBees:2.8.5-GTNH:dev') - // runtimeOnlyNonPublishable('com.github.GTNewHorizons:Binnie:2.4.1:dev') + // runtimeOnlyNonPublishable('com.github.GTNewHorizons:Binnie:2.4.2:dev') testImplementation(platform('org.junit:junit-bom:5.9.2')) testImplementation('org.junit.jupiter:junit-jupiter') From 49dbb5d1fb3fc86c551a545b94bed5c125fcce97 Mon Sep 17 00:00:00 2001 From: BucketBrigade <138534411+CookieBrigade@users.noreply.github.com> Date: Mon, 16 Sep 2024 12:24:00 -0500 Subject: [PATCH 05/42] Fixes cables/pipes not being able to attach to each other (#3209) --- .../java/gregtech/api/metatileentity/BaseMetaPipeEntity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index 12530ce8cd1..30a1561f203 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -1004,9 +1004,9 @@ public boolean onRightclick(EntityPlayer aPlayer, ForgeDirection side, float aX, if (!getCoverInfoAtSide(side).isGUIClickable()) return false; try { if (!aPlayer.isSneaking() && hasValidMetaTileEntity()) { - mMetaTileEntity.onRightclick(this, aPlayer, side, aX, aY, aZ);// Always returns false? + boolean value = mMetaTileEntity.onRightclick(this, aPlayer, side, aX, aY, aZ); mMetaTileEntity.markDirty(); - return true; // Play the animation + return value; } } catch (Throwable e) { GT_FML_LOGGER.error("Encountered Exception while right clicking TileEntity", e); From 95280a1ed4c80c0b6e3008eb9fb4028ceed6f32e Mon Sep 17 00:00:00 2001 From: Sampsa <69092953+S4mpsa@users.noreply.github.com> Date: Mon, 16 Sep 2024 20:37:16 +0300 Subject: [PATCH 06/42] Clarify Antimatter Forge tooltip (#3210) --- .../blocks/tileEntity/AntimatterForge.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/goodgenerator/blocks/tileEntity/AntimatterForge.java b/src/main/java/goodgenerator/blocks/tileEntity/AntimatterForge.java index f019f8f7cd9..1749b07df83 100644 --- a/src/main/java/goodgenerator/blocks/tileEntity/AntimatterForge.java +++ b/src/main/java/goodgenerator/blocks/tileEntity/AntimatterForge.java @@ -229,8 +229,15 @@ protected MultiblockTooltipBuilder createTooltip() { + EnumChatFormatting.AQUA + String.valueOf(this.baseSkew) + EnumChatFormatting.GRAY - + ", 1) of antimatter per cycle, consuming equal amounts of Protomatter") - .addInfo("The change can be negative! (N = Normal Distribution with mean of 0.2)") + + ", 0.25) of antimatter per cycle, consuming equal amounts of Protomatter") + .addInfo( + "The change is split between the 16 Antimatter Hatches, sampled from N(" + EnumChatFormatting.AQUA + + String.valueOf(this.baseSkew) + + EnumChatFormatting.GRAY + + ", 1) (Gaussian distribution with mean of " + + String.valueOf(this.baseSkew) + + ")") + .addInfo("The total change can be negative!") .addSeparator() .addInfo("Can be supplied with stabilization fluids to improve antimatter generation") .addInfo( @@ -299,6 +306,7 @@ protected MultiblockTooltipBuilder createTooltip() { "2. Depleted Naquadah Fuel Mk VI - Distribution skew " + EnumChatFormatting.AQUA + "+0.10" + EnumChatFormatting.GRAY) + .addInfo("Each stabilization can only use one of the fluids at a time") .addSeparator() .addCasingInfoMin("Antimatter Containment Casing", 512, false) .addCasingInfoMin("Magnetic Flux Casing", 2274, false) From f9ac981bbb731c1b9d5d17b772ec3fe7f10d34fc Mon Sep 17 00:00:00 2001 From: Martin Robertz Date: Mon, 16 Sep 2024 23:47:39 +0200 Subject: [PATCH 07/42] update --- dependencies.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies.gradle b/dependencies.gradle index 6692c5f5b1c..dcd5dedf375 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -70,7 +70,7 @@ dependencies { compileOnly("com.github.GTNewHorizons:ThaumicBases:1.7.5:dev") { transitive = false } compileOnly("com.github.GTNewHorizons:EnderCore:0.4.6:dev") { transitive = false } compileOnly('com.github.GTNewHorizons:VisualProspecting:1.3.17:dev') { transitive = false } - compileOnly("com.github.GTNewHorizons:Galaxy-Space-GTNH:1.1.93-GTNH:dev") { transitive = false } + compileOnly("com.github.GTNewHorizons:Galaxy-Space-GTNH:1.1.94-GTNH:dev") { transitive = false } compileOnlyApi("com.github.GTNewHorizons:Galacticraft:3.2.4-GTNH:dev") { transitive = false } implementation("com.github.GTNewHorizons:TinkersConstruct:1.12.9-GTNH:dev") From dfa65c81e3218af26cb3db8f1c61919beb46bf30 Mon Sep 17 00:00:00 2001 From: chochem <40274384+chochem@users.noreply.github.com> Date: Tue, 17 Sep 2024 12:57:52 +0100 Subject: [PATCH 08/42] fix ioob errors (#3212) Co-authored-by: Martin Robertz --- src/main/java/gtPlusPlus/core/util/minecraft/ItemUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/ItemUtils.java index 930ab6c34a9..3565b1c14d7 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -860,7 +860,7 @@ public static ItemStack[] cleanItemStackArray(ItemStack[] input) { aCleanedItems.add(checkStack); } } - for (int i = 0; i < aArraySize; i++) { + for (int i = 0; i < aCleanedItems.size(); i++) { ItemStack aMappedStack = aCleanedItems.get(i); if (aMappedStack != null) { aOutput[i] = aMappedStack; From b47d44ce6386984345b5601da732775861f8f1c3 Mon Sep 17 00:00:00 2001 From: NotAPenguin Date: Tue, 17 Sep 2024 16:44:03 +0200 Subject: [PATCH 09/42] Fix GT++ index out of bounds (#3214) Co-authored-by: Martin Robertz --- .../xmod/gregtech/loaders/recipe/RecipeLoaderAlgaeFarm.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoaderAlgaeFarm.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoaderAlgaeFarm.java index d5fe3011738..4689bb50420 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoaderAlgaeFarm.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoaderAlgaeFarm.java @@ -45,7 +45,7 @@ public static GTRecipe getTieredRecipeFromCache(int aTier, boolean aCompost) { aTemp.add(generateBaseRecipe(aCompost, aTier)); } } - int aIndex = MathUtils.randInt(0, aTemp.isEmpty() ? 1 : aTemp.size()); + int aIndex = MathUtils.randInt(0, (aTemp.isEmpty() ? 1 : aTemp.size()) - 1); Logger.INFO("Using recipe with index of " + aIndex + ". " + aComp); return aTemp.get(aIndex); } From a306b633d206c30db81f375da4927d0d0792aa8b Mon Sep 17 00:00:00 2001 From: Mary <33456283+FourIsTheNumber@users.noreply.github.com> Date: Tue, 17 Sep 2024 11:04:23 -0400 Subject: [PATCH 10/42] Remove waila black hole info (#3215) --- .../multi/compressor/MTEBlackHoleCompressor.java | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java index f8e223d6f5f..39538bfc7f6 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java @@ -273,7 +273,7 @@ protected MultiblockTooltipBuilder createTooltip() { EnumChatFormatting.LIGHT_PURPLE + "No longer requires heat management to perform superdense compression") .addInfo(EnumChatFormatting.LIGHT_PURPLE + "Can create advanced singularities!") - .addInfo(EnumChatFormatting.BLUE + "Use circuit 20 for compressor and 21 for Neutronium Compressor") + .addInfo(EnumChatFormatting.BLUE + "Use circuit 20 for Compressor and 21 for Neutronium Compressor") .addSeparator() .addInfo( "Insert a " + EnumChatFormatting.WHITE @@ -406,8 +406,6 @@ public void saveNBTData(NBTTagCompound aNBT) { public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) { super.getWailaNBTData(player, tile, tag, world, x, y, z); - tag.setByte("blackHoleStatus", blackHoleStatus); - tag.setFloat("blackHoleStability", blackHoleStability); tag.setInteger("parallels", getMaxParallelRecipes()); } @@ -420,18 +418,6 @@ public void getWailaBody(ItemStack itemStack, List currentTip, IWailaDat StatCollector.translateToLocal("GT5U.multiblock.parallelism") + ": " + EnumChatFormatting.WHITE + tag.getInteger("parallels")); - if (tag.getByte("blackHoleStatus") != 1) { - if (tag.getFloat("blackHoleStability") > 0) { - currentTip.add(EnumChatFormatting.DARK_PURPLE + "Black Hole Active"); - currentTip.add( - EnumChatFormatting.DARK_PURPLE + " Stability: " - + EnumChatFormatting.BOLD - + Math.round(tag.getFloat("blackHoleStability")) - + "%"); - } else { - currentTip.add(EnumChatFormatting.RED + "BLACK HOLE UNSTABLE"); - } - } else currentTip.add(EnumChatFormatting.DARK_PURPLE + "Black Hole Offline"); } private int getModeFromCircuit(ItemStack[] t) { From 0d27316cbbfb7ddaac334b93273833d94ad26a67 Mon Sep 17 00:00:00 2001 From: Mary <33456283+FourIsTheNumber@users.noreply.github.com> Date: Tue, 17 Sep 2024 11:28:12 -0400 Subject: [PATCH 11/42] Fix steam min casings (#3216) Co-authored-by: Martin Robertz --- .../machines/multi/processing/steam/MTESteamCentrifuge.java | 4 ++-- .../machines/multi/processing/steam/MTESteamCompressor.java | 4 ++-- .../machines/multi/processing/steam/MTESteamForgeHammer.java | 4 ++-- .../machines/multi/processing/steam/MTESteamMacerator.java | 4 ++-- .../machines/multi/processing/steam/MTESteamMixer.java | 4 ++-- .../machines/multi/processing/steam/MTESteamWasher.java | 4 ++-- .../machines/multi/processing/steam/MTESteamWaterPump.java | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamCentrifuge.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamCentrifuge.java index 6043b0f306d..52338322a30 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamCentrifuge.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamCentrifuge.java @@ -260,7 +260,7 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a if (tierGearBoxCasing == 1 && tierPipeCasing == 1 && tierFireBoxCasing == 1 && tierMachineCasing == 1 - && tCountCasing > 60 + && tCountCasing >= 60 && checkHatches()) { updateHatchTexture(); tierMachine = 1; @@ -269,7 +269,7 @@ && checkHatches()) { if (tierGearBoxCasing == 2 && tierPipeCasing == 2 && tierFireBoxCasing == 2 && tierMachineCasing == 2 - && tCountCasing > 60 + && tCountCasing >= 60 && checkHatches()) { updateHatchTexture(); tierMachine = 2; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamCompressor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamCompressor.java index fb6ffe0cda6..c8b441738b9 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamCompressor.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamCompressor.java @@ -205,12 +205,12 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a tierMachineCasing = -1; if (!checkPiece(STRUCTUR_PIECE_MAIN, HORIZONTAL_OFF_SET, VERTICAL_OFF_SET, DEPTH_OFF_SET)) return false; if (tierMachineCasing < 0) return false; - if (tierMachineCasing == 1 && mCountCasing > 25 && checkHatches()) { + if (tierMachineCasing == 1 && mCountCasing >= 25 && checkHatches()) { updateHatchTexture(); tierMachine = 1; return true; } - if (tierMachineCasing == 2 && mCountCasing > 25 && checkHatches()) { + if (tierMachineCasing == 2 && mCountCasing >= 25 && checkHatches()) { updateHatchTexture(); tierMachine = 2; return true; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamForgeHammer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamForgeHammer.java index 92fc531946a..01e719130ea 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamForgeHammer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamForgeHammer.java @@ -249,7 +249,7 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a if (tierPipeCasing < 0 && tierMachineCasing < 0 && tierSimpleBlock < 0) return false; if (tierPipeCasing == 1 && tierMachineCasing == 1 && tierSimpleBlock == 1 - && tCountCasing > 35 + && tCountCasing >= 35 && checkHatches()) { updateHatchTexture(); tierMachine = 1; @@ -257,7 +257,7 @@ && checkHatches()) { } if (tierPipeCasing == 2 && tierMachineCasing == 2 && tierSimpleBlock == 2 - && tCountCasing > 35 + && tCountCasing >= 35 && checkHatches()) { updateHatchTexture(); tierMachine = 2; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamMacerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamMacerator.java index 274711850a6..0a94a3068e0 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamMacerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamMacerator.java @@ -201,12 +201,12 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a mCounCasing = 0; if (!checkPiece(STRUCTUR_PIECE_MAIN, HORIZONTAL_OFF_SET, VERTICAL_OFF_SET, DEPTH_OFF_SET)) return false; if (tierMachineCasing < 0) return false; - if (tierMachineCasing == 1 && mCounCasing > 14 && checkHatches()) { + if (tierMachineCasing == 1 && mCounCasing >= 14 && checkHatches()) { updateHatchTexture(); tierMachine = 1; return true; } - if (tierMachineCasing == 2 && mCounCasing > 14 && checkHatches()) { + if (tierMachineCasing == 2 && mCounCasing >= 14 && checkHatches()) { updateHatchTexture(); tierMachine = 2; return true; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamMixer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamMixer.java index 2576c24749b..edbbb574eec 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamMixer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamMixer.java @@ -258,7 +258,7 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a if (tierGearBoxCasing < 0 && tierPipeCasing < 0 && tierMachineCasing < 0) return false; if (tierGearBoxCasing == 1 && tierPipeCasing == 1 && tierMachineCasing == 1 - && tCountCasing > 90 + && tCountCasing >= 90 && !mSteamInputFluids.isEmpty() && !mSteamInputs.isEmpty() && !mSteamOutputs.isEmpty() @@ -270,7 +270,7 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a } if (tierGearBoxCasing == 2 && tierPipeCasing == 2 && tierMachineCasing == 2 - && tCountCasing > 90 + && tCountCasing >= 90 && !mSteamInputFluids.isEmpty() && !mSteamInputs.isEmpty() && !mSteamOutputs.isEmpty() diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamWasher.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamWasher.java index de0c104c3cf..4967ab4ee26 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamWasher.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamWasher.java @@ -267,7 +267,7 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a if (tierGearBoxCasing < 0 && tierPipeCasing < 0 && tierMachineCasing < 0) return false; if (tierGearBoxCasing == 1 && tierPipeCasing == 1 && tierMachineCasing == 1 - && tCountCasing > 55 + && tCountCasing >= 55 && checkHatches()) { updateHatchTexture(); tierMachine = 1; @@ -275,7 +275,7 @@ && checkHatches()) { } if (tierGearBoxCasing == 2 && tierPipeCasing == 2 && tierMachineCasing == 2 - && tCountCasing > 55 + && tCountCasing >= 55 && checkHatches()) { updateHatchTexture(); tierMachine = 2; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamWaterPump.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamWaterPump.java index e29cc81baf5..ea0a78ccf01 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamWaterPump.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/MTESteamWaterPump.java @@ -267,11 +267,11 @@ protected MultiblockTooltipBuilder createTooltip() { .addStructureInfo("") .addStructureInfo(EnumChatFormatting.BLUE + "Tier " + EnumChatFormatting.DARK_PURPLE + 1) .addStructureInfo(EnumChatFormatting.GOLD + "10" + EnumChatFormatting.GRAY + " Bronze Frame Box") - .addStructureInfo(EnumChatFormatting.GOLD + "10" + EnumChatFormatting.GRAY + " Wooden Casing") + .addStructureInfo(EnumChatFormatting.GOLD + "9" + EnumChatFormatting.GRAY + " Wooden Casing") .addStructureInfo("") .addStructureInfo(EnumChatFormatting.BLUE + "Tier " + EnumChatFormatting.DARK_PURPLE + 2) .addStructureInfo(EnumChatFormatting.GOLD + "10" + EnumChatFormatting.GRAY + " Steel Frame Box") - .addStructureInfo(EnumChatFormatting.GOLD + "10 " + EnumChatFormatting.GRAY + " Wooden Casing") + .addStructureInfo(EnumChatFormatting.GOLD + "9 " + EnumChatFormatting.GRAY + " Wooden Casing") .addStructureInfo("") .toolTipFinisher(AuthorEvgenWarGold); return tt; From c7e451f83e3ae5ebadc5d223eb1180bf4b218e7f Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Tue, 17 Sep 2024 17:44:12 +0200 Subject: [PATCH 12/42] Add more is mod loaded checks to avoid crash during recipe registration (#3211) Co-authored-by: Martin Robertz --- .../gregtech/loaders/load/FuelLoader.java | 84 ++++++++++--------- .../java/gtPlusPlus/core/item/ModItems.java | 38 ++++----- 2 files changed, 63 insertions(+), 59 deletions(-) diff --git a/src/main/java/gregtech/loaders/load/FuelLoader.java b/src/main/java/gregtech/loaders/load/FuelLoader.java index 639b5359a35..544267c3660 100644 --- a/src/main/java/gregtech/loaders/load/FuelLoader.java +++ b/src/main/java/gregtech/loaders/load/FuelLoader.java @@ -2,7 +2,6 @@ import static gregtech.api.enums.Mods.BloodMagic; import static gregtech.api.enums.Mods.EnderIO; -import static gregtech.api.enums.Mods.Thaumcraft; import static gregtech.api.recipe.RecipeMaps.extremeNaquadahReactorFuels; import static gregtech.api.recipe.RecipeMaps.hugeNaquadahReactorFuels; import static gregtech.api.recipe.RecipeMaps.largeNaquadahReactorFuels; @@ -20,6 +19,7 @@ import gregtech.api.enums.GTValues; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; +import gregtech.api.enums.Mods; import gregtech.api.enums.OrePrefixes; import gregtech.api.fluid.GTFluidFactory; import gregtech.api.util.GTLog; @@ -85,43 +85,47 @@ public void run() { .addTo(ultraHugeNaquadahReactorFuels); // BloodMagic - GTValues.RA.stdBuilder() - .itemInputs(GTModHandler.getModItem(BloodMagic.ID, "reinforcedSlate", 1L)) - .itemOutputs(GTModHandler.getModItem(BloodMagic.ID, "blankSlate", 1L)) - .duration(0) - .eut(0) - .metadata(FUEL_VALUE, 400) - .addTo(magicFuels); + if (BloodMagic.isModLoaded()) { + GTValues.RA.stdBuilder() + .itemInputs(GTModHandler.getModItem(BloodMagic.ID, "reinforcedSlate", 1L)) + .itemOutputs(GTModHandler.getModItem(BloodMagic.ID, "blankSlate", 1L)) + .duration(0) + .eut(0) + .metadata(FUEL_VALUE, 400) + .addTo(magicFuels); - GTValues.RA.stdBuilder() - .itemInputs(GTModHandler.getModItem(BloodMagic.ID, "imbuedSlate", 1L)) - .itemOutputs(GTModHandler.getModItem(BloodMagic.ID, "reinforcedSlate", 1L)) - .duration(0) - .eut(0) - .metadata(FUEL_VALUE, 1000) - .addTo(magicFuels); + GTValues.RA.stdBuilder() + .itemInputs(GTModHandler.getModItem(BloodMagic.ID, "imbuedSlate", 1L)) + .itemOutputs(GTModHandler.getModItem(BloodMagic.ID, "reinforcedSlate", 1L)) + .duration(0) + .eut(0) + .metadata(FUEL_VALUE, 1000) + .addTo(magicFuels); - GTValues.RA.stdBuilder() - .itemInputs(GTModHandler.getModItem(BloodMagic.ID, "demonicSlate", 1L)) - .itemOutputs(GTModHandler.getModItem(BloodMagic.ID, "imbuedSlate", 1L)) - .duration(0) - .eut(0) - .metadata(FUEL_VALUE, 8000) - .addTo(magicFuels); + GTValues.RA.stdBuilder() + .itemInputs(GTModHandler.getModItem(BloodMagic.ID, "demonicSlate", 1L)) + .itemOutputs(GTModHandler.getModItem(BloodMagic.ID, "imbuedSlate", 1L)) + .duration(0) + .eut(0) + .metadata(FUEL_VALUE, 8000) + .addTo(magicFuels); - GTValues.RA.stdBuilder() - .itemInputs(GTModHandler.getModItem(BloodMagic.ID, "bloodMagicBaseItems", 1L, 27)) - .itemOutputs(GTModHandler.getModItem(BloodMagic.ID, "demonicSlate", 1L)) - .duration(0) - .eut(0) - .metadata(FUEL_VALUE, 20000) - .addTo(magicFuels); + GTValues.RA.stdBuilder() + .itemInputs(GTModHandler.getModItem(BloodMagic.ID, "bloodMagicBaseItems", 1L, 27)) + .itemOutputs(GTModHandler.getModItem(BloodMagic.ID, "demonicSlate", 1L)) + .duration(0) + .eut(0) + .metadata(FUEL_VALUE, 20000) + .addTo(magicFuels); + } - GTValues.RA.stdBuilder() - .itemInputs(GTModHandler.getModItem(Thaumcraft.ID, "ItemResource", 1L, 4)) - .metadata(FUEL_VALUE, 4) - .metadata(FUEL_TYPE, 5) - .addTo(GTRecipeConstants.Fuel); + if (Mods.Thaumcraft.isModLoaded()) { + GTValues.RA.stdBuilder() + .itemInputs(GTModHandler.getModItem(Mods.Thaumcraft.ID, "ItemResource", 1L, 4)) + .metadata(FUEL_VALUE, 4) + .metadata(FUEL_TYPE, 5) + .addTo(GTRecipeConstants.Fuel); + } GTValues.RA.stdBuilder() .itemInputs(new ItemStack(Items.experience_bottle, 1)) .metadata(FUEL_VALUE, 10) @@ -137,10 +141,12 @@ public void run() { .metadata(FUEL_VALUE, Materials.NetherStar.mFuelPower * 2) .metadata(FUEL_TYPE, Materials.NetherStar.mFuelType) .addTo(GTRecipeConstants.Fuel); - GTValues.RA.stdBuilder() - .itemInputs(GTModHandler.getModItem(EnderIO.ID, "bucketRocket_fuel", 1)) - .metadata(FUEL_VALUE, 250) - .metadata(FUEL_TYPE, 1) - .addTo(GTRecipeConstants.Fuel); + if (Mods.EnderIO.isModLoaded()) { + GTValues.RA.stdBuilder() + .itemInputs(GTModHandler.getModItem(EnderIO.ID, "bucketRocket_fuel", 1)) + .metadata(FUEL_VALUE, 250) + .metadata(FUEL_TYPE, 1) + .addTo(GTRecipeConstants.Fuel); + } } } diff --git a/src/main/java/gtPlusPlus/core/item/ModItems.java b/src/main/java/gtPlusPlus/core/item/ModItems.java index 12e127c3b70..bdf93c22bef 100644 --- a/src/main/java/gtPlusPlus/core/item/ModItems.java +++ b/src/main/java/gtPlusPlus/core/item/ModItems.java @@ -649,27 +649,25 @@ public static void init() { dustFertUN32 = ItemUtils .generateSpecialUseDusts("UN32Fertiliser", "UN-32 Fertiliser", Utils.rgbtoHexValue(55, 190, 55))[0]; - ItemStack temp1 = ItemUtils.getCorrectStacktype("IC2:itemFertilizer", 1); - ItemStack temp2 = null; - if (Forestry.isModLoaded()) { - temp2 = ItemUtils.getCorrectStacktype("Forestry:fertilizerCompound", 1); - } - if (temp1 != null) { - fluidFertBasic = FluidUtils.generateFluidNonMolten( - "Fertiliser", - "Fertiliser", - 32, - new short[] { 45, 170, 45, 100 }, - temp1, - null, - true); - GTValues.RA.stdBuilder() - .itemInputs(temp2) - .fluidOutputs(new FluidStack(fluidFertBasic, 36)) - .duration(5 * TICKS) - .eut(16) - .addTo(fluidExtractionRecipes); + ItemStack temp1 = ItemUtils.getCorrectStacktype("IC2:itemFertilizer", 1); + ItemStack temp2 = ItemUtils.getCorrectStacktype("Forestry:fertilizerCompound", 1); + if (temp1 != null && temp2 != null) { + fluidFertBasic = FluidUtils.generateFluidNonMolten( + "Fertiliser", + "Fertiliser", + 32, + new short[] { 45, 170, 45, 100 }, + temp1, + null, + true); + GTValues.RA.stdBuilder() + .itemInputs(temp2) + .fluidOutputs(new FluidStack(fluidFertBasic, 36)) + .duration(5 * TICKS) + .eut(16) + .addTo(fluidExtractionRecipes); + } } fluidFertUN32 = FluidUtils.generateFluidNonMolten( "UN32Fertiliser", From 89b686513756e38b20105749dd2aff1de7bd1372 Mon Sep 17 00:00:00 2001 From: Mary <33456283+FourIsTheNumber@users.noreply.github.com> Date: Tue, 17 Sep 2024 11:54:42 -0400 Subject: [PATCH 13/42] Fix stocking bus on black hole (#3217) Co-authored-by: Martin Robertz --- .../compressor/MTEBlackHoleCompressor.java | 63 ++++++++++++------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java index 39538bfc7f6..ba1c38db405 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java @@ -434,6 +434,44 @@ private int getModeFromCircuit(ItemStack[] t) { return 0; } + private void searchAndDecrementCatalysts() { + // Loop through all items and look for the Activation and Deactivation Catalysts + // Deactivation resets stability to 100 and catalyzing cost to 1 + + // Has to do this "start/endRecipeProcessing" nonsense, or it doesn't work with stocking bus. + for (MTEHatchInputBus bus : mInputBusses) { + ItemStack[] inv = bus.getRealInventory(); + if (inv != null) { + for (int i = 0; i < inv.length; i++) { + ItemStack inputItem = inv[i]; + if (inputItem != null) { + if (inputItem.getItem() instanceof MetaGeneratedItem01) { + if (inputItem.getItemDamage() == 32418 && (blackHoleStatus == 1)) { + startRecipeProcessing(); + bus.decrStackSize(i, 1); + endRecipeProcessing(); + blackHoleStatus = 2; + createRenderBlock(); + return; + } else if (inputItem.getItemDamage() == 32419 && !(blackHoleStatus == 1)) { + startRecipeProcessing(); + bus.decrStackSize(i, 1); + endRecipeProcessing(); + inputItem.stackSize -= 1; + blackHoleStatus = 1; + blackHoleStability = 100; + catalyzingCostModifier = 1; + rendererTileEntity = null; + destroyRenderBlock(); + return; + } + } + } + } + } + } + } + @Override protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic() { @@ -441,30 +479,7 @@ protected ProcessingLogic createProcessingLogic() { @NotNull @Override protected Stream findRecipeMatches(@Nullable RecipeMap map) { - // Loop through all items and look for the Activation and Deactivation Catalysts - // Deactivation resets stability to 100 and catalyzing cost to 1 - for (MTEHatchInputBus bus : mInputBusses) { - for (ItemStack inputItem : bus.mInventory) { - if (inputItem != null) { - if (inputItem.getItem() instanceof MetaGeneratedItem01) { - if (inputItem.getItemDamage() == 32418 && (blackHoleStatus == 1)) { - inputItem.stackSize -= 1; - blackHoleStatus = 2; - createRenderBlock(); - break; - } else if (inputItem.getItemDamage() == 32419 && !(blackHoleStatus == 1)) { - inputItem.stackSize -= 1; - blackHoleStatus = 1; - blackHoleStability = 100; - catalyzingCostModifier = 1; - rendererTileEntity = null; - destroyRenderBlock(); - break; - } - } - } - } - } + searchAndDecrementCatalysts(); RecipeMap realMap = (getModeFromCircuit(inputItems) == MACHINEMODE_COMPRESSOR) ? RecipeMaps.compressorRecipes From 257a023d03e8d3c63d12847c03392cc806665e6a Mon Sep 17 00:00:00 2001 From: GDCloud <93287602+GDCloudstrike@users.noreply.github.com> Date: Tue, 17 Sep 2024 21:16:23 +0200 Subject: [PATCH 14/42] Fix high amp wireless uxv hatches (#3219) --- .../recipe/ResearchStationAssemblyLine.java | 6 ++-- .../hatch/MTEHatchWirelessMulti.java | 34 +++++++++++++++---- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/main/java/tectech/loader/recipe/ResearchStationAssemblyLine.java b/src/main/java/tectech/loader/recipe/ResearchStationAssemblyLine.java index f20177950fe..e22f934b559 100644 --- a/src/main/java/tectech/loader/recipe/ResearchStationAssemblyLine.java +++ b/src/main/java/tectech/loader/recipe/ResearchStationAssemblyLine.java @@ -3525,10 +3525,8 @@ private void addWirelessEnergyRecipes() { for (int i = 0; i < wirelessLasers.length; i++) { TTRecipeAdder.addResearchableAssemblylineRecipe( - i != 8 ? laserTargets_UXV[i] : wirelessLasers[i - 1], // If current laser registered is UXV 4MA switch - // research item to avoid duplicate qc result from - // normal UXV 4MA laser, see this: - // https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/17188 + i != 7 ? laserTargets_UXV[i] : CustomItemList.eM_energyWirelessTunnel7_UXV.get(1), + // If current laser registered is UXV 4MA, switch research item to avoid research conflict totalComputation * 64, compPerSecond * 64, researchEuPerTick * 4, diff --git a/src/main/java/tectech/thing/metaTileEntity/hatch/MTEHatchWirelessMulti.java b/src/main/java/tectech/thing/metaTileEntity/hatch/MTEHatchWirelessMulti.java index 09d76c29a1c..6c737a7d2a4 100644 --- a/src/main/java/tectech/thing/metaTileEntity/hatch/MTEHatchWirelessMulti.java +++ b/src/main/java/tectech/thing/metaTileEntity/hatch/MTEHatchWirelessMulti.java @@ -16,6 +16,8 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; +import com.google.common.math.LongMath; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IWirelessEnergyHatchInformation; @@ -25,9 +27,21 @@ public class MTEHatchWirelessMulti extends MTEHatchEnergyMulti implements IWirelessEnergyHatchInformation { - private final BigInteger eu_transferred_per_operation = BigInteger - .valueOf(Amperes * V[mTier] * ticks_between_energy_addition); - private final long eu_transferred_per_operation_long = eu_transferred_per_operation.longValue(); + private final long precisionMultiplier = LongMath.pow(10, 15); + private final BigInteger eu_transferred_per_operation = BigInteger.valueOf(Amperes * V[mTier]) + .multiply(BigInteger.valueOf(ticks_between_energy_addition)); + + private final double overflowDivisor = getOverflowDivisor(eu_transferred_per_operation); + + private final long actualTicksBetweenEnergyAddition = overflowDivisor > 1 + ? (long) (ticks_between_energy_addition / (overflowDivisor * 2)) + : ticks_between_energy_addition; + + private final long eu_transferred_per_operation_long = overflowDivisor > 1 + ? eu_transferred_per_operation.divide(BigInteger.valueOf((long) (overflowDivisor * precisionMultiplier * 2))) + .multiply(BigInteger.valueOf(precisionMultiplier)) + .longValue() + : eu_transferred_per_operation.longValue(); private UUID owner_uuid; @@ -49,6 +63,13 @@ public MTEHatchWirelessMulti(String aName, int aTier, int aAmp, String[] aDescri super(aName, aTier, aAmp, aDescription, aTextures); } + private double getOverflowDivisor(BigInteger euTransferredPerOperation) { + if (euTransferredPerOperation.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) > 0) { + return euTransferredPerOperation.doubleValue() / Long.MAX_VALUE; + } + return 1d; + } + private ITexture[] TEXTURE_OVERLAY; @Override @@ -131,7 +152,7 @@ public long maxEUInput() { @Override public long maxEUStore() { - return totalStorage(V[mTier]) * Amperes / 2; + return (long) (totalStorage(V[mTier]) / (2 * overflowDivisor) * Amperes); } @Override @@ -191,8 +212,9 @@ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { // network // it should make no difference to them. Minimising the number of operations on BigInteger is essential. - // Every ticks_between_energy_addition add eu_transferred_per_operation to internal EU storage from network. - if (aTick % ticks_between_energy_addition == 0L) { + // Every actualTicksBetweenEnergyAddition add eu_transferred_per_operation to internal EU storage from + // network. + if (aTick % actualTicksBetweenEnergyAddition == 0L) { tryFetchingEnergy(); } } From 9e74ed7a31b9bdfe41f337d93ec719f5ac6d4a3e Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Sat, 14 Sep 2024 00:27:35 +0200 Subject: [PATCH 15/42] remove unnecessary reflection since the mods are now merged all together --- .../multis/MTEDeepEarthHeatingPump.java | 13 ++----------- .../java/bartworks/system/worldgen/MapGenRuins.java | 1 - 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/main/java/bartworks/common/tileentities/multis/MTEDeepEarthHeatingPump.java b/src/main/java/bartworks/common/tileentities/multis/MTEDeepEarthHeatingPump.java index d558e5466ba..b9ab023dae0 100644 --- a/src/main/java/bartworks/common/tileentities/multis/MTEDeepEarthHeatingPump.java +++ b/src/main/java/bartworks/common/tileentities/multis/MTEDeepEarthHeatingPump.java @@ -190,11 +190,7 @@ protected boolean workingUpward(ItemStack aStack, int xDrill, int yDrill, int zD int yHead, int oldYHead) { if (this.mMode != 3) { this.isPickingPipes = false; - try { - Field workState = this.getClass() - .getField("workState"); - workState.setInt(this, 0); - } catch (NoSuchFieldError | NoSuchFieldException | IllegalAccessException ignored) {} + this.workState = 0; return true; } return super.workingUpward(aStack, xDrill, yDrill, zDrill, xPipe, zPipe, yHead, oldYHead); @@ -215,12 +211,7 @@ protected boolean workingDownward(ItemStack aStack, int xDrill, int yDrill, int int yHead, int oldYHead) { if (this.mMode == 3) { this.isPickingPipes = true; - try { - Field workState = this.getClass() - .getSuperclass() - .getDeclaredField("workState"); - workState.setInt(this, 2); - } catch (NoSuchFieldError | NoSuchFieldException | IllegalAccessException ignored) {} + this.workState = 2; return true; } diff --git a/src/main/java/bartworks/system/worldgen/MapGenRuins.java b/src/main/java/bartworks/system/worldgen/MapGenRuins.java index b8489ccce49..a1925757434 100644 --- a/src/main/java/bartworks/system/worldgen/MapGenRuins.java +++ b/src/main/java/bartworks/system/worldgen/MapGenRuins.java @@ -163,7 +163,6 @@ private void checkTile(BaseMetaTileEntity BTE, World worldObj, int x, int y, int if (BTE.getMetaTileID() != meta || worldObj.getTileEntity(x, y, z) != BTE || BTE.isInvalid()) { this.redoTile(BTE, worldObj, x, y, z, meta, ownerName, facing); this.checkTile(BTE, worldObj, x, y, z, meta, ownerName, facing, depth); - depth++; } } else { worldObj.removeTileEntity(x, y, z); From fa9244831214fe88f3801fd42f87c92ae9f33113 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Sat, 14 Sep 2024 19:45:56 +0200 Subject: [PATCH 16/42] initialize the material maps used by detrav ore scanner only when they are used --- src/main/java/detrav/DetravScannerMod.java | 2 - ...BehaviourDetravToolElectricProspector.java | 2 +- .../java/detrav/net/ProspectingPacket.java | 6 +-- src/main/java/detrav/utils/GTppHelper.java | 54 ++++++++++++------- 4 files changed, 40 insertions(+), 24 deletions(-) diff --git a/src/main/java/detrav/DetravScannerMod.java b/src/main/java/detrav/DetravScannerMod.java index c65bc49a347..17e859216b2 100644 --- a/src/main/java/detrav/DetravScannerMod.java +++ b/src/main/java/detrav/DetravScannerMod.java @@ -15,7 +15,6 @@ import detrav.net.DetravNetwork; import detrav.proxies.CommonProxy; import detrav.utils.DetravCreativeTab; -import detrav.utils.GTppHelper; import gregtech.GT_Version; import gregtech.api.GregTechAPI; @@ -64,6 +63,5 @@ public void init(FMLInitializationEvent event) { @EventHandler public void onPostLoad(FMLPostInitializationEvent aEvent) { proxy.onPostLoad(); - GTppHelper.generate_OreIDs(); } } diff --git a/src/main/java/detrav/items/behaviours/BehaviourDetravToolElectricProspector.java b/src/main/java/detrav/items/behaviours/BehaviourDetravToolElectricProspector.java index 04b1c47cf62..fb3e4833995 100644 --- a/src/main/java/detrav/items/behaviours/BehaviourDetravToolElectricProspector.java +++ b/src/main/java/detrav/items/behaviours/BehaviourDetravToolElectricProspector.java @@ -104,7 +104,7 @@ public ItemStack onItemRightClick(MetaBaseItem aItem, ItemStack aStack, World aW c.xPosition * 16 + x, y, c.zPosition * 16 + z, - GTppHelper.getGTppMeta(tBlock)); + GTppHelper.getMetaFromBlock(tBlock)); } else if (BartWorksHelper.isOre(tBlock)) { if (data != 1 && BartWorksHelper.isSmallOre(tBlock)) continue; packet.addBlock( diff --git a/src/main/java/detrav/net/ProspectingPacket.java b/src/main/java/detrav/net/ProspectingPacket.java index 901a57d9328..1b861273e53 100644 --- a/src/main/java/detrav/net/ProspectingPacket.java +++ b/src/main/java/detrav/net/ProspectingPacket.java @@ -74,9 +74,9 @@ private static void addOre(ProspectingPacket packet, byte y, int i, int j, short rgba = werkstoff.getRGBA(); } } else { - gtPlusPlus.core.material.Material pMaterial = GTppHelper.decodeoresGTpp.get((short) (meta - 7000)); - rgba = pMaterial.getRGBA(); - name = pMaterial.getLocalizedName() + " Ore"; + gtPlusPlus.core.material.Material mat = GTppHelper.getMatFromMeta(meta); + rgba = mat.getRGBA(); + name = mat.getLocalizedName() + " Ore"; } } else if (packet.ptype == 2) { // Fluid diff --git a/src/main/java/detrav/utils/GTppHelper.java b/src/main/java/detrav/utils/GTppHelper.java index 985ca3386b9..483e8cfd5ec 100644 --- a/src/main/java/detrav/utils/GTppHelper.java +++ b/src/main/java/detrav/utils/GTppHelper.java @@ -1,9 +1,11 @@ package detrav.utils; +import java.lang.reflect.Field; import java.util.HashMap; import net.minecraft.block.Block; +import gregtech.GTMod; import gtPlusPlus.core.block.base.BlockBaseOre; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.MaterialMisc; @@ -12,23 +14,27 @@ import gtPlusPlus.core.material.MaterialsOres; import gtPlusPlus.core.material.nuclear.MaterialsFluorides; -/** - * Created by bartimaeusnek on 19.04.2018. - */ public class GTppHelper { - public static final HashMap decodeoresGTpp = new HashMap<>(); - public static final HashMap encodeoresGTpp = new HashMap<>(); + private static boolean initialized; + private static final HashMap decodeoresGTpp = new HashMap<>(); + private static final HashMap encodeoresGTpp = new HashMap<>(); - public static void generate_OreIDs() { + private static void generate_OreIDs() { short n = 0; - for (; n < MaterialsOres.class.getFields().length; ++n) { + final Field[] fields = MaterialsOres.class.getFields(); + for (; n < fields.length; ++n) { try { - Short i = (short) (n + 1); - Material m = ((Material) MaterialsOres.class.getFields()[n].get(MaterialsOres.class.getFields()[n])); - decodeoresGTpp.put(i, m); - encodeoresGTpp.put(m, i); - } catch (Exception ignored) {} + final Object o = fields[n].get(null); + if (o instanceof Material m) { + Short i = (short) (n + 1); + decodeoresGTpp.put(i, m); + encodeoresGTpp.put(m, i); + } + } catch (Exception e) { + GTMod.GT_FML_LOGGER + .error("Exception caught when trying to generate GT++ ore ids for detrav ore scanner", e); + } } // Manually add ores from other places than the ore class // Fluorite @@ -52,16 +58,28 @@ public static void generate_OreIDs() { encodeoresGTpp.put(MaterialsElements.STANDALONE.GRANITE, (short) (n + 1)); } - public static boolean isGTppBlock(Block tBlock) { - return tBlock instanceof BlockBaseOre; + public static short getMetaFromBlock(Block block) { + if (!initialized) { + generate_OreIDs(); + initialized = true; + } + return (short) (GTppHelper.encodeoresGTpp.get(((BlockBaseOre) block).getMaterialEx()) + 7000); + } + + public static Material getMatFromMeta(int meta) { + if (!initialized) { + generate_OreIDs(); + initialized = true; + } + return GTppHelper.decodeoresGTpp.get((short) (meta - 7000)); } - public static short getGTppMeta(Block tBlock) { - return (short) (GTppHelper.encodeoresGTpp.get(((BlockBaseOre) tBlock).getMaterialEx()) + 7000); + public static boolean isGTppBlock(Block block) { + return block instanceof BlockBaseOre; } - public static String getGTppVeinName(Block tBlock) { - return tBlock.getLocalizedName(); + public static String getGTppVeinName(Block block) { + return block.getLocalizedName(); } } From d83cc53cf944772818eb1e23c065c54accaa0034 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Mon, 16 Sep 2024 00:02:48 +0200 Subject: [PATCH 17/42] Delete TTUtility.getTier and use GTUtility instead --- .../multi/base/TTMultiblockBase.java | 5 ++--- .../metaTileEntity/single/MTEBuckConverter.java | 3 ++- .../single/MTEDebugPowerGenerator.java | 2 +- src/main/java/tectech/util/TTUtility.java | 15 --------------- 4 files changed, 5 insertions(+), 20 deletions(-) diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/base/TTMultiblockBase.java b/src/main/java/tectech/thing/metaTileEntity/multi/base/TTMultiblockBase.java index 140fb80ae2d..2a0c10f3038 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/base/TTMultiblockBase.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/base/TTMultiblockBase.java @@ -104,7 +104,6 @@ import tectech.thing.metaTileEntity.hatch.MTEHatchUncertainty; import tectech.thing.metaTileEntity.multi.base.render.TTRenderedExtendedFacingTexture; import tectech.util.CommonValues; -import tectech.util.TTUtility; /** * Created by danie_000 on 27.10.2016. @@ -1717,12 +1716,12 @@ public final long getMaxInputEnergy_EM() { // new Method public final int getMaxEnergyInputTier_EM() { - return TTUtility.getTier(maxEUinputMax); + return GTUtility.getTier(maxEUinputMax); } // new Method public final int getMinEnergyInputTier_EM() { - return TTUtility.getTier(maxEUinputMin); + return GTUtility.getTier(maxEUinputMin); } public final long getMaxAmpereFlowAtMinTierOfEnergyHatches() { diff --git a/src/main/java/tectech/thing/metaTileEntity/single/MTEBuckConverter.java b/src/main/java/tectech/thing/metaTileEntity/single/MTEBuckConverter.java index 3f2c66276dc..0a2a8d756ec 100644 --- a/src/main/java/tectech/thing/metaTileEntity/single/MTEBuckConverter.java +++ b/src/main/java/tectech/thing/metaTileEntity/single/MTEBuckConverter.java @@ -33,6 +33,7 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.MTETieredMachineBlock; import gregtech.api.objects.GTRenderedTexture; +import gregtech.api.util.GTUtility; import tectech.util.CommonValues; import tectech.util.TTUtility; @@ -219,7 +220,7 @@ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildCont .setDefaultColor(COLOR_TEXT_WHITE.get()) .setPos(46, 8)) .widget( - new TextWidget().setStringSupplier(() -> "TIER: " + VN[TTUtility.getTier(Math.abs(EUT))]) + new TextWidget().setStringSupplier(() -> "TIER: " + VN[GTUtility.getTier(Math.abs(EUT))]) .setDefaultColor(COLOR_TEXT_WHITE.get()) .setPos(46, 16)) .widget( diff --git a/src/main/java/tectech/thing/metaTileEntity/single/MTEDebugPowerGenerator.java b/src/main/java/tectech/thing/metaTileEntity/single/MTEDebugPowerGenerator.java index b82e0036c0d..0251a919f0c 100644 --- a/src/main/java/tectech/thing/metaTileEntity/single/MTEDebugPowerGenerator.java +++ b/src/main/java/tectech/thing/metaTileEntity/single/MTEDebugPowerGenerator.java @@ -323,7 +323,7 @@ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildCont .setPos(43, 4)) .widget( - new TextWidget().setStringSupplier(() -> "TIER: " + VN[TTUtility.getTier(Math.abs(EUT))]) + new TextWidget().setStringSupplier(() -> "TIER: " + VN[GTUtility.getTier(Math.abs(EUT))]) .setDefaultColor(COLOR_TEXT_WHITE.get()) .setPos(46, 22)) diff --git a/src/main/java/tectech/util/TTUtility.java b/src/main/java/tectech/util/TTUtility.java index c933b37b82b..da58e3d22fe 100644 --- a/src/main/java/tectech/util/TTUtility.java +++ b/src/main/java/tectech/util/TTUtility.java @@ -1,7 +1,5 @@ package tectech.util; -import static gregtech.api.enums.GTValues.V; - import java.lang.reflect.Field; import java.math.BigInteger; import java.util.Formatter; @@ -95,19 +93,6 @@ public static String getUniqueIdentifier(ItemStack is) { return GameRegistry.findUniqueIdentifierFor(is.getItem()).modId + ':' + is.getUnlocalizedName(); } - public static byte getTier(long l) { - byte b = -1; - - do { - ++b; - if (b >= V.length) { - return b; - } - } while (l > V[b]); - - return b; - } - public static void setTier(int tier, Object me) { try { Field field = MTETieredMachineBlock.class.getField("mTier"); From 730024055f670fef1fd4ba76b0863736a03fe227 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Mon, 16 Sep 2024 01:12:03 +0200 Subject: [PATCH 18/42] cache some Enum.values() call to reduce RAM allocations --- .../loaders/StaticRecipeChangeLoaders.java | 84 ++++++++++--------- .../registration/BridgeMaterialsLoader.java | 3 +- .../dynconfig/DynamicDimensionConfig.java | 3 +- src/main/java/ggfab/GigaGramFab.java | 65 +++++++------- .../java/gregtech/api/enums/OrePrefixes.java | 16 +++- .../gtPlusPlus/api/recipe/TGSFrontend.java | 7 +- .../forestry/bees/custom/CustomCombs.java | 2 +- .../forestry/bees/custom/ItemCustomComb.java | 9 +- .../advanced/MTEAdvDistillationTower.java | 2 +- .../multi/production/MTETreeFarm.java | 12 +-- .../gtnhlanth/common/item/ItemParticle.java | 37 ++------ src/main/java/kekztech/Items.java | 10 +-- .../MTELapotronicSuperCapacitor.java | 4 +- .../thing/block/TileEntityEyeOfHarmony.java | 2 +- 14 files changed, 121 insertions(+), 135 deletions(-) diff --git a/src/main/java/bartworks/common/loaders/StaticRecipeChangeLoaders.java b/src/main/java/bartworks/common/loaders/StaticRecipeChangeLoaders.java index a27da269196..f266c2fdc21 100644 --- a/src/main/java/bartworks/common/loaders/StaticRecipeChangeLoaders.java +++ b/src/main/java/bartworks/common/loaders/StaticRecipeChangeLoaders.java @@ -98,6 +98,7 @@ public static void addEBFGasRecipes() { public static void unificationRecipeEnforcer() { List toRemove = new ArrayList<>(); + final OrePrefixes[] OREPREFIX_VALUES = OrePrefixes.values(); for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) { StaticRecipeChangeLoaders.runMaterialLinker(werkstoff); if (werkstoff.getGenerationFeatures().enforceUnification) { @@ -105,51 +106,54 @@ public static void unificationRecipeEnforcer() { oreDictNames.add(werkstoff.getVarName()); StaticRecipeChangeLoaders.runMoltenUnificationEnfocement(werkstoff); StaticRecipeChangeLoaders.runUnficationDeleter(werkstoff); - for (String s : oreDictNames) for (OrePrefixes prefixes : OrePrefixes.values()) { - if (!werkstoff.hasItemType(prefixes)) continue; - String fullOreName = prefixes + s; - List ores = OreDictionary.getOres(fullOreName, false); - if (ores.size() <= 1) // empty or one entry, i.e. no unification needed - continue; - for (ItemStack toReplace : ores) { - ItemStack replacement = werkstoff.get(prefixes); - if (toReplace == null || GTUtility.areStacksEqual(toReplace, replacement) - || replacement == null - || replacement.getItem() == null) continue; - for (RecipeMap map : RecipeMap.ALL_RECIPE_MAPS.values()) { - toRemove.clear(); - nextRecipe: for (GTRecipe recipe : map.getAllRecipes()) { - boolean removal = map.equals(RecipeMaps.fluidExtractionRecipes) - || map.equals(RecipeMaps.fluidSolidifierRecipes); - for (int i = 0; i < recipe.mInputs.length; i++) { - if (!GTUtility.areStacksEqual(recipe.mInputs[i], toReplace)) continue; - if (removal) { - toRemove.add(recipe); - continue nextRecipe; + for (String s : oreDictNames) { + for (OrePrefixes prefixes : OREPREFIX_VALUES) { + if (!werkstoff.hasItemType(prefixes)) continue; + String fullOreName = prefixes + s; + List ores = OreDictionary.getOres(fullOreName, false); + if (ores.size() <= 1) // empty or one entry, i.e. no unification needed + continue; + for (ItemStack toReplace : ores) { + ItemStack replacement = werkstoff.get(prefixes); + if (toReplace == null || GTUtility.areStacksEqual(toReplace, replacement) + || replacement == null + || replacement.getItem() == null) continue; + for (RecipeMap map : RecipeMap.ALL_RECIPE_MAPS.values()) { + toRemove.clear(); + nextRecipe: for (GTRecipe recipe : map.getAllRecipes()) { + boolean removal = map.equals(RecipeMaps.fluidExtractionRecipes) + || map.equals(RecipeMaps.fluidSolidifierRecipes); + for (int i = 0; i < recipe.mInputs.length; i++) { + if (!GTUtility.areStacksEqual(recipe.mInputs[i], toReplace)) continue; + if (removal) { + toRemove.add(recipe); + continue nextRecipe; + } + recipe.mInputs[i] = GTUtility + .copyAmount(recipe.mInputs[i].stackSize, replacement); } - recipe.mInputs[i] = GTUtility.copyAmount(recipe.mInputs[i].stackSize, replacement); - } - for (int i = 0; i < recipe.mOutputs.length; i++) { - if (!GTUtility.areStacksEqual(recipe.mOutputs[i], toReplace)) continue; - if (removal) { - toRemove.add(recipe); - continue nextRecipe; + for (int i = 0; i < recipe.mOutputs.length; i++) { + if (!GTUtility.areStacksEqual(recipe.mOutputs[i], toReplace)) continue; + if (removal) { + toRemove.add(recipe); + continue nextRecipe; + } + recipe.mOutputs[i] = GTUtility + .copyAmount(recipe.mOutputs[i].stackSize, replacement); } - recipe.mOutputs[i] = GTUtility - .copyAmount(recipe.mOutputs[i].stackSize, replacement); - } - if (recipe.mSpecialItems instanceof ItemStack specialItemStack) { - if (!GTUtility.areStacksEqual(specialItemStack, toReplace)) continue; - if (removal) { - toRemove.add(recipe); - continue nextRecipe; + if (recipe.mSpecialItems instanceof ItemStack specialItemStack) { + if (!GTUtility.areStacksEqual(specialItemStack, toReplace)) continue; + if (removal) { + toRemove.add(recipe); + continue nextRecipe; + } + recipe.mSpecialItems = GTUtility + .copyAmount(specialItemStack.stackSize, replacement); } - recipe.mSpecialItems = GTUtility - .copyAmount(specialItemStack.stackSize, replacement); } + map.getBackend() + .removeRecipes(toRemove); } - map.getBackend() - .removeRecipes(toRemove); } } } diff --git a/src/main/java/bartworks/system/material/werkstoff_loaders/registration/BridgeMaterialsLoader.java b/src/main/java/bartworks/system/material/werkstoff_loaders/registration/BridgeMaterialsLoader.java index 2bf712ed7a2..d328474fa69 100644 --- a/src/main/java/bartworks/system/material/werkstoff_loaders/registration/BridgeMaterialsLoader.java +++ b/src/main/java/bartworks/system/material/werkstoff_loaders/registration/BridgeMaterialsLoader.java @@ -68,12 +68,13 @@ public void run(Werkstoff werkstoff) { 1, 1, null); + final Element[] ELEMENT_VALUES = Element.values(); for (OrePrefixes prefixes : values()) { if (prefixes != cell || !Werkstoff.Types.ELEMENT.equals(werkstoff.getType())) { if (prefixes == dust && Werkstoff.Types.ELEMENT.equals(werkstoff.getType()) && Werkstoff.Types.ELEMENT.equals(werkstoff.getType())) { boolean ElementSet = false; - for (Element e : Element.values()) { + for (Element e : ELEMENT_VALUES) { if (e.toString() .equals(werkstoff.getToolTip())) { if (!e.mLinkedMaterials.isEmpty()) break; diff --git a/src/main/java/galacticgreg/dynconfig/DynamicDimensionConfig.java b/src/main/java/galacticgreg/dynconfig/DynamicDimensionConfig.java index 33e1f6a7500..8e6a7ef6e2f 100644 --- a/src/main/java/galacticgreg/dynconfig/DynamicDimensionConfig.java +++ b/src/main/java/galacticgreg/dynconfig/DynamicDimensionConfig.java @@ -39,6 +39,7 @@ public static AsteroidConfig getAsteroidConfig(ModDimensionDef pDimDef) { public static boolean InitDynamicConfig() { try { + final Asteroids[] ASTEROIDS_VALUES = Asteroids.values(); for (ModContainer mc : GalacticGregRegistry.getModContainers()) { if (!mc.isModLoaded()) continue; @@ -56,7 +57,7 @@ public static boolean InitDynamicConfig() { } Asteroids AsteroidProperties = null; - for (Asteroids asteroidsConfig : Asteroids.values()) { + for (Asteroids asteroidsConfig : ASTEROIDS_VALUES) { if (!asteroidsConfig.modContainers.modContainer.getModName() .equals(mc.getModName())) { continue; diff --git a/src/main/java/ggfab/GigaGramFab.java b/src/main/java/ggfab/GigaGramFab.java index 8fc8ef26a9c..b13b789f40d 100644 --- a/src/main/java/ggfab/GigaGramFab.java +++ b/src/main/java/ggfab/GigaGramFab.java @@ -2,7 +2,7 @@ import static gregtech.api.enums.ToolDictNames.*; import static gregtech.common.items.IDMetaTool01.*; -import static gregtech.common.items.MetaGeneratedTool01.*; +import static gregtech.common.items.MetaGeneratedTool01.INSTANCE; import net.minecraft.item.ItemStack; @@ -140,46 +140,43 @@ public void postInit(FMLPostInitializationEvent event) {} private void initDumbItem1() { GGMetaItemDumbItems i1 = new GGMetaItemDumbItems("ggfab.d1"); int id = 0; - { - int idShape = 30; - final int budget = idShape; - String prefix = "One_Use_craftingTool"; - String prefix2 = "Shape_One_Use_craftingTool"; - for (GGItemList i : GGItemList.values()) { - ItemStack stack = null; - if (i.name() - .startsWith(prefix)) { + int idShape = 30; + final int budget = idShape; + String prefix = "One_Use_craftingTool"; + String prefix2 = "Shape_One_Use_craftingTool"; + for (GGItemList i : GGItemList.values()) { + ItemStack stack = null; + if (i.name() + .startsWith(prefix)) { + stack = i1.addItem( + id++, + "Single Use " + GGUtils.processSentence( + i.name() + .substring(prefix.length()), + ' ', + true, + true), + null, + i, + i.name() + .substring("One_Use_".length())); + } else if (i.name() + .startsWith(prefix2)) { stack = i1.addItem( - id++, - "Single Use " + GGUtils.processSentence( + idShape++, + "Tool Casting Mold (" + GGUtils.processSentence( i.name() - .substring(prefix.length()), + .substring(prefix2.length()), ' ', true, - true), + true) + ")", null, - i, - i.name() - .substring("One_Use_".length())); - } else if (i.name() - .startsWith(prefix2)) { - stack = i1.addItem( - idShape++, - "Tool Casting Mold (" + GGUtils.processSentence( - i.name() - .substring(prefix2.length()), - ' ', - true, - true) + ")", - null, - i); - } - if (stack != null) { - i.set(stack); + i); } + if (stack != null) { + i.set(stack); } - if (id >= budget || idShape >= 2 * budget || idShape - id != budget) throw new AssertionError(); - id = budget * 2; } + if (id >= budget || idShape >= 2 * budget || idShape - id != budget) throw new AssertionError(); } } diff --git a/src/main/java/gregtech/api/enums/OrePrefixes.java b/src/main/java/gregtech/api/enums/OrePrefixes.java index 003624007f6..418fe716816 100644 --- a/src/main/java/gregtech/api/enums/OrePrefixes.java +++ b/src/main/java/gregtech/api/enums/OrePrefixes.java @@ -654,10 +654,18 @@ public enum OrePrefixes { ingot.addFamiliarPrefix(nugget); nugget.addFamiliarPrefix(ingot); - for (OrePrefixes tPrefix1 : values()) if (tPrefix1.name() - .startsWith("ore")) - for (OrePrefixes tPrefix2 : values()) if (tPrefix2.name() - .startsWith("ore")) tPrefix1.addFamiliarPrefix(tPrefix2); + final OrePrefixes[] THIS_VALUES = values(); + for (OrePrefixes tPrefix1 : THIS_VALUES) { + if (tPrefix1.name() + .startsWith("ore")) { + for (OrePrefixes tPrefix2 : THIS_VALUES) { + if (tPrefix2.name() + .startsWith("ore")) { + tPrefix1.addFamiliarPrefix(tPrefix2); + } + } + } + } // These are only the important ones. gem.mNotGeneratedItems.add(Materials.Coal); diff --git a/src/main/java/gtPlusPlus/api/recipe/TGSFrontend.java b/src/main/java/gtPlusPlus/api/recipe/TGSFrontend.java index e7253b6ea50..aa795373939 100644 --- a/src/main/java/gtPlusPlus/api/recipe/TGSFrontend.java +++ b/src/main/java/gtPlusPlus/api/recipe/TGSFrontend.java @@ -103,11 +103,12 @@ public List handleNEIItemTooltip(ItemStack stack, List currentTi // Inputs int slot = 0; - for (int mode = 0; mode < Mode.values().length; ++mode) { + final Mode[] MODE_VALUES = Mode.values(); + for (int mode = 0; mode < MODE_VALUES.length; ++mode) { if (mode < recipe.mOreDictAlt.length && recipe.mOreDictAlt[mode] != null) { // There is a valid input in this mode. if (slot < neiCachedRecipe.mInputs.size() && stack == neiCachedRecipe.mInputs.get(slot).item) { - int toolMultiplier = MTETreeFarm.getToolMultiplier(stack, Mode.values()[mode]); + int toolMultiplier = MTETreeFarm.getToolMultiplier(stack, MODE_VALUES[mode]); currentTip.add(EnumChatFormatting.YELLOW + tooltipInputs[mode]); if (toolMultiplier > 0) { currentTip.add(EnumChatFormatting.YELLOW + tooltipMultiplier + " " + toolMultiplier + "x"); @@ -120,7 +121,7 @@ public List handleNEIItemTooltip(ItemStack stack, List currentTi // Outputs slot = 0; - for (int mode = 0; mode < Mode.values().length; ++mode) { + for (int mode = 0; mode < MODE_VALUES.length; ++mode) { if (mode < recipe.mOutputs.length && recipe.mOutputs[mode] != null) { // There is a valid output in this mode. if (slot < neiCachedRecipe.mOutputs.size() && stack == neiCachedRecipe.mOutputs.get(slot).item) { 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 05ab3c87110..73e01bac7a2 100644 --- a/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/CustomCombs.java +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/CustomCombs.java @@ -69,7 +69,7 @@ public enum CustomCombs { public final int chance; private final String name; - private CustomCombs(String pName, boolean show, Materials material, int chance) { + CustomCombs(String pName, boolean show, Materials material, int chance) { this.name = pName; this.material = material; this.chance = chance; diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/ItemCustomComb.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/ItemCustomComb.java index 0ff3625a253..e136b825e6e 100644 --- a/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/ItemCustomComb.java +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/ItemCustomComb.java @@ -82,13 +82,12 @@ public IIcon getIcon(ItemStack stack, int pass) { @Override @SideOnly(Side.CLIENT) public int getColorFromItemStack(ItemStack stack, int pass) { - int meta = Math.max(0, Math.min(CustomCombs.values().length - 1, stack.getItemDamage())); - int colour = CustomCombs.values()[meta].getColours()[0]; - + final CustomCombs[] COMB_VALUES = CustomCombs.values(); + int meta = Math.max(0, Math.min(COMB_VALUES.length - 1, stack.getItemDamage())); + int colour = COMB_VALUES[meta].getColours()[0]; if (pass >= 1) { - colour = CustomCombs.values()[meta].getColours()[1]; + colour = COMB_VALUES[meta].getColours()[1]; } - return colour; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvDistillationTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvDistillationTower.java index ad351caf55f..a5ff70f0475 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvDistillationTower.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvDistillationTower.java @@ -317,7 +317,7 @@ public void saveNBTData(NBTTagCompound aNBT) { @Override public void loadNBTData(NBTTagCompound aNBT) { - mMode = Mode.values()[aNBT.getByte("mMode")]; + mMode = Mode.VALUES[aNBT.getByte("mMode")]; mUpgraded = aNBT.getBoolean("mUpgraded"); super.loadNBTData(aNBT); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTETreeFarm.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTETreeFarm.java index 86c4eb628f8..204cd5e6b97 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTETreeFarm.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTETreeFarm.java @@ -348,7 +348,8 @@ public CheckRecipeResult process() { int tierMultiplier = getTierMultiplier(tier); List outputs = new ArrayList<>(); - for (Mode mode : Mode.values()) { + final Mode[] MODE_VALUES = Mode.values(); + for (Mode mode : MODE_VALUES) { ItemStack output = outputPerMode.get(mode); if (output == null) continue; // This sapling has no output in this mode. @@ -379,7 +380,7 @@ public CheckRecipeResult process() { duration = TICKS_PER_OPERATION; calculatedEut = GTValues.VP[tier]; - for (Mode mode : Mode.values()) { + for (Mode mode : MODE_VALUES) { if (outputPerMode.get(mode) != null) { useToolForMode(mode, true); } @@ -780,10 +781,11 @@ public static boolean addFakeRecipeToNEI(ItemStack saplingIn, ItemStack log, Ite * the mode multiplier, but not tool/tier multipliers as those can change dynamically. If the sapling has an * output in this mode, also add the tools usable for this mode as inputs. */ - ItemStack[][] inputStacks = new ItemStack[Mode.values().length][]; - ItemStack[] outputStacks = new ItemStack[Mode.values().length]; + final Mode[] MODE_VALUES = Mode.values(); + ItemStack[][] inputStacks = new ItemStack[MODE_VALUES.length][]; + ItemStack[] outputStacks = new ItemStack[MODE_VALUES.length]; - for (Mode mode : Mode.values()) { + for (Mode mode : MODE_VALUES) { ItemStack output = switch (mode) { case LOG -> log; case SAPLING -> saplingOut; diff --git a/src/main/java/gtnhlanth/common/item/ItemParticle.java b/src/main/java/gtnhlanth/common/item/ItemParticle.java index 07286e8f45b..00a6477978e 100644 --- a/src/main/java/gtnhlanth/common/item/ItemParticle.java +++ b/src/main/java/gtnhlanth/common/item/ItemParticle.java @@ -18,21 +18,21 @@ public class ItemParticle extends Item { public static final int NUMBER_OF_SUBTYPES = Particle.values().length; - - private static String[] names = new String[NUMBER_OF_SUBTYPES]; + private static final String[] names = new String[NUMBER_OF_SUBTYPES]; static { - populateNamesArray(); + for (int i = 0; i < NUMBER_OF_SUBTYPES; i++) { + Particle particle = Particle.values()[i]; + names[i] = particle.getName(); + } } @SideOnly(Side.CLIENT) private IIcon[] iconArray; public ItemParticle() { - this.setHasSubtypes(true); this.setMaxDamage(0); - } @SideOnly(Side.CLIENT) @@ -60,7 +60,6 @@ public void getSubItems(Item item, CreativeTabs tab, List list) { @Override public void registerIcons(IIconRegister register) { this.iconArray = new IIcon[NUMBER_OF_SUBTYPES]; - for (int i = 0; i < NUMBER_OF_SUBTYPES; ++i) { this.iconArray[i] = register.registerIcon(Tags.MODID + ":" + "particle/" + names[i]); } @@ -69,11 +68,8 @@ public void registerIcons(IIconRegister register) { @SideOnly(Side.CLIENT) @Override public String getItemStackDisplayName(ItemStack stack) { - int i = MathHelper.clamp_int(stack.getItemDamage(), 0, NUMBER_OF_SUBTYPES - 1); - Particle particle = Particle.values()[i]; - return particle.getLocalisedName(); } @@ -81,43 +77,20 @@ public String getItemStackDisplayName(ItemStack stack) { @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { - int i = MathHelper.clamp_int(stack.getItemDamage(), 0, NUMBER_OF_SUBTYPES - 1); - Particle particle = Particle.values()[i]; - float restMass = particle.getMass(); - float charge = particle.getCharge(); - String chargeSpecial = particle.getChargeSpecial(); - String chargeStringToAppend; if (chargeSpecial != null) { - chargeStringToAppend = chargeSpecial; - } else { - if (charge > 0) chargeStringToAppend = "+" + charge; else chargeStringToAppend = "" + charge; } - list.add("Rest Mass: " + restMass + " MeV"); list.add("Charge: " + chargeStringToAppend + "e"); - - } - - private static void populateNamesArray() { - - for (int i = 0; i < NUMBER_OF_SUBTYPES; i++) { - - Particle particle = Particle.values()[i]; - - names[i] = particle.getName(); - - } - } } diff --git a/src/main/java/kekztech/Items.java b/src/main/java/kekztech/Items.java index 800f69c77e4..7ba594f9e08 100644 --- a/src/main/java/kekztech/Items.java +++ b/src/main/java/kekztech/Items.java @@ -1,7 +1,5 @@ package kekztech; -import java.util.Arrays; - import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; @@ -45,9 +43,11 @@ private void registerOreDict() { } public static void registerOreDictNames() { - Arrays.stream(Items.values()) - .filter(e -> e.getOreDictName() != null) - .forEach(Items::registerOreDict); + for (Items e : Items.values()) { + if (e.getOreDictName() != null) { + e.registerOreDict(); + } + } } public ItemStack getNonOreDictedItemStack(int amount) { diff --git a/src/main/java/kekztech/common/tileentities/MTELapotronicSuperCapacitor.java b/src/main/java/kekztech/common/tileentities/MTELapotronicSuperCapacitor.java index e39a0b74eb1..e6260bc7af2 100644 --- a/src/main/java/kekztech/common/tileentities/MTELapotronicSuperCapacitor.java +++ b/src/main/java/kekztech/common/tileentities/MTELapotronicSuperCapacitor.java @@ -139,8 +139,8 @@ public BigInteger getProvidedCapacity() { } public static int getIndexFromGlassTier(int glassTier) { - for (int index = 0; index < values().length; index++) { - if (values()[index].getMinimalGlassTier() == glassTier) { + for (int index = 0; index < VALUES.length; index++) { + if (VALUES[index].getMinimalGlassTier() == glassTier) { return index; } } diff --git a/src/main/java/tectech/thing/block/TileEntityEyeOfHarmony.java b/src/main/java/tectech/thing/block/TileEntityEyeOfHarmony.java index 4a46660d0dc..147894f4e22 100644 --- a/src/main/java/tectech/thing/block/TileEntityEyeOfHarmony.java +++ b/src/main/java/tectech/thing/block/TileEntityEyeOfHarmony.java @@ -148,7 +148,7 @@ public void generateImportantInfo() { float xAngle = generateRandomFloat(-MAX_ANGLE, MAX_ANGLE); float zAngle = generateRandomFloat(-MAX_ANGLE, MAX_ANGLE); - index += 1.0; + index += 1; float distance = index + generateRandomFloat(-0.2f, 0.2f); float scale = generateRandomFloat(0.2f, 0.9f); float rotationSpeed = generateRandomFloat(0.5f, 1.5f); From e5c6827ab214ab5dc815622d7cf284d99f0ee624 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Mon, 16 Sep 2024 01:54:46 +0200 Subject: [PATCH 19/42] delete unused methods from BWUtil --- src/main/java/bartworks/util/BWUtil.java | 113 ----------------------- 1 file changed, 113 deletions(-) diff --git a/src/main/java/bartworks/util/BWUtil.java b/src/main/java/bartworks/util/BWUtil.java index be201e10bda..a9a4811bb56 100644 --- a/src/main/java/bartworks/util/BWUtil.java +++ b/src/main/java/bartworks/util/BWUtil.java @@ -19,28 +19,23 @@ import static gregtech.api.enums.GTValues.VN; import static gregtech.api.enums.GTValues.W; -import java.lang.reflect.Array; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.function.BiConsumer; import java.util.function.Function; -import java.util.stream.Collectors; import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.init.Items; import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; import net.minecraft.world.World; -import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; @@ -63,7 +58,6 @@ import gregtech.api.util.GTLog; import gregtech.api.util.GTModHandler; import gregtech.api.util.GTOreDictUnificator; -import gregtech.api.util.GTRecipe; import gregtech.api.util.GTShapedRecipe; import gregtech.api.util.GTUtility; @@ -96,22 +90,6 @@ public static Object get2DCoordFrom1DArray(int indexX, int indexY, int sizeY, Ob return array[index]; } - public static GTRecipe copyAndSetTierToNewRecipe(GTRecipe recipe, byte tier) { - byte oldTier = GTUtility.getTier(recipe.mEUt); - int newTime = recipe.mDuration; - int newVoltage = recipe.mEUt; - if (tier < oldTier) { - newTime <<= oldTier - tier; - newVoltage >>= 2 * (oldTier - tier); - } else { - newTime >>= tier - oldTier; - newVoltage <<= 2 * (tier - oldTier); - } - recipe.mEUt = newVoltage; - recipe.mDuration = newTime; - return recipe; - } - public static String subscriptNumbers(String b) { char[] chars = b.toCharArray(); char[] nu = new char[chars.length]; @@ -176,46 +154,6 @@ public static String superscriptNumbers(String b) { return new String(nu); } - public static String superscriptNumber(Number b) { - char[] chars = Long.toString(b.longValue()) - .toCharArray(); - char[] nu = new char[chars.length]; - for (int i = 0; i < chars.length; i++) { - nu[i] = switch (chars[i]) { - case '0' -> '\u2070'; - case '1' -> '\u2071'; - case '2' -> '\u00B2'; - case '3' -> '\u00B3'; - case '4' -> '\u2074'; - case '5' -> '\u2075'; - case '6' -> '\u2076'; - case '7' -> '\u2077'; - case '8' -> '\u2078'; - case '9' -> '\u2079'; - default -> chars[i]; - }; - } - return new String(nu); - } - - public static byte specialToByte(int aSpecialValue) { - byte special = 0; - switch (aSpecialValue) { - case LOWGRAVITY: - special = 1; - break; - case CLEANROOM: - special = 2; - break; - case LOWGRAVITY | CLEANROOM: - special = 3; - break; - default: - break; - } - return special; - } - public static int calculateSv(Materials materials) { for (BioVatLogicAdder.MaterialSvPair pair : BioVatLogicAdder.RadioHatch.getMaSv()) { if (pair.getMaterials() @@ -239,57 +177,6 @@ public static boolean checkStackAndPrefix(ItemStack itemStack) { && GTOreDictUnificator.getAssociation(itemStack).mMaterial.mMaterial != null; } - public static int abstractHashGTRecipe(GTRecipe recipe) { - int hash = 31; - hash += recipe.mDuration / 20 * 31; - hash += GTUtility.getTier(recipe.mEUt) * 31; - hash += BWUtil.specialToByte(recipe.mSpecialValue) * 31; - hash += recipe.mInputs.length * 31; - for (ItemStack mInput : recipe.mInputs) { - if (mInput != null) { - hash += mInput.stackSize * 31; - hash += Item.getIdFromItem(mInput.getItem()) * 31; - } - } - hash += recipe.mOutputs.length * 31; - for (ItemStack mOutput : recipe.mOutputs) { - if (mOutput != null) { - hash += mOutput.stackSize * 31; - hash += Item.getIdFromItem(mOutput.getItem()) * 31; - } - } - hash += recipe.mFluidInputs.length * 31; - for (FluidStack mInput : recipe.mFluidInputs) { - if (mInput != null) { - hash += mInput.amount * 31; - hash += mInput.getFluidID() * 31; - } - } - hash += recipe.mFluidOutputs.length * 31; - for (FluidStack mOutput : recipe.mFluidOutputs) { - if (mOutput != null) { - hash += mOutput.amount * 31; - hash += mOutput.getFluidID() * 31; - } - } - return hash; - } - - @SuppressWarnings({ "unchecked" }) - public static T[] copyAndRemoveNulls(T[] input, Class clazz) { - List ret = Arrays.stream(input) - .filter(Objects::nonNull) - .collect(Collectors.toList()); - - if (ret.size() <= 0) return (T[]) Array.newInstance(clazz, 0); - - T[] retArr = (T[]) Array.newInstance(clazz, ret.size()); - - for (int i = 0; i < ret.size(); i++) retArr[i] = ret.get(i); - - return retArr; - } - @Deprecated public static int getMachineVoltageFromTier(int tier) { return (int) (30 * Math.pow(4, tier - 1)); From 0d4d99bd4de246d5b6154675d4b083019f573d82 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Mon, 16 Sep 2024 02:28:57 +0200 Subject: [PATCH 20/42] add logging to TTUtility.setTier --- src/main/java/tectech/util/TTUtility.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/tectech/util/TTUtility.java b/src/main/java/tectech/util/TTUtility.java index da58e3d22fe..7bfc612e572 100644 --- a/src/main/java/tectech/util/TTUtility.java +++ b/src/main/java/tectech/util/TTUtility.java @@ -10,6 +10,7 @@ import net.minecraft.item.ItemStack; import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.GTMod; import gregtech.api.metatileentity.implementations.MTETieredMachineBlock; /** @@ -93,13 +94,22 @@ public static String getUniqueIdentifier(ItemStack is) { return GameRegistry.findUniqueIdentifierFor(is.getItem()).modId + ':' + is.getUnlocalizedName(); } - public static void setTier(int tier, Object me) { + public static void setTier(int tier, Object o) { + if (!(o instanceof MTETieredMachineBlock)) { + GTMod.GT_FML_LOGGER.error( + "Could not set tier as object " + o.getClass() + .getName() + " isn't instance of MTETieredMachineBlock"); + return; + } try { Field field = MTETieredMachineBlock.class.getField("mTier"); field.setAccessible(true); - field.set(me, (byte) tier); + field.set(o, (byte) tier); } catch (Exception e) { - // e.printStackTrace(); + GTMod.GT_FML_LOGGER.error( + "Could not set tier of " + o.getClass() + .getName(), + e); } } From d3d71cbd373a3629a1df36b82fd3138cf4294b80 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Mon, 16 Sep 2024 02:29:16 +0200 Subject: [PATCH 21/42] remove reflection from WerkstoffLoader --- .../system/material/WerkstoffLoader.java | 27 +++++-------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/src/main/java/bartworks/system/material/WerkstoffLoader.java b/src/main/java/bartworks/system/material/WerkstoffLoader.java index a1b1aac2ed8..fdfb4f8e9eb 100644 --- a/src/main/java/bartworks/system/material/WerkstoffLoader.java +++ b/src/main/java/bartworks/system/material/WerkstoffLoader.java @@ -2002,38 +2002,25 @@ public static void addVanillaCasingsToGTOreDictUnificator() { } /** - * very hacky way to make my ores/blocks/smallores detectable by gt assosication in world, well at least the prefix. + * very hacky way to make my ores/blocks/small ores detectable by gt association in world, well at least the prefix. * used for the miners mostly removing this hacky material from the materials map instantly. we only need the item * data. */ - @SuppressWarnings("unchecked") private static void addFakeItemDataToInWorldBlocksAndCleanUpFakeData() { - - Map MATERIALS_MAP = null; - - try { - Field f = Materials.class.getDeclaredField("MATERIALS_MAP"); - f.setAccessible(true); - MATERIALS_MAP = (Map) f.get(null); - } catch (NoSuchFieldException | IllegalAccessException | ClassCastException e) { - e.printStackTrace(); - } - - if (MATERIALS_MAP == null) throw new NullPointerException("MATERIALS_MAP null!"); - Materials oreMat = new Materials(-1, null, 0, 0, 0, false, "bwores", "bwores", null, true, null); Materials smallOreMat = new Materials(-1, null, 0, 0, 0, false, "bwsmallores", "bwsmallores", null, true, null); Materials blockMat = new Materials(-1, null, 0, 0, 0, false, "bwblocks", "bwblocks", null, true, null); - for (int i = 0; i < 16; i++) { GTOreDictUnificator.addAssociation(ore, oreMat, new ItemStack(BWOres, 1, i), true); GTOreDictUnificator.addAssociation(oreSmall, smallOreMat, new ItemStack(BWSmallOres, 1, i), true); GTOreDictUnificator.addAssociation(block, blockMat, new ItemStack(BWBlocks, 1, i), true); } - - MATERIALS_MAP.remove("bwores"); - MATERIALS_MAP.remove("bwsmallores"); - MATERIALS_MAP.remove("bwblocks"); + Materials.getMaterialsMap() + .remove("bwores"); + Materials.getMaterialsMap() + .remove("bwsmallores"); + Materials.getMaterialsMap() + .remove("bwblocks"); } public static void removeIC2Recipes() { From b29015462cc29d889c77de16bd3f0935ef718109 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Mon, 16 Sep 2024 02:40:01 +0200 Subject: [PATCH 22/42] remove reflection from CLSCompat --- .../system/material/WerkstoffLoader.java | 8 ++- src/main/java/bwcrossmod/cls/CLSCompat.java | 63 +++---------------- 2 files changed, 14 insertions(+), 57 deletions(-) diff --git a/src/main/java/bartworks/system/material/WerkstoffLoader.java b/src/main/java/bartworks/system/material/WerkstoffLoader.java index fdfb4f8e9eb..c12a3303c99 100644 --- a/src/main/java/bartworks/system/material/WerkstoffLoader.java +++ b/src/main/java/bartworks/system/material/WerkstoffLoader.java @@ -1652,7 +1652,9 @@ public static void run() { DebugLog.log("Loading Recipes" + (System.nanoTime() - timepre)); Integer[] clsArr = {}; int size = 0; - if (BetterLoadingScreen.isModLoaded()) clsArr = CLSCompat.initCls(); + if (BetterLoadingScreen.isModLoaded()) { + clsArr = CLSCompat.initCls(); + } IWerkstoffRunnable[] werkstoffRunnables = { new ToolLoader(), new DustLoader(), new GemLoader(), new SimpleMetalLoader(), new CasingLoader(), new AspectLoader(), new OreLoader(), new RawOreLoader(), @@ -1670,7 +1672,9 @@ public static void run() { progressBar.step(""); continue; } - if (BetterLoadingScreen.isModLoaded()) size = CLSCompat.invokeStepSize(werkstoff, clsArr, size); + if (BetterLoadingScreen.isModLoaded()) { + size = CLSCompat.invokeStepSize(werkstoff, clsArr, size); + } DebugLog.log("Werkstoff: " + werkstoff.getDefaultName() + " " + (System.nanoTime() - timepreone)); for (IWerkstoffRunnable runnable : werkstoffRunnables) { String loaderName = runnable.getClass() diff --git a/src/main/java/bwcrossmod/cls/CLSCompat.java b/src/main/java/bwcrossmod/cls/CLSCompat.java index 9cb9c6fc9cf..18033ea23be 100644 --- a/src/main/java/bwcrossmod/cls/CLSCompat.java +++ b/src/main/java/bwcrossmod/cls/CLSCompat.java @@ -13,92 +13,45 @@ package bwcrossmod.cls; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Optional; +import java.io.IOException; +import alexiil.mods.load.MinecraftDisplayer; +import alexiil.mods.load.ProgressDisplayer; import bartworks.system.material.Werkstoff; -@SuppressWarnings({ "rawtypes", "unchecked" }) public class CLSCompat { private CLSCompat() {} private static final long MINIMAL_UPDATE_INTERVAL = 1000 / 30; // target 30 fps private static long lastUpdate = 0; - private static Class alexiilMinecraftDisplayer; - private static Class alexiilProgressDisplayer; - private static Method displayProgress; - private static Field isRegisteringBartWorks; - - static { - try { - alexiilMinecraftDisplayer = Class.forName("alexiil.mods.load.MinecraftDisplayer"); - alexiilProgressDisplayer = Class.forName("alexiil.mods.load.ProgressDisplayer"); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - - Optional.ofNullable(alexiilMinecraftDisplayer) - .ifPresent(e -> { - try { - isRegisteringBartWorks = e.getField("isRegisteringBartWorks"); - } catch (NoSuchFieldException ex) { - ex.printStackTrace(); - } - }); - - Optional.ofNullable(alexiilProgressDisplayer) - .ifPresent(e -> { - try { - displayProgress = e.getMethod("displayProgress", String.class, float.class); - } catch (NoSuchMethodException ex) { - ex.printStackTrace(); - } - }); - } public static Integer[] initCls() { int sizeStep; int sizeStep2 = 1; - - try { - isRegisteringBartWorks.set(null, true); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - + MinecraftDisplayer.isRegisteringBartWorks = true; if (Werkstoff.werkstoffHashSet.size() >= 100) sizeStep = Werkstoff.werkstoffHashSet.size() / 100 - 1; else sizeStep = sizeStep2 = Werkstoff.werkstoffHashSet.size(); - return new Integer[] { sizeStep, sizeStep2, sizeStep }; } public static int invokeStepSize(Werkstoff werkstoff, Integer[] steps, int size) { --steps[0]; - long time = System.currentTimeMillis(); if (time - lastUpdate >= MINIMAL_UPDATE_INTERVAL) { try { - displayProgress.invoke(null, werkstoff.getDefaultName(), (float) size / 10000); - } catch (IllegalAccessException | InvocationTargetException e) { - e.printStackTrace(); + ProgressDisplayer.displayProgress(werkstoff.getDefaultName(), (float) size / 10000); + } catch (IOException e) { + throw new RuntimeException(e); } lastUpdate = time; } - if (steps[0] == 0 && Werkstoff.werkstoffHashSet.size() >= 100) steps[0] = steps[2]; - size += steps[1]; return size; } public static void disableCls() { - try { - isRegisteringBartWorks.set(null, false); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } + MinecraftDisplayer.isRegisteringBartWorks = false; } } From 57f361649066b615b2c455793bca88c95b2e0499 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Mon, 16 Sep 2024 02:51:50 +0200 Subject: [PATCH 23/42] delete CommandMath and MiningUtils which can only be used by minecraft user "draknyte1" --- src/main/java/gtPlusPlus/GTplusplus.java | 2 - .../gtPlusPlus/core/commands/CommandMath.java | 96 ----------------- .../core/util/minecraft/MiningUtils.java | 102 ------------------ 3 files changed, 200 deletions(-) delete mode 100644 src/main/java/gtPlusPlus/core/commands/CommandMath.java delete mode 100644 src/main/java/gtPlusPlus/core/util/minecraft/MiningUtils.java diff --git a/src/main/java/gtPlusPlus/GTplusplus.java b/src/main/java/gtPlusPlus/GTplusplus.java index 8823304e897..eafc39af3e2 100644 --- a/src/main/java/gtPlusPlus/GTplusplus.java +++ b/src/main/java/gtPlusPlus/GTplusplus.java @@ -35,7 +35,6 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.recipe.GTPPRecipeMaps; import gtPlusPlus.core.commands.CommandEnableDebugWhileRunning; -import gtPlusPlus.core.commands.CommandMath; import gtPlusPlus.core.common.CommonProxy; import gtPlusPlus.core.config.ConfigHandler; import gtPlusPlus.core.handler.BookHandler; @@ -221,7 +220,6 @@ public void postInit(final FMLPostInitializationEvent event) { @EventHandler public synchronized void serverStarting(final FMLServerStartingEvent event) { INIT_PHASE.SERVER_START.setPhaseActive(true); - event.registerServerCommand(new CommandMath()); event.registerServerCommand(new CommandEnableDebugWhileRunning()); if (Thaumcraft.isModLoaded()) { event.registerServerCommand(new CommandDumpAspects()); diff --git a/src/main/java/gtPlusPlus/core/commands/CommandMath.java b/src/main/java/gtPlusPlus/core/commands/CommandMath.java deleted file mode 100644 index 276e7874e7d..00000000000 --- a/src/main/java/gtPlusPlus/core/commands/CommandMath.java +++ /dev/null @@ -1,96 +0,0 @@ -package gtPlusPlus.core.commands; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.GTPPCore; -import gtPlusPlus.core.util.minecraft.MiningUtils; - -public class CommandMath implements ICommand { - - private final List aliases; - - protected String fullEntityName; - protected Entity conjuredEntity; - - public CommandMath() { - this.aliases = new ArrayList<>(); - } - - @Override - public int compareTo(final Object o) { - if (o instanceof ICommand c) { - return this.getCommandName() - .compareTo(c.getCommandName()); - } - return -1; - } - - @Override - public String getCommandName() { - return "alkalus"; - } - - @Override - public String getCommandUsage(final ICommandSender var1) { - return "/alkalus [Dev Command]"; - } - - @Override - public List getCommandAliases() { - return this.aliases; - } - - @Override - public void processCommand(final ICommandSender S, final String[] argString) { - Logger.INFO("Debug Command"); - final World W = S.getEntityWorld(); - final EntityPlayer P = CommandUtils.getPlayer(S); - if (P.getDisplayName() - .equalsIgnoreCase("draknyte1")) { - Logger.INFO("[Bedrock Miner] OreType Scan"); - MiningUtils.iterateAllOreTypes(); - } - } - - @Override - public boolean canCommandSenderUseCommand(final ICommandSender var1) { - final EntityPlayer P = CommandUtils.getPlayer(var1); - if (P == null) { - return false; - } - if (P.getDisplayName() - .toLowerCase() - .equals("draknyte1") - || P.getCommandSenderName() - .toLowerCase() - .equals("draknyte1") - || GTPPCore.DEVENV) { - return true; - } - return false; - } - - @Override - public List addTabCompletionOptions(final ICommandSender var1, final String[] var2) { - return null; - } - - @Override - public boolean isUsernameIndex(final String[] var1, final int var2) { - // TODO Auto-generated method stub - return false; - } - - public boolean playerUsesCommand(final World W, final EntityPlayer P, final int cost) { - - return true; - } -} diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/MiningUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/MiningUtils.java deleted file mode 100644 index 34945a5d8a3..00000000000 --- a/src/main/java/gtPlusPlus/core/util/minecraft/MiningUtils.java +++ /dev/null @@ -1,102 +0,0 @@ -package gtPlusPlus.core.util.minecraft; - -import java.util.ArrayList; -import java.util.HashMap; - -import gregtech.api.enums.Mods; -import gregtech.common.WorldgenGTOreLayer; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; -import micdoodle8.mods.galacticraft.planets.asteroids.ConfigManagerAsteroids; -import micdoodle8.mods.galacticraft.planets.mars.ConfigManagerMars; - -public class MiningUtils { - - public static int mMoonID = -99; - public static int mMarsID = -99; - public static int mCometsID = -99; - - public static void iterateAllOreTypes() { - HashMap M = new HashMap<>(); - String aTextWorldGen; - if (MiningUtils.findAndMapOreTypesFromGT()) { - int mapKey = 0; - for (ArrayList g : MiningUtils.mOreMaps) { - for (WorldgenGTOreLayer h : g) { - - try { - aTextWorldGen = (String) ReflectionUtils.getField(WorldgenGTOreLayer.class, "aTextWorldgen") - .get(h); - } catch (IllegalArgumentException | IllegalAccessException e) { - aTextWorldGen = h.mWorldGenName; - } - - M.put(aTextWorldGen + h.mWorldGenName, mapKey); - Logger.INFO("Found Vein type: " + aTextWorldGen + h.mWorldGenName + " in map with key: " + mapKey); - } - mapKey++; - } - } - } - - public static ArrayList[] mOreMaps = new ArrayList[7]; - private static final ArrayList Ores_Overworld = new ArrayList<>(); - private static final ArrayList Ores_Nether = new ArrayList<>(); - private static final ArrayList Ores_End = new ArrayList<>(); - private static final ArrayList Ores_Moon = new ArrayList<>(); - private static final ArrayList Ores_Mars = new ArrayList<>(); - private static final ArrayList Ores_Comets = new ArrayList<>(); - private static final ArrayList Ores_Misc = new ArrayList<>(); - - public static boolean findAndMapOreTypesFromGT() { - // Gets Moon ID - - if (Mods.GalacticraftCore.isModLoaded()) { - if (mMoonID == -99) { - mMoonID = ConfigManagerCore.idDimensionMoon; - } - if (mMarsID == -99) { - mMarsID = ConfigManagerMars.dimensionIDMars; - } - if (mCometsID == -99) { - mCometsID = ConfigManagerAsteroids.dimensionIDAsteroids; - } - } - - // Clear Cache - Ores_Overworld.clear(); - Ores_Nether.clear(); - Ores_End.clear(); - Ores_Misc.clear(); - - for (WorldgenGTOreLayer gtOreLayer : WorldgenGTOreLayer.sList) { - if (gtOreLayer.mEnabled) { - if (gtOreLayer.mOverworld) { - Ores_Overworld.add(gtOreLayer); - } - if (gtOreLayer.mNether) { - Ores_Nether.add(gtOreLayer); - } - if (gtOreLayer.mEnd || gtOreLayer.mEndAsteroid) { - Ores_End.add(gtOreLayer); - } - if (gtOreLayer.mOverworld || gtOreLayer.mNether || (gtOreLayer.mEnd || gtOreLayer.mEndAsteroid)) { - continue; - } - Ores_Misc.add(gtOreLayer); - } else { - Ores_Comets.add(gtOreLayer); - } - } - - mOreMaps[0] = Ores_Overworld; - mOreMaps[1] = Ores_Nether; - mOreMaps[2] = Ores_End; - mOreMaps[3] = Ores_Moon; - mOreMaps[4] = Ores_Mars; - mOreMaps[5] = Ores_Comets; - mOreMaps[6] = Ores_Misc; - return true; - } -} From ef32597b0766f83ca0872443e71d3bb8edefd46f Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Mon, 16 Sep 2024 03:05:23 +0200 Subject: [PATCH 24/42] fix molecular transformer tooltip notice that disappeared in last gt+ cleanup --- .../gtPlusPlus/core/common/CommonProxy.java | 7 +++++-- .../events/GeneralTooltipEventHandler.java | 20 ------------------- .../MolecularTransformerTooltipNotice.java | 18 +++++++++++++++++ 3 files changed, 23 insertions(+), 22 deletions(-) delete mode 100644 src/main/java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java create mode 100644 src/main/java/gtPlusPlus/core/handler/events/MolecularTransformerTooltipNotice.java diff --git a/src/main/java/gtPlusPlus/core/common/CommonProxy.java b/src/main/java/gtPlusPlus/core/common/CommonProxy.java index 162b8ac1abf..7cf512cdd58 100644 --- a/src/main/java/gtPlusPlus/core/common/CommonProxy.java +++ b/src/main/java/gtPlusPlus/core/common/CommonProxy.java @@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingAttackEvent; import baubles.common.container.InventoryBaubles; @@ -29,7 +30,7 @@ import gtPlusPlus.core.handler.GuiHandler; import gtPlusPlus.core.handler.events.EnderDragonDeathHandler; import gtPlusPlus.core.handler.events.EntityDeathHandler; -import gtPlusPlus.core.handler.events.GeneralTooltipEventHandler; +import gtPlusPlus.core.handler.events.MolecularTransformerTooltipNotice; import gtPlusPlus.core.handler.events.PlayerSleepEventHandler; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.item.bauble.BaseBauble; @@ -79,7 +80,9 @@ public void preInit(final FMLPreInitializationEvent e) { public void init(final FMLInitializationEvent e) { CI.init(); - Utils.registerEvent(new GeneralTooltipEventHandler()); + if (Mods.AdvancedSolarPanel.isModLoaded()) { + MinecraftForge.EVENT_BUS.register(new MolecularTransformerTooltipNotice()); + } // Handles Tooltips for items giving custom multiblock behaviour Utils.registerEvent(new SpecialBehaviourTooltipHandler()); // Handles Sleep Benefits diff --git a/src/main/java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java b/src/main/java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java deleted file mode 100644 index 650fd70efd2..00000000000 --- a/src/main/java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java +++ /dev/null @@ -1,20 +0,0 @@ -package gtPlusPlus.core.handler.events; - -import net.minecraft.item.Item; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; - -import advsolar.common.AdvancedSolarPanel; -import cpw.mods.fml.common.Optional; -import gregtech.api.enums.Mods; - -public class GeneralTooltipEventHandler { - - @Optional.Method(modid = Mods.Names.ADVANCED_SOLAR_PANEL) - @SuppressWarnings("unused") - public static void molecularTransformer(ItemTooltipEvent event) { - if (event.itemStack.getItem() == Item.getItemFromBlock(AdvancedSolarPanel.blockMolecularTransformer)) { - event.toolTip.add("" + EnumChatFormatting.RED + "Disabled, Use the multiblock"); - } - } -} diff --git a/src/main/java/gtPlusPlus/core/handler/events/MolecularTransformerTooltipNotice.java b/src/main/java/gtPlusPlus/core/handler/events/MolecularTransformerTooltipNotice.java new file mode 100644 index 00000000000..7471f746249 --- /dev/null +++ b/src/main/java/gtPlusPlus/core/handler/events/MolecularTransformerTooltipNotice.java @@ -0,0 +1,18 @@ +package gtPlusPlus.core.handler.events; + +import net.minecraft.item.Item; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; + +import advsolar.common.AdvancedSolarPanel; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; + +public class MolecularTransformerTooltipNotice { + + @SubscribeEvent + public void molecularTransformer(ItemTooltipEvent event) { + if (event.itemStack.getItem() == Item.getItemFromBlock(AdvancedSolarPanel.blockMolecularTransformer)) { + event.toolTip.add(EnumChatFormatting.RED + "Disabled, use the multiblock"); + } + } +} From ab411da881e3307f45eeb0f4f944bbf9f691e1cc Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Mon, 16 Sep 2024 03:11:55 +0200 Subject: [PATCH 25/42] delete SpecialBehaviourTooltipHandler.java which does nothing --- .../gtPlusPlus/core/common/CommonProxy.java | 3 -- .../util/SpecialBehaviourTooltipHandler.java | 35 ------------------- 2 files changed, 38 deletions(-) delete mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java diff --git a/src/main/java/gtPlusPlus/core/common/CommonProxy.java b/src/main/java/gtPlusPlus/core/common/CommonProxy.java index 7cf512cdd58..436f04868c5 100644 --- a/src/main/java/gtPlusPlus/core/common/CommonProxy.java +++ b/src/main/java/gtPlusPlus/core/common/CommonProxy.java @@ -41,7 +41,6 @@ import gtPlusPlus.core.util.minecraft.EntityUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.preloader.PreloaderCore; -import gtPlusPlus.xmod.gregtech.api.util.SpecialBehaviourTooltipHandler; import gtPlusPlus.xmod.ic2.CustomInternalName; public class CommonProxy { @@ -83,8 +82,6 @@ public void init(final FMLInitializationEvent e) { if (Mods.AdvancedSolarPanel.isModLoaded()) { MinecraftForge.EVENT_BUS.register(new MolecularTransformerTooltipNotice()); } - // Handles Tooltips for items giving custom multiblock behaviour - Utils.registerEvent(new SpecialBehaviourTooltipHandler()); // Handles Sleep Benefits PlayerSleepEventHandler.init(); // Handles Magic Feather diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java deleted file mode 100644 index da6db942aa0..00000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java +++ /dev/null @@ -1,35 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.util; - -import java.util.HashMap; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import gregtech.api.util.GTUtility; - -public class SpecialBehaviourTooltipHandler { - - private static final HashMap mTooltipCache = new HashMap<>(); - - public static void addTooltipForItem(ItemStack aStack, String aTooltip) { - mTooltipCache.put(aStack, aTooltip); - } - - @SubscribeEvent - public void onItemTooltip(ItemTooltipEvent event) { - if (event != null) { - if (event.itemStack != null) { - for (ItemStack aKey : mTooltipCache.keySet()) { - if (GTUtility.areStacksEqual(aKey, event.itemStack, false)) { - String s = mTooltipCache.get(aKey); - if (s != null && s.length() > 0) { - event.toolTip.add(EnumChatFormatting.RED + s); - } - } - } - } - } - } -} From b9c00a4666b84f1cc3be06b677397c4de14cef0f Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Mon, 16 Sep 2024 03:23:56 +0200 Subject: [PATCH 26/42] delete GT++ ServerProxy.java since it does nothing --- src/main/java/gtPlusPlus/GTplusplus.java | 8 +----- .../gtPlusPlus/core/proxy/ServerProxy.java | 28 ------------------- 2 files changed, 1 insertion(+), 35 deletions(-) delete mode 100644 src/main/java/gtPlusPlus/core/proxy/ServerProxy.java diff --git a/src/main/java/gtPlusPlus/GTplusplus.java b/src/main/java/gtPlusPlus/GTplusplus.java index eafc39af3e2..7550d1724b4 100644 --- a/src/main/java/gtPlusPlus/GTplusplus.java +++ b/src/main/java/gtPlusPlus/GTplusplus.java @@ -110,15 +110,12 @@ public final synchronized void setPhaseActive(boolean aIsPhaseActive) { public static INIT_PHASE CURRENT_LOAD_PHASE = INIT_PHASE.SUPER; - // Mod Instance @Mod.Instance(Names.G_T_PLUS_PLUS) public static GTplusplus instance; - // GT++ Proxy Instances - @SidedProxy(clientSide = "gtPlusPlus.core.proxy.ClientProxy", serverSide = "gtPlusPlus.core.proxy.ServerProxy") + @SidedProxy(clientSide = "gtPlusPlus.core.proxy.ClientProxy", serverSide = "gtPlusPlus.core.common.CommonProxy") public static CommonProxy proxy; - // Loads Textures @SideOnly(value = Side.CLIENT) public static void loadTextures() { Logger.INFO("Loading some textures on the client."); @@ -141,7 +138,6 @@ public GTplusplus() { INIT_PHASE.SUPER.setPhaseActive(true); } - // Pre-Init @Mod.EventHandler public void preInit(final FMLPreInitializationEvent event) { INIT_PHASE.PRE_INIT.setPhaseActive(true); @@ -168,7 +164,6 @@ public void preInit(final FMLPreInitializationEvent event) { CoreManager.preInit(); } - // Init @Mod.EventHandler public void init(final FMLInitializationEvent event) { INIT_PHASE.INIT.setPhaseActive(true); @@ -182,7 +177,6 @@ public void init(final FMLInitializationEvent event) { } } - // Post-Init @Mod.EventHandler public void postInit(final FMLPostInitializationEvent event) { INIT_PHASE.POST_INIT.setPhaseActive(true); diff --git a/src/main/java/gtPlusPlus/core/proxy/ServerProxy.java b/src/main/java/gtPlusPlus/core/proxy/ServerProxy.java deleted file mode 100644 index 73b027af10f..00000000000 --- a/src/main/java/gtPlusPlus/core/proxy/ServerProxy.java +++ /dev/null @@ -1,28 +0,0 @@ -package gtPlusPlus.core.proxy; - -import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import gtPlusPlus.core.common.CommonProxy; - -@SuppressWarnings("unused") -public class ServerProxy extends CommonProxy { - - @Override - public void preInit(final FMLPreInitializationEvent e) { - // TODO Auto-generated method stub - super.preInit(e); - } - - @Override - public void init(final FMLInitializationEvent e) { - // TODO Auto-generated method stub - super.init(e); - } - - @Override - public void postInit(final FMLPostInitializationEvent e) { - // TODO Auto-generated method stub - super.postInit(e); - } -} From a62b97852d7d9979e2394293363927c5737d4d14 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Mon, 16 Sep 2024 03:46:32 +0200 Subject: [PATCH 27/42] delete SideOnly annotation in gt++ ClientProxy --- .../gtPlusPlus/core/proxy/ClientProxy.java | 55 +++---------------- 1 file changed, 8 insertions(+), 47 deletions(-) diff --git a/src/main/java/gtPlusPlus/core/proxy/ClientProxy.java b/src/main/java/gtPlusPlus/core/proxy/ClientProxy.java index e45bd76544d..ac93757845b 100644 --- a/src/main/java/gtPlusPlus/core/proxy/ClientProxy.java +++ b/src/main/java/gtPlusPlus/core/proxy/ClientProxy.java @@ -7,6 +7,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import net.minecraftforge.client.event.RenderPlayerEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; @@ -22,8 +23,6 @@ import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.GTplusplus; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.client.renderer.CustomItemBlockRenderer; @@ -48,53 +47,32 @@ import gtPlusPlus.xmod.gregtech.common.render.MachineBlockRenderer; import ic2.core.item.ItemFluidCell; -public class ClientProxy extends CommonProxy implements Runnable { +public class ClientProxy extends CommonProxy { - private final CapeRenderer mCapeRenderer; - - @SideOnly(Side.CLIENT) - public static boolean mFancyGraphics = false; - - public ClientProxy() { - mCapeRenderer = new CapeRenderer(); - // Get Graphics Mode. - mFancyGraphics = Minecraft.isFancyGraphicsEnabled(); - } + private final CapeRenderer mCapeRenderer = new CapeRenderer(); + public static String playerName = ""; @SubscribeEvent - public void receiveRenderSpecialsEvent(net.minecraftforge.client.event.RenderPlayerEvent.Specials.Pre aEvent) { + public void receiveRenderSpecialsEvent(RenderPlayerEvent.Specials.Pre aEvent) { if (ConfigSwitches.enableCustomCapes) { mCapeRenderer.receiveRenderSpecialsEvent(aEvent); } } - @SideOnly(Side.CLIENT) - public static String playerName = ""; - @Override public void preInit(final FMLPreInitializationEvent e) { super.preInit(e); - if (ConfigSwitches.enableCustomCapes) { - onPreLoad(); - } // Do this weird things for textures. GTplusplus.loadTextures(); } @Override public void init(final FMLInitializationEvent e) { - - /** - * Custom Block Renderers - */ new CustomOreBlockRenderer(); new CustomItemBlockRenderer(); new MachineBlockRenderer(); - new FlaskRenderer(); - MinecraftForge.EVENT_BUS.register(new NEIGTPPConfig()); - super.init(e); } @@ -105,12 +83,7 @@ public void postInit(final FMLPostInitializationEvent e) { @Override public void registerRenderThings() { - - // Standard GT++ - - /** - * Entities - */ + // Entities RenderingRegistry .registerEntityRenderingHandler(EntityPrimedMiningExplosive.class, new RenderMiningExplosivesPrimed()); RenderingRegistry.registerEntityRenderingHandler(EntitySickBlaze.class, new RenderSickBlaze()); @@ -118,10 +91,7 @@ public void registerRenderThings() { .registerEntityRenderingHandler(EntityStaballoyConstruct.class, new RenderStaballoyConstruct()); RenderingRegistry.registerEntityRenderingHandler(EntityToxinballSmall.class, new RenderToxinball(1F)); RenderingRegistry.registerEntityRenderingHandler(EntityLightningAttack.class, new RenderFireball(1F)); - - /** - * Tiles - */ + // Tiles Logger.INFO("Registering Custom Renderer for the Lead Lined Chest."); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDecayablesChest.class, new RenderDecayChest()); } @@ -134,15 +104,6 @@ public int addArmor(final String armor) { @Override public void serverStarting(final FMLServerStartingEvent e) {} - public void onPreLoad() { - - } - - @Override - public void run() { - - } - @Override public void onLoadComplete(FMLLoadCompleteEvent event) { if (GTPPCore.ConfigSwitches.hideUniversalCells) { @@ -151,7 +112,7 @@ public void onLoadComplete(FMLLoadCompleteEvent event) { super.onLoadComplete(event); } - public void hideUniversalCells() { + private void hideUniversalCells() { ArrayList itemList = new ArrayList<>(); for (Fluid fluid : FluidRegistry.getRegisteredFluids() .values()) { From 3874c017b82e4ff7577513e99d2bc17b0552c8ad Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Mon, 16 Sep 2024 03:46:57 +0200 Subject: [PATCH 28/42] handle baubles dependency in gt++ ServerProxy with @optional method annotation --- .../gtPlusPlus/core/common/CommonProxy.java | 53 ++++++++----------- 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/src/main/java/gtPlusPlus/core/common/CommonProxy.java b/src/main/java/gtPlusPlus/core/common/CommonProxy.java index 436f04868c5..dc45ae15e53 100644 --- a/src/main/java/gtPlusPlus/core/common/CommonProxy.java +++ b/src/main/java/gtPlusPlus/core/common/CommonProxy.java @@ -9,6 +9,7 @@ import baubles.common.container.InventoryBaubles; import baubles.common.lib.PlayerHandler; +import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLLoadCompleteEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; @@ -47,7 +48,7 @@ public class CommonProxy { public CommonProxy() { // Should Register Gregtech Materials I've Made - Utils.registerEvent(this); + MinecraftForge.EVENT_BUS.register(this); } public void preInit(final FMLPreInitializationEvent e) { @@ -87,7 +88,7 @@ public void init(final FMLInitializationEvent e) { // Handles Magic Feather Utils.registerEvent(ModItems.itemMagicFeather); - Utils.registerEvent(new EnderDragonDeathHandler()); + MinecraftForge.EVENT_BUS.register(new EnderDragonDeathHandler()); Utils.registerEvent(new EntityDeathHandler()); // Compat Handling @@ -204,38 +205,28 @@ public EntityPlayer getPlayerEntity(MessageContext ctx) { return ctx.getServerHandler().playerEntity; } - @SuppressWarnings("unused") // used by the event bus + @Optional.Method(modid = Mods.Names.BAUBLES) @SubscribeEvent public void onPlayerAttacked(LivingAttackEvent event) { - if (Mods.Baubles.isModLoaded()) { - BaubleAttackHandler.run(event); + if (!(event.entityLiving instanceof EntityPlayer player)) { + return; } - } - - // Prevent class loading errors if Baubles are missing - private static final class BaubleAttackHandler { - - public static void run(LivingAttackEvent event) { - if (!(event.entityLiving instanceof EntityPlayer player)) { - return; - } - InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player); - if (baubles == null) { - return; - } - final ItemStack bauble1 = baubles.getStackInSlot(1); - if (bauble1 != null && bauble1.getItem() instanceof BaseBauble gtBauble - && gtBauble.getDamageNegations() - .contains(event.source.damageType)) { - event.setCanceled(true); - return; - } - final ItemStack bauble2 = baubles.getStackInSlot(2); - if (bauble2 != null && bauble2.getItem() instanceof BaseBauble gtBauble - && gtBauble.getDamageNegations() - .contains(event.source.damageType)) { - event.setCanceled(true); - } + InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player); + if (baubles == null) { + return; + } + final ItemStack bauble1 = baubles.getStackInSlot(1); + if (bauble1 != null && bauble1.getItem() instanceof BaseBauble gtBauble + && gtBauble.getDamageNegations() + .contains(event.source.damageType)) { + event.setCanceled(true); + return; + } + final ItemStack bauble2 = baubles.getStackInSlot(2); + if (bauble2 != null && bauble2.getItem() instanceof BaseBauble gtBauble + && gtBauble.getDamageNegations() + .contains(event.source.damageType)) { + event.setCanceled(true); } } } From 04042808a9c9b79fee0d49b031cf798e29cdc5bb Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Mon, 16 Sep 2024 03:52:30 +0200 Subject: [PATCH 29/42] Delete the GT ++ utils method that mindlessly register event classes to both buses --- src/main/java/gtPlusPlus/core/common/CommonProxy.java | 10 ++++++---- src/main/java/gtPlusPlus/core/util/Utils.java | 9 --------- .../plugin/fixes/vanilla/VanillaBedHeightFix.java | 4 ++-- .../gregtech/GregtechWirelessChargers.java | 6 ++++-- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/main/java/gtPlusPlus/core/common/CommonProxy.java b/src/main/java/gtPlusPlus/core/common/CommonProxy.java index dc45ae15e53..50b4578085e 100644 --- a/src/main/java/gtPlusPlus/core/common/CommonProxy.java +++ b/src/main/java/gtPlusPlus/core/common/CommonProxy.java @@ -9,6 +9,7 @@ import baubles.common.container.InventoryBaubles; import baubles.common.lib.PlayerHandler; +import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLLoadCompleteEvent; @@ -38,7 +39,6 @@ import gtPlusPlus.core.lib.GTPPCore; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.tileentities.ModTileEntities; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.EntityUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.preloader.PreloaderCore; @@ -86,10 +86,12 @@ public void init(final FMLInitializationEvent e) { // Handles Sleep Benefits PlayerSleepEventHandler.init(); // Handles Magic Feather - Utils.registerEvent(ModItems.itemMagicFeather); - + MinecraftForge.EVENT_BUS.register(ModItems.itemMagicFeather); + FMLCommonHandler.instance() + .bus() + .register(ModItems.itemMagicFeather); MinecraftForge.EVENT_BUS.register(new EnderDragonDeathHandler()); - Utils.registerEvent(new EntityDeathHandler()); + MinecraftForge.EVENT_BUS.register(new EntityDeathHandler()); // Compat Handling CompatHandler.registerMyModsOreDictEntries(); diff --git a/src/main/java/gtPlusPlus/core/util/Utils.java b/src/main/java/gtPlusPlus/core/util/Utils.java index c3c877388be..fb05c6aa10e 100644 --- a/src/main/java/gtPlusPlus/core/util/Utils.java +++ b/src/main/java/gtPlusPlus/core/util/Utils.java @@ -17,7 +17,6 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.util.ChatComponentText; import net.minecraft.util.IChatComponent; -import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidRegistry; @@ -126,14 +125,6 @@ public static TC_AspectStack getTcAspectStack(final String aspect, final int siz return returnValue; } - // Register an event to both busses. - public static void registerEvent(Object o) { - MinecraftForge.EVENT_BUS.register(o); - FMLCommonHandler.instance() - .bus() - .register(o); - } - // Send a message to all players on the server public static void sendServerMessage(final String translationKey) { sendServerMessage(new ChatComponentText(translationKey)); diff --git a/src/main/java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java b/src/main/java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java index 31c0a2e41c2..aa81a0378cb 100644 --- a/src/main/java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java +++ b/src/main/java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java @@ -4,13 +4,13 @@ import java.lang.reflect.Method; import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import gtPlusPlus.api.interfaces.IPlugin; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.plugin.fixes.interfaces.IBugFix; import gtPlusPlus.preloader.PreloaderCore; @@ -37,7 +37,7 @@ public VanillaBedHeightFix(IPlugin minstance) { if (m != null) { mSleepInBedAt = m; mParent.log("Registering Bed Height Fix."); - Utils.registerEvent(this); + MinecraftForge.EVENT_BUS.register(this); } else { mSleepInBedAt = null; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechWirelessChargers.java b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechWirelessChargers.java index c66d2b574a5..4bb51c93d02 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechWirelessChargers.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechWirelessChargers.java @@ -10,8 +10,8 @@ import static gregtech.api.enums.MetaTileEntityIDs.Charger_UV; import static gregtech.api.enums.MetaTileEntityIDs.Charger_ZPM; +import cpw.mods.fml.common.FMLCommonHandler; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.MTEWirelessCharger; @@ -22,7 +22,9 @@ public static void run() { Logger.INFO("Gregtech5u Content | Registering Wireless Chargers."); - Utils.registerEvent(new ChargingHelper()); + FMLCommonHandler.instance() + .bus() + .register(new ChargingHelper()); GregtechItemList.Charger_LV.set( new MTEWirelessCharger( From 26a2f3783138080105ea0e937d221b1b0baf8cb6 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Mon, 16 Sep 2024 05:14:47 +0200 Subject: [PATCH 30/42] remove reflection from WorldGen_GT_Ore_Layer and fix ore generation in toxic everglades --- .../gen/gt/WorldGen_GT_Ore_Layer.java | 113 +++--------------- 1 file changed, 19 insertions(+), 94 deletions(-) diff --git a/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Ore_Layer.java b/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Ore_Layer.java index bfeeff89109..74aad2d9968 100644 --- a/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Ore_Layer.java +++ b/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Ore_Layer.java @@ -2,8 +2,6 @@ import static gtPlusPlus.everglades.gen.gt.WorldGen_GT_Base.debugWorldGen; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; @@ -90,12 +88,7 @@ public WorldGen_GT_Ore_Layer(String aName, boolean aDefault, int aMinY, int aMax this.mNether = HandlerGT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Nether", aNether); this.mEnd = HandlerGT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "TheEnd", aEnd); this.mMinY = 5; - short mMaxY = 14; - if (mMaxY < (this.mMinY + 7)) { - GTLog.out.println("Oremix " + this.mWorldGenName + " has invalid Min/Max heights!"); - mMaxY = (short) (this.mMinY + 7); - } - this.mMaxY = mMaxY; + this.mMaxY = (short) 14; this.mWeight = ((short) HandlerGT.sCustomWorldgenFile .get(aTextWorldgen + this.mWorldGenName, "RandomWeight", aWeight)); this.mDensity = ((short) HandlerGT.sCustomWorldgenFile @@ -119,11 +112,8 @@ public WorldGen_GT_Ore_Layer(String aName, boolean aDefault, int aMinY, int aMax public int executeWorldgenChunkified(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, int aSeedX, int aSeedZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { - // Debug Handler - /** - * This handles Variables that are null during Init - */ + // This handles Variables that are null during Init if (this.mPrimaryMeta == Blocks.stone || this.mSecondaryMeta == Blocks.stone || this.mBetweenMeta == Blocks.stone || this.mSporadicMeta == Blocks.stone) { @@ -247,7 +237,7 @@ public int executeWorldgenChunkified(World aWorld, Random aRandom, String aBiome } else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta != null)) { // Sporadics are only 1 per vertical column normally, - // reduce by 1/7 to + // reduce by 1/7 to // compensate if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false)) placeCount[3]++; } @@ -274,7 +264,7 @@ public int executeWorldgenChunkified(World aWorld, Random aRandom, String aBiome } else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta != null)) { // Sporadics are only 1 per vertical column normally, - // reduce by 1/7 to + // reduce by 1/7 to // compensate if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false)) placeCount[3]++; } @@ -291,14 +281,14 @@ public int executeWorldgenChunkified(World aWorld, Random aRandom, String aBiome .max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ)) / localDensity); if ((aRandom.nextInt(2) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mBetweenMeta != null)) { // Between are only 1 per vertical column, reduce by 1/2 to - // compensate + // compensate if (setOreBlock(aWorld, tX, level, tZ, this.mBetweenMeta, false, false)) { placeCount[2]++; } } else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta != null)) { // Sporadics are only 1 per vertical column normally, - // reduce by 1/7 to + // reduce by 1/7 to // compensate if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false)) placeCount[3]++; } @@ -314,7 +304,7 @@ public int executeWorldgenChunkified(World aWorld, Random aRandom, String aBiome .max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ)) / localDensity); if ((aRandom.nextInt(2) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mBetweenMeta != null)) { // Between are only 1 per vertical column, reduce by 1/2 to - // compensate + // compensate if (setOreBlock(aWorld, tX, level, tZ, this.mBetweenMeta, false, false)) { placeCount[2]++; } @@ -326,7 +316,7 @@ public int executeWorldgenChunkified(World aWorld, Random aRandom, String aBiome } else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta != null)) { // Sporadics are only 1 per vertical column normally, - // reduce by 1/7 to + // reduce by 1/7 to // compensate if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false)) placeCount[3]++; } @@ -350,7 +340,7 @@ public int executeWorldgenChunkified(World aWorld, Random aRandom, String aBiome } else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta != null)) { // Sporadics are only 1 per vertical column normally, - // reduce by 1/7 to + // reduce by 1/7 to // compensate if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false)) placeCount[3]++; } @@ -398,8 +388,10 @@ public int executeWorldgenChunkified(World aWorld, Random aRandom, String aBiome return ORE_PLACED; } - private String fString = "unset", ore1String = "unset", ore2String = "unset", ore3String = "unset", - ore4String = "unset"; + private String ore1String = "unset"; + private String ore2String = "unset"; + private String ore3String = "unset"; + private String ore4String = "unset"; Map gtOreMap = new HashMap<>(); public boolean setOreBlock(World aWorld, int aX, int aY, int aZ, Block aMetaData, boolean isSmallOre, boolean air) { @@ -430,6 +422,7 @@ public boolean setOreBlock(World aWorld, int aX, int aY, int aZ, Block aMetaData .toLowerCase()); } + String fString; if (this.mPrimaryMeta == aMetaData) { for (Materials f : Materials.values()) { if (!gtOreMap.containsKey(f)) { @@ -438,15 +431,7 @@ public boolean setOreBlock(World aWorld, int aX, int aY, int aZ, Block aMetaData fString = gtOreMap.get(f); if (fString.contains(ore1String)) { int r = f.mMetaItemSubID; - if (setOreBlock(aWorld, aX, aY, aZ, r, false)) { - Logger.WORLD( - "[World Generation Debug] Set " + f.mDefaultLocalName - + " Ore at X: " - + aX - + " | Y: " - + aY - + " | Z: " - + aZ); + if (TileEntityOres.setOreBlock(aWorld, aX, aY, aZ, r, false)) { return true; } } @@ -460,15 +445,7 @@ public boolean setOreBlock(World aWorld, int aX, int aY, int aZ, Block aMetaData fString = gtOreMap.get(f); if (fString.contains(ore2String)) { int r = f.mMetaItemSubID; - if (setOreBlock(aWorld, aX, aY, aZ, r, false)) { - Logger.WORLD( - "[World Generation Debug] Set " + f.mDefaultLocalName - + " Ore at X: " - + aX - + " | Y: " - + aY - + " | Z: " - + aZ); + if (TileEntityOres.setOreBlock(aWorld, aX, aY, aZ, r, false)) { return true; } } @@ -482,15 +459,7 @@ public boolean setOreBlock(World aWorld, int aX, int aY, int aZ, Block aMetaData fString = gtOreMap.get(f); if (fString.contains(ore3String)) { int r = f.mMetaItemSubID; - if (setOreBlock(aWorld, aX, aY, aZ, r, false)) { - Logger.WORLD( - "[World Generation Debug] Set " + f.mDefaultLocalName - + " Ore at X: " - + aX - + " | Y: " - + aY - + " | Z: " - + aZ); + if (TileEntityOres.setOreBlock(aWorld, aX, aY, aZ, r, false)) { return true; } } @@ -504,15 +473,7 @@ public boolean setOreBlock(World aWorld, int aX, int aY, int aZ, Block aMetaData fString = gtOreMap.get(f); if (fString.contains(ore4String)) { int r = f.mMetaItemSubID; - if (setOreBlock(aWorld, aX, aY, aZ, r, false)) { - Logger.WORLD( - "[World Generation Debug] Set " + f.mDefaultLocalName - + " Ore at X: " - + aX - + " | Y: " - + aY - + " | Z: " - + aZ); + if (TileEntityOres.setOreBlock(aWorld, aX, aY, aZ, r, false)) { return true; } } @@ -521,9 +482,6 @@ public boolean setOreBlock(World aWorld, int aX, int aY, int aZ, Block aMetaData } Block tBlock = aWorld.getBlock(aX, aY, aZ); - Block tOreBlock = aMetaData; - int BlockMeta = aWorld.getBlockMetadata(aX, aY, aZ); - String BlockName = tBlock.getUnlocalizedName(); if (tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone) || tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.sand) || tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.dirt) @@ -534,43 +492,10 @@ public boolean setOreBlock(World aWorld, int aX, int aY, int aZ, Block aMetaData || tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, DimensionEverglades.blockSecondaryFiller) || tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.sandstone)) { - if (aWorld.setBlock(aX, aY, aZ, tOreBlock, 0, 3)) { - Logger.WORLD( - "[World Generation Debug] Set " + tOreBlock - .getLocalizedName() + " at X: " + aX + " | Y: " + aY + " | Z: " + aZ); + if (aWorld.setBlock(aX, aY, aZ, aMetaData, 0, 3)) { return true; } } return false; } - - private boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int mMetaItemSubID, boolean useless) { - - // Get Class and Methods - Method setOres = null; - - try { - setOres = TileEntityOres.class.getDeclaredMethod( - "setOreBlock", - World.class, - int.class, - int.class, - int.class, - int.class, - boolean.class); - } catch (NoSuchMethodException | SecurityException e) { - - } - - try { - if (setOres != null) { - setOres.invoke(null, aWorld, aX, aY, aZ, mMetaItemSubID, useless); - } else { - return false; - } - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - - } - return false; - } } From a741c77474a0b5548376beee6947435ab0bf7d3c Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Mon, 16 Sep 2024 23:41:14 +0200 Subject: [PATCH 31/42] cleanup EntityStaballoyConstruct, remove broken reflection + broken logic and remove the explosion on death behavior --- .../monster/EntityStaballoyConstruct.java | 531 +----------------- 1 file changed, 6 insertions(+), 525 deletions(-) diff --git a/src/main/java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java b/src/main/java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java index c58f5ba9dfc..f40c00d7d0f 100644 --- a/src/main/java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java +++ b/src/main/java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java @@ -1,28 +1,8 @@ package gtPlusPlus.core.entity.monster; -import java.lang.reflect.Field; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.EntityAIAttackOnCollide; -import net.minecraft.entity.ai.EntityAIHurtByTarget; -import net.minecraft.entity.ai.EntityAILookIdle; -import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction; -import net.minecraft.entity.ai.EntityAIMoveTowardsTarget; -import net.minecraft.entity.ai.EntityAINearestAttackableTarget; -import net.minecraft.entity.ai.EntityAIWander; -import net.minecraft.entity.ai.EntityAIWatchClosest; -import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.monster.EntityIronGolem; -import net.minecraft.entity.monster.IMob; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.DamageSource; -import net.minecraft.util.MathHelper; import net.minecraft.village.Village; import net.minecraft.world.World; @@ -30,87 +10,18 @@ import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.core.world.explosions.ExplosionHandler; public class EntityStaballoyConstruct extends EntityIronGolem { - /* - * Determines whether or not the entity is in a fluid at all. - */ - private boolean inFluid = false; - private boolean mReflectFirstUpdate = true; - private boolean isReadyToExplode = false; - private int fuse = 60; - private int attackTimer; - public EntityStaballoyConstruct(World world) { super(world); this.experienceValue = 250; - this.setSize(1.4F, 2.9F); - this.getNavigator() - .setAvoidsWater(true); this.getNavigator() .setBreakDoors(true); this.getNavigator() .setCanSwim(false); this.getNavigator() .setAvoidSun(false); - this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true)); - this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); - // this.tasks.addTask(3, new EntityAIMoveThroughVillage(this, 0.6D, true)); - this.tasks.addTask(3, new EntityAIMoveTowardsRestriction(this, 1.0D)); - this.tasks.addTask(4, new EntityAIWander(this, 0.6D)); - this.tasks.addTask(5, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); - this.tasks.addTask(6, new EntityAILookIdle(this)); - this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false)); - this.targetTasks.addTask( - 2, - new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector)); - } - - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ - @Override - public void writeEntityToNBT(NBTTagCompound p_70014_1_) { - super.writeEntityToNBT(p_70014_1_); - p_70014_1_.setBoolean("inFluid", this.inFluid); - p_70014_1_.setBoolean("isReadyToExplode", this.isReadyToExplode); - p_70014_1_.setInteger("fuse", this.fuse); - } - - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - @Override - public void readEntityFromNBT(NBTTagCompound p_70037_1_) { - super.readEntityFromNBT(p_70037_1_); - this.inFluid = p_70037_1_.getBoolean("inFluid"); - this.isReadyToExplode = p_70037_1_.getBoolean("isReadyToExplode"); - this.fuse = p_70037_1_.getInteger("fuse"); - } - - @Override - protected void entityInit() { - super.entityInit(); - this.dataWatcher.addObject(17, Byte.valueOf((byte) 0)); - } - - /** - * Returns true if the newer Entity AI code should be run - */ - @Override - public boolean isAIEnabled() { - return true; - } - - /** - * main AI tick function, replaces updateEntityActionState - */ - @Override - protected void updateAITick() { - super.updateAITick(); } @Override @@ -122,87 +33,19 @@ protected void applyEntityAttributes() { .setBaseValue(0.5D); } - /** - * Decrements the entity's air supply when underwater - */ @Override - protected int decreaseAirSupply(int p_70682_1_) { - return 0; - } - - @Override - protected void collideWithEntity(Entity p_82167_1_) { - if (p_82167_1_ instanceof IMob && this.getRNG() - .nextInt(20) == 0) { - this.setAttackTarget((EntityLivingBase) p_82167_1_); - } - - super.collideWithEntity(p_82167_1_); - } - - /** - * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons - * use this to react to sunlight and start to burn. - */ - @Override - public void onLivingUpdate() { - super.onLivingUpdate(); - - if (this.attackTimer > 0) { - --this.attackTimer; - } - - if (this.motionX * this.motionX + this.motionZ * this.motionZ > 2.500000277905201E-7D - && this.rand.nextInt(5) == 0) { - int i = MathHelper.floor_double(this.posX); - int j = MathHelper.floor_double(this.posY - 0.20000000298023224D - this.yOffset); - int k = MathHelper.floor_double(this.posZ); - Block block = this.worldObj.getBlock(i, j, k); - - if (block.getMaterial() != Material.air) { - this.worldObj.spawnParticle( - "blockcrack_" + Block.getIdFromBlock(block) + "_" + this.worldObj.getBlockMetadata(i, j, k), - this.posX + (this.rand.nextFloat() - 0.5D) * this.width, - this.boundingBox.minY + 0.1D, - this.posZ + (this.rand.nextFloat() - 0.5D) * this.width, - 4.0D * (this.rand.nextFloat() - 0.5D), - 0.5D, - (this.rand.nextFloat() - 0.5D) * 4.0D); - } - } - } - - /** - * Returns true if this entity can attack entities of the specified class. - */ - @Override - public boolean canAttackClass(Class clazz) { - return clazz.equals(this.getClass()) ? false : true; - } - - @Override - public boolean attackEntityAsMob(Entity p_70652_1_) { - this.attackTimer = 10; - this.worldObj.setEntityState(this, (byte) 4); - boolean flag = p_70652_1_.attackEntityFrom(DamageSource.causeMobDamage(this), 7 + this.rand.nextInt(15)); - - if (flag) { - p_70652_1_.motionY += 0.4000000059604645D; - } - - this.playSound("mob.irongolem.throw", 1.0F, 1.0F); - return flag; + public boolean canAttackClass(Class clazz) { + return !this.getClass() + .equals(clazz); } @Override @SideOnly(Side.CLIENT) public void handleHealthUpdate(byte p_70103_1_) { - if (p_70103_1_ == 4) { - this.attackTimer = 10; - this.playSound("mob.irongolem.throw", 1.0F, 1.0F); - } else { - super.handleHealthUpdate(p_70103_1_); + if (p_70103_1_ == 11) { + return; } + super.handleHealthUpdate(p_70103_1_); } @Override @@ -210,33 +53,6 @@ public Village getVillage() { return null; } - @Override - @SideOnly(Side.CLIENT) - public int getAttackTimer() { - return this.attackTimer; - } - - /** - * Returns the sound this mob makes when it is hurt. - */ - @Override - protected String getHurtSound() { - return "mob.irongolem.hit"; - } - - /** - * Returns the sound this mob makes on death. - */ - @Override - protected String getDeathSound() { - return "mob.irongolem.death"; - } - - @Override - protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) { - this.playSound("mob.irongolem.walk", 1.0F, 1.0F); - } - /** * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param * par2 - Level of Looting used to kill this mob. @@ -246,13 +62,10 @@ protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) { int lootingChance = p_70628_2_ + 1; int j = this.rand.nextInt(3); int k; - for (k = 0; k < j; ++k) { this.entityDropItem(ItemUtils.getItemStackOfAmountFromOreDict("blockStaballoy", 1), 0f); } - k = 3 + this.rand.nextInt(3); - for (int l = 0; l < k; ++l) { this.entityDropItem(ItemUtils.getItemStackOfAmountFromOreDict("ingotStaballoy", lootingChance), 0f); if (MathUtils.randInt(0, 2) == 0) { @@ -269,24 +82,6 @@ public boolean isPlayerCreated() { @Override public void setPlayerCreated(boolean p_70849_1_) {} - /** - * Called when the mob's health reaches 0. - */ - @Override - public void onDeath(DamageSource p_70645_1_) { - super.onDeath(p_70645_1_); - } - - @Override - protected String getLivingSound() { // TODO - return super.getLivingSound(); - } - - @Override - public int getTalkInterval() { - return 0; - } - @Override protected boolean canDespawn() { return true; @@ -294,140 +89,12 @@ protected boolean canDespawn() { @Override public void onEntityUpdate() { - // Set Fire Immunity if (!this.isImmuneToFire) { this.isImmuneToFire = true; } - - if (!this.worldObj.isRemote) { - final float hp = getHealth(); - final float modifier = MathUtils.randInt(5, 10) / 100F; - final float amountToExplode = (hp * modifier); - - if (hp <= amountToExplode && !isReadyToExplode) { - if (this.ticksExisted >= 50) { - // Logger.INFO("Construct has low hp, trying to enable explosions. HP: "+this.getHealth()+", Max: - // "+this.getMaxHealth()+", Mod: "+modifier); - // Logger.INFO("Construct required HP to be <= "+amountToExplode); - float r = MathUtils.randFloat(0, 10); - if (r <= 0.1) { - this.isReadyToExplode = true; - // Logger.INFO("Construct can now explode."); - } - } - } - // Handle Exploding - else if (hp <= amountToExplode && isReadyToExplode) { - // Logger.INFO("Trying to explode. ["+this.fuse+"]"); - if (this.fuse-- <= 0) { - // Logger.INFO("Fuse has run out."); - this.setDead(); - if (!this.worldObj.isRemote) { - this.explode(); - } - } else { - // Logger.INFO("Ticking fuse and spawning particles."); - - int maxFuse = 60; - int fuseUsed = maxFuse - this.fuse; - float var2 = (float) (fuseUsed * 0.1); - - this.setSize(1.4F + (var2 / 2), 2.9F + (var2 / 2)); - - float r = MathUtils.randFloat(0, 1); - int r2 = MathUtils.randInt(5, 15); - for (int o = 0; o < r2; o++) { - if (r <= 0.3) { - this.worldObj.spawnParticle( - "smoke", - this.posX + MathUtils.randDouble(-2, 2), - this.posY + MathUtils.randDouble(-2, 2), - this.posZ + MathUtils.randDouble(-2, 2), - 0.0D, - 0.0D, - 0.0D); - - } else if (r <= 0.6) { - this.worldObj.spawnParticle( - "largesmoke", - this.posX + MathUtils.randDouble(-2, 2), - this.posY + MathUtils.randDouble(-2, 2), - this.posZ + MathUtils.randDouble(-2, 2), - 0.0D, - 0.0D, - 0.0D); - } - if (r <= 0.3) { - this.worldObj.spawnParticle( - "cloud", - this.posX + MathUtils.randDouble(-2, 2), - this.posY + MathUtils.randDouble(-2, 2), - this.posZ + MathUtils.randDouble(-2, 2), - 0.0D, - 0.0D, - 0.0D); - - } else if (r <= 0.7) { - this.worldObj.spawnParticle( - "flame", - this.posX + MathUtils.randDouble(-2, 2), - this.posY + MathUtils.randDouble(-2, 2), - this.posZ + MathUtils.randDouble(-2, 2), - 0.0D, - 0.0D, - 0.0D); - } - if (r <= 0.2) { - this.worldObj.spawnParticle( - "explode", - this.posX + MathUtils.randDouble(-2, 2), - this.posY + MathUtils.randDouble(-2, 2), - this.posZ + MathUtils.randDouble(-2, 2), - 0.0D, - 0.0D, - 0.0D); - - } else if (r <= 0.5) { - this.worldObj.spawnParticle( - "largeexplode", - this.posX + MathUtils.randDouble(-2, 2), - this.posY + MathUtils.randDouble(-2, 2), - this.posZ + MathUtils.randDouble(-2, 2), - 0.0D, - 0.0D, - 0.0D); - - } else if (r <= 0.7) { - this.worldObj.spawnParticle( - "hugeexplosion", - this.posX + MathUtils.randDouble(-2, 2), - this.posY + MathUtils.randDouble(-2, 2), - this.posZ + MathUtils.randDouble(-2, 2), - 0.0D, - 0.0D, - 0.0D); - } - } - } - } else { - - } - - // Get a private field from a super class if it exists. - if (mFirstUpdateField == null) { - mFirstUpdateField = ReflectionUtils.getField(this.getClass(), "firstUpdate"); - } - if (mFirstUpdateField != null && mReflectFirstUpdate == true) { - try { - this.mReflectFirstUpdate = (boolean) mFirstUpdateField.get(this); - } catch (IllegalArgumentException | IllegalAccessException e) {} - } - } super.onEntityUpdate(); } - private static Field mFirstUpdateField; - @Override public int getMaxSpawnedInChunk() { return 1; @@ -454,192 +121,6 @@ public void setFire(int p_70015_1_) { @Override protected void dealFireDamage(int p_70081_1_) {} - @Override - public boolean isInWater() { - if (super.isInWater()) { - return true; - } else { - this.moveForward *= 0.98F; - return false; - } - } - - @Override - public boolean handleWaterMovement() { - this.moveForward *= 0.74F; - return handleFluidMovement(Material.water); - } - - @Override - public boolean handleLavaMovement() { - this.moveForward *= 0.74F; - return handleFluidMovement(Material.lava); - } - - /** - * Returns if this entity is in water and will end up adding the waters velocity to the entity - */ - public boolean handleFluidMovement(Material fluid) { - - if (this.worldObj.handleMaterialAcceleration( - this.boundingBox.expand(0.0D, -0.4000000059604645D, 0.0D) - .contract(0.001D, 0.001D, 0.001D), - fluid, - this)) { - if (!this.inFluid && !this.mReflectFirstUpdate) { - float f = MathHelper.sqrt_double( - this.motionX * this.motionX * 0.20000000298023224D + this.motionY * this.motionY - + this.motionZ * this.motionZ * 0.20000000298023224D) - * 0.2F; - - if (f > 1.0F) { - f = 1.0F; - } - - this.playSound(this.getSplashSound(), f, 1.0F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.4F); - float f1 = MathHelper.floor_double(this.boundingBox.minY); - int i; - float f2; - float f3; - - for (i = 0; i < 1.0F + this.width * 20.0F; ++i) { - f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; - f3 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; - this.worldObj.spawnParticle( - "bubble", - this.posX + f2, - f1 + 1.0F, - this.posZ + f3, - this.motionX, - this.motionY - this.rand.nextFloat() * 0.2F, - this.motionZ); - } - - for (i = 0; i < 1.0F + this.width * 20.0F; ++i) { - f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; - f3 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; - this.worldObj.spawnParticle( - "splash", - this.posX + f2, - f1 + 1.0F, - this.posZ + f3, - this.motionX, - this.motionY, - this.motionZ); - } - } - this.fallDistance = 0.0F; - this.inFluid = true; - } else { - this.inFluid = false; - } - return this.inFluid; - } - - @Override - public void onChunkLoad() { - // TODO Auto-generated method stub - super.onChunkLoad(); - } - - @Override - public void onStruckByLightning(EntityLightningBolt p_70077_1_) { - this.isReadyToExplode = true; - this.fuse = 20; - } - - private void explode() { - /* - * float f = 12.0F; this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, f, true); - */ - - if (!this.worldObj.isRemote) { - final float f = 6.5F; - ExplosionHandler explode = new ExplosionHandler(); - explode.createExplosion(this.worldObj, this, this.posX, this.posY, this.posZ, f, true, true); - - float r = MathUtils.randFloat(0, 1); - int r2 = MathUtils.randInt(20, 40); - for (int o = 0; o < r2; o++) { - if (r <= 0.3) { - this.worldObj.spawnParticle( - "smoke", - this.posX + MathUtils.randDouble(-4, 4), - this.posY + MathUtils.randDouble(0, 3), - this.posZ + MathUtils.randDouble(-4, 4), - 0.0D, - 0.0D, - 0.0D); - - } else if (r <= 0.6) { - this.worldObj.spawnParticle( - "largesmoke", - this.posX + MathUtils.randDouble(-4, 4), - this.posY + MathUtils.randDouble(-4, 4), - this.posZ + MathUtils.randDouble(-4, 4), - 0.0D, - 0.0D, - 0.0D); - } - if (r <= 0.3) { - this.worldObj.spawnParticle( - "cloud", - this.posX + MathUtils.randDouble(-4, 4), - this.posY + MathUtils.randDouble(-4, 4), - this.posZ + MathUtils.randDouble(-4, 4), - 0.0D, - 0.0D, - 0.0D); - - } else if (r <= 0.7) { - this.worldObj.spawnParticle( - "flame", - this.posX + MathUtils.randDouble(-4, 4), - this.posY + MathUtils.randDouble(-4, 4), - this.posZ + MathUtils.randDouble(-4, 4), - 0.0D, - 0.0D, - 0.0D); - } - if (r <= 0.2) { - this.worldObj.spawnParticle( - "explode", - this.posX + MathUtils.randDouble(-4, 4), - this.posY + MathUtils.randDouble(-4, 4), - this.posZ + MathUtils.randDouble(-4, 4), - 0.0D, - 0.0D, - 0.0D); - - } else if (r <= 0.5) { - this.worldObj.spawnParticle( - "largeexplode", - this.posX + MathUtils.randDouble(-4, 4), - this.posY + MathUtils.randDouble(-4, 4), - this.posZ + MathUtils.randDouble(-4, 4), - 0.0D, - 0.0D, - 0.0D); - - } else if (r <= 0.7) { - this.worldObj.spawnParticle( - "hugeexplosion", - this.posX + MathUtils.randDouble(-4, 4), - this.posY + MathUtils.randDouble(-4, 4), - this.posZ + MathUtils.randDouble(-4, 4), - 0.0D, - 0.0D, - 0.0D); - } - } - } - } - - @Override - public boolean canAttackWithItem() { - return true; - } - @Override public boolean canRenderOnFire() { return false; From ccae1802ca5bbdfcf9cf2c41ea03b9897048d9d8 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Tue, 17 Sep 2024 00:08:13 +0200 Subject: [PATCH 32/42] use higher update frequency to sync updates of the GT++ entities so it doesn't look like they teleport --- .../java/gtPlusPlus/core/entity/InternalEntityRegistry.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/gtPlusPlus/core/entity/InternalEntityRegistry.java b/src/main/java/gtPlusPlus/core/entity/InternalEntityRegistry.java index a971541bc2a..f193f019914 100644 --- a/src/main/java/gtPlusPlus/core/entity/InternalEntityRegistry.java +++ b/src/main/java/gtPlusPlus/core/entity/InternalEntityRegistry.java @@ -35,7 +35,7 @@ public static void registerEntities() { mEntityID++, GTplusplus.instance, 64, - 20, + 3, true); ItemCustomSpawnEgg.registerEntityForSpawnEgg( 0, @@ -44,7 +44,7 @@ public static void registerEntities() { Utils.rgbtoHexValue(20, 20, 20)); EntityRegistry - .registerModEntity(EntitySickBlaze.class, "sickBlaze", mEntityID++, GTplusplus.instance, 64, 20, true); + .registerModEntity(EntitySickBlaze.class, "sickBlaze", mEntityID++, GTplusplus.instance, 64, 3, true); ItemCustomSpawnEgg.registerEntityForSpawnEgg( 1, "sickBlaze", From 0a0657ba22ef77c057a172b1f69def635367d385 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Tue, 17 Sep 2024 00:39:48 +0200 Subject: [PATCH 33/42] delete gt++ capes --- src/main/java/gtPlusPlus/GTplusplus.java | 6 - .../gtPlusPlus/core/config/ConfigHandler.java | 2 - .../java/gtPlusPlus/core/lib/GTPPCore.java | 1 - .../gtPlusPlus/core/proxy/ClientProxy.java | 14 - .../gregtech/common/render/CapeRenderer.java | 500 ------------------ .../assets/miscutils/textures/DevCapeHD.png | Bin 4788 -> 0 bytes .../assets/miscutils/textures/FancyCapeHD.png | Bin 9643 -> 0 bytes .../assets/miscutils/textures/Orange.png | Bin 364 -> 0 bytes .../assets/miscutils/textures/OrangeHD.png | Bin 5904 -> 0 bytes .../miscutils/textures/PatreonCapeHD.png | Bin 10267 -> 0 bytes .../miscutils/textures/TesterCapeHD.png | Bin 7976 -> 0 bytes 11 files changed, 523 deletions(-) delete mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/common/render/CapeRenderer.java delete mode 100644 src/main/resources/assets/miscutils/textures/DevCapeHD.png delete mode 100644 src/main/resources/assets/miscutils/textures/FancyCapeHD.png delete mode 100644 src/main/resources/assets/miscutils/textures/Orange.png delete mode 100644 src/main/resources/assets/miscutils/textures/OrangeHD.png delete mode 100644 src/main/resources/assets/miscutils/textures/PatreonCapeHD.png delete mode 100644 src/main/resources/assets/miscutils/textures/TesterCapeHD.png diff --git a/src/main/java/gtPlusPlus/GTplusplus.java b/src/main/java/gtPlusPlus/GTplusplus.java index 7550d1724b4..8f368365217 100644 --- a/src/main/java/gtPlusPlus/GTplusplus.java +++ b/src/main/java/gtPlusPlus/GTplusplus.java @@ -3,7 +3,6 @@ import static gregtech.api.enums.Mods.GTPlusPlus; import static gregtech.api.enums.Mods.Names; import static gregtech.api.enums.Mods.Thaumcraft; -import static gtPlusPlus.core.lib.GTPPCore.ConfigSwitches.enableCustomCapes; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -42,7 +41,6 @@ import gtPlusPlus.core.handler.Recipes.RegistrationHandler; import gtPlusPlus.core.lib.GTPPCore; import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.data.LocaleUtils; import gtPlusPlus.plugin.manager.CoreManager; import gtPlusPlus.xmod.gregtech.common.MetaGTProxy; @@ -145,10 +143,6 @@ public void preInit(final FMLPreInitializationEvent event) { CoreManager.veryEarlyInit(); PacketHandler.init(); - if (!Utils.isServer()) { - enableCustomCapes = true; - } - // Give this a go mate. setupMaterialBlacklist(); diff --git a/src/main/java/gtPlusPlus/core/config/ConfigHandler.java b/src/main/java/gtPlusPlus/core/config/ConfigHandler.java index d214bd8a52d..e6041ab78a5 100644 --- a/src/main/java/gtPlusPlus/core/config/ConfigHandler.java +++ b/src/main/java/gtPlusPlus/core/config/ConfigHandler.java @@ -195,8 +195,6 @@ public static void handleConfigFile(final FMLPreInitializationEvent event) { .getBoolean("enableMultiblock_Cyclotron", GregTech.ID, true, "COMET - Scientific Cyclotron."); // Features - enableCustomCapes = config.getBoolean("enableSupporterCape", "features", true, "Enables Custom GT++ Cape."); - enableWatchdogBGM = config.getInt( "enableWatchdogBGM", "features", diff --git a/src/main/java/gtPlusPlus/core/lib/GTPPCore.java b/src/main/java/gtPlusPlus/core/lib/GTPPCore.java index af6bedfa61f..17b3573940c 100644 --- a/src/main/java/gtPlusPlus/core/lib/GTPPCore.java +++ b/src/main/java/gtPlusPlus/core/lib/GTPPCore.java @@ -78,7 +78,6 @@ public static class ConfigSwitches { public static int boilerSteamPerSecond = 750; // Feature Related - public static boolean enableCustomCapes = false; public static int enableWatchdogBGM = PreloaderCore.enableWatchdogBGM; public static boolean hideUniversalCells = true; diff --git a/src/main/java/gtPlusPlus/core/proxy/ClientProxy.java b/src/main/java/gtPlusPlus/core/proxy/ClientProxy.java index ac93757845b..2ca0a4ae3d6 100644 --- a/src/main/java/gtPlusPlus/core/proxy/ClientProxy.java +++ b/src/main/java/gtPlusPlus/core/proxy/ClientProxy.java @@ -7,7 +7,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import net.minecraftforge.client.event.RenderPlayerEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; @@ -21,7 +20,6 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStartingEvent; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import gtPlusPlus.GTplusplus; import gtPlusPlus.api.objects.Logger; @@ -39,26 +37,14 @@ import gtPlusPlus.core.entity.projectile.EntityLightningAttack; import gtPlusPlus.core.entity.projectile.EntityToxinballSmall; import gtPlusPlus.core.lib.GTPPCore; -import gtPlusPlus.core.lib.GTPPCore.ConfigSwitches; import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest; import gtPlusPlus.nei.NEIGTPPConfig; -import gtPlusPlus.xmod.gregtech.common.render.CapeRenderer; import gtPlusPlus.xmod.gregtech.common.render.FlaskRenderer; import gtPlusPlus.xmod.gregtech.common.render.MachineBlockRenderer; import ic2.core.item.ItemFluidCell; public class ClientProxy extends CommonProxy { - private final CapeRenderer mCapeRenderer = new CapeRenderer(); - public static String playerName = ""; - - @SubscribeEvent - public void receiveRenderSpecialsEvent(RenderPlayerEvent.Specials.Pre aEvent) { - if (ConfigSwitches.enableCustomCapes) { - mCapeRenderer.receiveRenderSpecialsEvent(aEvent); - } - } - @Override public void preInit(final FMLPreInitializationEvent e) { super.preInit(e); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/render/CapeRenderer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/render/CapeRenderer.java deleted file mode 100644 index bf7de52ff2a..00000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/render/CapeRenderer.java +++ /dev/null @@ -1,500 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.render; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.concurrent.ForkJoinPool; - -import net.minecraft.client.entity.AbstractClientPlayer; -import net.minecraft.client.model.ModelBiped; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.renderer.entity.RenderPlayer; -import net.minecraft.potion.Potion; -import net.minecraft.util.MathHelper; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.event.RenderPlayerEvent; - -import org.apache.commons.io.IOUtils; -import org.lwjgl.opengl.GL11; - -import gregtech.api.util.GTUtility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.lib.GTPPCore; -import gtPlusPlus.core.lib.GTPPCore.ConfigSwitches; -import gtPlusPlus.core.proxy.ClientProxy; -import gtPlusPlus.core.util.data.AES; -import gtPlusPlus.core.util.data.FileUtils; -import gtPlusPlus.core.util.math.MathUtils; - -public class CapeRenderer extends RenderPlayer { - - private static final ResourceLocation[] mCapes = { new ResourceLocation("miscutils:textures/OrangeHD.png"), - new ResourceLocation("miscutils:textures/FancyCapeHD.png"), - new ResourceLocation("miscutils:textures/TesterCapeHD.png"), - new ResourceLocation("miscutils:textures/PatreonCapeHD.png"), - new ResourceLocation("miscutils:textures/DevCapeHD.png"), }; - - private final boolean mInit; - - public CapeRenderer() { - mInit = init(); - } - - private boolean init() { - if (mInit) { - return false; - } - return CapeUtils.init(); - } - - private static boolean hasResourceChecked = false; - private static boolean hasSetRenderer = false; - private boolean hasCape = false; - private ResourceLocation tResource = null; - - public synchronized void receiveRenderSpecialsEvent(RenderPlayerEvent.Specials.Pre aEvent) { - - // Check we have set Render Manager - if (this.renderManager == null) { - hasSetRenderer = false; - } - - // Set Render Manager - if (!hasSetRenderer) { - if (RenderManager.instance != null) { - setRenderManager(RenderManager.instance); - hasSetRenderer = true; - } - } - - // Actually Render - if (hasSetRenderer) { - - // We have capes turned off, so let's not render. - if (!ConfigSwitches.enableCustomCapes) { - return; - } - - if (!CapeUtils.mapsPopulated) { - if (!CapeUtils.cacheReady) { - return; - } - CapeUtils.writeCacheToMaps(); - CapeUtils.mapsPopulated = true; - } - - // We have already checked if this player has a cape, but since they do not, we best not render. - if (hasResourceChecked) { - if (!hasCape && !GTPPCore.DEVENV) { - return; - } - } - - // Allocate client player object - AbstractClientPlayer aPlayer = (AbstractClientPlayer) aEvent.entityPlayer; - - // Make sure we don't keep checking on clients who dont have capes. - if (!hasResourceChecked) { - - // Get players UUID - String aPlayerUUID = aPlayer != null ? aPlayer.getGameProfile() - .getId() - .toString() : "BAD"; - - // If for whatever reason this fails, we just exit early. - if (aPlayerUUID.equals("BAD")) { - return; - } - - // Automatically allocate a Dev cape while in Dev mode. - if (tResource == null && GTPPCore.DEVENV) { - tResource = mCapes[4]; - hasCape = true; - } - - String aPlayerName = ClientProxy.playerName; - - // Check cape lists for the cape this player owns. - if (!hasCape) { - for (Pair aData : CapeUtils.mOrangeCapes) { - if (aData.getKey() - .equals(aPlayerUUID) || aPlayerName.equals(aData.getValue())) { - tResource = mCapes[0]; - hasCape = true; - break; - } - } - } - if (!hasCape) { - for (Pair aData : CapeUtils.mMiscCapes) { - if (aData.getKey() - .equals(aPlayerUUID) || aPlayerName.equals(aData.getValue())) { - tResource = mCapes[1]; - hasCape = true; - break; - } - } - } - if (!hasCape) { - for (Pair aData : CapeUtils.mBetaTestCapes) { - if (aData.getKey() - .equals(aPlayerUUID) || aPlayerName.equals(aData.getValue())) { - tResource = mCapes[2]; - hasCape = true; - break; - } - } - } - if (!hasCape) { - for (Pair aData : CapeUtils.mPatreonCapes) { - if (aData.getKey() - .equals(aPlayerUUID) || aPlayerName.equals(aData.getValue())) { - tResource = mCapes[3]; - hasCape = true; - break; - } - } - } - if (!hasCape) { - for (Pair aData : CapeUtils.mDevCapes) { - if (aData.getKey() - .equals(aPlayerUUID) || aPlayerName.equals(aData.getValue())) { - tResource = mCapes[4]; - hasCape = true; - break; - } - } - } - hasResourceChecked = true; - } - - if (hasResourceChecked) { - // We have met all the conditions, let's render that cape. - renderCapeOnPlayer(aEvent, aPlayer); - } - } - } - - private boolean renderCapeOnPlayer(RenderPlayerEvent.Specials.Pre aEvent, AbstractClientPlayer aPlayer) { - float aPartialTicks = aEvent.partialRenderTick; - try { - if (tResource == null && GTPPCore.DEVENV) { - tResource = mCapes[3]; - } - - // If player is invisible, don't render. - if (GTUtility.getFullInvisibility(aPlayer) || aPlayer.isInvisible() - || GTUtility.getPotion(aPlayer, Integer.valueOf(Potion.invisibility.id))) { - aEvent.setCanceled(true); - return false; - } - - if ((tResource != null) && (!aPlayer.getHideCape())) { - bindTexture(tResource); - GL11.glPushMatrix(); - GL11.glTranslatef(0.0F, 0.0F, 0.125F); - double d0 = aPlayer.field_71091_bM + (aPlayer.field_71094_bP - aPlayer.field_71091_bM) * aPartialTicks - - (aPlayer.prevPosX + (aPlayer.posX - aPlayer.prevPosX) * aPartialTicks); - double d1 = aPlayer.field_71096_bN + (aPlayer.field_71095_bQ - aPlayer.field_71096_bN) * aPartialTicks - - (aPlayer.prevPosY + (aPlayer.posY - aPlayer.prevPosY) * aPartialTicks); - double d2 = aPlayer.field_71097_bO + (aPlayer.field_71085_bR - aPlayer.field_71097_bO) * aPartialTicks - - (aPlayer.prevPosZ + (aPlayer.posZ - aPlayer.prevPosZ) * aPartialTicks); - float f6 = aPlayer.prevRenderYawOffset - + (aPlayer.renderYawOffset - aPlayer.prevRenderYawOffset) * aPartialTicks; - double d3 = MathHelper.sin(f6 * GTPPCore.PI / 180.0F); - double d4 = -MathHelper.cos(f6 * GTPPCore.PI / 180.0F); - float f7 = (float) d1 * 10.0F; - float f8 = (float) (d0 * d3 + d2 * d4) * 100.0F; - float f9 = (float) (d0 * d4 - d2 * d3) * 100.0F; - if (f7 < -6.0F) { - f7 = -6.0F; - } - if (f7 > 32.0F) { - f7 = 32.0F; - } - if (f8 < 0.0F) { - f8 = 0.0F; - } - float f10 = aPlayer.prevCameraYaw + (aPlayer.cameraYaw - aPlayer.prevCameraYaw) * aPartialTicks; - f7 += MathHelper.sin( - (aPlayer.prevDistanceWalkedModified - + (aPlayer.distanceWalkedModified - aPlayer.prevDistanceWalkedModified) * aPartialTicks) * 6.0F) - * 32.0F - * f10; - if (aPlayer.isSneaking()) { - f7 += 25.0F; - } - GL11.glRotatef(6.0F + f8 / 2.0F + f7, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(f9 / 2.0F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(-f9 / 2.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); - ((ModelBiped) this.mainModel).renderCloak(0.0625F); - GL11.glPopMatrix(); - return true; - } - } catch (Throwable e) { - - } - return false; - } - - private static class CapeUtils { - - private static char SPLIT_CHARACTER = '§'; - private static AES sAES; - private static volatile boolean cacheReady = false; - private static boolean mapsPopulated = false; - - // UUID - Username - private static final ArrayList> mOrangeCapes = new ArrayList<>(); - private static final ArrayList> mMiscCapes = new ArrayList<>(); - private static final ArrayList> mBetaTestCapes = new ArrayList<>(); - private static final ArrayList> mPatreonCapes = new ArrayList<>(); - private static final ArrayList> mDevCapes = new ArrayList<>(); - - private static boolean init() { - CapeUtils.handleOldCapeCache(); - if (GTPPCore.DEVENV) { - return true; - } - ForkJoinPool.commonPool() - .execute(() -> { - try { - if (shouldDownloadCapeList()) { - downloadCapeList(); - } - } catch (Exception ignored) {} - cacheReady = true; - }); - return true; - } - - private static boolean shouldDownloadCapeList() { - if (!doesCapeCacheExistLocally()) { - return true; - } - if (isCapeCacheWeekOld()) { - return true; - } - return false; - } - - private static boolean isCapeCacheWeekOld() { - if (!doesCapeCacheExistLocally()) { - return true; - } else { - File dat = CapeUtils.getCapeCache(); - Date dateLastMod = new Date(dat.lastModified()); - Date dateNow = new Date(System.currentTimeMillis() - (7l * 24 * 60 * 60 * 1000)); - if (dateLastMod.before(dateNow)) { - return true; - } - } - return false; - } - - private static void downloadCapeList() { - try { - File dat = getCapeCache(); - File temp = allocateTempFile(); - InputStream inputStream = new URL("https://alkcorp.overminddl1.com/CapeCache.dat").openStream(); - FileOutputStream fileOS = new FileOutputStream(temp); - IOUtils.copy(inputStream, fileOS); - if (isDownloadedCapeListBigger(temp)) { - fileOS = new FileOutputStream(dat); - IOUtils.copy(inputStream, fileOS); - } - } catch (Throwable t) { - Logger.INFO("Unable to download GT++ cape list."); - } - } - - private static boolean isDownloadedCapeListBigger(File aFile) { - double aExistingFileSize = (doesCapeCacheExistLocally() ? getCapeCache().length() : 0); - double aNewFileSize = aFile.length(); - if (aNewFileSize > aExistingFileSize) { - return true; - } - return false; - } - - private static void handleOldCapeCache() { - File aCacheFile = FileUtils.getFile("GTPP", "dat"); - if (FileUtils.doesFileExist(aCacheFile)) { - aCacheFile.delete(); - } - } - - private static boolean doesCapeCacheExistLocally() { - File aCacheFile = FileUtils.getFile("CapeCache", "dat"); - if (FileUtils.doesFileExist(aCacheFile)) { - return true; - } - return false; - } - - private static File getCapeCache() { - File aCacheFile = FileUtils.getFile("CapeCache", "dat"); - if (FileUtils.doesFileExist(aCacheFile)) { - FileUtils.createFile(aCacheFile); - } - return aCacheFile; - } - - public static final List getDataFromCache() { - File aCacheFile = getCapeCache(); - List aCache = FileUtils.readLines(aCacheFile); - if (aCache != null && !aCache.isEmpty()) { - return aCache; - } - return new ArrayList<>(); - } - - private static File allocateTempFile() { - File tempFile = null; - try { - tempFile = File.createTempFile("gtpp-", null); - } catch (IOException e) { - e.printStackTrace(); - } - if (tempFile == null) { - tempFile = FileUtils - .createFile("", "gtpp-" + MathUtils.randInt(Short.MAX_VALUE, (Integer.MAX_VALUE / 2)), "tmp"); - } - tempFile.deleteOnExit(); - return tempFile; - } - - public static final void writeCacheToMaps() { - List aCacheData = getDataFromCache(); - if (aCacheData != null && !aCacheData.isEmpty()) { - if (sAES == null) { - sAES = new AES(); - } - ArrayList aDecodedData = new ArrayList<>(); - for (String aToDecode : aCacheData) { - aDecodedData.add(sAES.decode(aToDecode)); - } - if (!aDecodedData.isEmpty()) { - ArrayList> aCapeType1 = new ArrayList<>(); - ArrayList> aCapeType2 = new ArrayList<>(); - ArrayList> aCapeType3 = new ArrayList<>(); - ArrayList> aCapeType4 = new ArrayList<>(); - ArrayList> aCapeType5 = new ArrayList<>(); - boolean didProcessStringData = false; - Logger.INFO("Decoded String Count: " + aDecodedData.size()); - for (String aToSplit : aDecodedData) { - String[] aSplitData = aToSplit.split("" + SPLIT_CHARACTER); - if (aSplitData != null && aSplitData.length >= 2) { - if (aSplitData[0] != null) { - Integer aCapeTypeID2 = Integer.parseInt(aSplitData[0]); - if (aCapeTypeID2 != null) { - int aCapeTypeID = aCapeTypeID2; - Pair aFinalString = new Pair<>( - "UUID: " + aSplitData[1], - "Username: " - + (aSplitData[2] != null && aSplitData[0].length() > 0 ? aSplitData[2] - : "Not Specified")); - Logger.INFO("Cape Type: " + aCapeTypeID); - switch (aCapeTypeID) { - case 0 -> { - aCapeType1.add(aFinalString); - Logger.INFO( - "Added user to map " + aCapeTypeID - + ", map now holds " - + aCapeType1.size() - + " users."); - } - case 1 -> { - aCapeType2.add(aFinalString); - Logger.INFO( - "Added user to map " + aCapeTypeID - + ", map now holds " - + aCapeType2.size() - + " users."); - } - case 2 -> { - aCapeType3.add(aFinalString); - Logger.INFO( - "Added user to map " + aCapeTypeID - + ", map now holds " - + aCapeType3.size() - + " users."); - } - case 3 -> { - aCapeType4.add(aFinalString); - Logger.INFO( - "Added user to map " + aCapeTypeID - + ", map now holds " - + aCapeType4.size() - + " users."); - } - case 4 -> { - aCapeType5.add(aFinalString); - Logger.INFO( - "Added user to map " + aCapeTypeID - + ", map now holds " - + aCapeType5.size() - + " users."); - } - default -> {} - } - } - } - } - } - if (!aCapeType1.isEmpty() || !aCapeType2.isEmpty() - || !aCapeType3.isEmpty() - || !aCapeType4.isEmpty() - || !aCapeType5.isEmpty()) { - didProcessStringData = true; - } else { - // did not process any data - } - if (didProcessStringData) { - if (!aCapeType1.isEmpty()) { - for (Pair aUser : aCapeType1) { - Logger.INFO("Adding Generic cape for " + aUser.getKey()); - mOrangeCapes.add(aUser); - } - } - if (!aCapeType2.isEmpty()) { - for (Pair aUser : aCapeType2) { - Logger.INFO("Adding Blue cape for " + aUser.getKey()); - mMiscCapes.add(aUser); - } - } - if (!aCapeType3.isEmpty()) { - for (Pair aUser : aCapeType3) { - Logger.INFO("Adding Beta cape for " + aUser.getKey()); - mBetaTestCapes.add(aUser); - } - } - if (!aCapeType4.isEmpty()) { - for (Pair aUser : aCapeType4) { - Logger.INFO("Adding Patreon cape for " + aUser.getKey()); - mPatreonCapes.add(aUser); - } - } - if (!aCapeType5.isEmpty()) { - for (Pair aUser : aCapeType5) { - Logger.INFO("Adding Dev cape for " + aUser.getKey()); - mDevCapes.add(aUser); - } - } - } - } else { - // No data decoded - } - } else { - // Nothing was cached? - } - } - } -} diff --git a/src/main/resources/assets/miscutils/textures/DevCapeHD.png b/src/main/resources/assets/miscutils/textures/DevCapeHD.png deleted file mode 100644 index f74bd8c9e3501804cd75e79259834e9e0839406b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4788 zcmcIoXH-*7w+gtqoHJ);@7eS0HWTx}#DI>PgBkz;(A_iCeFy-M5MKe2 z*GY+`*Ep{|vAX7_b6*Dl_>xG2cP1x(^ST&5ybl0`3K9GL0|5NF>c0*E1W5w`n@#|L zYB~VG>X+SQs!set@fd8N3m{xw`K_fX#1<+)Lz_SVfbs7`63^dA2>{$ox~HpSj+ok> z-3YXBZIjwVJNnP%v;_@F@@lW?e@$PBWHS#UwJfRnf$1jqvE%!kJwNL6;$ys>03vF!|FZ(uW|;R)%`siyHV|)uhtN`YZ2ST z8LH~@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LqFZs->BWBmQyl^{ diff --git a/src/main/resources/assets/miscutils/textures/FancyCapeHD.png b/src/main/resources/assets/miscutils/textures/FancyCapeHD.png deleted file mode 100644 index d8da3ba76db858f9e19f1d0ed658596bfaefd06e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9643 zcmc(FRa_L_6Ys(TOLs_jmvk(!OGya}3L=fPfaKEMh%_kDOCz1qB`KXE!cwv<-BJ?Q z-~ajE=lgKZoSCP2n3?naen0bGS4WKqpAH`Y01#=YtGoaJF#bIOp}3g;Zl^^SvwsG| z^M#rcpk|U`_n(7huc)mE0MsWD+`Ym6=i|Al8+if% z=Z%Lg!0pXj7r2m%Eu2MM=&6v1%>0iA8vuZlUPDDu-`D&wHzpw6;BvUfHS;QWHElfC zhU?ud1ukA!By^{X7lE+Cphxf&Vupt!Dt|&rRrwH@|^_#rPJ8nCSQYz5pp~U~cn1@GeX-|nFV<|0C2Hff* zJNSGquS2d^W$%Xe>s6%~?lm`W4E)>$5(9<&oL^`r1Yv+JIDNRQ+xW@?ws)sK~fBnl%Kbr-Qbrkrn z&N|dDHgRsemDHN&h;h|}U)SzNOC2vuk2f(0xXsZ|yTMbo9p`xJ- z(44E(c2&Z0!88t_6jJf!e9G7=x@=2NXvlQmg%WPYM7^r}hF{!jahqw9*>89N*$l>_ zQG(?E{(1JY6$mVVsZ0XZFXjkM#Bxr|hRKe{3t(bqewmBoB+>jC-B0=ZHpaZa=-RA@ z{dlS54ot@w#?+X=P2=NXIE1z_Ruvl}ox=je1JRg84i^g-lP>@=(PD%XIDDk9F?OKB zJ0)30F0BDC=Vd#ivNSNH2!|}UR){F=JDhy>ApUCP7yRWNEz!iM}hDDn$SawSMje{?wr)H~UC-zv{?VRwYMpbXmq*NHmpa%+%G_t2hgY^o^T0{R~Mr3yuHuYpAQ&|egVkdaN^(Z zPUp5WjuZDXjRI6T0Mgrz{*i@Cv96fv)-lmm=`oL%CH*Eu)kzx_9;mBgVaxV?FMgO9 z|B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qvo06TkZOreZdQ!yN#9d1KRCz z!7ch1>OM`6kFT=k5u_%nPsSN5np3Z9-nzx}$e)?19G!~iWMuB5wZTU&C%W>}J@q$V zdQWIfzLxy$&M`mty!|G>JNEF2sZPY~MCUe>d9L3DmjB08_Q%`D&i&cd$sTY2xc;EA z?u-0j&8chXP|IRAf3z;`b(I*r&3~|Cjjh49P?BP_lO+5~;>jC_D0N-; zC8|@;4P>MaxH)d(WGbv%CpJwtkdf`T-|7ApqvFz!c8`y(4#fXs6X^fC9`yewc-I5ChVWBw@;WNe5&YYw0%)k}sMIJ~hW{V%!G{L` diff --git a/src/main/resources/assets/miscutils/textures/Orange.png b/src/main/resources/assets/miscutils/textures/Orange.png deleted file mode 100644 index 9de164d437c4ab0d23d7a344bf92bda26acd945a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 364 zcmeAS@N?(olHy`uVBq!ia0vp^4M6O`#0(_Y@0k7uNU@|l`Z_W&Z0zU$lgJ9>D{HZZU08-nxGO3D+9QW**oGxJLH@={9_O!N%&42?~gqpN_57(8A5T-G@yGywqS CI$>)7 diff --git a/src/main/resources/assets/miscutils/textures/OrangeHD.png b/src/main/resources/assets/miscutils/textures/OrangeHD.png deleted file mode 100644 index ea5e8af8cfb473e552b8b146b94ffa65ebbef1e2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5904 zcmcgwXE~B&dX#9iR66Kx(z{x-P6#xj80Dv_|08q#T z0G5E9CSxVy#8qeA`%vKW-<97|oJM>@5%9n&7yuYT{()r5jT;UCOdHxzH8c314ZE)| z_+^8Vcxpc0mvlt7wUZIp>>Ufr2JfBBonBO^sM9%Gwf)(dq8Xd|86w@Y^@!dzrKkMO z%lB_}@XGmjOu{Xg%Tl)IG$kP2Q2xEznPqz}Acvz;0yqNmMKPEIz!sGNYVf_GsuHlZ zOhxjXp0br4I6@}-N=5VX-f(>+@3?frXL9LFcc1SPjnwokd4SAQ*3^XbhFd)^4$yom zd=z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h}_C;(Adb(6gz$ZBSsoV$Y&i|2f<8%)Oxs<;D z8kd%{HZr550C-T`=m&bS3+Z83BFS=pWV}$%qrEuih-)V!CPK6p@~`4!(k|MZ zUf%7zpHC8GLttup+%L)CwfDkxW(TV;%qxmiL4Z*aHh?6loEvxsB8GN(B2Su6#L+`x zVy{XBiirPGvmoL~N(4C(bVTqFp-Kdbi2p}{|MS)}S=-o1O6FG6#23lLFBS;Vv_7ji}>FayiB|p yi3&IV?O^Kf7833h^biPe^7IQ4^LrS=BPAvwc1M1AwAz&@1ZZm-Kr7T8AO8pO3(MC4 diff --git a/src/main/resources/assets/miscutils/textures/PatreonCapeHD.png b/src/main/resources/assets/miscutils/textures/PatreonCapeHD.png deleted file mode 100644 index c4ebef82b2bd30df2757a90e9b2ae5911b5face0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10267 zcmd6NcTf{w)OLW-1f+;`frv=xU62k+fJj%6CM`sIlU@Xbpa=<|bm>iMR009%z4zXv zE4_CJkeA<|-+c4_|IVJhclYi&b9e5}J@f4IoX@)2YE*Yv?f?J)Dh>7L`TzjI?Ij?D zjPSN~oaB6S+W~ErwUhyXvKWdhE8^RGPMEsB769P?_|^{r09^j(zYYL+i2wkbmH>cE zG62BnmR6%Dcl&_E`i0ta0RF!ttG*!ac7)tb-Pi*FpnLb$_dpKCl37`+46pwtS9jF}`T^f!V|Du+dz{lFoG%@3kWTF6O z8>Z$Ys^+q0!!jQN6}a?MRe9&6&xdkim;;%NDab%E)`%?Dk<#J%SOO(FU0&3n2t@jj ziSq@GSO{5Y8;`wu6l6}Gk5;8)#vT-?je!uSy+VPQ5S0u{d`)CB1ZAh62|{Qe0zto! zSs}1c-E~^WWa4E{PKJ7Rd*SkTWY_`gf8TD_C~o% zI?TYmtr=uL#g0kiUudYGum);`1`G@IeAIWP2=-{B&KGzo=@DN=+BVW~TF z$@VhzYlt;6e}v46!aI!|vFOWdo#_-~t?kZpSW)Km{IRhIE^CqA5k{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`wnR@T9 Date: Tue, 17 Sep 2024 01:15:00 +0200 Subject: [PATCH 34/42] remove reflection and try catches from GregtechConduits --- .../core/util/minecraft/MaterialUtils.java | 5 +- .../gregtech/GregtechConduits.java | 245 ++++++------------ 2 files changed, 87 insertions(+), 163 deletions(-) diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/MaterialUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/MaterialUtils.java index 8b0d73cc8b7..5e75cc2050f 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/MaterialUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/MaterialUtils.java @@ -234,8 +234,7 @@ public static int getVoltageForTier(int aTier) { private static Materials getMaterialByName(String materialName) { for (Materials m : Materials.values()) { if (MaterialUtils.getMaterialName(m) - .toLowerCase() - .equals(materialName.toLowerCase())) { + .equalsIgnoreCase(materialName)) { return m; } } @@ -244,7 +243,7 @@ private static Materials getMaterialByName(String materialName) { public static String getMaterialName(Materials mat) { String mName = mat.mDefaultLocalName; - if (mName == null || mName.equals("")) { + if (mName == null || mName.isEmpty()) { mName = mat.mName; } return mName; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java index 9f66dc394f3..ec9eff9ebe3 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java @@ -2,15 +2,10 @@ import static gregtech.api.enums.Mods.EnderIO; import static gregtech.api.enums.Mods.Thaumcraft; -import static gregtech.api.recipe.RecipeMaps.assemblerRecipes; -import static gregtech.api.recipe.RecipeMaps.extruderRecipes; -import static gregtech.api.recipe.RecipeMaps.unpackagerRecipes; -import static gregtech.api.recipe.RecipeMaps.wiremillRecipes; +import static gregtech.api.recipe.RecipeMaps.*; import static gregtech.api.util.GTRecipeBuilder.SECONDS; import static gregtech.api.util.GTRecipeBuilder.TICKS; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import net.minecraft.item.ItemStack; @@ -41,13 +36,11 @@ public class GregtechConduits { // 30000-30999 - - private static int BaseWireID = 30600; - private static int BasePipeID = 30700; + private static final int BaseWireID = 30600; + private static final int BasePipeID = 30700; private static int BasePipeHexadecupleID = 30100; public static void run() { - Logger.INFO("Gregtech5u Content | Registering Custom Cables/Wires/Pipes."); if (GTPPCore.ConfigSwitches.enableCustom_Cables) { run1(); } @@ -58,142 +51,80 @@ public static void run() { } private static void run3() { - - try { - Class aPipeEntity = MTEFluid.class; - Constructor constructor = aPipeEntity.getConstructor( - int.class, - String.class, - String.class, - float.class, - Materials.class, - int.class, - int.class, - boolean.class, - int.class); - if (constructor != null) { - Logger.INFO("Generating Hexadecuple pipes."); - generateFluidMultiPipes( - constructor, - Materials.Copper, - MaterialUtils.getMaterialName(Materials.Copper), - "Copper", - BasePipeHexadecupleID++, - 60, - 1000, - true); - generateFluidMultiPipes( - constructor, - Materials.Bronze, - MaterialUtils.getMaterialName(Materials.Bronze), - "Bronze", - BasePipeHexadecupleID++, - 120, - 2000, - true); - generateFluidMultiPipes( - constructor, - Materials.Steel, - MaterialUtils.getMaterialName(Materials.Steel), - "Steel", - BasePipeHexadecupleID++, - 240, - 2500, - true); - generateFluidMultiPipes( - constructor, - Materials.StainlessSteel, - MaterialUtils.getMaterialName(Materials.StainlessSteel), - "Stainless Steel", - BasePipeHexadecupleID++, - 360, - 3000, - true); - generateFluidMultiPipes( - constructor, - Materials.Titanium, - MaterialUtils.getMaterialName(Materials.Titanium), - "Titanium", - BasePipeHexadecupleID++, - 480, - 5000, - true); - generateFluidMultiPipes( - constructor, - Materials.TungstenSteel, - MaterialUtils.getMaterialName(Materials.TungstenSteel), - "Tungsten Steel", - BasePipeHexadecupleID++, - 600, - 7500, - true); - generateFluidMultiPipes( - constructor, - Materials.Plastic, - MaterialUtils.getMaterialName(Materials.Plastic), - "Plastic", - BasePipeHexadecupleID++, - 360, - 350, - true); - - Materials aPTFE = Materials.get("Polytetrafluoroethylene"); - if (aPTFE != null) { - generateFluidMultiPipes( - constructor, - aPTFE, - MaterialUtils.getMaterialName(aPTFE), - "PTFE", - BasePipeHexadecupleID++, - 480, - 600, - true); - } - } else { - Logger.INFO("Failed during Hexadecuple pipe generation."); - } - - } catch (NoSuchMethodException | SecurityException e) { - Logger.INFO("Failed during Hexadecuple pipe generation. [Ecx]"); - e.printStackTrace(); - } + generateFluidMultiPipes( + Materials.Copper, + MaterialUtils.getMaterialName(Materials.Copper), + "Copper", + BasePipeHexadecupleID++, + 60, + 1000); + generateFluidMultiPipes( + Materials.Bronze, + MaterialUtils.getMaterialName(Materials.Bronze), + "Bronze", + BasePipeHexadecupleID++, + 120, + 2000); + generateFluidMultiPipes( + Materials.Steel, + MaterialUtils.getMaterialName(Materials.Steel), + "Steel", + BasePipeHexadecupleID++, + 240, + 2500); + generateFluidMultiPipes( + Materials.StainlessSteel, + MaterialUtils.getMaterialName(Materials.StainlessSteel), + "Stainless Steel", + BasePipeHexadecupleID++, + 360, + 3000); + generateFluidMultiPipes( + Materials.Titanium, + MaterialUtils.getMaterialName(Materials.Titanium), + "Titanium", + BasePipeHexadecupleID++, + 480, + 5000); + generateFluidMultiPipes( + Materials.TungstenSteel, + MaterialUtils.getMaterialName(Materials.TungstenSteel), + "Tungsten Steel", + BasePipeHexadecupleID++, + 600, + 7500); + generateFluidMultiPipes( + Materials.Plastic, + MaterialUtils.getMaterialName(Materials.Plastic), + "Plastic", + BasePipeHexadecupleID++, + 360, + 350); + + Materials aPTFE = Materials.get("Polytetrafluoroethylene"); + generateFluidMultiPipes(aPTFE, MaterialUtils.getMaterialName(aPTFE), "PTFE", BasePipeHexadecupleID++, 480, 600); } - private static void generateFluidMultiPipes(Constructor aClazz, Materials aMaterial, String name, - String displayName, int startID, int transferRatePerSec, int heatCapacity, boolean gasProof) { - MTEFluid aPipe; + private static void generateFluidMultiPipes(Materials aMaterial, String name, String displayName, int startID, + int transferRatePerSec, int heatCapacity) { final int transferRatePerTick = transferRatePerSec / 20; - try { - aPipe = aClazz.newInstance( - startID, - "GT_Pipe_" + name + "_Hexadecuple", - "Hexadecuple " + displayName + " Fluid Pipe", - 1.0F, - aMaterial, - transferRatePerTick, - heatCapacity, - gasProof, - 16); - if (aPipe == null) { - Logger.INFO("Failed to Generate " + aMaterial + " Hexadecuple pipes."); - } else { - Logger.INFO("Generated " + aMaterial + " Hexadecuple pipes."); - GTOreDictUnificator.registerOre("pipeHexadecuple" + aMaterial, aPipe.getStackForm(1L)); - } - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException e) { - Logger.INFO("Failed to Generate " + aMaterial + " Hexadecuple pipes. [Ecx]"); - e.printStackTrace(); - } + MTEFluid aPipe = new MTEFluid( + startID, + "GT_Pipe_" + name + "_Hexadecuple", + "Hexadecuple " + displayName + " Fluid Pipe", + 1.0F, + aMaterial, + transferRatePerTick, + heatCapacity, + true, + 16); + GTOreDictUnificator.registerOre("pipeHexadecuple" + aMaterial, aPipe.getStackForm(1L)); } private static void run1() { - wireFactory("RedstoneAlloy", 32, BaseWireID + 45, 0, 2, 1, new short[] { 178, 34, 34, 0 }); - // need to go back id because fluid pipes already occupy makeCustomWires(MaterialsElements.STANDALONE.HYPOGEN, BaseWireID - 15, 0, 0, 8, GTValues.V[11], false, true); - } private static void run2() { @@ -734,7 +665,6 @@ private static void generateGTFluidPipes(final Materials material, final int sta private static void generateNonGTFluidPipes(final GT_Materials material, final Material GGMaterial, final int startID, final int transferRatePerSec, final int heatResistance, final boolean isGasProof) { final int transferRatePerTick = transferRatePerSec / 20; - GTOreDictUnificator.registerOre( OrePrefixes.pipeTiny.get(material), new GTPPMTEFluid( @@ -922,28 +852,23 @@ public static void generatePipeRecipes(final String materialName, final long Mas } if ((eut < 512) && !output.equals("Void")) { - try { - final ItemStack pipePlateDouble = ItemUtils.getItemStackOfAmountFromOreDict("plateDouble" + output, 1) - .copy(); - if (pipePlateDouble != null) { - RecipeUtils.addShapedRecipe( - pipePlateDouble, - "craftingToolHardHammer", - pipePlateDouble, - pipePlateDouble, - null, - pipePlateDouble, - pipePlateDouble, - "craftingToolWrench", - pipePlateDouble, - ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Huge" + output, 1)); - } else { - Logger.INFO( - "Failed to add a recipe for " + materialName - + " Huge pipes. Double plates probably do not exist."); - } - } catch (Throwable t) { - t.printStackTrace(); + ItemStack pipePlateDouble = ItemUtils.getItemStackOfAmountFromOreDict("plateDouble" + output, 1); + if (pipePlateDouble != null) { + pipePlateDouble = pipePlateDouble.copy(); + RecipeUtils.addShapedRecipe( + pipePlateDouble, + "craftingToolHardHammer", + pipePlateDouble, + pipePlateDouble, + null, + pipePlateDouble, + pipePlateDouble, + "craftingToolWrench", + pipePlateDouble, + ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Huge" + output, 1)); + } else { + Logger.INFO( + "Failed to add a recipe for " + materialName + " Huge pipes. Double plates probably do not exist."); } } } From 4659a3d88d15ea5c9faa054161d5996ba6f598fd Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Tue, 17 Sep 2024 01:38:03 +0200 Subject: [PATCH 35/42] remove reflection from MTEHatchNaquadah --- .../implementations/MTEHatch.java | 8 +++ .../implementations/MTEHatchNaquadah.java | 56 +++---------------- 2 files changed, 16 insertions(+), 48 deletions(-) diff --git a/src/main/java/gregtech/api/metatileentity/implementations/MTEHatch.java b/src/main/java/gregtech/api/metatileentity/implementations/MTEHatch.java index bd0b3b6f613..8eb11ab37f2 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/MTEHatch.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/MTEHatch.java @@ -198,6 +198,14 @@ public final byte getTexturePage() { return (byte) (mTexturePage & 0x7F); } + public final byte getmTexturePage() { + return mTexturePage; + } + + public final byte getActualTexture() { + return actualTexture; + } + @Override public boolean doesFillContainers() { return false; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchNaquadah.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchNaquadah.java index 90db739be72..adcf85c7751 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchNaquadah.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchNaquadah.java @@ -1,16 +1,12 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; -import java.lang.reflect.Field; - import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import gregtech.api.enums.Materials; -import gregtech.api.enums.Textures; import gregtech.api.enums.Textures.BlockIcons; -import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -18,7 +14,6 @@ import gregtech.api.objects.GTRenderedTexture; import gregtech.api.util.GTUtility; import gtPlusPlus.core.lib.GTPPCore; -import gtPlusPlus.core.util.reflect.ReflectionUtils; public class MTEHatchNaquadah extends MTEHatchInput { @@ -51,14 +46,12 @@ private void initHatch() { @Override public ITexture[] getTexturesActive(final ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, - new GTRenderedTexture((IIconContainer) Textures.BlockIcons.NAQUADAH_REACTOR_FLUID_SIDE_ACTIVE) }; + return new ITexture[] { aBaseTexture, new GTRenderedTexture(BlockIcons.NAQUADAH_REACTOR_FLUID_SIDE_ACTIVE) }; } @Override public ITexture[] getTexturesInactive(final ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, - new GTRenderedTexture((IIconContainer) Textures.BlockIcons.NAQUADAH_REACTOR_FLUID_SIDE) }; + return new ITexture[] { aBaseTexture, new GTRenderedTexture(BlockIcons.NAQUADAH_REACTOR_FLUID_SIDE) }; } public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, @@ -98,6 +91,8 @@ public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new MTEHatchNaquadah(this.mName, this.mDescriptionArray, this.mTextures); } + private static final String[] aDescCache = new String[3]; + @Override public String[] getDescription() { if (aDescCache[0] == null || aDescCache[0].contains(".name") || aDescCache[0].contains("fluid.")) { @@ -112,14 +107,11 @@ public String[] getDescription() { String aNaq = aDescCache[0]; String aEnrNaq = aDescCache[1]; String aNaquad = aDescCache[2]; - String[] s2 = new String[] { "Fluid Input for Multiblocks", "Capacity: " + getCapacity() + "L", + return new String[] { "Fluid Input for Multiblocks", "Capacity: " + getCapacity() + "L", "Accepted Fluid: " + aNaq, "Accepted Fluid: " + aEnrNaq, "Accepted Fluid: " + aNaquad, GTPPCore.GT_Tooltip.get() }; - return s2; } - private static String[] aDescCache = new String[3]; - private String formatFluidString(FluidStack fluidStack) { String mTempMod = EnumChatFormatting.RESET.toString(); int mLockedTemp = fluidStack.getFluid() @@ -142,50 +134,18 @@ private String formatFluidString(FluidStack fluidStack) { return mTempMod + fluidStack.getLocalizedName(); } - @Override - public boolean doesFillContainers() { - return false; - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - // TODO Auto-generated method stub - return super.getTextureSet(aTextures); - } - - private Field F1, F2; - @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, int aColorIndex, boolean aActive, boolean aRedstone) { - byte a1 = 0, a2 = 0; - try { - if (F1 == null) { - F1 = ReflectionUtils.getField(getClass(), "actualTexture"); - } - if (F2 == null) { - F2 = ReflectionUtils.getField(getClass(), "mTexturePage"); - } - - if (F1 != null) { - a1 = F1.getByte(this); - } - if (F2 != null) { - a2 = F2.getByte(this); - } - } catch (IllegalArgumentException | IllegalAccessException n) {} - + byte a1 = this.getActualTexture(); + byte a2 = this.getmTexturePage(); int textureIndex = a1 | a2 << 7; byte texturePointer = (byte) (a1 & 127); - if (side == ForgeDirection.UP || side == ForgeDirection.DOWN) { ITexture g = textureIndex > 0 ? BlockIcons.casingTexturePages[a2][texturePointer] : BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1]; - - return new ITexture[] { g, - new GTRenderedTexture((IIconContainer) Textures.BlockIcons.NAQUADAH_REACTOR_FLUID_TOP_ACTIVE) }; + return new ITexture[] { g, new GTRenderedTexture(BlockIcons.NAQUADAH_REACTOR_FLUID_TOP_ACTIVE) }; } - return side != facing ? (textureIndex > 0 ? new ITexture[] { BlockIcons.casingTexturePages[a2][texturePointer] } : new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1] }) From fba2d98e733d02caef585bed6910894ed5abf375 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Tue, 17 Sep 2024 01:40:14 +0200 Subject: [PATCH 36/42] remove reflection from GTPPMTECable --- .../implementations/GTPPMTECable.java | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GTPPMTECable.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GTPPMTECable.java index 9025dad232d..5f6d3762f8a 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GTPPMTECable.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GTPPMTECable.java @@ -12,23 +12,10 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.MTECable; import gregtech.api.objects.GTRenderedTexture; -import gregtech.api.util.GTUtility; public class GTPPMTECable extends MTECable implements IMetaTileEntityCable { - private static Textures.BlockIcons INSULATION_MEDIUM_PLUS; - - static { - try { - INSULATION_MEDIUM_PLUS = (Textures.BlockIcons) GTUtility - .getField(Textures.BlockIcons.class, "INSULATION_MEDIUM_PLUS") - .get(null); - } catch (IllegalAccessException | NullPointerException e) { - throw new Error(e); - } - } - - private short[] vRGB = null; + private final short[] vRGB; public GTPPMTECable(final int aID, final String aName, final String aNameRegional, final float aThickNess, final Materials aMaterial, final long aCableLossPerMeter, final long aAmperage, final long aVoltage, @@ -134,7 +121,7 @@ private ITexture[] getTextureGTNH(IGregTechTileEntity aBaseMetaTileEntity, Forge return new ITexture[] { new GTRenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB), new GTRenderedTexture( - INSULATION_MEDIUM_PLUS, + Textures.BlockIcons.INSULATION_MEDIUM_PLUS, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.874F) // 0.825 x12 return new ITexture[] { From c999c4c8175713713994169dbcd3f2cf64189a37 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Tue, 17 Sep 2024 01:46:30 +0200 Subject: [PATCH 37/42] remove reflection from MTEAdvFusionMk4 and MTEAdvFusionMk5 --- .../processing/advanced/MTEAdvFusionMk4.java | 36 ++++++------------- .../processing/advanced/MTEAdvFusionMk5.java | 36 ++++++------------- 2 files changed, 22 insertions(+), 50 deletions(-) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvFusionMk4.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvFusionMk4.java index eed5159271b..7c2735c6e18 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvFusionMk4.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvFusionMk4.java @@ -1,7 +1,5 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced; -import java.lang.reflect.Method; - import net.minecraft.block.Block; import net.minecraftforge.common.util.ForgeDirection; @@ -13,7 +11,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.logic.ProcessingLogic; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.MTEHatch; import gregtech.api.metatileentity.implementations.MTEHatchEnergy; import gregtech.api.metatileentity.implementations.MTEHatchInput; import gregtech.api.metatileentity.implementations.MTEHatchOutput; @@ -25,17 +22,10 @@ import gregtech.common.tileentities.machines.multi.MTEFusionComputer; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.GTPPCore; -import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; public class MTEAdvFusionMk4 extends MTEFusionComputer { - public static final Method mUpdateHatchTexture; - - static { - mUpdateHatchTexture = ReflectionUtils.getMethod(MTEHatch.class, "updateTexture", int.class); - } - public MTEAdvFusionMk4(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } @@ -160,24 +150,20 @@ public IIconContainer getIconOverlay() { @Override public boolean turnCasingActive(final boolean status) { - try { - if (this.mEnergyHatches != null) { - for (final MTEHatchEnergy hatch : this.mEnergyHatches) { - mUpdateHatchTexture.invoke(hatch, (status ? TAE.getIndexFromPage(2, 14) : 53)); - } + if (this.mEnergyHatches != null) { + for (final MTEHatchEnergy hatch : this.mEnergyHatches) { + hatch.updateTexture((status ? TAE.getIndexFromPage(2, 14) : 53)); } - if (this.mOutputHatches != null) { - for (final MTEHatchOutput hatch2 : this.mOutputHatches) { - mUpdateHatchTexture.invoke(hatch2, (status ? TAE.getIndexFromPage(2, 14) : 53)); - } + } + if (this.mOutputHatches != null) { + for (final MTEHatchOutput hatch : this.mOutputHatches) { + hatch.updateTexture(status ? TAE.getIndexFromPage(2, 14) : 53); } - if (this.mInputHatches != null) { - for (final MTEHatchInput hatch3 : this.mInputHatches) { - mUpdateHatchTexture.invoke(hatch3, (status ? TAE.getIndexFromPage(2, 14) : 53)); - } + } + if (this.mInputHatches != null) { + for (final MTEHatchInput hatch : this.mInputHatches) { + hatch.updateTexture(status ? TAE.getIndexFromPage(2, 14) : 53); } - } catch (Throwable t) { - return false; } return true; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvFusionMk5.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvFusionMk5.java index 9ed65ffa086..52928268cf3 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvFusionMk5.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvFusionMk5.java @@ -1,7 +1,5 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced; -import java.lang.reflect.Method; - import net.minecraft.block.Block; import net.minecraftforge.common.util.ForgeDirection; @@ -13,7 +11,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.logic.ProcessingLogic; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.MTEHatch; import gregtech.api.metatileentity.implementations.MTEHatchEnergy; import gregtech.api.metatileentity.implementations.MTEHatchInput; import gregtech.api.metatileentity.implementations.MTEHatchOutput; @@ -25,17 +22,10 @@ import gregtech.common.tileentities.machines.multi.MTEFusionComputer; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.GTPPCore; -import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; public class MTEAdvFusionMk5 extends MTEFusionComputer { - public static final Method mUpdateHatchTexture; - - static { - mUpdateHatchTexture = ReflectionUtils.getMethod(MTEHatch.class, "updateTexture", int.class); - } - public MTEAdvFusionMk5(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } @@ -160,24 +150,20 @@ public IIconContainer getIconOverlay() { @Override public boolean turnCasingActive(final boolean status) { - try { - if (this.mEnergyHatches != null) { - for (final MTEHatchEnergy hatch : this.mEnergyHatches) { - mUpdateHatchTexture.invoke(hatch, (status ? TAE.getIndexFromPage(3, 6) : 53)); - } + if (this.mEnergyHatches != null) { + for (final MTEHatchEnergy hatch : this.mEnergyHatches) { + hatch.updateTexture(status ? TAE.getIndexFromPage(3, 6) : 53); } - if (this.mOutputHatches != null) { - for (final MTEHatchOutput hatch2 : this.mOutputHatches) { - mUpdateHatchTexture.invoke(hatch2, (status ? TAE.getIndexFromPage(3, 6) : 53)); - } + } + if (this.mOutputHatches != null) { + for (final MTEHatchOutput hatch : this.mOutputHatches) { + hatch.updateTexture(status ? TAE.getIndexFromPage(3, 6) : 53); } - if (this.mInputHatches != null) { - for (final MTEHatchInput hatch3 : this.mInputHatches) { - mUpdateHatchTexture.invoke(hatch3, (status ? TAE.getIndexFromPage(3, 6) : 53)); - } + } + if (this.mInputHatches != null) { + for (final MTEHatchInput hatch : this.mInputHatches) { + hatch.updateTexture(status ? TAE.getIndexFromPage(3, 6) : 53); } - } catch (Throwable t) { - return false; } return true; } From 670b56865f7e36f53fd2fc81bfb6028b91b5a3eb Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Tue, 17 Sep 2024 04:04:58 +0200 Subject: [PATCH 38/42] remove reflection from BioRecipes.java that's just calling GTModHandler.addCraftingRecipe with extra steps... --- .../core/item/chemistry/GenericChem.java | 51 +++++---- .../plugin/agrichem/BioRecipes.java | 105 +++++------------- 2 files changed, 50 insertions(+), 106 deletions(-) diff --git a/src/main/java/gtPlusPlus/core/item/chemistry/GenericChem.java b/src/main/java/gtPlusPlus/core/item/chemistry/GenericChem.java index 99885d77e88..4ba835d57d1 100644 --- a/src/main/java/gtPlusPlus/core/item/chemistry/GenericChem.java +++ b/src/main/java/gtPlusPlus/core/item/chemistry/GenericChem.java @@ -40,7 +40,6 @@ import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.plugin.agrichem.BioRecipes; import gtPlusPlus.plugin.agrichem.block.AgrichemFluids; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; @@ -866,100 +865,100 @@ private static void recipeAdvancedChip() { 0, new Object[] { OrePrefixes.circuit.get(Materials.HV) }); - long bits = 0; - BioRecipes.addCraftingRecipe( + final long bits = 0; + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 1L), bits, new Object[] { "d ", " P ", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 2L), bits, new Object[] { " d ", " P ", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 3L), bits, new Object[] { " d", " P ", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 4L), bits, new Object[] { " ", " Pd", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 5L), bits, new Object[] { " ", " P ", " d", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 6L), bits, new Object[] { " ", " P ", " d ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 7L), bits, new Object[] { " ", " P ", "d ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 8L), bits, new Object[] { " ", "dP ", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 9L), bits, new Object[] { "P d", " ", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 10L), bits, new Object[] { "P ", " d", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 11L), bits, new Object[] { "P ", " ", " d", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 12L), bits, new Object[] { "P ", " ", " d ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 13L), bits, new Object[] { " P", " ", " d", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 14L), bits, new Object[] { " P", " ", " d ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 15L), bits, new Object[] { " P", " ", "d ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 16L), bits, new Object[] { " P", "d ", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 17L), bits, new Object[] { " ", " ", "d P", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 18L), bits, new Object[] { " ", "d ", " P", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 19L), bits, new Object[] { "d ", " ", " P", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 20L), bits, new Object[] { " d ", " ", " P", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 21L), bits, new Object[] { "d ", " ", "P ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 22L), bits, new Object[] { " d ", " ", "P ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 23L), bits, new Object[] { " d", " ", "P ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); - BioRecipes.addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 24L), bits, new Object[] { " ", " d", "P ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L) }); diff --git a/src/main/java/gtPlusPlus/plugin/agrichem/BioRecipes.java b/src/main/java/gtPlusPlus/plugin/agrichem/BioRecipes.java index 5164967a90e..622ae92281f 100644 --- a/src/main/java/gtPlusPlus/plugin/agrichem/BioRecipes.java +++ b/src/main/java/gtPlusPlus/plugin/agrichem/BioRecipes.java @@ -23,13 +23,10 @@ import static gtPlusPlus.api.recipe.GTPPRecipeMaps.chemicalPlantRecipes; import static gtPlusPlus.api.recipe.GTPPRecipeMaps.cokeOvenRecipes; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; -import net.minecraft.enchantment.Enchantment; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -58,7 +55,6 @@ import gtPlusPlus.core.util.minecraft.MaterialUtils; import gtPlusPlus.core.util.minecraft.OreDictUtils; import gtPlusPlus.core.util.minecraft.RecipeUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.plugin.agrichem.block.AgrichemFluids; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.railcraft.utils.RailcraftUtils; @@ -1105,153 +1101,102 @@ private static void recipeBioChip() { 0, new Object[] { OrePrefixes.circuit.get(Materials.ULV) }); - long bits = 0; - addCraftingRecipe( + final long bits = 0; + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 1L), bits, new Object[] { "d ", " P ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 2L), bits, new Object[] { " d ", " P ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 3L), bits, new Object[] { " d", " P ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 4L), bits, new Object[] { " ", " Pd", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 5L), bits, new Object[] { " ", " P ", " d", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 6L), bits, new Object[] { " ", " P ", " d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 7L), bits, new Object[] { " ", " P ", "d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 8L), bits, new Object[] { " ", "dP ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 9L), bits, new Object[] { "P d", " ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 10L), bits, new Object[] { "P ", " d", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 11L), bits, new Object[] { "P ", " ", " d", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 12L), bits, new Object[] { "P ", " ", " d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 13L), bits, new Object[] { " P", " ", " d", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 14L), bits, new Object[] { " P", " ", " d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 15L), bits, new Object[] { " P", " ", "d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 16L), bits, new Object[] { " P", "d ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 17L), bits, new Object[] { " ", " ", "d P", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 18L), bits, new Object[] { " ", "d ", " P", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 19L), bits, new Object[] { "d ", " ", " P", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 20L), bits, new Object[] { " d ", " ", " P", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 21L), bits, new Object[] { "d ", " ", "P ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 22L), bits, new Object[] { " d ", " ", "P ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 23L), bits, new Object[] { " d", " ", "P ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); - addCraftingRecipe( + GTModHandler.addCraftingRecipe( GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 24L), bits, new Object[] { " ", " d", "P ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L) }); } - - public static boolean addCraftingRecipe(ItemStack aResult, long aBitMask, Object[] aRecipe) { - Method mAddRecipe = ReflectionUtils.getMethod( - GTModHandler.class, - "addCraftingRecipe", - ItemStack.class, - Enchantment[].class, - int[].class, - boolean.class, - boolean.class, - boolean.class, - boolean.class, - boolean.class, - boolean.class, - boolean.class, - boolean.class, - boolean.class, - boolean.class, - boolean.class, - boolean.class, - boolean.class, - Object[].class); - boolean didInvoke = false; - if (mAddRecipe != null) { - try { - didInvoke = (boolean) mAddRecipe.invoke( - null, - aResult, - new Enchantment[] {}, - new int[] {}, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - true, - aRecipe); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return didInvoke; - } } From 2098c456ba243820a9ac3a66a2dd03f8b74b8e2a Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Tue, 17 Sep 2024 04:15:25 +0200 Subject: [PATCH 39/42] remove reflection from PartP2PGTPower and just delegate to super implementation --- .../loaders/postload/PartP2PGTPower.java | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/main/java/gregtech/loaders/postload/PartP2PGTPower.java b/src/main/java/gregtech/loaders/postload/PartP2PGTPower.java index cb8d73cae13..3d62c07bb9e 100644 --- a/src/main/java/gregtech/loaders/postload/PartP2PGTPower.java +++ b/src/main/java/gregtech/loaders/postload/PartP2PGTPower.java @@ -1,7 +1,5 @@ package gregtech.loaders.postload; -import java.lang.reflect.Field; - import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; @@ -11,10 +9,8 @@ import appeng.api.networking.ticking.IGridTickable; import appeng.api.networking.ticking.TickRateModulation; import appeng.api.networking.ticking.TickingRequest; -import appeng.parts.AEBasePart; import appeng.parts.p2p.PartP2PIC2Power; import gregtech.api.interfaces.tileentity.IEnergyConnected; -import gregtech.api.util.GTLog; public class PartP2PGTPower extends PartP2PIC2Power implements IGridTickable { @@ -88,17 +84,4 @@ public TickingRequest getTickingRequest(IGridNode iGridNode) { public TickRateModulation tickingRequest(IGridNode iGridNode, int i) { return outputEnergy() ? TickRateModulation.FASTER : TickRateModulation.SLOWER; } - - @Override - public ForgeDirection getSide() { - try { - Field fSide = AEBasePart.class.getDeclaredField("side"); - fSide.setAccessible(true); - return (ForgeDirection) fSide.get(this); - } catch (Exception e) { - GTLog.out.println("A fatal error occured at the P2P tunnel for GT electricity"); - e.printStackTrace(GTLog.out); - throw new RuntimeException(e); - } - } } From 474160812a17c637378b0c59619433fddf5727fb Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Tue, 17 Sep 2024 04:26:50 +0200 Subject: [PATCH 40/42] move some fields that can be local variables in AssemblyLineServer --- .../gregtech/api/util/AssemblyLineServer.java | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/main/java/gregtech/api/util/AssemblyLineServer.java b/src/main/java/gregtech/api/util/AssemblyLineServer.java index 49e3882982f..8e0c6ba81b1 100644 --- a/src/main/java/gregtech/api/util/AssemblyLineServer.java +++ b/src/main/java/gregtech/api/util/AssemblyLineServer.java @@ -16,15 +16,14 @@ public class AssemblyLineServer { public static LinkedHashMap lServerNames = new LinkedHashMap<>(); - private static LinkedHashMap internal2 = new LinkedHashMap<>(), internal3 = new LinkedHashMap<>(), - internal4 = new LinkedHashMap<>(); - private static HashMap internal = new HashMap<>(); public static void fillMap(FMLPreInitializationEvent aEvent) { - Configuration conf = GTLanguageManager.sEnglishFile; - - ConfigCategory cat = conf.getCategory("languagefile"); - internal.putAll(cat.getValues()); + final Configuration conf = GTLanguageManager.sEnglishFile; + final ConfigCategory cat = conf.getCategory("languagefile"); + final HashMap internal = new HashMap<>(cat.getValues()); + final LinkedHashMap internal2 = new LinkedHashMap<>(); + final LinkedHashMap internal3 = new LinkedHashMap<>(); + final LinkedHashMap internal4 = new LinkedHashMap<>(); for (Map.Entry entry : internal.entrySet()) { try { String s = entry.getValue() @@ -253,7 +252,6 @@ else if (entry.getKey() .length() - ".name".length()); i = Integer.parseInt(t); lServerNames.put(entry.getKey(), "Block of " + mMats[i].toString()); - mMats = null; } else if (entry.getKey() .contains("blockgem")) { Materials[] mMats = null; @@ -284,14 +282,8 @@ else if (entry.getKey() .length() - ".name".length()); i = Integer.parseInt(t); lServerNames.put(entry.getKey(), "Block of " + mMats[i].toString()); - mMats = null; } } catch (Exception ignored) {} } - - internal = null; - internal2 = null; - internal3 = null; - internal4 = null; } } From d60ed47ae1a0131ba33e923c452123e427eedc9f Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Tue, 17 Sep 2024 04:37:24 +0200 Subject: [PATCH 41/42] remove reflection from GregTechAPI.constructBaseMetaTileEntity --- src/main/java/gregtech/api/GregTechAPI.java | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/main/java/gregtech/api/GregTechAPI.java b/src/main/java/gregtech/api/GregTechAPI.java index c485c8e47e0..70d1a0c2ce9 100644 --- a/src/main/java/gregtech/api/GregTechAPI.java +++ b/src/main/java/gregtech/api/GregTechAPI.java @@ -268,8 +268,6 @@ public class GregTechAPI { sLoadStarted = false, sLoadFinished = false, sPostloadStarted = false, sPostloadFinished = false, sFullLoadFinished = false; - private static Class sBaseMetaTileEntityClass = null; - @SuppressWarnings("unchecked") private static final IntFunction[] teCreators = new IntFunction[16]; @@ -390,16 +388,8 @@ public static boolean isMachineBlock(Block aBlock, int aMeta) { * Electricity) we have to use invocation at the constructor of the BaseMetaTileEntity. */ public static BaseMetaTileEntity constructBaseMetaTileEntity() { - if (sBaseMetaTileEntityClass == null) { - try { - return (sBaseMetaTileEntityClass = BaseMetaTileEntity.class).getDeclaredConstructor() - .newInstance(); - } catch (Throwable ignored) {} - } - try { - return sBaseMetaTileEntityClass.getDeclaredConstructor() - .newInstance(); + return new BaseMetaTileEntity(); } catch (Throwable e) { GTLog.err.println("GTMod: Fatal Error occurred while initializing TileEntities, crashing Minecraft."); e.printStackTrace(GTLog.err); From d869dae9af9f0a6e82274b381d4b784a6f80a267 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Tue, 17 Sep 2024 05:04:01 +0200 Subject: [PATCH 42/42] remove reflection from GTCLSCompat --- .../java/gregtech/api/enums/GTValues.java | 1 - .../java/gregtech/api/util/GTCLSCompat.java | 78 +++++-------------- src/main/java/gregtech/common/GTProxy.java | 12 +-- .../gregtech/loaders/postload/GTPostLoad.java | 12 +-- 4 files changed, 27 insertions(+), 76 deletions(-) diff --git a/src/main/java/gregtech/api/enums/GTValues.java b/src/main/java/gregtech/api/enums/GTValues.java index 09cb0cb75c1..388e2aec76b 100644 --- a/src/main/java/gregtech/api/enums/GTValues.java +++ b/src/main/java/gregtech/api/enums/GTValues.java @@ -524,7 +524,6 @@ public static final class NBT { public static boolean alwaysReloadChunkloaders = false; public static boolean debugChunkloaders = false; - public static boolean cls_enabled; public static final Set mCTMEnabledBlock = new HashSet<>(); public static final Set mCTMDisabledBlock = new HashSet<>(); diff --git a/src/main/java/gregtech/api/util/GTCLSCompat.java b/src/main/java/gregtech/api/util/GTCLSCompat.java index 823a7b850ea..b8259d25472 100644 --- a/src/main/java/gregtech/api/util/GTCLSCompat.java +++ b/src/main/java/gregtech/api/util/GTCLSCompat.java @@ -1,69 +1,32 @@ package gregtech.api.util; +import java.io.IOException; import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.Collection; -import java.util.Optional; import java.util.Set; import java.util.function.Consumer; import java.util.function.Function; +import alexiil.mods.load.MinecraftDisplayer; +import alexiil.mods.load.ProgressDisplayer; import cpw.mods.fml.common.ProgressManager; import gregtech.GTMod; import gregtech.api.enums.Materials; import gregtech.common.GTProxy; import gregtech.loaders.postload.GTPostLoad; -@SuppressWarnings("rawtypes, unchecked, deprecation") +@SuppressWarnings("rawtypes, deprecation") public class GTCLSCompat { - private static Class alexiilMinecraftDisplayer; - private static Class alexiilProgressDisplayer; private static Class cpwProgressBar; - - private static Method getLastPercent; - private static Method displayProgress; - - private static Field isReplacingVanillaMaterials; - private static Field isRegisteringGTmaterials; private static Field progressBarStep; static { - // CLS - try { - alexiilMinecraftDisplayer = Class.forName("alexiil.mods.load.MinecraftDisplayer"); - alexiilProgressDisplayer = Class.forName("alexiil.mods.load.ProgressDisplayer"); - } catch (ClassNotFoundException ex) { - GTMod.GT_FML_LOGGER.catching(ex); - } - try { cpwProgressBar = Class.forName("cpw.mods.fml.common.ProgressManager$ProgressBar"); } catch (ClassNotFoundException ex) { GTMod.GT_FML_LOGGER.catching(ex); } - - Optional.ofNullable(alexiilMinecraftDisplayer) - .ifPresent(e -> { - try { - getLastPercent = e.getMethod("getLastPercent"); - isReplacingVanillaMaterials = e.getField("isReplacingVanillaMaterials"); - isRegisteringGTmaterials = e.getField("isRegisteringGTmaterials"); - } catch (NoSuchMethodException | NoSuchFieldException ex) { - GTMod.GT_FML_LOGGER.catching(ex); - } - }); - - Optional.ofNullable(alexiilProgressDisplayer) - .ifPresent(e -> { - try { - displayProgress = e.getMethod("displayProgress", String.class, float.class); - } catch (NoSuchMethodException ex) { - GTMod.GT_FML_LOGGER.catching(ex); - } - }); - try { progressBarStep = cpwProgressBar.getDeclaredField("step"); progressBarStep.setAccessible(true); @@ -91,9 +54,9 @@ private static void registerAndReportProgression(String materialsType, Colle String materialName = getName.apply(m) .toString(); try { - displayProgress.invoke(null, materialName, (float) currentStep / sizeStep); - } catch (IllegalAccessException | InvocationTargetException iae) { - GTMod.GT_FML_LOGGER.error("While updating progression", iae); + ProgressDisplayer.displayProgress(materialName, (float) currentStep / sizeStep); + } catch (IOException e) { + GTMod.GT_FML_LOGGER.error("While updating progression", e); } try { progressBarStep.set(progressBar, currentStep); @@ -119,12 +82,8 @@ private static void registerAndReportProgression(String materialsType, Colle } public static void stepMaterialsCLS(Collection mEvents, - ProgressManager.ProgressBar progressBar) throws IllegalAccessException { - try { - isRegisteringGTmaterials.set(null, true); - } catch (IllegalArgumentException | IllegalAccessException e) { - GTMod.GT_FML_LOGGER.catching(e); - } + ProgressManager.ProgressBar progressBar) { + MinecraftDisplayer.isRegisteringGTmaterials = true; registerAndReportProgression( "GregTech materials", mEvents, @@ -132,16 +91,12 @@ public static void stepMaterialsCLS(Collection mE m -> m.mMaterial, GTProxy::registerRecipes); ProgressManager.pop(progressBar); - isRegisteringGTmaterials.set(null, false); + MinecraftDisplayer.isRegisteringGTmaterials = false; } public static void doActualRegistrationCLS(ProgressManager.ProgressBar progressBar, Set replacedVanillaItemsSet) { - try { - isReplacingVanillaMaterials.set(null, true); - } catch (IllegalArgumentException | IllegalAccessException e) { - GTMod.GT_FML_LOGGER.catching(e); - } + MinecraftDisplayer.isReplacingVanillaMaterials = true; registerAndReportProgression( "Vanilla materials", replacedVanillaItemsSet, @@ -150,8 +105,13 @@ public static void doActualRegistrationCLS(ProgressManager.ProgressBar progressB GTPostLoad::doActualRegistration); } - public static void pushToDisplayProgress() throws InvocationTargetException, IllegalAccessException { - isReplacingVanillaMaterials.set(null, false); - displayProgress.invoke(null, "Post Initialization: loading GregTech", getLastPercent.invoke(null)); + public static void pushToDisplayProgress() { + MinecraftDisplayer.isReplacingVanillaMaterials = false; + try { + ProgressDisplayer + .displayProgress("Post Initialization: loading GregTech", MinecraftDisplayer.getLastPercent()); + } catch (IOException e) { + GTMod.GT_FML_LOGGER.error("Exception caught when updating loading screen", e); + } } } diff --git a/src/main/java/gregtech/common/GTProxy.java b/src/main/java/gregtech/common/GTProxy.java index ef7070cb593..221fcd6f1f0 100644 --- a/src/main/java/gregtech/common/GTProxy.java +++ b/src/main/java/gregtech/common/GTProxy.java @@ -2719,15 +2719,11 @@ public void registerUnificationEntries() { public void activateOreDictHandler() { this.mOreDictActivated = true; ProgressManager.ProgressBar progressBar = ProgressManager.push("Register materials", mEvents.size()); - if (BetterLoadingScreen.isModLoaded()) { - GTValues.cls_enabled = true; - try { - GTCLSCompat.stepMaterialsCLS(mEvents, progressBar); - } catch (IllegalAccessException e) { - GT_FML_LOGGER.catching(e); - } - } else GTProxy.stepMaterialsVanilla(this.mEvents, progressBar); + GTCLSCompat.stepMaterialsCLS(mEvents, progressBar); + } else { + GTProxy.stepMaterialsVanilla(this.mEvents, progressBar); + } } @Deprecated diff --git a/src/main/java/gregtech/loaders/postload/GTPostLoad.java b/src/main/java/gregtech/loaders/postload/GTPostLoad.java index ffcd815156b..35c4e2d874b 100644 --- a/src/main/java/gregtech/loaders/postload/GTPostLoad.java +++ b/src/main/java/gregtech/loaders/postload/GTPostLoad.java @@ -1,5 +1,6 @@ package gregtech.loaders.postload; +import static gregtech.api.enums.Mods.BetterLoadingScreen; import static gregtech.api.enums.Mods.Forestry; import static gregtech.api.enums.Mods.GalacticraftCore; import static gregtech.api.enums.Mods.GalacticraftMars; @@ -13,7 +14,6 @@ import static gregtech.api.util.GTRecipeBuilder.SECONDS; import static gregtech.api.util.GTRecipeBuilder.TICKS; -import java.lang.reflect.InvocationTargetException; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -416,13 +416,9 @@ public static void replaceVanillaMaterials() { ProgressManager.ProgressBar progressBar = ProgressManager .push("Register materials", replaceVanillaItemsSet.size()); - if (GTValues.cls_enabled) { - try { - GTCLSCompat.doActualRegistrationCLS(progressBar, replaceVanillaItemsSet); - GTCLSCompat.pushToDisplayProgress(); - } catch (InvocationTargetException | IllegalAccessException e) { - GTMod.GT_FML_LOGGER.catching(e); - } + if (BetterLoadingScreen.isModLoaded()) { + GTCLSCompat.doActualRegistrationCLS(progressBar, replaceVanillaItemsSet); + GTCLSCompat.pushToDisplayProgress(); } else { replaceVanillaItemsSet.forEach(m -> { progressBar.step(m.mDefaultLocalName);