diff options
author | Alkalus <Draknyte1@hotmail.com> | 2020-03-28 02:09:24 +0000 |
---|---|---|
committer | Alkalus <Draknyte1@hotmail.com> | 2020-03-28 02:09:24 +0000 |
commit | f39e8134fcef5da8bd04503c5233b2b6de249b3a (patch) | |
tree | 5713706bbff562e41ee5ebb4c896f5beab6e396d | |
parent | 0678527ea975b4a95eb7f3d6547b79865b0a2a0e (diff) | |
download | GT5-Unofficial-f39e8134fcef5da8bd04503c5233b2b6de249b3a.tar.gz GT5-Unofficial-f39e8134fcef5da8bd04503c5233b2b6de249b3a.tar.bz2 GT5-Unofficial-f39e8134fcef5da8bd04503c5233b2b6de249b3a.zip |
+ Added more 'Special Behaviour' items for my multiblocks as Examples.
+ Added '/gtpp hand' command.
+ Added TungstenSteel & Neutronium tool variants to NEI while in dev.
+ Added Large Semifluid Generator and a crafting recipe for it.
+ Added Placeholder for Adv. Assembly Line.
+ Added Distillus Upgrade Chip and a crafting recipe for it.
% Updated build.gradle.
% Reworked a few recipes.
$ Fixed ULV Overflow Covers using 0L Water in assembler. (https://github.com/GTNewHorizons/NewHorizons/issues/5700)
$ Fixed Integral Encasement I using 0L Steel in assembler. (https://github.com/GTNewHorizons/NewHorizons/issues/5617)
$ Fixed Thaumcraft based FakePlayer's triggering Fluorite drops. (https://github.com/GTNewHorizons/NewHorizons/issues/5744)
$ Fixed bad handling of hatch textures on a few multiblocks.
$ Semi-Fixed Distillus.
$ Fixed Semifluid Generator recipes.
$ Fixed Semifluid Generators crashing the game when mined.
$ Fixed bad handling of calls to ItemList.java.
$ Began work fixing all ASM to be more compatible with ProGuard.
$ Fixed compiler complaining about varargs.
^ Bumped version to 1.7.05.x.
55 files changed, 2603 insertions, 1173 deletions
diff --git a/build.gradle b/build.gradle index ab5fec70de..f8260d8e38 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,6 @@ buildscript { repositories { + mavenLocal() mavenCentral() jcenter() //maven { @@ -20,8 +21,8 @@ buildscript { } dependencies { classpath "net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT" - classpath 'net.sf.proguard:proguard-gradle:6.2.2' //classpath "gradle.plugin.se.bjurr.gitchangelog:git-changelog-gradle-plugin:1.55" + classpath 'net.sf.proguard:proguard-gradle:6.2.2' } } @@ -81,7 +82,10 @@ compileJava.options.encoding = 'UTF-8' minecraft { version = "${config.minecraft.version}-${config.forge.version}" - runDir = "eclipse" + runDir = "eclipse" + srgExtra "PK: org/dom4j gtpp/shaded/org/dom4j" + srgExtra "PK: org/javassist gtpp/shaded/org/javassist" + srgExtra "PK: org/reflections/reflections gtpp/shaded/org/reflections" } idea { module { inheritOutputDirs = true } } @@ -89,7 +93,8 @@ idea { module { inheritOutputDirs = true } } configurations { provided embedded - compile.extendsFrom provided, embedded + shade + compile.extendsFrom provided, embedded, shade } repositories { @@ -110,8 +115,35 @@ sourceSets { } } +processResources +{ + // this will ensure that this task is redone when the versions change. + inputs.property "version", project.version + inputs.property "mcversion", project.minecraft.version + + // replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' + + // replace version and mcversion + expand 'version':project.version, 'mcversion':project.minecraft.version + } + + // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } + exclude '**/Thumbs.db' +} + dependencies { + // Used for productive reflection without class loading. (0.9.12 has no reliance on Guava either) + //shade group: 'org.reflections', name: 'reflections', version: '0.9.12' + //shade group: 'org.dom4j', name: 'dom4j', version: '2.1.1' + //compile group: 'org.javassist', name: 'javassist', version: '3.26.0-GA' + + //compile files('libs/gregtech-5.08.33-dev.jar') compile files('libs/gregtech-5.09.31-dev.jar') @@ -122,7 +154,7 @@ dependencies { compile "codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev" compile "codechicken:CodeChickenCore:1.7.10-1.0.7.47:dev" compile "codechicken:NotEnoughItems:1.7.10-1.0.5.120:dev" - compile files('libs/PlayerAPI-1.7.10-1.4.jar') + compile "api.player:PlayerAPI:1.7.10-1.4" compile "com.enderio.core:EnderCore:1.7.10-0.2.0.39_beta:dev" compile "com.enderio:EnderIO:1.7.10-2.3.0.430_beta:dev" @@ -143,33 +175,17 @@ dependencies { compile "com.azanor.baubles:Baubles:1.7.10-1.0.1.10:deobf" } -processResources -{ - // this will ensure that this task is redone when the versions change. - inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.version - - // replace stuff in mcmod.info, nothing else - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' - - // replace version and mcversion - expand 'version':project.version, 'mcversion':project.minecraft.version - } - - // copy everything else, thats not the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - } - exclude '**/Thumbs.db' -} - jar { archiveName = archivesBaseName + "-" + version + ".jar" manifest { attributes 'FMLCorePlugin': 'gtPlusPlus.preloader.asm.Preloader_FMLLoadingPlugin' attributes 'FMLCorePluginContainsFMLMod': 'true' } + configurations.shade.each { dep -> + from(project.zipTree(dep)){ + exclude 'META-INF', 'META-INF/**' + } + } } task generateDictionaries(type: JavaExec) { @@ -212,7 +228,7 @@ task proguard(type: proguard.gradle.ProGuardTask) { build.finalizedBy(generateDictionaries) // Obfuscate this bitch. -//build.finalizedBy(proguard) // Disabled until optimization is working 100% +build.finalizedBy(proguard) // Disabled until optimization is working 100% //build.finalizedBy(gitChangelogTask) //build.finalizedBy(curseChangelogTask) diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index 6f734db111..71adfcb1c2 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -43,7 +43,6 @@ import gtPlusPlus.core.handler.events.MissingMappingsEvent; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.nuclear.FLUORIDES; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.data.LocaleUtils; import gtPlusPlus.core.util.minecraft.HazmatUtils; @@ -65,7 +64,6 @@ import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechMiniRaFusion; import gtPlusPlus.xmod.thaumcraft.commands.CommandDumpAspects; import net.minecraft.launchwrapper.Launch; import net.minecraft.util.IIcon; -import net.minecraftforge.oredict.OreDictionary; @MCVersion(value = "1.7.10") @Mod(modid = CORE.MODID, name = CORE.name, version = CORE.VERSION, dependencies = "required-after:Forge; after:TConstruct; after:PlayerAPI; after:dreamcraft; after:IC2; after:ihl; after:psychedelicraft; after:gregtech; after:Forestry; after:MagicBees; after:CoFHCore; after:Growthcraft; after:Railcraft; after:CompactWindmills; after:ForbiddenMagic; after:MorePlanet; after:PneumaticCraft; after:ExtraUtilities; after:Thaumcraft; after:rftools; after:simplyjetpacks; after:BigReactors; after:EnderIO; after:tectech; after:GTRedtech; after:beyondrealitycore; after:OpenBlocks; after:IC2NuclearControl; after:TGregworks; after:StevesCarts; after:xreliquary;") @@ -203,12 +201,8 @@ public class GTplusplus implements ActionListener { Meta_GT_Proxy.postInit(); Core_Manager.postInit(); //SprinklerHandler.registerModFerts(); - - //Set Variables for Fluorite Block handling - Logger.INFO("Setting some Variables for the block break event handler."); - BlockEventHandler.oreLimestone = OreDictionary.getOres("oreLimestone"); - BlockEventHandler.blockLimestone = OreDictionary.getOres("limestone"); - BlockEventHandler.fluoriteOre = FLUORIDES.FLUORITE.getOre(1); + + BlockEventHandler.init(); Logger.INFO("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); Logger.INFO("| Recipes succesfully Loaded: " + RegistrationHandler.recipesSuccess + " | Failed: " diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoEUBonusMultiBehaviour.java b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoEUBonusMultiBehaviour.java new file mode 100644 index 0000000000..78341db7a1 --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoEUBonusMultiBehaviour.java @@ -0,0 +1,27 @@ +package gtPlusPlus.api.objects.minecraft.multi; + +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import net.minecraft.item.ItemStack; + +public class NoEUBonusMultiBehaviour extends SpecialMultiBehaviour { + + public NoEUBonusMultiBehaviour() { + // Used by other mods which may wish to not obtain bonus outputs on their Sifting or Maceration recipes. + } + + @Override + public ItemStack getTriggerItem() { + return GregtechItemList.Chip_MultiNerf_NoEuBonus.get(1); + } + + @Override + public String getTriggerItemTooltip() { + return "Prevents EU discounts on GT++ multiblocks when used"; + } + + @Override + public int getEUPercent() { + return 0; + } + +} diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java index 4dc032d01f..8137f2573d 100644 --- a/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java +++ b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java @@ -1,6 +1,6 @@ package gtPlusPlus.api.objects.minecraft.multi; -import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import net.minecraft.item.ItemStack; public class NoOutputBonusMultiBehaviour extends SpecialMultiBehaviour { @@ -11,7 +11,7 @@ public class NoOutputBonusMultiBehaviour extends SpecialMultiBehaviour { @Override public ItemStack getTriggerItem() { - return CI.getNumberedBioCircuit(22); + return GregtechItemList.Chip_MultiNerf_NoOutputBonus.get(1); } @Override diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoSpeedBonusMultiBehaviour.java b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoSpeedBonusMultiBehaviour.java new file mode 100644 index 0000000000..fe7a90960d --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoSpeedBonusMultiBehaviour.java @@ -0,0 +1,27 @@ +package gtPlusPlus.api.objects.minecraft.multi; + +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import net.minecraft.item.ItemStack; + +public class NoSpeedBonusMultiBehaviour extends SpecialMultiBehaviour { + + public NoSpeedBonusMultiBehaviour() { + // Used by other mods which may wish to not obtain bonus outputs on their Sifting or Maceration recipes. + } + + @Override + public ItemStack getTriggerItem() { + return GregtechItemList.Chip_MultiNerf_NoSpeedBonus.get(1); + } + + @Override + public String getTriggerItemTooltip() { + return "Prevents speed bonuses on GT++ multiblocks when used"; + } + + @Override + public int getSpeedBonusPercent() { + return 0; + } + +} diff --git a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java index 06b6f14822..adcaa1db70 100644 --- a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java +++ b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java @@ -2,15 +2,22 @@ package gtPlusPlus.core.commands; import java.util.ArrayList; import java.util.List; +import java.util.Map; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.NBTUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.preloader.asm.AsmConfig; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; @@ -84,6 +91,27 @@ public class CommandEnableDebugWhileRunning implements ICommand AsmConfig.disableAllLogging = Utils.invertBoolean(AsmConfig.disableAllLogging); PlayerUtils.messagePlayer(P, "Toggled GT++ Logging - Enabled: "+(!AsmConfig.disableAllLogging)); } + /* else if (argString[0].toLowerCase().equals("test")) { + ItemStack mSemiFluidgen = ItemUtils.simpleMetaStack("IC2:blockGenerator", 7, 1); + final EntityPlayer P = CommandUtils.getPlayer(S); + if(mSemiFluidgen != null) { + PlayerUtils.messagePlayer(P, ItemUtils.getItemName(mSemiFluidgen)); + } + }*/ + else if (argString[0].toLowerCase().equals("hand")) { + final EntityPlayer P = CommandUtils.getPlayer(S); + if (P != null) { + ItemStack aHeldItem = PlayerUtils.getItemStackInPlayersHand(P); + if (aHeldItem != null) { + String aItemDisplayName = ItemUtils.getItemName(aHeldItem); + String aNbtString = tryIterateNBTData(aHeldItem); + PlayerUtils.messagePlayer(P, "["+aItemDisplayName+"] "+aNbtString); + } + else { + PlayerUtils.messagePlayer(P, "No item held."); + } + } + } else { final EntityPlayer P = CommandUtils.getPlayer(S); PlayerUtils.messagePlayer(P, "Invalid command, use '?' as an argument for help.'"); @@ -117,5 +145,35 @@ public class CommandEnableDebugWhileRunning implements ICommand public boolean playerUsesCommand(final World W, final EntityPlayer P, final int cost){ return true; } + + public static String tryIterateNBTData(ItemStack aStack) { + try { + AutoMap<String> aItemDataTags = new AutoMap<String>(); + NBTTagCompound aNBT = NBTUtils.getNBT(aStack); + if (aNBT != null) { + if (!aNBT.hasNoTags()) { + Map<?, ?> mInternalMap = ReflectionUtils.getField(aNBT, "tagMap"); + if (mInternalMap != null) { + for (Map.Entry<?, ?> e : mInternalMap.entrySet()) { + aItemDataTags.add(e.getKey().toString()+":"+e.getValue()); + } + int a = 0; + String data = ""; + for (String tag : aItemDataTags) { + data += (tag+","); + } + if (data.endsWith(",")) { + data = data.substring(0, data.length()-2); + } + return data; + } else { + Logger.INFO("Data map reflected from NBTTagCompound was not valid."); + return "Bad NBT"; + } + } + } + } catch (Throwable t) {} + return ""; + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/common/CommonProxy.java b/src/Java/gtPlusPlus/core/common/CommonProxy.java index 71a7b37cfc..0398b1619f 100644 --- a/src/Java/gtPlusPlus/core/common/CommonProxy.java +++ b/src/Java/gtPlusPlus/core/common/CommonProxy.java @@ -110,7 +110,7 @@ public class CommonProxy { Logger.INFO("[Proxy] Calling Render registrator."); registerRenderThings(); - if (!mFluidsGenerated && ItemList.valueOf("Cell_Empty").hasBeenSet()) { + if (!mFluidsGenerated && ItemList.Cell_Empty.hasBeenSet()) { Material.generateQueuedFluids(); mFluidsGenerated = true; } @@ -126,7 +126,7 @@ public class CommonProxy { registerCustomItemsForMaterials(); ModBlocks.blockCustomMobSpawner = new BlockGenericSpawner(); - if (!mFluidsGenerated && ItemList.valueOf("Cell_Empty").hasBeenSet()) { + if (!mFluidsGenerated && ItemList.Cell_Empty.hasBeenSet()) { Material.generateQueuedFluids(); mFluidsGenerated = true; } else { diff --git a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java index ee6c15fa67..b3738e6ea2 100644 --- a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java @@ -16,17 +16,28 @@ import net.minecraft.util.ChunkCoordinates; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.material.nuclear.FLUORIDES; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.world.BlockEvent; +import net.minecraftforge.oredict.OreDictionary; +import thaumcraft.common.lib.FakeThaumcraftPlayer; public class BlockEventHandler { public static ArrayList<ItemStack> oreLimestone; public static ArrayList<ItemStack> blockLimestone; public static ItemStack fluoriteOre; + + public static void init() { + //Set Variables for Fluorite Block handling + Logger.INFO("Setting some Variables for the block break event handler."); + BlockEventHandler.oreLimestone = OreDictionary.getOres("oreLimestone"); + BlockEventHandler.blockLimestone = OreDictionary.getOres("limestone"); + BlockEventHandler.fluoriteOre = FLUORIDES.FLUORITE.getOre(1); + } @SubscribeEvent public void onBlockLeftClicked(final PlayerInteractEvent event) { @@ -90,7 +101,7 @@ public class BlockEventHandler { ChunkCoordinates aChunkLocation = p.getPlayerCoordinates(); // Cache Fake Player - if (p instanceof FakePlayer + if (p instanceof FakePlayer || p instanceof FakeThaumcraftPlayer || (event.harvester.getCommandSenderName() == null || event.harvester.getCommandSenderName().length() <= 0) || (p.isEntityInvulnerable() && !p.canCommandSenderUseCommand(0, "") diff --git a/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java b/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java index 4abb84a33c..d98b27d163 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java @@ -4,6 +4,14 @@ import static gtPlusPlus.core.lib.CORE.RANDOM; import java.util.List; +import gregtech.api.enums.ItemList; +import gtPlusPlus.core.entity.item.ItemEntityGiantEgg; +import gtPlusPlus.core.item.base.BaseItemBurnable; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.NBTUtils; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; @@ -14,16 +22,6 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import gregtech.api.enums.ItemList; - -import gtPlusPlus.core.entity.item.ItemEntityGiantEgg; -import gtPlusPlus.core.item.base.BaseItemBurnable; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.NBTUtils; - public class ItemGiantEgg extends BaseItemBurnable { public ItemGiantEgg(String unlocalizedName, String displayName, CreativeTabs creativeTab, int stackSize, int maxDmg, @@ -138,7 +136,7 @@ public class ItemGiantEgg extends BaseItemBurnable { if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && Utils.getGregtechSubVersion() > 28) { - ItemList xl = Utils.getValueOfItemList("Circuit_Chip_Stemcell", ItemList.Circuit_Elite); + ItemList xl = ItemUtils.getValueOfItemList("Circuit_Chip_Stemcell", ItemList.Circuit_Elite); if (xl != null && xl.hasBeenSet()) { mCorrectStemCells = xl.get(1); } diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java index 34d7475df3..41a21bb642 100644 --- a/src/Java/gtPlusPlus/core/lib/CORE.java +++ b/src/Java/gtPlusPlus/core/lib/CORE.java @@ -55,7 +55,7 @@ public class CORE { public static final String name = "GT++"; public static final String MODID = "miscutils"; - public static final String VERSION = "1.7.03.45"; + public static final String VERSION = "1.7.05"; public static String MASTER_VERSION = NetworkUtils.getContentFromURL("https://raw.githubusercontent.com/draknyte1/GTplusplus/master/Recommended.txt").toLowerCase(); public static String USER_COUNTRY = GeoUtils.determineUsersCountry(); public static boolean isModUpToDate = Utils.isModUpToDate(); diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index 69bd414d9c..f766e8d768 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -597,6 +597,16 @@ public class RECIPES_GREGTECH { ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_1_CONTAINMENT, 1), 20 * 60 * 5, MaterialUtils.getVoltageForTier(5)); + + // Distillus Upgrade Chip + GT_Values.RA.addLaserEngraverRecipe( + GregtechItemList.Laser_Lens_WoodsGlass.get(0), + ItemUtils.simpleMetaStack(AgriculturalChem.mBioCircuit, 20, 1), + GregtechItemList.Distillus_Upgrade_Chip.get(1), + 20 * 60 * 5, + MaterialUtils.getVoltageForTier(5)); + + } @@ -1493,10 +1503,10 @@ public class RECIPES_GREGTECH { CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {ItemUtils.getSimpleStack(Items.nether_star), ItemUtils.getItemStackOfAmountFromOreDict("plateTungstenSteel", 8), ItemUtils.getItemStackOfAmountFromOreDict("stickBlackSteel", 8)}, null, ItemUtils.getSimpleStack(ModBlocks.blockWitherGuard, 32), 30*20, 500); - ItemStack aFluidReg1 = Utils.getValueOfItemList("FluidRegulator_LV", ItemList.Pump_LV).get(1); - ItemStack aFluidReg2 = Utils.getValueOfItemList("FluidRegulator_MV", ItemList.Pump_MV).get(1); - ItemStack aFluidReg3 = Utils.getValueOfItemList("FluidRegulator_HV", ItemList.Pump_HV).get(1); - ItemStack aFluidReg4 = Utils.getValueOfItemList("FluidRegulator_EV", ItemList.Pump_EV).get(1); + ItemStack aFluidReg1 = ItemUtils.getValueOfItemList("FluidRegulator_LV", ItemList.Pump_LV).get(1); + ItemStack aFluidReg2 = ItemUtils.getValueOfItemList("FluidRegulator_MV", ItemList.Pump_MV).get(1); + ItemStack aFluidReg3 = ItemUtils.getValueOfItemList("FluidRegulator_HV", ItemList.Pump_HV).get(1); + ItemStack aFluidReg4 = ItemUtils.getValueOfItemList("FluidRegulator_EV", ItemList.Pump_EV).get(1); CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { aFluidReg1, diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index 2165f27ec7..ebc2c07a63 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -2,9 +2,14 @@ package gtPlusPlus.core.recipe; import static gtPlusPlus.core.lib.CORE.GTNH; +import codechicken.nei.api.API; import cpw.mods.fml.common.Loader; -import gregtech.api.enums.*; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; +import gregtech.common.items.GT_MetaGenerated_Tool_01; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.ModItems; @@ -15,16 +20,17 @@ import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.*; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.MaterialUtils; +import gtPlusPlus.core.util.minecraft.RecipeUtils; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.everglades.dimension.Dimension_Everglades; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import gtPlusPlus.xmod.gregtech.common.covers.CoverManager; import gtPlusPlus.xmod.gregtech.common.items.MetaCustomCoverItem; +import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -241,29 +247,29 @@ public class RECIPES_Machines { distillus(); algaeFarm(); chemPlant(); - + } private static void chemPlant() { - + CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { - CI.getNumberedBioCircuit(19), - CI.getTieredGTPPMachineCasing(1, 6), - CI.getTieredComponentOfMaterial(Materials.Steel, OrePrefixes.gearGt, 6), - CI.getTieredComponentOfMaterial(Materials.Aluminium, OrePrefixes.plate, 32), - CI.getTieredComponentOfMaterial(Materials.CobaltBrass, OrePrefixes.dust, 16), - CI.getTieredComponent(OrePrefixes.frameGt, 2, 4), + CI.getNumberedBioCircuit(19), + CI.getTieredGTPPMachineCasing(1, 6), + CI.getTieredComponentOfMaterial(Materials.Steel, OrePrefixes.gearGt, 6), + CI.getTieredComponentOfMaterial(Materials.Aluminium, OrePrefixes.plate, 32), + CI.getTieredComponentOfMaterial(Materials.CobaltBrass, OrePrefixes.dust, 16), + CI.getTieredComponent(OrePrefixes.frameGt, 2, 4), }, ALLOY.STEEL.getFluid(2 * (144 * 4)), GregtechItemList.ChemicalPlant_Controller.get(1), 120 * 20, MaterialUtils.getVoltageForTier(2)); - + } private static void algaeFarm() { - + // Give the shitty algae a use :) CORE.RA.addDistilleryRecipe( ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, 32), @@ -273,26 +279,26 @@ public class RECIPES_Machines { 20 * 15, 16, false); - + CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { - CI.getNumberedBioCircuit(21), - CI.getTieredGTPPMachineCasing(0, 4), - CI.getTieredComponentOfMaterial(Materials.Iron, OrePrefixes.rod, 12), - CI.getTieredComponentOfMaterial(Materials.Wood, OrePrefixes.plate, 32), - CI.getTieredComponentOfMaterial(Materials.Bronze, OrePrefixes.bolt, 16), - CI.getTieredComponentOfMaterial(Materials.Redstone, OrePrefixes.dust, 32), + CI.getNumberedBioCircuit(21), + CI.getTieredGTPPMachineCasing(0, 4), + CI.getTieredComponentOfMaterial(Materials.Iron, OrePrefixes.rod, 12), + CI.getTieredComponentOfMaterial(Materials.Wood, OrePrefixes.plate, 32), + CI.getTieredComponentOfMaterial(Materials.Bronze, OrePrefixes.bolt, 16), + CI.getTieredComponentOfMaterial(Materials.Redstone, OrePrefixes.dust, 32), }, ALLOY.POTIN.getFluid(2 * (144 * 4)), GregtechItemList.AlgaeFarm_Controller.get(1), 60 * 20, MaterialUtils.getVoltageForTier(1)); - - + + } private static void distillus() { - + CORE.RA.addChemicalPlantRecipe( new ItemStack[] { CI.getNumberedBioCircuit(19), @@ -310,44 +316,44 @@ public class RECIPES_Machines { GregtechItemList.Machine_Adv_DistillationTower.get(1) }, new FluidStack[] { - + }, 20 * 600, MaterialUtils.getVoltageForTier(6), 3); - + } private static void chunkloaders() { - + ItemStack aOutputs[] = new ItemStack[] { GregtechItemList.GT_Chunkloader_HV.get(1L), GregtechItemList.GT_Chunkloader_IV.get(1L), GregtechItemList.GT_Chunkloader_ZPM.get(1L), }; - + int aIndex = 0; - + for (int i=3;i<8;i++) { if (i == 4 || i == 6) { continue; } CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { - CI.getNumberedBioCircuit(21), - CI.getElectricPiston(i, 10), - CI.getFieldGenerator(i + 1, 6), - CI.getPlate(i, 16), - CI.getTransmissionComponent(i - 1, 8), - CI.getTieredComponent(OrePrefixes.cableGt08, i, 16) + CI.getNumberedBioCircuit(21), + CI.getElectricPiston(i, 10), + CI.getFieldGenerator(i + 1, 6), + CI.getPlate(i, 16), + CI.getTransmissionComponent(i - 1, 8), + CI.getTieredComponent(OrePrefixes.cableGt08, i, 16) }, ALLOY.EGLIN_STEEL.getFluid(i * (144 * 4)), aOutputs[aIndex++].copy(), 300 * 20, MaterialUtils.getVoltageForTier(i)); } - - + + } private static void overflowValveCovers() { @@ -359,25 +365,25 @@ public class RECIPES_Machines { GregtechItemList.Cover_Overflow_EV.get(1L), GregtechItemList.Cover_Overflow_IV.get(1L), }; - + for (int i=0;i<6;i++) { CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { - CI.getNumberedBioCircuit(19), - CI.getElectricPump(i, 2), - CI.getElectricMotor(i, 2), - CI.getPlate(i, 4) + CI.getNumberedBioCircuit(19), + CI.getElectricPump(i, 2), + CI.getElectricMotor(i, 2), + CI.getPlate(i, 4) }, - FluidUtils.getWater(i * 1500), + FluidUtils.getWater((i+1) * 750), aOutputs[i].copy(), 20 * 20, MaterialUtils.getVoltageForTier(i)); } - + } private static void tieredMachineHulls() { - + GregtechItemList[] aHulls = new GregtechItemList[] { GregtechItemList.GTPP_Casing_ULV, GregtechItemList.GTPP_Casing_LV, @@ -390,7 +396,7 @@ public class RECIPES_Machines { GregtechItemList.GTPP_Casing_UV, GregtechItemList.GTPP_Casing_MAX }; - + for (int i=0;i<10;i++) { CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { @@ -401,12 +407,12 @@ public class RECIPES_Machines { CI.getTieredComponent(OrePrefixes.cableGt02, i, 4), CI.getTieredComponent(OrePrefixes.circuit, i, 2) }, - CI.getAlternativeTieredFluid(i, 144 * i * 2), + CI.getAlternativeTieredFluid(i, 144 * (i+1) * 2), aHulls[i].get(1), 20 * 20, MaterialUtils.getVoltageForTier(i)); } - + } private static void initModItems(){ @@ -443,7 +449,7 @@ public class RECIPES_Machines { EV_MACHINE_Wiremill= ItemList.Machine_IV_Wiremill.get(1); HV_MACHINE_Macerator= ItemList.Machine_EV_Macerator.get(1); EV_MACHINE_Macerator= ItemList.Machine_IV_Macerator.get(1); - EV_MACHINE_MassFabricator= CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? gtPlusPlus.core.util.Utils.getValueOfItemList("Machine_LuV_Massfab", ItemList.Machine_IV_Massfab).get(1) : ItemList.Machine_IV_Massfab.get(1); + EV_MACHINE_MassFabricator= CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? ItemUtils.getValueOfItemList("Machine_LuV_Massfab", ItemList.Machine_IV_Massfab).get(1) : ItemList.Machine_IV_Massfab.get(1); EV_MACHINE_Centrifuge= ItemList.Machine_IV_Centrifuge.get(1); EV_MACHINE_Cutter = ItemList.Machine_IV_Cutter.get(1); EV_MACHINE_Extruder = ItemList.Machine_IV_Extruder.get(1); @@ -541,9 +547,9 @@ public class RECIPES_Machines { 20 * 30, 30); - ItemStack aFluidRegulator1 = ItemUtils.getItemListObject("FluidRegulator_MV", "Pump_HV", GTNH ? 4 : 2); - ItemStack aFluidRegulator2 = ItemUtils.getItemListObject("FluidRegulator_IV", "Pump_LuV", GTNH ? 4 : 2); - + ItemStack aFluidRegulator1 = ItemUtils.getValueOfItemList("FluidRegulator_MV",GTNH ? 4 : 2, ItemList.Electric_Pump_HV); + ItemStack aFluidRegulator2 = ItemUtils.getValueOfItemList("FluidRegulator_IV", GTNH ? 4 : 2, ItemUtils.getValueOfItemList("Electric_Pump_LuV", GTNH ? 8 : 4, ItemList.Electric_Pump_IV)); + //Poo Collector CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { @@ -605,7 +611,7 @@ public class RECIPES_Machines { plateEnergeticAlloy, pipeLargeCopper, plateEnergeticAlloy, RECIPE_SteamCondenser); } - + //Steam Condenser if (LoadedMods.CoFHCore && CORE.ConfigSwitches.enableMachine_RF_Convetor){ @@ -900,25 +906,47 @@ public class RECIPES_Machines { } //TODO - //Semi-Fluid Generators - ItemStack mSemiFluidgen = ItemUtils.getItemStackFromFQRN("IC2:blockGenerator:7", 1); - mSemiFluidgen.setItemDamage(7); + //Semi-Fluid Generators + ItemStack[][] aSemiFluidInputs = new ItemStack[3][6]; + aSemiFluidInputs[0] = new ItemStack[]{ + CI.getNumberedBioCircuit(14), + CI.getTieredMachineHull(1, 1), + CI.getElectricPiston(1, GTNH ? 4 : 2), + CI.getTieredComponent(OrePrefixes.circuit, 1, GTNH ? 4 : 2), + CI.getPlate(1, GTNH ? 8 : 4), + CI.getGear(1, GTNH ? 4 : 2) + }; + aSemiFluidInputs[1] = new ItemStack[]{ + CI.getNumberedBioCircuit(14), + CI.getTieredMachineHull(2, 1), + CI.getElectricPiston(2, GTNH ? 4 : 2), + CI.getTieredComponent(OrePrefixes.circuit, 2, GTNH ? 4 : 2), + CI.getPlate(2, GTNH ? 8 : 4), + CI.getGear(2, GTNH ? 4 : 2) + }; + aSemiFluidInputs[2] = new ItemStack[]{ + CI.getNumberedBioCircuit(14), + CI.getTieredMachineHull(3, 1), + CI.getElectricPiston(3, GTNH ? 4 : 2), + CI.getTieredComponent(OrePrefixes.circuit, 3, GTNH ? 4 : 2), + CI.getPlate(3, GTNH ? 8 : 4), + CI.getGear(3, GTNH ? 4 : 2) + }; + FluidStack[] aSemiFluidFluidInputs = new FluidStack[] { + ALLOY.BRONZE.getFluid(144 * 8), + ALLOY.STEEL.getFluid(144 * 8), + ELEMENT.getInstance().ALUMINIUM.getFluid(144 * 8), + }; + //ItemUtils.simpleMetaStack("IC2:blockGenerator:7", 7, 1); - ItemStack[] aSemifluids = new ItemStack[] {mSemiFluidgen, GregtechItemList.Generator_SemiFluid_LV.get(1), GregtechItemList.Generator_SemiFluid_MV.get(1), GregtechItemList.Generator_SemiFluid_HV.get(1)}; - for (int o=1;o<4;o++) { + ItemStack[] aSemifluids = new ItemStack[] {GregtechItemList.Generator_SemiFluid_LV.get(1), GregtechItemList.Generator_SemiFluid_MV.get(1), GregtechItemList.Generator_SemiFluid_HV.get(1)}; + for (int o=0;o<3;o++) { CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - aSemifluids[o-1], - CI.getElectricPiston(o, GTNH ? 4 : 2), - CI.getElectricMotor(o, GTNH ? 2 : 1), - CI.getTieredComponent(OrePrefixes.circuit, o, GTNH ? 4 : 2), - CI.getPlate(o, GTNH ? 8 : 4), - CI.getGear(o-1, GTNH ? 4 : 2) - }, - CI.getAlternativeTieredFluid(o, 144 * 4), + aSemiFluidInputs[o], + aSemiFluidFluidInputs[o], aSemifluids[o], 20 * 30, - (int) GT_Values.V[o]); + MaterialUtils.getVoltageForTier(o+1)); } if (CORE.ConfigSwitches.enableMultiblock_AlloyBlastSmelter){ @@ -955,9 +983,9 @@ public class RECIPES_Machines { //Matter Fabricator CPU RecipeUtils.addShapedGregtechRecipe( - "plateDoubleQuantum", CI.circuitTier5, "plateDoubleQuantum", + CI.getDoublePlate(8, 1), CI.circuitTier5, CI.getPlate(8, 1), cableTier8, CI.machineCasing_LuV, cableTier8, - "plateDoubleQuantum", CI.circuitTier5, "plateDoubleQuantum", + CI.getPlate(8, 1), CI.circuitTier5, CI.getPlate(8, 1), RECIPE_IndustrialMatterFabController); //Matter Fabricator Frame Casing RecipeUtils.addShapedGregtechRecipe( @@ -967,9 +995,9 @@ public class RECIPES_Machines { RECIPE_IndustrialMatterFabFrame); //Matter Fabricator Coil RecipeUtils.addShapedGregtechRecipe( - "plateQuantum", "plateQuantum", "plateQuantum", + CI.getPlate(6, 1), CI.getPlate(7, 1), CI.getPlate(6, 1), "frameGtStellite", CI.machineCasing_UV, "frameGtStellite", - "plateQuantum", "plateQuantum", "plateQuantum", + CI.getPlate(6, 1), CI.getPlate(7, 1), CI.getPlate(6, 1), RECIPE_IndustrialMatterFabCoil); } @@ -1120,12 +1148,6 @@ public class RECIPES_Machines { aSimpleWasherTier += 2; aSlot++; } - - - - - - } if (CORE.ConfigSwitches.enableMachine_Pollution && PollutionUtils.isPollutionEnabled()){ @@ -1149,20 +1171,6 @@ public class RECIPES_Machines { CI.getTieredCircuit(1), CI.machineHull_LV, CI.getTieredCircuit(0), GregtechItemList.Pollution_Detector.get(1)); - //Air Intake Hatch - - - - ItemList FluidRegulator_IV = Utils.getValueOfItemList("FluidRegulator_IV", ItemList.Pump_IV); - ItemStack aTieredFluidRegulator = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? FluidRegulator_IV.get(1) : ItemList.Pump_IV.get(1); - - - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[6], ItemList.Casing_Grate.get(1), CI.component_Plate[6], - CI.component_Plate[6], aTieredFluidRegulator, CI.component_Plate[6], - CI.getTieredCircuit(4), ItemList.Hatch_Input_IV.get(1), CI.getTieredCircuit(4), - GregtechItemList.Hatch_Air_Intake.get(1)); - //ULV RecipeUtils.addShapedGregtechRecipe( CI.component_Plate[0], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 0, 1), CI.component_Plate[0], @@ -1267,6 +1275,15 @@ public class RECIPES_Machines { ); } + //Air Intake Hatch + ItemList FluidRegulator_IV = ItemUtils.getValueOfItemList("FluidRegulator_IV", ItemList.Pump_IV); + ItemStack aTieredFluidRegulator = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? FluidRegulator_IV.get(1) : ItemList.Pump_IV.get(1); + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[6], ItemList.Casing_Grate.get(1), CI.component_Plate[6], + CI.component_Plate[6], aTieredFluidRegulator, CI.component_Plate[6], + CI.getTieredCircuit(4), ItemList.Hatch_Input_IV.get(1), CI.getTieredCircuit(4), + GregtechItemList.Hatch_Air_Intake.get(1)); + if (CORE.ConfigSwitches.enableMultiblock_LiquidFluorideThoriumReactor){ //Thorium Reactor @@ -1342,15 +1359,6 @@ public class RECIPES_Machines { CI.craftingToolHammer_Hard, "frameGtHastelloyC276", CI.craftingToolWrench, CI.component_Plate[5], CI.getTieredMachineCasing(4), "ringInconel792", GregtechItemList.Casing_Refinery_Structural.get(Casing_Amount)); - - - - - - - - - } //Shelves @@ -1419,15 +1427,25 @@ public class RECIPES_Machines { RECIPE_CyclotronController, 60 * 20 * 5, MaterialUtils.getVoltageForTier(5)); + } + // Mazut + GT_ModHandler.addCraftingRecipe( + GregtechItemList.Controller_LargeSemifluidGenerator.get(1L), + CI.bitsd, + new Object[]{ + "PCP", + "EME", + "GWG", + 'M', ItemList.Hull_EV, + 'P', ItemList.Electric_Piston_EV, + 'E', ItemList.Electric_Pump_EV, + 'C', OrePrefixes.circuit.get(Materials.Data), + 'W', OrePrefixes.cableGt08.get(Materials.Electrum), + 'G', ALLOY.INCONEL_792.getGear(1) + }); - - - - - } - if (CORE.ConfigSwitches.enableMultiblock_PowerSubstation){ RecipeUtils.recipeBuilder( "screwTitanium", "plateIncoloy020", "screwTitanium", @@ -1475,8 +1493,7 @@ public class RECIPES_Machines { if (CORE.ConfigSwitches.enableMultiblock_LargeAutoCrafter) { ItemStack aCoreBlock = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK - ? ItemList.valueOf("Block_IridiumTungstensteel").get(1, - ItemUtils.getItemStackOfAmountFromOreDict("blockOsmiridium", 1)) + ? ItemUtils.getValueOfItemList("Block_IridiumTungstensteel", 1, ItemUtils.getItemStackOfAmountFromOreDict("blockOsmiridium", 1)) : ItemUtils.getItemStackOfAmountFromOreDict("blockOsmiridium", 1); aCoreBlock.stackSize = GTNH ? 2 : 1; @@ -1622,7 +1639,7 @@ public class RECIPES_Machines { cell1 = CI.conveyorModule_EV; cell2 = CI.electricMotor_IV; ItemStack casingAmazon = GregtechItemList.Casing_AmazonWarehouse.get(1); - ItemStack aTieredUnboxinator = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? ItemList.valueOf("Machine_LuV_Unboxinator").get(1, ItemList.Machine_IV_Unboxinator.get(1)) : ItemList.Machine_IV_Unboxinator.get(1); + ItemStack aTieredUnboxinator = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? ItemUtils.getValueOfItemList("Machine_LuV_Unboxinator", 1, ItemList.Machine_IV_Unboxinator.get(1)) : ItemList.Machine_IV_Unboxinator.get(1); RecipeUtils.recipeBuilder( @@ -1768,7 +1785,7 @@ public class RECIPES_Machines { - ItemStack aDrillController = Utils.getValueOfItemList("OreDrill4", ItemList.Hull_UV).get(1); + ItemStack aDrillController = ItemUtils.getValueOfItemList("OreDrill4", ItemList.Hull_UV).get(1); //Drilling Platform CORE.RA.addSixSlotAssemblingRecipe( diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java index 98ea687747..3ed2f5f168 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java @@ -1,24 +1,24 @@ package gtPlusPlus.core.recipe; import cpw.mods.fml.common.Loader; - -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.*; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OreDictNames; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.SubTag; import gregtech.api.interfaces.IOreRecipeRegistrator; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; - -import codechicken.nei.api.API; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.RecipeUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import net.minecraft.item.ItemStack; public class RECIPES_Old_Circuits implements IOreRecipeRegistrator { public RECIPES_Old_Circuits() { @@ -445,7 +445,7 @@ public class RECIPES_Old_Circuits implements IOreRecipeRegistrator { for (String component : CircuitToHide){ try { - API.hideItem(Utils.getValueOfItemList(component, null).get(1L, new Object[0])); + ItemUtils.hideItemFromNEI(ItemUtils.getValueOfItemList(component, null).get(1L, new Object[0])); } catch (IllegalArgumentException I){ Logger.INFO("Could not find "+component+" in the Gregtech item list."); Logger.INFO("This is NOT an error, simply a notification."); diff --git a/src/Java/gtPlusPlus/core/recipe/common/CI.java b/src/Java/gtPlusPlus/core/recipe/common/CI.java index 1d3d386da3..d67a372572 100644 --- a/src/Java/gtPlusPlus/core/recipe/common/CI.java +++ b/src/Java/gtPlusPlus/core/recipe/common/CI.java @@ -9,7 +9,6 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.chemistry.AgriculturalChem; import gtPlusPlus.core.item.chemistry.GenericChem; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.material.Material; @@ -17,7 +16,6 @@ import gtPlusPlus.core.recipe.LOADER_Machine_Components; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.eio.material.MaterialEIO; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import ic2.core.Ic2Items; @@ -184,7 +182,7 @@ public class CI { public static ItemStack explosiveITNT; public static void preInit(){ - + //Tiered Components component_Plate = new String[]{ getTieredComponent(OrePrefixes.plate, 0), @@ -402,7 +400,7 @@ public class CI { return ItemList.Tool_DataOrb.get(1); } } - + public static ItemStack getDataStick(){ if (CORE.ConfigSwitches.enableOldGTcircuits && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && !CORE.GTNH){ return GregtechItemList.Old_Tool_DataStick.get(1); @@ -489,17 +487,7 @@ public class CI { public static void init() { //Set Explosives - try { - ItemList PowerderBarrel = Utils.getValueOfItemList("Block_Powderbarrel", null); - if (PowerderBarrel != null){ - explosivePowderKeg = PowerderBarrel.get(1).copy(); - } - else { - explosivePowderKeg = ItemUtils.getSimpleStack(Items.gunpowder).copy(); - } - } catch (java.lang.IllegalArgumentException Y) { - explosivePowderKeg = ItemUtils.getSimpleStack(Items.gunpowder).copy(); - } + explosivePowderKeg = ItemUtils.getValueOfItemList("Block_Powderbarrel", 1, ItemUtils.getSimpleStack(Items.gunpowder, 16)); explosiveTNT = ItemUtils.getSimpleStack(Blocks.tnt).copy(); explosiveITNT = Ic2Items.industrialTnt.copy(); @@ -540,13 +528,13 @@ public class CI { public static ItemStack emptyCells(int i) { return ItemUtils.getEmptyCell(i); } - - - + + + /* * */ - + private static final Material[] aMaterial_Main = new Material[] { ALLOY.POTIN, ALLOY.TUMBAGA, @@ -561,7 +549,7 @@ public class CI { ALLOY.QUANTUM, ELEMENT.STANDALONE.HYPOGEN }; - + private static final Material[] aMaterial_Secondary = new Material[] { ALLOY.STEEL, ALLOY.SILICON_CARBIDE, @@ -576,7 +564,7 @@ public class CI { ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN, ELEMENT.STANDALONE.HYPOGEN }; - + private static final Material[] aMaterial_Tertiary = new Material[] { ELEMENT.getInstance().LEAD, ELEMENT.getInstance().ALUMINIUM, @@ -591,21 +579,21 @@ public class CI { ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN, ELEMENT.STANDALONE.HYPOGEN }; - + private static final Materials[] aMaterial_Cables = new Materials[] { !CORE.GTNH ? Materials.Lead : Materials.Tin, - Materials.Cobalt, - Materials.AnnealedCopper, - Materials.Gold, - Materials.Titanium, - Materials.Nichrome, - Materials.Platinum, - Materials.YttriumBariumCuprate, - Materials.Naquadah, - Materials.Duranium, - Materials.Superconductor, + Materials.Cobalt, + Materials.AnnealedCopper, + Materials.Gold, + Materials.Titanium, + Materials.Nichrome, + Materials.Platinum, + Materials.YttriumBariumCuprate, + Materials.Naquadah, + Materials.Duranium, + Materials.Superconductor, }; - + private static final Materials[] aMaterial_Circuits = new Materials[] { Materials.Primitive, Materials.Basic, @@ -619,18 +607,18 @@ public class CI { Materials.Superconductor, Materials.Infinite, }; - + private static final Material[][] aMaster = new Material[][] {aMaterial_Main, aMaterial_Secondary, aMaterial_Tertiary}; - - + + public static FluidStack getTieredFluid(int aTier, int aAmount) { return getTieredFluid(aTier, aAmount, 0); } - + public static FluidStack getAlternativeTieredFluid(int aTier, int aAmount) { return getTieredFluid(aTier, aAmount, 1); } - + public static FluidStack getTertiaryTieredFluid(int aTier, int aAmount) { return getTieredFluid(aTier, aAmount, 2); } @@ -642,7 +630,7 @@ public class CI { if (a == null) { a = aMaster[aType][aTier].getFluid(aAmount); }*/ - + // Modern Handling FluidStack a = aMaster[aType][aTier].getFluid(aAmount); if (a == null) { @@ -654,7 +642,7 @@ public class CI { } return a; } - + public static ItemStack getEnergyCore(int aTier, int aAmount) { ItemStack[] aOutput = new ItemStack[] { ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"1", 1), @@ -670,39 +658,43 @@ public class CI { }; return ItemUtils.getSimpleStack(aOutput[MathUtils.balance(aTier, 0, 9)], aAmount); } - + public static ItemStack getPlate(int aTier, int aAmount) { return getTieredComponent(OrePrefixes.plate, aTier, aAmount); } - + + public static ItemStack getDoublePlate(int aTier, int aAmount) { + return getTieredComponent(OrePrefixes.plateDouble, aTier, aAmount); + } + public static ItemStack getGear(int aTier, int aAmount) { return getTieredComponent(OrePrefixes.gearGt, aTier, aAmount); } - + public static ItemStack getIngot(int aTier, int aAmount) { return getTieredComponent(OrePrefixes.ingot, aTier, aAmount); } - + public static ItemStack getBolt(int aTier, int aAmount) { return getTieredComponent(OrePrefixes.bolt, aTier, aAmount); } - + public static ItemStack getTieredComponent(OrePrefixes aPrefix, int aTier, int aAmount) { aTier = Math.max(0, aTier); - + Material m = null; - - - - - - + + + + + + if (aPrefix == OrePrefixes.liquid) { int aMatID = (aTier == 0 || aTier == 2 || aTier == 5 || aTier == 8 ? 0 : (aTier == 1 || aTier == 3 || aTier == 6 || aTier == 9 ? 1 : 2)); ItemStack aCell = aMaster[aMatID][aTier].getCell(aAmount); return aCell; } - + if (aPrefix == OrePrefixes.circuit) { if (aTier == 4) { return ItemUtils.getSimpleStack(CI.getDataStick(), aAmount); @@ -736,19 +728,19 @@ public class CI { else { return ItemUtils.getOrePrefixStack(aPrefix, aMaterial_Cables[aTier], aAmount); } - - + + } if (aPrefix == OrePrefixes.wireGt01 || aPrefix == OrePrefixes.wireGt02 || aPrefix == OrePrefixes.wireGt04 || aPrefix == OrePrefixes.wireGt08 || aPrefix == OrePrefixes.wireGt12 || aPrefix == OrePrefixes.wireGt16) { return ItemUtils.getOrePrefixStack(aPrefix, aMaterial_Cables[aTier], aAmount); } if (aPrefix == OrePrefixes.pipeTiny || aPrefix == OrePrefixes.pipeSmall || aPrefix == OrePrefixes.pipe || aPrefix == OrePrefixes.pipeMedium || aPrefix == OrePrefixes.pipeLarge || aPrefix == OrePrefixes.pipeHuge) { - + if (aPrefix == OrePrefixes.pipe) { aPrefix = OrePrefixes.pipeMedium; } - + if (aTier == 0) { return ItemUtils.getOrePrefixStack(aPrefix, Materials.Lead, aAmount); } @@ -787,12 +779,10 @@ public class CI { } } - ItemStack aTempStack = null; - if (aPrefix == OrePrefixes.rod) { aPrefix = OrePrefixes.stick; } - + if (aPrefix == OrePrefixes.gear || aPrefix == OrePrefixes.gearGt) { m = aMaster[0][aTier]; } @@ -832,24 +822,24 @@ public class CI { else { m = aMaterial_Main[aTier]; } - + ItemStack aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount); - + //If Invalid, Try First Material if (!ItemUtils.checkForInvalidItems(aReturn)) { m = aMaster[0][aTier]; aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount); - + //If Invalid, Try Second Material if (!ItemUtils.checkForInvalidItems(aReturn)) { m = aMaster[1][aTier]; aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount); - + //If Invalid, Try Third Material if (!ItemUtils.checkForInvalidItems(aReturn)) { m = aMaster[2][aTier]; aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount); - + //All Invalid? Ok, shit. //Let's add a special error ingot. if (!ItemUtils.checkForInvalidItems(aReturn)) { @@ -858,12 +848,12 @@ public class CI { } } } - + return aReturn; - + } - + public static ItemStack getElectricMotor(int aTier, int aSize) { ItemStack aType; int aLazyTier = 0; @@ -902,7 +892,7 @@ public class CI { } return ItemUtils.getSimpleStack(aType, aSize); } - + public static ItemStack getElectricPiston(int aTier, int aSize) { ItemStack aType; int aLazyTier = 0; @@ -941,7 +931,7 @@ public class CI { } return ItemUtils.getSimpleStack(aType, aSize); } - + public static ItemStack getElectricPump(int aTier, int aSize) { ItemStack aType; int aLazyTier = 0; @@ -980,7 +970,7 @@ public class CI { } return ItemUtils.getSimpleStack(aType, aSize); } - + public static ItemStack getRobotArm(int aTier, int aSize) { ItemStack aType; int aLazyTier = 0; @@ -1019,7 +1009,7 @@ public class CI { } return ItemUtils.getSimpleStack(aType, aSize); } - + public static ItemStack getConveyor(int aTier, int aSize) { ItemStack aType; int aLazyTier = 0; @@ -1058,7 +1048,7 @@ public class CI { } return ItemUtils.getSimpleStack(aType, aSize); } - + public static ItemStack getEmitter(int aTier, int aSize) { ItemStack aType; int aLazyTier = 0; @@ -1097,7 +1087,7 @@ public class CI { } return ItemUtils.getSimpleStack(aType, aSize); } - + public static ItemStack getSensor(int aTier, int aSize) { ItemStack aType; int aLazyTier = 0; @@ -1136,7 +1126,7 @@ public class CI { } return ItemUtils.getSimpleStack(aType, aSize); } - + public static ItemStack getFieldGenerator(int aTier, int aSize) { ItemStack aType; int aLazyTier = 0; @@ -1175,9 +1165,9 @@ public class CI { } return ItemUtils.getSimpleStack(aType, aSize); } - - + + public static ItemStack getTieredMachineHull(int aTier, int aSize) { ItemStack aType; int aLazyTier = 0; @@ -1293,7 +1283,7 @@ public class CI { public static ItemStack getGreenCatalyst(int aAmount) { return ItemUtils.simpleMetaStack(AgriculturalChem.mAgrichemItem1, 14, aAmount); } - + /** * Iron + Copper Catalyst * @param aAmount - Stacksize @@ -1302,7 +1292,7 @@ public class CI { public static ItemStack getRedCatalyst(int aAmount) { return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 0, aAmount); } - + /** * Tungsten + Nickel Catalyst * @param aAmount - Stacksize @@ -1311,7 +1301,7 @@ public class CI { public static ItemStack getYellowCatalyst(int aAmount) { return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 1, aAmount); } - + /** * Cobalt + Titanium Catalyst * @param aAmount - Stacksize @@ -1320,7 +1310,7 @@ public class CI { public static ItemStack getBlueCatalyst(int aAmount) { return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 2, aAmount); } - + /** * Vanadium + Palladium Catalyst * @param aAmount - Stacksize @@ -1329,7 +1319,7 @@ public class CI { public static ItemStack getOrangeCatalyst(int aAmount) { return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 3, aAmount); } - + /** * Iridium + Ruthenium Catalyst * @param aAmount - Stacksize @@ -1338,7 +1328,7 @@ public class CI { public static ItemStack getPurpleCatalyst(int aAmount) { return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 4, aAmount); } - + /** * Aluminium + Nickel Catalyst * @param aAmount - Stacksize @@ -1347,7 +1337,7 @@ public class CI { public static ItemStack getBrownCatalyst(int aAmount) { return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 5, aAmount); } - + /** * Platinum + Rhodium Catalyst * @param aAmount - Stacksize diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java index 234b54d2d2..72b13b3067 100644 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ b/src/Java/gtPlusPlus/core/util/Utils.java @@ -935,22 +935,6 @@ public class Utils { return false; } - public static ItemList getValueOfItemList(String string, ItemList aOther) { - ItemList[] aListValues = ItemList.class.getEnumConstants(); - for (ItemList aItem : aListValues) { - if (aItem != null) { - if (aItem.name().equals(string) || aItem.name().toLowerCase().equals(string.toLowerCase())) { - return aItem; - } - } - } - Logger.INFO("Tried to obtain '"+string+"' from the GT ItemList, however it does not exist."); - if (aOther != null) { - Logger.INFO("Using fallback option instead - "+aOther.name()); - } - return aOther; - } - public static long getMillisSince(long aStartTime, long aCurrentTime) { return (aCurrentTime - aStartTime); } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index d7d611a1e4..cd5b98557b 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -42,7 +42,6 @@ import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_DustGeneration; import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentData; -import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; @@ -1220,7 +1219,6 @@ public class ItemUtils { return GT_Values.NI; } - public static ItemStack depleteStack(ItemStack aStack) { return depleteStack(aStack, 1); } @@ -1235,41 +1233,6 @@ public class ItemUtils { } return getNullStack(); } - - public static ItemStack getItemListObject(String aObjectFromExperimentalName, String aReplacementName, int aAmount) { - ItemList aItemListObject = getItemListObject(aObjectFromExperimentalName, aReplacementName); - if (aItemListObject == ItemList.NULL || aItemListObject == null) { - return null; - } - else { - return aItemListObject.get(aAmount); - } - } - - public static ItemStack getItemListObject(ItemList aItemListObject, int aAmount) { - if (aItemListObject == ItemList.NULL || aItemListObject == null) { - return null; - } - else { - return aItemListObject.get(aAmount); - } - } - - public static ItemList getItemListObject(String aObjectFromExperimentalName, String aReplacementName) { - ItemList aVal = ItemList.valueOf(aObjectFromExperimentalName); - if (aVal != null) { - return aVal; - } - else { - aVal = ItemList.valueOf(aReplacementName); - if (aVal != null) { - return aVal; - } - else { - return ItemList.NULL; - } - } - } public static boolean isControlCircuit(ItemStack aStack) { if (aStack != null) { @@ -1313,5 +1276,42 @@ public class ItemUtils { public static String getLocalizedNameOfBlock(Block aBlock, int aMeta) { return LangUtils.getLocalizedNameOfBlock(aBlock, aMeta); } + + + + public static ItemList getValueOfItemList(String string, ItemList aOther) { + ItemList[] aListValues = ItemList.class.getEnumConstants(); + for (ItemList aItem : aListValues) { + if (aItem != null) { + if (aItem.name().equals(string) || aItem.name().toLowerCase().equals(string.toLowerCase())) { + return aItem; + } + } + } + Logger.INFO("Tried to obtain '"+string+"' from the GT ItemList, however it does not exist."); + if (aOther != null) { + Logger.INFO("Using fallback option instead - "+aOther.name()); + } + return aOther; + } + public static ItemStack getValueOfItemList(String string, int aAmount, ItemList aOther) { + return getValueOfItemList(string, aOther).get(aAmount); + } + + public static ItemStack getValueOfItemList(String string, int aAmount, ItemStack aOther) { + ItemList[] aListValues = ItemList.class.getEnumConstants(); + for (ItemList aItem : aListValues) { + if (aItem != null) { + if (aItem.name().equals(string) || aItem.name().toLowerCase().equals(string.toLowerCase())) { + return aItem.get(aAmount); + } + } + } + Logger.INFO("Tried to obtain '"+string+"' from the GT ItemList, however it does not exist."); + if (aOther != null) { + Logger.INFO("Using fallback option instead - "+ItemUtils.getItemName(aOther)); + } + return aOther; + } } diff --git a/src/Java/gtPlusPlus/preloader/CORE_Preloader.java b/src/Java/gtPlusPlus/preloader/CORE_Preloader.java index b8ebdaf49c..e7101bc025 100644 --- a/src/Java/gtPlusPlus/preloader/CORE_Preloader.java +++ b/src/Java/gtPlusPlus/preloader/CORE_Preloader.java @@ -1,14 +1,32 @@ package gtPlusPlus.preloader; +import java.io.File; import java.util.ArrayList; -import java.util.Arrays; +import java.util.Collections; import java.util.List; +import cpw.mods.fml.common.versioning.ArtifactVersion; + public class CORE_Preloader { + public static final String NAME = "GT++ Preloader"; public static final String MODID = "GT++_Preloader"; - public static final String VERSION = "0.4-Beta"; + public static final String VERSION = "0.5-Beta"; + public static final List<ArtifactVersion> DEPENDENCIES; + public static final String JAVA_VERSION = System.getProperty("java.version"); + + public static File MC_DIR; + public static boolean DEV_ENVIRONMENT = false; public static boolean enableOldGTcircuits = false; public static int enableWatchdogBGM = 0; - public static List<?> DEPENDENCIES = new ArrayList<>(Arrays.asList(new String[] {"required-before:gregtech;"})); + + public static void setMinecraftDirectory(File aDir) { + MC_DIR = aDir; + } + + static { + ArrayList<ArtifactVersion> deps = new ArrayList<ArtifactVersion>(); + //deps.add("required-before:gregtech;"); + DEPENDENCIES = Collections.unmodifiableList(deps); + } } diff --git a/src/Java/gtPlusPlus/preloader/DevHelper.java b/src/Java/gtPlusPlus/preloader/DevHelper.java index 81d36d591b..70a3c53073 100644 --- a/src/Java/gtPlusPlus/preloader/DevHelper.java +++ b/src/Java/gtPlusPlus/preloader/DevHelper.java @@ -5,7 +5,6 @@ import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.Pair; import gtPlusPlus.api.objects.data.weakref.WeakAutoMap; import gtPlusPlus.core.util.reflect.ReflectionUtils; @@ -118,7 +117,7 @@ public class DevHelper { String aForgeName = DevHelperInternals.srgToForge.get(mSrgName); return aForgeName != null ? aForgeName : "BAD_FORGE_NAME"; } - + public static String getMinecraftClassName(String adeObName, boolean obfuscated) { if (obfuscated) { return getObfuscated(adeObName); @@ -130,7 +129,7 @@ public class DevHelper { String obfuscatedClassname = DevHelperInternals.deObToOb.get(mDeob); obfuscatedClassname = obfuscatedClassname != null ? obfuscatedClassname : "BAD_OBFUSCATED_CLASS_NAME"; if (obfuscatedClassname.equals("BAD_OBFUSCATED_CLASS_NAME")) { - Logger.INFO("[Fix] Failed to Get Deobfuscated name for "+mDeob); + Preloader_Logger.INFO("[Fix] Failed to Get Deobfuscated name for "+mDeob); } return obfuscatedClassname; } @@ -139,15 +138,15 @@ public class DevHelper { String deobfuscatedClassname = DevHelperInternals.obToDeOb.get(mOb); return deobfuscatedClassname != null ? deobfuscatedClassname : "BAD_DEOBFUSCATED_CLASS_NAME"; } - + public static class DevHelperInternals { - public static Map<String, String> srgToForge = new HashMap<String, String>(); - public static Map<String, String> forgeToSrg = new HashMap<String, String>(); + public static final Map<String, String> srgToForge = new HashMap<String, String>(); + public static final Map<String, String> forgeToSrg = new HashMap<String, String>(); private static WeakAutoMap<Pair<String, String>> mInitMap = new WeakAutoMap<Pair<String, String>>(); //Obfuscation - public static Map<String, String> obToDeOb = new HashMap<String, String>(); - public static Map<String, String> deObToOb = new HashMap<String, String>(); + public static final Map<String, String> obToDeOb = new HashMap<String, String>(); + public static final Map<String, String> deObToOb = new HashMap<String, String>(); private static WeakAutoMap<Pair<String, String>> mObInitMap = new WeakAutoMap<Pair<String, String>>(); private static boolean init() { @@ -176,14 +175,90 @@ public class DevHelper { } } } - Logger.INFO("[DevHelper] mInitMap size: "+mInitMap.size()); - Logger.INFO("[DevHelper] mObInitMap size: "+mObInitMap.size()); + Preloader_Logger.INFO("[DevHelper] mInitMap size: "+mInitMap.size()); + Preloader_Logger.INFO("[DevHelper] mObInitMap size: "+mObInitMap.size()); + + Preloader_Logger.INFO("[DevHelper] srgToForge size: "+srgToForge.size()); + Preloader_Logger.INFO("[DevHelper] forgeToSrg size: "+forgeToSrg.size()); + Preloader_Logger.INFO("[DevHelper] obToDeOb size: "+obToDeOb.size()); + Preloader_Logger.INFO("[DevHelper] deObToOb size: "+deObToOb.size()); + + if (srgToForge.size() > 0 && forgeToSrg.size() > 0 && obToDeOb.size() > 0 && deObToOb.size() > 0) { + if (srgToForge.size() == forgeToSrg.size() && obToDeOb.size() == deObToOb.size()) { + return true; + } + else { + if (srgToForge.size() != forgeToSrg.size()) { + int aKey1 = 0; + int aKey2 = 0; + HashMap<Integer, String> aMissingForgeNames = new HashMap<Integer, String>(); + HashMap<Integer, String> aMissingSrgNames = new HashMap<Integer, String>(); + Preloader_Logger.INFO("Mismatch between mapped Forge and Srg names, finding missing values."); + if (srgToForge.size() > forgeToSrg.size()) { + Preloader_Logger.INFO("More SRG Keys detected."); + for (String aKey : srgToForge.keySet()) { + if (!forgeToSrg.containsValue(aKey)) { + aMissingSrgNames.put(aKey1++, aKey); + } + } + } + else if (srgToForge.size() < forgeToSrg.size()) { + Preloader_Logger.INFO("More Forge Keys detected."); + for (String aKey : forgeToSrg.keySet()) { + if (!srgToForge.containsValue(aKey)) { + aMissingForgeNames.put(aKey2++, aKey); + } + } + } + if (!aMissingForgeNames.isEmpty()) { + for (String missingVal : aMissingForgeNames.values()) { + //Preloader_Logger.WARNING("Missing Forge value: "+missingVal); + } + } + if (!aMissingSrgNames.isEmpty()) { + for (String missingVal : aMissingSrgNames.values()) { + //Preloader_Logger.WARNING("Missing SRG value: "+missingVal); + } + } + } + if (obToDeOb.size() != deObToOb.size()) { + int aKey1 = 0; + int aKey2 = 0; + HashMap<Integer, String> aMissingObfNames = new HashMap<Integer, String>(); + HashMap<Integer, String> aMissingDeObfNames = new HashMap<Integer, String>(); + Preloader_Logger.INFO("Mismatch between mapped Obfuscated and Deobfuscated names, finding missing values."); + if (obToDeOb.size() > deObToOb.size()) { + Preloader_Logger.INFO("More Obfuscated Keys detected."); + for (String aKey : obToDeOb.keySet()) { + if (!deObToOb.containsValue(aKey)) { + aMissingObfNames.put(aKey1++, aKey); + } + } + } + else if (obToDeOb.size() < deObToOb.size()) { + Preloader_Logger.INFO("More Deobfuscated Keys detected."); + for (String aKey : deObToOb.keySet()) { + if (!obToDeOb.containsValue(aKey)) { + aMissingDeObfNames.put(aKey2++, aKey); + } + } + } + if (!aMissingObfNames.isEmpty()) { + for (String missingVal : aMissingObfNames.values()) { + Preloader_Logger.WARNING("Missing Obfuscated value: "+missingVal); + } + } + if (!aMissingDeObfNames.isEmpty()) { + for (String missingVal : aMissingDeObfNames.values()) { + Preloader_Logger.WARNING("Missing Deobfuscated value: "+missingVal); + } + } + } + } + } - Logger.INFO("[DevHelper] srgToForge size: "+srgToForge.size()); - Logger.INFO("[DevHelper] forgeToSrg size: "+forgeToSrg.size()); - Logger.INFO("[DevHelper] obToDeOb size: "+obToDeOb.size()); - Logger.INFO("[DevHelper] deObToOb size: "+deObToOb.size()); - return srgToForge.size() > 0 && forgeToSrg.size() > 0 && obToDeOb.size() > 0 && deObToOb.size() > 0; + // return true anyway as some keys will mismatch. + return true; } private static void init1() { @@ -5029,7 +5104,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("bmg", "net/minecraft/client/shader/Framebuffer")); mObInitMap.put(new Pair<String, String>("na", "net/minecraft/client/network/NetHandlerHandshakeMemory")); mObInitMap - .put(new Pair<String, String>("jb", "net/minecraft/network/play/client/C02PacketUseEntity$Action")); + .put(new Pair<String, String>("jb", "net/minecraft/network/play/client/C02PacketUseEntity$Action")); mObInitMap.put(new Pair<String, String>("fc", "net/minecraft/util/MessageDeserializer2")); mObInitMap.put(new Pair<String, String>("bd", "net/minecraft/command/server/CommandPardonIp")); mObInitMap.put(new Pair<String, String>("amw", "net/minecraft/block/BlockPumpkin")); @@ -5104,7 +5179,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("tl", "net/minecraft/entity/ai/attributes/BaseAttributeMap")); mObInitMap.put(new Pair<String, String>("pm", "net/minecraft/stats/IStatType")); mObInitMap - .put(new Pair<String, String>("atc", "net/minecraft/world/gen/structure/StructureMineshaftStart")); + .put(new Pair<String, String>("atc", "net/minecraft/world/gen/structure/StructureMineshaftStart")); mObInitMap.put(new Pair<String, String>("apd", "net/minecraft/tileentity/TileEntityEnchantmentTable")); mObInitMap.put(new Pair<String, String>("ale", "net/minecraft/block/BlockFurnace")); mObInitMap.put(new Pair<String, String>("adg", "net/minecraft/item/ItemLeaves")); @@ -5112,7 +5187,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("axb", "net/minecraft/world/gen/layer/GenLayerAddIsland")); mObInitMap.put(new Pair<String, String>("bpg", "net/minecraft/client/util/JsonBlendingMode")); mObInitMap - .put(new Pair<String, String>("net/minecraft/realms/RealmsMth", "net/minecraft/realms/RealmsMth")); + .put(new Pair<String, String>("net/minecraft/realms/RealmsMth", "net/minecraft/realms/RealmsMth")); mObInitMap.put(new Pair<String, String>("qa", "net/minecraft/util/IntHashMap$Entry")); mObInitMap.put(new Pair<String, String>("mb", "net/minecraft/server/gui/MinecraftServerGui$3")); mObInitMap.put( @@ -5262,13 +5337,13 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("aaw", "net/minecraft/inventory/InventoryCraftResult")); mObInitMap.put(new Pair<String, String>("w", "net/minecraft/client/audio/SoundCategory")); mObInitMap - .put(new Pair<String, String>("bqv", "net/minecraft/client/resources/IReloadableResourceManager")); + .put(new Pair<String, String>("bqv", "net/minecraft/client/resources/IReloadableResourceManager")); mObInitMap.put(new Pair<String, String>("baz", "net/minecraft/client/Minecraft$3")); mObInitMap.put(new Pair<String, String>("bey", "net/minecraft/client/gui/GuiRepair")); mObInitMap.put(new Pair<String, String>("bix", "net/minecraft/client/model/ModelRenderer")); mObInitMap.put(new Pair<String, String>("bmw", "net/minecraft/client/renderer/culling/ClippingHelperImpl")); mObInitMap - .put(new Pair<String, String>("fs", "net/minecraft/util/ChatComponentTranslationFormatException")); + .put(new Pair<String, String>("fs", "net/minecraft/util/ChatComponentTranslationFormatException")); mObInitMap.put(new Pair<String, String>("bt", "net/minecraft/command/server/CommandStop")); mObInitMap.put(new Pair<String, String>("yy", "net/minecraft/entity/player/InventoryPlayer$1")); mObInitMap.put(new Pair<String, String>("uz", "net/minecraft/entity/ai/EntityAIPanic")); @@ -5290,7 +5365,7 @@ public class DevHelper { mObInitMap.put( new Pair<String, String>("np", "net/minecraft/server/network/NetHandlerLoginServer$LoginState")); mObInitMap - .put(new Pair<String, String>("jq", "net/minecraft/network/handshake/INetHandlerHandshakeServer")); + .put(new Pair<String, String>("jq", "net/minecraft/network/handshake/INetHandlerHandshakeServer")); mObInitMap.put(new Pair<String, String>("fr", "net/minecraft/util/ChatComponentTranslation")); mObInitMap.put(new Pair<String, String>("arf", "net/minecraft/world/gen/feature/WorldGenBlockBlob")); mObInitMap.put(new Pair<String, String>("ang", "net/minecraft/block/BlockRotatedPillar")); @@ -5300,7 +5375,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("ave", "net/minecraft/world/gen/structure/MapGenStructure")); mObInitMap.put(new Pair<String, String>("azd", "net/minecraft/client/AnvilConverterException")); mObInitMap - .put(new Pair<String, String>("net/minecraft/client/main/Main", "net/minecraft/client/main/Main")); + .put(new Pair<String, String>("net/minecraft/client/main/Main", "net/minecraft/client/main/Main")); mObInitMap.put(new Pair<String, String>("bri", "net/minecraft/client/resources/SimpleResource")); mObInitMap.put(new Pair<String, String>("bfl", "net/minecraft/client/gui/inventory/GuiContainerCreative")); mObInitMap.put(new Pair<String, String>("bjk", "net/minecraft/client/entity/EntityClientPlayerMP")); @@ -5310,7 +5385,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("od", "net/minecraft/server/management/PreYggdrasilConverter$4")); mObInitMap.put(new Pair<String, String>("ke", "net/minecraft/network/ServerStatusResponse$Serializer")); mObInitMap - .put(new Pair<String, String>("gf", "net/minecraft/network/play/server/S35PacketUpdateTileEntity")); + .put(new Pair<String, String>("gf", "net/minecraft/network/play/server/S35PacketUpdateTileEntity")); mObInitMap.put(new Pair<String, String>("cg", "net/minecraft/command/PlayerNotFoundException")); mObInitMap.put(new Pair<String, String>("ary", "net/minecraft/world/gen/feature/WorldGenGlowStone1")); mObInitMap.put(new Pair<String, String>("anz", "net/minecraft/block/BlockTallGrass")); @@ -5353,7 +5428,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("btc", "net/minecraft/client/network/LanServerDetector$ThreadLanServerFind")); mObInitMap - .put(new Pair<String, String>("bpd", "net/minecraft/client/renderer/tileentity/RenderWitherSkull")); + .put(new Pair<String, String>("bpd", "net/minecraft/client/renderer/tileentity/RenderWitherSkull")); mObInitMap.put(new Pair<String, String>("bhf", "net/minecraft/client/model/ModelBook")); mObInitMap.put(new Pair<String, String>("ble", "net/minecraft/client/particle/EntityFishWakeFX")); mObInitMap.put(new Pair<String, String>("ea", "net/minecraft/nbt/NBTException")); @@ -5397,11 +5472,11 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("aye", "net/minecraft/pathfinding/PathPoint")); mObInitMap.put(new Pair<String, String>("bbc", "net/minecraft/client/Minecraft$6")); mObInitMap - .put(new Pair<String, String>("bfb", "net/minecraft/client/gui/inventory/GuiBeacon$ConfirmButton")); + .put(new Pair<String, String>("bfb", "net/minecraft/client/gui/inventory/GuiBeacon$ConfirmButton")); mObInitMap.put(new Pair<String, String>("bui", "net/minecraft/client/stream/IngestServerTester")); mObInitMap.put(new Pair<String, String>("bqj", "net/minecraft/client/renderer/texture/ITickable")); mObInitMap - .put(new Pair<String, String>("zb", "net/minecraft/entity/player/EntityPlayer$EnumChatVisibility")); + .put(new Pair<String, String>("zb", "net/minecraft/entity/player/EntityPlayer$EnumChatVisibility")); mObInitMap.put(new Pair<String, String>("vc", "net/minecraft/entity/ai/EntityAIWander")); mObInitMap.put(new Pair<String, String>("rd", "net/minecraft/world/EnumDifficulty")); mObInitMap.put(new Pair<String, String>("ne", "net/minecraft/network/NetworkSystem$2")); @@ -5428,7 +5503,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("brq", "net/minecraft/client/resources/Language")); mObInitMap.put(new Pair<String, String>("bbu", "net/minecraft/client/gui/FontRenderer")); mObInitMap - .put(new Pair<String, String>("bft", "net/minecraft/client/gui/inventory/GuiScreenHorseInventory")); + .put(new Pair<String, String>("bft", "net/minecraft/client/gui/inventory/GuiScreenHorseInventory")); mObInitMap.put(new Pair<String, String>("bjs", "net/minecraft/client/network/OldServerPinger$2")); mObInitMap.put(new Pair<String, String>("bnr", "net/minecraft/client/renderer/entity/RenderFireball")); mObInitMap.put(new Pair<String, String>("sk", "net/minecraft/command/IEntitySelector$1")); @@ -5554,14 +5629,14 @@ public class DevHelper { "net/minecraft/world/gen/structure/StructureStrongholdPieces$Straight")); mObInitMap.put(new Pair<String, String>("bnz", "net/minecraft/client/renderer/entity/RenderItem$1")); mObInitMap - .put(new Pair<String, String>("gv", "net/minecraft/network/play/server/S2BPacketChangeGameState")); + .put(new Pair<String, String>("gv", "net/minecraft/network/play/server/S2BPacketChangeGameState")); mObInitMap.put(new Pair<String, String>("cw", "net/minecraft/util/RegistryNamespaced")); mObInitMap.put(new Pair<String, String>("net/minecraft/realms/RealmsScrolledSelectionList", "net/minecraft/realms/RealmsScrolledSelectionList")); mObInitMap.put(new Pair<String, String>("aru", "net/minecraft/world/gen/feature/WorldGenBigMushroom")); mObInitMap.put(new Pair<String, String>("anv", "net/minecraft/block/BlockStone")); mObInitMap - .put(new Pair<String, String>("afx", "net/minecraft/enchantment/EnchantmentHelper$DamageIterator")); + .put(new Pair<String, String>("afx", "net/minecraft/enchantment/EnchantmentHelper$DamageIterator")); mObInitMap.put(new Pair<String, String>("ajw", "net/minecraft/block/BlockCauldron")); mObInitMap.put( new Pair<String, String>("avt", "net/minecraft/world/gen/structure/StructureVillagePieces$Torch")); @@ -5569,7 +5644,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("bcq", "net/minecraft/client/gui/GuiScreenRealmsProxy")); mObInitMap.put(new Pair<String, String>("bgp", "net/minecraft/client/gui/stream/GuiStreamUnavailable")); mObInitMap - .put(new Pair<String, String>("brx", "net/minecraft/client/resources/data/IMetadataSerializer$1")); + .put(new Pair<String, String>("brx", "net/minecraft/client/resources/data/IMetadataSerializer$1")); mObInitMap.put(new Pair<String, String>("wq", "net/minecraft/entity/passive/EntitySheep$1")); mObInitMap.put(new Pair<String, String>("sr", "net/minecraft/entity/EntityFlying")); mObInitMap.put(new Pair<String, String>("os", "net/minecraft/server/management/UserListWhitelistEntry")); @@ -5635,7 +5710,7 @@ public class DevHelper { "net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces$JunglePyramid")); mObInitMap.put(new Pair<String, String>("ayb", "net/minecraft/world/gen/layer/GenLayerVoronoiZoom")); mObInitMap - .put(new Pair<String, String>("buf", "net/minecraft/client/stream/ChatController$SwitchChatState")); + .put(new Pair<String, String>("buf", "net/minecraft/client/stream/ChatController$SwitchChatState")); mObInitMap.put(new Pair<String, String>("bqg", "net/minecraft/client/renderer/texture/TextureManager$1")); mObInitMap.put(new Pair<String, String>("bii", "net/minecraft/client/model/PositionTextureVertex")); mObInitMap.put(new Pair<String, String>("bmh", "net/minecraft/client/renderer/Tessellator")); @@ -5670,7 +5745,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("net/minecraft/realms/RealmsLevelSummary", "net/minecraft/realms/RealmsLevelSummary")); mObInitMap - .put(new Pair<String, String>("gk", "net/minecraft/network/play/server/S22PacketMultiBlockChange")); + .put(new Pair<String, String>("gk", "net/minecraft/network/play/server/S22PacketMultiBlockChange")); mObInitMap.put(new Pair<String, String>("cl", "net/minecraft/block/BlockSourceImpl")); mObInitMap.put(new Pair<String, String>("vr", "net/minecraft/entity/ai/EntityAITargetNonTamed")); mObInitMap.put(new Pair<String, String>("rs", "net/minecraft/potion/PotionAttackDamage")); @@ -5688,7 +5763,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("gj", "net/minecraft/network/play/server/S02PacketChat")); mObInitMap.put(new Pair<String, String>("acb", "net/minecraft/creativetab/CreativeTabs$5")); mObInitMap - .put(new Pair<String, String>("aga", "net/minecraft/enchantment/EnchantmentHelper$ModifierLiving")); + .put(new Pair<String, String>("aga", "net/minecraft/enchantment/EnchantmentHelper$ModifierLiving")); mObInitMap.put( new Pair<String, String>("bsa", "net/minecraft/client/resources/data/AnimationMetadataSection")); mObInitMap.put(new Pair<String, String>("bkc", "net/minecraft/client/particle/EntityFireworkOverlayFX")); @@ -5710,7 +5785,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("po", "net/minecraft/util/IJsonSerializable")); mObInitMap.put(new Pair<String, String>("lp", "net/minecraft/scoreboard/ServerScoreboard")); mObInitMap - .put(new Pair<String, String>("hq", "net/minecraft/network/play/server/S13PacketDestroyEntities")); + .put(new Pair<String, String>("hq", "net/minecraft/network/play/server/S13PacketDestroyEntities")); mObInitMap.put(new Pair<String, String>("dr", "net/minecraft/nbt/NBTTagLong")); mObInitMap.put(new Pair<String, String>("adi", "net/minecraft/item/ItemBucketMilk")); mObInitMap.put(new Pair<String, String>("ahh", "net/minecraft/world/IWorldAccess")); @@ -5812,7 +5887,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("acj", "net/minecraft/item/ItemDye")); mObInitMap.put(new Pair<String, String>("agi", "net/minecraft/enchantment/EnchantmentProtection")); mObInitMap - .put(new Pair<String, String>("bsi", "net/minecraft/client/resources/data/TextureMetadataSection")); + .put(new Pair<String, String>("bsi", "net/minecraft/client/resources/data/TextureMetadataSection")); mObInitMap.put(new Pair<String, String>("bcm", "net/minecraft/client/gui/GuiSlot")); mObInitMap.put(new Pair<String, String>("bgl", "net/minecraft/client/gui/GuiResourcePackSelected")); mObInitMap.put(new Pair<String, String>("bkk", "net/minecraft/client/particle/EntityLavaFX")); @@ -5832,7 +5907,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("xa", "net/minecraft/entity/boss/EntityDragon")); mObInitMap.put(new Pair<String, String>("tb", "net/minecraft/entity/item/EntityPainting")); mObInitMap - .put(new Pair<String, String>("asx", "net/minecraft/world/gen/structure/StructureMineshaftPieces")); + .put(new Pair<String, String>("asx", "net/minecraft/world/gen/structure/StructureMineshaftPieces")); mObInitMap.put(new Pair<String, String>("aoy", "net/minecraft/tileentity/TileEntityCommandBlock$1")); mObInitMap.put(new Pair<String, String>("akz", "net/minecraft/block/BlockFence")); mObInitMap.put(new Pair<String, String>("aww", "net/minecraft/block/material/MaterialPortal")); @@ -5861,7 +5936,7 @@ public class DevHelper { "net/minecraft/realms/RealmsServerStatusPinger")); mObInitMap.put(new Pair<String, String>("mk", "net/minecraft/world/demo/DemoWorldServer")); mObInitMap - .put(new Pair<String, String>("il", "net/minecraft/network/play/server/S20PacketEntityProperties")); + .put(new Pair<String, String>("il", "net/minecraft/network/play/server/S20PacketEntityProperties")); mObInitMap.put(new Pair<String, String>("em", "net/minecraft/network/NetworkManager$3")); mObInitMap.put(new Pair<String, String>("an", "net/minecraft/command/server/CommandEmote")); mObInitMap.put(new Pair<String, String>("aqa", "net/minecraft/world/chunk/storage/NibbleArrayReader")); @@ -5997,12 +6072,12 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("axr", "net/minecraft/world/gen/layer/GenLayerHills")); mObInitMap.put(new Pair<String, String>("bap", "net/minecraft/client/Minecraft$1")); mObInitMap - .put(new Pair<String, String>("beo", "net/minecraft/client/gui/achievement/GuiStats$StatsItem$1")); + .put(new Pair<String, String>("beo", "net/minecraft/client/gui/achievement/GuiStats$StatsItem$1")); mObInitMap.put(new Pair<String, String>("bin", "net/minecraft/client/model/ModelWither")); mObInitMap.put(new Pair<String, String>("bmm", "net/minecraft/client/renderer/tileentity/TileEntityChestRenderer")); mObInitMap - .put(new Pair<String, String>("jh", "net/minecraft/network/play/client/C13PacketPlayerAbilities")); + .put(new Pair<String, String>("jh", "net/minecraft/network/play/client/C13PacketPlayerAbilities")); mObInitMap.put(new Pair<String, String>("fi", "net/minecraft/event/ClickEvent$Action")); mObInitMap.put(new Pair<String, String>("bj", "net/minecraft/command/server/CommandSaveOn")); mObInitMap.put(new Pair<String, String>("yo", "net/minecraft/entity/monster/EntitySpider$GroupData")); @@ -6058,7 +6133,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("avm", "net/minecraft/world/gen/structure/StructureStart")); mObInitMap.put(new Pair<String, String>("bcj", "net/minecraft/client/gui/GuiOptionButton")); mObInitMap - .put(new Pair<String, String>("bgi", "net/minecraft/client/resources/ResourcePackListEntryFound")); + .put(new Pair<String, String>("bgi", "net/minecraft/client/resources/ResourcePackListEntryFound")); mObInitMap.put(new Pair<String, String>("bkh", "net/minecraft/client/particle/EntityHeartFX")); mObInitMap.put(new Pair<String, String>("bog", "net/minecraft/client/renderer/entity/RenderLightningBolt")); mObInitMap.put(new Pair<String, String>("lb", "net/minecraft/client/util/JsonException")); @@ -6153,7 +6228,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("sa", "net/minecraft/entity/Entity")); mObInitMap.put(new Pair<String, String>("ob", "net/minecraft/server/management/PreYggdrasilConverter$2")); mObInitMap - .put(new Pair<String, String>("kc", "net/minecraft/network/ServerStatusResponse$PlayerCountData")); + .put(new Pair<String, String>("kc", "net/minecraft/network/ServerStatusResponse$PlayerCountData")); mObInitMap.put(new Pair<String, String>("gd", "net/minecraft/network/play/server/S37PacketStatistics")); mObInitMap.put(new Pair<String, String>("ce", "net/minecraft/command/NumberInvalidException")); mObInitMap.put(new Pair<String, String>("net/minecraft/realms/Realms", "net/minecraft/realms/Realms")); @@ -6223,7 +6298,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("axo", "net/minecraft/world/gen/layer/GenLayer$1")); mObInitMap.put(new Pair<String, String>("bam", "net/minecraft/client/renderer/RenderHelper")); mObInitMap - .put(new Pair<String, String>("bel", "net/minecraft/client/gui/achievement/GuiStats$StatsBlock$1")); + .put(new Pair<String, String>("bel", "net/minecraft/client/gui/achievement/GuiStats$StatsBlock$1")); mObInitMap.put(new Pair<String, String>("bik", "net/minecraft/client/model/ModelVillager")); mObInitMap.put(new Pair<String, String>("bmj", "net/minecraft/client/renderer/tileentity/TileEntityBeaconRenderer")); @@ -6289,12 +6364,12 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("wg", "net/minecraft/entity/passive/EntityChicken")); mObInitMap.put(new Pair<String, String>("sh", "net/minecraft/entity/EntityList$EntityEggInfo")); mObInitMap - .put(new Pair<String, String>("oi", "net/minecraft/server/management/ServerConfigurationManager")); + .put(new Pair<String, String>("oi", "net/minecraft/server/management/ServerConfigurationManager")); mObInitMap.put(new Pair<String, String>("kj", "net/minecraft/network/status/client/C00PacketServerQuery")); mObInitMap.put(new Pair<String, String>("aka", "net/minecraft/block/BlockColored")); mObInitMap.put(new Pair<String, String>("acc", "net/minecraft/creativetab/CreativeTabs$6")); mObInitMap - .put(new Pair<String, String>("agb", "net/minecraft/enchantment/EnchantmentHelper$ModifierDamage")); + .put(new Pair<String, String>("agb", "net/minecraft/enchantment/EnchantmentHelper$ModifierDamage")); mObInitMap.put(new Pair<String, String>("bsb", "net/minecraft/client/resources/data/AnimationMetadataSectionSerializer")); mObInitMap.put(new Pair<String, String>("bkd", "net/minecraft/client/particle/EntityFireworkSparkFX")); @@ -6333,7 +6408,7 @@ public class DevHelper { mObInitMap.put( new Pair<String, String>("net/minecraft/realms/Tezzelator", "net/minecraft/realms/Tezzelator")); mObInitMap - .put(new Pair<String, String>("ate", "net/minecraft/world/gen/structure/MapGenNetherBridge$Start")); + .put(new Pair<String, String>("ate", "net/minecraft/world/gen/structure/MapGenNetherBridge$Start")); mObInitMap.put(new Pair<String, String>("apf", "net/minecraft/tileentity/TileEntityFlowerPot")); mObInitMap.put(new Pair<String, String>("alg", "net/minecraft/block/BlockGlowstone")); mObInitMap.put(new Pair<String, String>("axd", "net/minecraft/world/gen/layer/GenLayerAddSnow")); @@ -6370,7 +6445,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("vi", "net/minecraft/entity/ai/EntityAICreeperSwell")); mObInitMap.put(new Pair<String, String>("rj", "net/minecraft/profiler/PlayerUsageSnooper$1")); mObInitMap - .put(new Pair<String, String>("nk", "net/minecraft/network/NetHandlerPlayServer$SwitchEnumState")); + .put(new Pair<String, String>("nk", "net/minecraft/network/NetHandlerPlayServer$SwitchEnumState")); mObInitMap.put(new Pair<String, String>("jl", "net/minecraft/network/play/client/C09PacketHeldItemChange")); mObInitMap.put(new Pair<String, String>("fm", "net/minecraft/event/HoverEvent$Action")); mObInitMap.put(new Pair<String, String>("bn", "net/minecraft/command/server/CommandSetDefaultSpawnpoint")); @@ -6438,7 +6513,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("bdb", "net/minecraft/client/gui/GuiCreateWorld")); mObInitMap.put(new Pair<String, String>("ly", "net/minecraft/server/gui/MinecraftServerGui")); mObInitMap - .put(new Pair<String, String>("hz", "net/minecraft/network/play/server/S04PacketEntityEquipment")); + .put(new Pair<String, String>("hz", "net/minecraft/network/play/server/S04PacketEntityEquipment")); mObInitMap.put(new Pair<String, String>("asy", "net/minecraft/world/gen/structure/StructureMineshaftPieces$Corridor")); mObInitMap.put(new Pair<String, String>("aoz", "net/minecraft/tileentity/TileEntityComparator")); @@ -6482,7 +6557,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("bud", "net/minecraft/client/stream/BroadcastController$BroadcastListener")); mObInitMap - .put(new Pair<String, String>("bqe", "net/minecraft/client/renderer/texture/TextureAtlasSprite$1")); + .put(new Pair<String, String>("bqe", "net/minecraft/client/renderer/texture/TextureAtlasSprite$1")); mObInitMap.put(new Pair<String, String>("beh", "net/minecraft/client/gui/achievement/GuiAchievement")); mObInitMap.put(new Pair<String, String>("big", "net/minecraft/client/model/ModelSpider")); mObInitMap.put(new Pair<String, String>("ja", "net/minecraft/network/play/client/C02PacketUseEntity")); @@ -6662,7 +6737,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("bgj", "net/minecraft/client/gui/GuiResourcePackAvailable")); mObInitMap.put(new Pair<String, String>("bki", "net/minecraft/client/particle/EntityLargeExplodeFX")); mObInitMap - .put(new Pair<String, String>("boh", "net/minecraft/client/renderer/entity/RendererLivingEntity")); + .put(new Pair<String, String>("boh", "net/minecraft/client/renderer/entity/RendererLivingEntity")); mObInitMap.put(new Pair<String, String>("lc", "net/minecraft/client/util/JsonException$1")); mObInitMap.put(new Pair<String, String>("hd", "net/minecraft/network/play/server/S01PacketJoinGame")); mObInitMap.put(new Pair<String, String>("de", "net/minecraft/util/StringTranslate")); @@ -6731,7 +6806,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("bbm", "net/minecraft/client/settings/GameSettings$Options")); mObInitMap.put(new Pair<String, String>("bus", "net/minecraft/realms/RealmsConnect$1")); mObInitMap - .put(new Pair<String, String>("bqt", "net/minecraft/client/resources/FoliageColorReloadListener")); + .put(new Pair<String, String>("bqt", "net/minecraft/client/resources/FoliageColorReloadListener")); mObInitMap.put(new Pair<String, String>("zl", "net/minecraft/entity/projectile/EntityEgg")); mObInitMap.put(new Pair<String, String>("vm", "net/minecraft/entity/ai/EntityAIDefendVillage")); mObInitMap.put(new Pair<String, String>("rn", "net/minecraft/util/CombatTracker")); @@ -6795,7 +6870,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("pi", "net/minecraft/stats/StatBase$1")); mObInitMap.put(new Pair<String, String>("lj", "net/minecraft/server/MinecraftServer$3")); mObInitMap - .put(new Pair<String, String>("hk", "net/minecraft/network/play/server/S39PacketPlayerAbilities")); + .put(new Pair<String, String>("hk", "net/minecraft/network/play/server/S39PacketPlayerAbilities")); mObInitMap.put(new Pair<String, String>("dl", "net/minecraft/nbt/NBTTagEnd")); mObInitMap.put(new Pair<String, String>("ala", "net/minecraft/block/BlockFenceGate")); mObInitMap.put(new Pair<String, String>("adc", "net/minecraft/item/Item$ToolMaterial")); @@ -6829,7 +6904,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("axp", "net/minecraft/world/gen/layer/GenLayer$2")); mObInitMap.put(new Pair<String, String>("ban", "net/minecraft/client/renderer/GLAllocation")); mObInitMap - .put(new Pair<String, String>("bem", "net/minecraft/client/gui/achievement/GuiStats$StatsGeneral")); + .put(new Pair<String, String>("bem", "net/minecraft/client/gui/achievement/GuiStats$StatsGeneral")); mObInitMap.put(new Pair<String, String>("bil", "net/minecraft/client/model/ModelZombieVillager")); mObInitMap.put(new Pair<String, String>("bmk", "net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher")); @@ -6846,7 +6921,7 @@ public class DevHelper { mObInitMap.put(new Pair<String, String>("ayd", "net/minecraft/pathfinding/Path")); mObInitMap.put(new Pair<String, String>("bbb", "net/minecraft/client/Minecraft$5")); mObInitMap - .put(new Pair<String, String>("bfa", "net/minecraft/client/gui/inventory/GuiBeacon$CancelButton")); + .put(new Pair<String, String>("bfa", "net/minecraft/client/gui/inventory/GuiBeacon$CancelButton")); mObInitMap.put(new Pair<String, String>("buh", "net/minecraft/client/stream/ChatController$ChatListener")); mObInitMap.put(new Pair<String, String>("bqi", "net/minecraft/client/renderer/texture/TextureUtil")); mObInitMap.put(new Pair<String, String>("za", "net/minecraft/entity/player/EntityPlayer$EnumStatus")); diff --git a/src/Java/gtPlusPlus/preloader/Preloader_Logger.java b/src/Java/gtPlusPlus/preloader/Preloader_Logger.java new file mode 100644 index 0000000000..84f0fab012 --- /dev/null +++ b/src/Java/gtPlusPlus/preloader/Preloader_Logger.java @@ -0,0 +1,60 @@ +package gtPlusPlus.preloader; + +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class Preloader_Logger { + + private Preloader_Logger() { + + } + + // Logging Functions + public static final Logger MODLOGGER = Preloader_Logger.makeLogger(); + + // Generate GT++ Logger + public static Logger makeLogger() { + final Logger gtPlusPlusLogger = LogManager.getLogger("GT++ ASM"); + return gtPlusPlusLogger; + } + + public static final org.apache.logging.log4j.Logger getLogger(){ + return MODLOGGER; + } + + // Non-Dev Comments + + public static void INFO(final String s, final String s2) { + INFO(s); + INFO(s2); + } + + public static void INFO(final String s) { + MODLOGGER.info(s); + } + + // Developer Comments + public static void WARNING(final String s) { + MODLOGGER.warn(s); + } + + // Errors + public static void ERROR(final String s) { + MODLOGGER.fatal(s); + } + + public static void LOG(String string, Level info, String string2) { + if (info.equals(Level.INFO)) { + INFO("["+string+"] "+string2); + } + if (info.equals(Level.WARN)) { + WARNING("["+string+"] "+string2); + } + if (info.equals(Level.ERROR)) { + ERROR("["+string+"] "+string2); + } + + } + +} diff --git a/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java b/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java index 87ac77d5da..476d07b674 100644 --- a/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java +++ b/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java @@ -1,6 +1,8 @@ package gtPlusPlus.preloader.asm; import cpw.mods.fml.common.FMLLog; +import gtPlusPlus.preloader.Preloader_Logger; + import java.io.File; import java.util.ArrayList; import net.minecraftforge.common.config.Configuration; @@ -11,7 +13,8 @@ public class AsmConfig { public static boolean loaded; public static Configuration config; - + + public static boolean enableOreDictPatch; public static boolean enableTiConFluidLighting; public static boolean enableGtTooltipFix; public static boolean enableGtNbtFix; @@ -80,6 +83,12 @@ public class AsmConfig { enableCofhPatch = prop.getBoolean(false); propOrderDebug.add(prop.getName()); + prop = config.get("debug", "enableOreDictPatch", false); + prop.comment = "Enable/Disable Forge OreDictionary Patch (Useful for Development)"; + prop.setLanguageKey("gtpp.enableOreDictPatch").setRequiresMcRestart(true); + enableOreDictPatch = prop.getBoolean(false); + propOrderDebug.add(prop.getName()); + @@ -168,15 +177,15 @@ public class AsmConfig { config.save(); } - FMLLog.log(Level.INFO, "[GT++ ASM] Chunk Debugging - Enabled: "+enableChunkDebugging, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] Gt Nbt Fix - Enabled: "+enableGtNbtFix, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] TiCon Fluid Lighting - Enabled: "+enableTiConFluidLighting, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] Gt Tooltip Fix - Enabled: "+enableGtTooltipFix, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] COFH Patch - Enabled: "+enableCofhPatch, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] Gc Fuel Changes Patch - Enabled: "+enableGcFuelChanges, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] Railcraft Fluid Flow Patch - Enabled: "+enableRcFlowFix, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] Thaumcraft Aspect Safety Patch - Enabled: "+enableTcAspectSafety, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] Fix bad usage of EntityLivingBase.setHealth Patch - Enabled: "+enabledFixEntitySetHealth, new Object[0]); + Preloader_Logger.INFO("Chunk Debugging - Enabled: "+enableChunkDebugging); + Preloader_Logger.INFO("Gt Nbt Fix - Enabled: "+enableGtNbtFix); + Preloader_Logger.INFO("TiCon Fluid Lighting - Enabled: "+enableTiConFluidLighting); + Preloader_Logger.INFO("Gt Tooltip Fix - Enabled: "+enableGtTooltipFix); + Preloader_Logger.INFO("COFH Patch - Enabled: "+enableCofhPatch); + Preloader_Logger.INFO("Gc Fuel Changes Patch - Enabled: "+enableGcFuelChanges); + Preloader_Logger.INFO("Railcraft Fluid Flow Patch - Enabled: "+enableRcFlowFix); + Preloader_Logger.INFO("Thaumcraft Aspect Safety Patch - Enabled: "+enableTcAspectSafety); + Preloader_Logger.INFO("Fix bad usage of EntityLivingBase.setHealth Patch - Enabled: "+enabledFixEntitySetHealth); } catch (Exception var3) { FMLLog.log(Level.ERROR, var3, "GT++ ASM had a problem loading it's config", new Object[0]); diff --git a/src/Java/gtPlusPlus/preloader/asm/ClassesToTransform.java b/src/Java/gtPlusPlus/preloader/asm/ClassesToTransform.java new file mode 100644 index 0000000000..84593f6597 --- /dev/null +++ b/src/Java/gtPlusPlus/preloader/asm/ClassesToTransform.java @@ -0,0 +1,74 @@ +package gtPlusPlus.preloader.asm; + +public class ClassesToTransform { + + + public static final String LWJGL_KEYBOARD = "org.lwjgl.input.Keyboard"; + + + public static final String MINECRAFT_GAMESETTINGS = "net.minecraft.client.settings.GameSettings"; + public static final String MINECRAFT_GAMESETTINGS_OBF = "bbj"; + + + public static final String FORGE_CHUNK_MANAGER = "net.minecraftforge.common.ForgeChunkManager"; + public static final String FORGE_ORE_DICTIONARY = "net.minecraftforge.oredict.OreDictionary"; + + + public static final String COFH_ORE_DICTIONARY_ARBITER = "cofh.core.util.oredict.OreDictionaryArbiter"; + + + public static final String TINKERS_FLUID_BLOCK = "tconstruct.smeltery.blocks.TConstructFluid"; + + + public static final String RAILCRAFT_FLUID_HELPER = "mods.railcraft.common.fluids.FluidHelper"; + public static final String RAILCRAFT_TILE_FLUID_LOADER = "mods.railcraft.common.blocks.machine.gamma.TileFluidLoader"; + public static final String RAILCRAFT_INVENTORY_TOOLS = "mods.railcraft.common.util.inventory.InvTools"; + + + public static final String GALACTICRAFT_FLUID_UTILS = "micdoodle8.mods.galacticraft.core.util.FluidUtil"; + public static final String GALACTICRAFT_TILE_ENTITY_FUEL_LOADER = "micdoodle8.mods.galacticraft.core.tile.TileEntityFuelLoader"; + public static final String GALACTICRAFT_ENTITY_AUTO_ROCKET = "micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket"; + + + public static final String GT_UTILITY = "gregtech.api.util.GT_Utility"; + public static final String GT_ACHIEVEMENTS = "gregtech.loaders.misc.GT_Achievements"; + public static final String GT_CLIENT_PROXY = "gregtech.common.GT_Client"; + public static final String GT_PACKET_TILE_ENTITY = "gregtech.api.net.GT_Packet_TileEntity"; + public static final String GT_BASE_META_TILE_ENTITY = "gregtech.api.metatileentity.BaseMetaTileEntity"; + public static final String GT_MTE_CHARCOAL_PIT = "gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_Charcoal_Pit"; + public static final String GT_ITEM_MACHINES = "gregtech.common.blocks.GT_Item_Machines"; + public static final String GT_METAGENERATED_TOOL = "gregtech.api.items.GT_MetaGenerated_Tool"; + public static final String GT_BLOCK_MACHINES = "gregtech.common.blocks.GT_Block_Machines"; + public static final String GT_MTE_HATCH_INPUTBUS = "gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus"; + public static final String GT_MTE_HATCH_OUTPUTBUS = "gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus"; + public static final String GT_METAPIPE_ITEM = "gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Item"; + public static final String GT_METAPIPE_FLUID = "gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid"; + public static final String GT_METAPIPE_FRAME = "gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Frame"; + + + public static final String GTPP_MTE_HATCH_SUPER_INPUT_BUS = "gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Input"; + public static final String GTPP_MTE_HATCH_SUPER_OUTPUT_BUS = "gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Output"; + public static final String NAME = ""; + + + public static final String THAUMCRAFT_ITEM_WISP_ESSENCE = "thaumcraft.common.items.ItemWispEssence"; + + public static final String IC2_ITEM_ARMOUR_HAZMAT = "ic2.core.item.armor.ItemArmorHazmat"; + public static final String IC2_BLOCK_BASE_TILE_ENTITY = "ic2.core.block.BlockTileEntity"; + public static final String IC2_BLOCK_MACHINE1 = "ic2.core.block.machine.BlockMachine"; + public static final String IC2_BLOCK_MACHINE2 = "ic2.core.block.machine.BlockMachine2"; + public static final String IC2_BLOCK_MACHINE3 = "ic2.core.block.machine.BlockMachine3"; + public static final String IC2_BLOCK_KINETIC_GENERATOR = "ic2.core.block.kineticgenerator.block.BlockKineticGenerator"; + public static final String IC2_BLOCK_HEAT_GENERATOR = "ic2.core.block.heatgenerator.block.BlockHeatGenerator"; + public static final String IC2_BLOCK_GENERATOR = "ic2.core.block.generator.block.BlockGenerator"; + public static final String IC2_BLOCK_REACTOR_ACCESS_HATCH = "ic2.core.block.reactor.block.BlockReactorAccessHatch"; + public static final String IC2_BLOCK_REACTOR_CHAMBER = "ic2.core.block.reactor.block.BlockReactorChamber"; + public static final String IC2_BLOCK_REACTOR_FLUID_PORT = "ic2.core.block.reactor.block.BlockReactorFluidPort"; + public static final String IC2_BLOCK_REACTOR_REDSTONE_PORT = "ic2.core.block.reactor.block.BlockReactorRedstonePort"; + public static final String IC2_BLOCK_REACTOR_VESSEL = "ic2.core.block.reactor.block.BlockReactorVessel"; + public static final String IC2_BLOCK_PERSONAL = "ic2.core.block.personal.BlockPersonal.class"; + public static final String IC2_BLOCK_CHARGEPAD = "ic2.core.block.wiring.BlockChargepad.class"; + public static final String IC2_BLOCK_ELECTRIC = "ic2.core.block.wiring.BlockElectric.class"; + public static final String IC2_BLOCK_LUMINATOR = "ic2.core.block.wiring.BlockLuminator.class"; + +} diff --git a/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java b/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java index d8a4bf96f5..2a0082754a 100644 --- a/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java +++ b/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java @@ -2,27 +2,24 @@ package gtPlusPlus.preloader.asm; import java.io.File; import java.util.Arrays; -import java.util.List; import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; import cpw.mods.fml.common.DummyModContainer; import cpw.mods.fml.common.LoadController; -import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.ModMetadata; -import cpw.mods.fml.common.event.*; -import cpw.mods.fml.common.versioning.ArtifactVersion; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.Utils; +import cpw.mods.fml.common.event.FMLConstructionEvent; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; import gtPlusPlus.preloader.CORE_Preloader; +import gtPlusPlus.preloader.Preloader_Logger; import net.minecraftforge.common.config.Configuration; public class Preloader_DummyContainer extends DummyModContainer { public Preloader_DummyContainer() { - super(new ModMetadata()); ModMetadata meta = getMetadata(); meta.modId = CORE_Preloader.MODID; @@ -35,7 +32,8 @@ public class Preloader_DummyContainer extends DummyModContainer { meta.updateUrl = ""; meta.screenshots = new String[0]; meta.logoFile = ""; - meta.dependencies = (List<ArtifactVersion>) CORE_Preloader.DEPENDENCIES; + //meta.dependencies = (List<ArtifactVersion>) CORE_Preloader.DEPENDENCIES; + Preloader_Logger.INFO("Initializing DummyModContainer"); } @@ -47,29 +45,26 @@ public class Preloader_DummyContainer extends DummyModContainer { @Subscribe public void modConstruction(FMLConstructionEvent evt){ - - } - - @Subscribe - public void init(FMLInitializationEvent evt) { + Preloader_Logger.INFO("Constructing DummyModContainer"); } - @EventHandler - public void load(final FMLInitializationEvent e) { - Logger.INFO("[GT++ ASM] Begin resource allocation for " + CORE_Preloader.MODID + " V" + CORE_Preloader.VERSION); - } - @Subscribe public void preInit(FMLPreInitializationEvent event) { - Logger.INFO("[GT++ ASM] Loading " + CORE_Preloader.MODID + " V" + CORE_Preloader.VERSION); + Preloader_Logger.INFO("Loading " + CORE_Preloader.MODID + " V" + CORE_Preloader.VERSION); // Handle GT++ Config handleConfigFile(event); } @Subscribe + public void init(FMLInitializationEvent evt) { + Preloader_Logger.INFO("Begin resource allocation for " + CORE_Preloader.MODID + " V" + CORE_Preloader.VERSION); + + } + + @Subscribe public void postInit(FMLPostInitializationEvent evt) { - Logger.INFO("[GT++ ASM] Finished loading GT++ Pre-Loader."); + Preloader_Logger.INFO("Finished loading."); } public static void handleConfigFile(final FMLPreInitializationEvent event) { @@ -84,17 +79,17 @@ public class Preloader_DummyContainer extends DummyModContainer { } public static boolean getConfig(){ - final Configuration config = new Configuration( new File(Utils.getMcDir(), "config/GTplusplus/GTplusplus.cfg")); + final Configuration config = new Configuration( new File(gtPlusPlus.preloader.CORE_Preloader.MC_DIR, "config/GTplusplus/GTplusplus.cfg")); if (config != null){ config.load(); // Circuits CORE_Preloader.enableOldGTcircuits = config.getBoolean("enableOldGTcircuits", "gregtech", false, "Restores circuits and their recipes from Pre-5.09.28 times."); CORE_Preloader.enableWatchdogBGM = config.getInt("enableWatchdogBGM", "features", 0, 0, Short.MAX_VALUE, "Set to a value greater than 0 to reduce the ticks taken to delay between BGM tracks. Acceptable Values are 1-32767, where 0 is disabled. Vanilla Uses 12,000 & 24,000. 200 is 10s."); - Logger.INFO("GT++ Preloader - Loaded the configuration file."); + Preloader_Logger.INFO("Loaded the configuration file."); return true; } - Logger.INFO("GT++ Preloader - Failed loading the configuration file."); + Preloader_Logger.INFO("Failed loading the configuration file."); return false; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java b/src/Java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java index b208c2f8f0..8a9258f07d 100644 --- a/src/Java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java +++ b/src/Java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java @@ -1,12 +1,15 @@ package gtPlusPlus.preloader.asm; +import java.io.File; import java.util.Map; import cpw.mods.fml.relauncher.IFMLLoadingPlugin; import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion; import cpw.mods.fml.relauncher.IFMLLoadingPlugin.SortingIndex; - +import gtPlusPlus.preloader.CORE_Preloader; +import gtPlusPlus.preloader.Preloader_Logger; import gtPlusPlus.preloader.asm.transformers.Preloader_Transformer_Handler; +import net.minecraft.launchwrapper.Launch; @SortingIndex(10097) @MCVersion(value = "1.7.10") @@ -14,6 +17,10 @@ public class Preloader_FMLLoadingPlugin implements IFMLLoadingPlugin { //-Dfml.coreMods.load=gtPlusPlus.preloader.asm.Preloader_FMLLoadingPlugin + static { + Preloader_Logger.INFO("Initializing IFMLLoadingPlugin"); + } + @Override public String getAccessTransformerClass() { return null; @@ -22,7 +29,9 @@ public class Preloader_FMLLoadingPlugin implements IFMLLoadingPlugin { @Override public String[] getASMTransformerClass() { //This will return the name of the class - return new String[]{Preloader_Transformer_Handler.class.getName()}; + return new String[]{ + Preloader_Transformer_Handler.class.getName() + }; } @Override @@ -33,12 +42,32 @@ public class Preloader_FMLLoadingPlugin implements IFMLLoadingPlugin { @Override public String getSetupClass() { + //return Preloader_SetupClass.class.getName(); return null; } @Override public void injectData(Map<String, Object> data) { - + boolean isDeObf = (boolean) data.get("runtimeDeobfuscationEnabled"); + File mcDir = (File) data.get("mcLocation"); + //LaunchClassLoader classLoader = (LaunchClassLoader) data.get("classLoader"); + File coremodLocation = (File) data.get("coremodLocation"); + String deobfuscationFileName = (String) data.get("deobfuscationFileName"); + if (mcDir != null && mcDir.exists()) { + CORE_Preloader.setMinecraftDirectory(mcDir); + Preloader_Logger.INFO("Set McDir via Preloader_SetupClass"); + } + Preloader_Logger.INFO("runtimeDeobfuscationEnabled: "+isDeObf); + Preloader_Logger.INFO("deobfuscationFileName: "+deobfuscationFileName); + if (coremodLocation != null && coremodLocation.exists()) { + Preloader_Logger.INFO("coremodLocation: "+coremodLocation.getPath()); + } + else { + Preloader_Logger.INFO("coremodLocation: null"); + Preloader_Logger.ERROR("Unable to determine CoreMod location"); + } + CORE_Preloader.DEV_ENVIRONMENT = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment"); + Preloader_Logger.INFO("Running on "+gtPlusPlus.preloader.CORE_Preloader.JAVA_VERSION+" | Development Environment: "+CORE_Preloader.DEV_ENVIRONMENT); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/preloader/asm/Preloader_SetupClass.java b/src/Java/gtPlusPlus/preloader/asm/Preloader_SetupClass.java new file mode 100644 index 0000000000..a6d2b6c863 --- /dev/null +++ b/src/Java/gtPlusPlus/preloader/asm/Preloader_SetupClass.java @@ -0,0 +1,23 @@ +package gtPlusPlus.preloader.asm; + +import java.io.File; +import java.util.Map; + +import cpw.mods.fml.relauncher.IFMLCallHook; +import gtPlusPlus.preloader.CORE_Preloader; +import gtPlusPlus.preloader.Preloader_Logger; + +public class Preloader_SetupClass implements IFMLCallHook { + + @Override + public Void call() throws Exception { + Preloader_Logger.INFO("Executing IFMLCallHook"); + return null; + } + + @Override + public void injectData(Map<String, Object> data) { + + } + +} diff --git a/src/Java/gtPlusPlus/preloader/asm/helpers/MethodHelper_GT.java b/src/Java/gtPlusPlus/preloader/asm/helpers/MethodHelper_GT.java new file mode 100644 index 0000000000..8120df81fa --- /dev/null +++ b/src/Java/gtPlusPlus/preloader/asm/helpers/MethodHelper_GT.java @@ -0,0 +1,25 @@ +package gtPlusPlus.preloader.asm.helpers; + +import java.util.List; + +import gregtech.api.enums.Materials; +import gregtech.api.items.GT_MetaGenerated_Tool; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class MethodHelper_GT { + + public static final void getSubItems(GT_MetaGenerated_Tool aTool, Item var1, CreativeTabs aCreativeTab, List aList) { + for (int i = 0; i < 32766; i += 2) { + if (aTool.getToolStats(new ItemStack(aTool, 1, i)) != null) { + ItemStack tStack = new ItemStack(aTool, 1, i); + aTool.isItemStackUsable(tStack); + aList.add(tStack); + aList.add(aTool.getToolWithStats(i,1,Materials.TungstenSteel,Materials.TungstenSteel,null)); + aList.add(aTool.getToolWithStats(i,1,Materials.Neutronium,Materials.Neutronium,null)); + } + } + } + +} diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java index f71615b7c1..dce1fa15d2 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java @@ -21,7 +21,6 @@ import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.SubTag; import gregtech.api.metatileentity.BaseMetaPipeEntity; -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; @@ -149,7 +148,7 @@ public class ClassTransformer_GT_BlockMachines_MetaPipeEntity { int mMode; - public ClassTransformer_GT_BlockMachines_MetaPipeEntity(byte[] basicClass, boolean obfuscated, int aMode) { + public ClassTransformer_GT_BlockMachines_MetaPipeEntity(byte[] basicClass, int aMode) { mMode = aMode; ClassReader aTempReader = null; ClassWriter aTempWriter = null; diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BusPatch.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BusPatch.java index 4394aa0f04..e123c6a9e0 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BusPatch.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BusPatch.java @@ -1,6 +1,28 @@ package gtPlusPlus.preloader.asm.transformers; -import static org.objectweb.asm.Opcodes.*; +import static org.objectweb.asm.Opcodes.AALOAD; +import static org.objectweb.asm.Opcodes.AASTORE; +import static org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static org.objectweb.asm.Opcodes.ACONST_NULL; +import static org.objectweb.asm.Opcodes.ALOAD; +import static org.objectweb.asm.Opcodes.ANEWARRAY; +import static org.objectweb.asm.Opcodes.ASM5; +import static org.objectweb.asm.Opcodes.DUP; +import static org.objectweb.asm.Opcodes.F_FULL; +import static org.objectweb.asm.Opcodes.GOTO; +import static org.objectweb.asm.Opcodes.ICONST_0; +import static org.objectweb.asm.Opcodes.ICONST_1; +import static org.objectweb.asm.Opcodes.ICONST_2; +import static org.objectweb.asm.Opcodes.IF_ICMPLT; +import static org.objectweb.asm.Opcodes.ILOAD; +import static org.objectweb.asm.Opcodes.INTEGER; +import static org.objectweb.asm.Opcodes.INVOKESPECIAL; +import static org.objectweb.asm.Opcodes.INVOKESTATIC; +import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL; +import static org.objectweb.asm.Opcodes.NEW; +import static org.objectweb.asm.Opcodes.PUTFIELD; +import static org.objectweb.asm.Opcodes.RETURN; +import static org.objectweb.asm.Opcodes.UNINITIALIZED_THIS; import org.apache.logging.log4j.Level; import org.objectweb.asm.ClassReader; @@ -10,13 +32,14 @@ import org.objectweb.asm.Label; import org.objectweb.asm.MethodVisitor; import cpw.mods.fml.relauncher.FMLRelaunchLog; +import gtPlusPlus.preloader.asm.ClassesToTransform; public class ClassTransformer_GT_BusPatch { - public static final String aSuperInput = "gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Input"; - public static final String aSuperOutput = "gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Output"; - public static final String aInput = "gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus"; - public static final String aOutput = "gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus"; + private static final String aSuperInputFormatted = ClassesToTransform.GTPP_MTE_HATCH_SUPER_INPUT_BUS.replace(".", "/"); + private static final String aSuperOutputFormatted = ClassesToTransform.GTPP_MTE_HATCH_SUPER_OUTPUT_BUS.replace(".", "/"); + private static final String aInputFormatted = ClassesToTransform.GT_MTE_HATCH_INPUTBUS.replace(".", "/"); + private static final String aOutputFormatted = ClassesToTransform.GT_MTE_HATCH_OUTPUTBUS.replace(".", "/"); private final boolean isValid; private final ClassReader reader; @@ -74,7 +97,7 @@ public class ClassTransformer_GT_BusPatch { //GT_MetaTileEntity_Hatch_InputBus //Constructor - if (aClassName.equals(aInput)){ + if (aClassName.equals(ClassesToTransform.GT_MTE_HATCH_INPUTBUS)){ //Constructor 1 { @@ -131,14 +154,14 @@ public class ClassTransformer_GT_BusPatch { mv.visitLineNumber(16, l4); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l5 = new Label(); mv.visitLabel(l5); mv.visitLineNumber(21, l5); mv.visitInsn(RETURN); Label l6 = new Label(); mv.visitLabel(l6); - mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus;", null, l0, l6, 0); + mv.visitLocalVariable("this", "L"+aInputFormatted+";", null, l0, l6, 0); mv.visitLocalVariable("aID", "I", null, l0, l6, 1); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l6, 2); mv.visitLocalVariable("aNameRegional", "Ljava/lang/String;", null, l0, l6, 3); @@ -168,14 +191,14 @@ public class ClassTransformer_GT_BusPatch { mv.visitLineNumber(16, l1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(30, l2); mv.visitInsn(RETURN); Label l3 = new Label(); mv.visitLabel(l3); - mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus;", null, l0, l3, 0); + mv.visitLocalVariable("this", "L"+aInputFormatted+";", null, l0, l3, 0); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 1); mv.visitLocalVariable("aTier", "I", null, l0, l3, 2); mv.visitLocalVariable("aSlots", "I", null, l0, l3, 3); @@ -205,14 +228,14 @@ public class ClassTransformer_GT_BusPatch { mv.visitLineNumber(16, l1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(34, l2); mv.visitInsn(RETURN); Label l3 = new Label(); mv.visitLabel(l3); - mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus;", null, l0, l3, 0); + mv.visitLocalVariable("this", "L"+aInputFormatted+";", null, l0, l3, 0); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 1); mv.visitLocalVariable("aTier", "I", null, l0, l3, 2); mv.visitLocalVariable("aSlots", "I", null, l0, l3, 3); @@ -231,7 +254,7 @@ public class ClassTransformer_GT_BusPatch { //GT_MetaTileEntity_Hatch_OutputBus //Constructor - if (aClassName.equals(aOutput)){ + if (aClassName.equals(ClassesToTransform.GT_MTE_HATCH_OUTPUTBUS)){ { mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(ILjava/lang/String;Ljava/lang/String;II)V", null, null); @@ -288,7 +311,7 @@ public class ClassTransformer_GT_BusPatch { mv.visitInsn(RETURN); Label l5 = new Label(); mv.visitLabel(l5); - mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus;", null, l0, l5, 0); + mv.visitLocalVariable("this", "L"+aOutputFormatted+";", null, l0, l5, 0); mv.visitLocalVariable("aID", "I", null, l0, l5, 1); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l5, 2); mv.visitLocalVariable("aNameRegional", "Ljava/lang/String;", null, l0, l5, 3); @@ -317,7 +340,7 @@ public class ClassTransformer_GT_BusPatch { mv.visitInsn(RETURN); Label l2 = new Label(); mv.visitLabel(l2); - mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus;", null, l0, l2, 0); + mv.visitLocalVariable("this", "L"+aOutputFormatted+";", null, l0, l2, 0); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l2, 1); mv.visitLocalVariable("aTier", "I", null, l0, l2, 2); mv.visitLocalVariable("aSlots", "I", null, l0, l2, 3); @@ -346,7 +369,7 @@ public class ClassTransformer_GT_BusPatch { mv.visitInsn(RETURN); Label l2 = new Label(); mv.visitLabel(l2); - mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus;", null, l0, l2, 0); + mv.visitLocalVariable("this", "L"+aOutputFormatted+";", null, l0, l2, 0); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l2, 1); mv.visitLocalVariable("aTier", "I", null, l0, l2, 2); mv.visitLocalVariable("aSlots", "I", null, l0, l2, 3); @@ -363,7 +386,7 @@ public class ClassTransformer_GT_BusPatch { //GT_MetaTileEntity_SuperBus_Input //Constructor - if (aClassName.equals(aSuperInput)){ + if (aClassName.equals(ClassesToTransform.GTPP_MTE_HATCH_SUPER_INPUT_BUS)){ { mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(ILjava/lang/String;Ljava/lang/String;II)V", null, null); @@ -376,20 +399,20 @@ public class ClassTransformer_GT_BusPatch { mv.visitVarInsn(ALOAD, 2); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ILOAD, 4); - mv.visitMethodInsn(INVOKESPECIAL, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "<init>", "(ILjava/lang/String;Ljava/lang/String;I)V", false); + mv.visitMethodInsn(INVOKESPECIAL, ""+aInputFormatted+"", "<init>", "(ILjava/lang/String;Ljava/lang/String;I)V", false); Label l1 = new Label(); mv.visitLabel(l1); mv.visitLineNumber(20, l1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aSuperInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(28, l2); mv.visitInsn(RETURN); Label l3 = new Label(); mv.visitLabel(l3); - mv.visitLocalVariable("this", "LgtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input;", null, l0, l3, 0); + mv.visitLocalVariable("this", "L"+aSuperInputFormatted+";", null, l0, l3, 0); mv.visitLocalVariable("aID", "I", null, l0, l3, 1); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 2); mv.visitLocalVariable("aNameRegional", "Ljava/lang/String;", null, l0, l3, 3); @@ -409,23 +432,23 @@ public class ClassTransformer_GT_BusPatch { mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 2); - mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input", "getSlots", "(I)I", false); + mv.visitMethodInsn(INVOKESTATIC, ""+aSuperInputFormatted+"", "getSlots", "(I)I", false); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ALOAD, 4); - mv.visitMethodInsn(INVOKESPECIAL, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); + mv.visitMethodInsn(INVOKESPECIAL, ""+aInputFormatted+"", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); Label l1 = new Label(); mv.visitLabel(l1); mv.visitLineNumber(20, l1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aSuperInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(28, l2); mv.visitInsn(RETURN); Label l3 = new Label(); mv.visitLabel(l3); - mv.visitLocalVariable("this", "LgtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input;", null, l0, l3, 0); + mv.visitLocalVariable("this", "L"+aSuperInputFormatted+";", null, l0, l3, 0); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 1); mv.visitLocalVariable("aTier", "I", null, l0, l3, 2); mv.visitLocalVariable("aDescription", "Ljava/lang/String;", null, l0, l3, 3); @@ -444,25 +467,25 @@ public class ClassTransformer_GT_BusPatch { mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 2); - mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input", "getSlots", "(I)I", false); + mv.visitMethodInsn(INVOKESTATIC, ""+aSuperInputFormatted+"", "getSlots", "(I)I", false); mv.visitVarInsn(ALOAD, 3); mv.visitInsn(ICONST_0); mv.visitInsn(AALOAD); mv.visitVarInsn(ALOAD, 4); - mv.visitMethodInsn(INVOKESPECIAL, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); + mv.visitMethodInsn(INVOKESPECIAL, ""+aInputFormatted+"", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); Label l1 = new Label(); mv.visitLabel(l1); mv.visitLineNumber(20, l1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aSuperInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(32, l2); mv.visitInsn(RETURN); Label l3 = new Label(); mv.visitLabel(l3); - mv.visitLocalVariable("this", "LgtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input;", null, l0, l3, 0); + mv.visitLocalVariable("this", "L"+aSuperInputFormatted+";", null, l0, l3, 0); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 1); mv.visitLocalVariable("aTier", "I", null, l0, l3, 2); mv.visitLocalVariable("aDescription", "[Ljava/lang/String;", null, l0, l3, 3); @@ -479,7 +502,7 @@ public class ClassTransformer_GT_BusPatch { //GT_MetaTileEntity_SuperBus_Output //Constructor - if (aClassName.equals(aSuperOutput)){ + if (aClassName.equals(ClassesToTransform.GTPP_MTE_HATCH_SUPER_OUTPUT_BUS)){ { mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(ILjava/lang/String;Ljava/lang/String;II)V", null, null); @@ -492,20 +515,20 @@ public class ClassTransformer_GT_BusPatch { mv.visitVarInsn(ALOAD, 2); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ILOAD, 4); - mv.visitMethodInsn(INVOKESPECIAL, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus", "<init>", "(ILjava/lang/String;Ljava/lang/String;I)V", false); + mv.visitMethodInsn(INVOKESPECIAL, ""+aOutputFormatted+"", "<init>", "(ILjava/lang/String;Ljava/lang/String;I)V", false); Label l1 = new Label(); mv.visitLabel(l1); mv.visitLineNumber(18, l1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aSuperOutputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(26, l2); mv.visitInsn(RETURN); Label l3 = new Label(); mv.visitLabel(l3); - mv.visitLocalVariable("this", "LgtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output;", null, l0, l3, 0); + mv.visitLocalVariable("this", "L"+aSuperOutputFormatted+";", null, l0, l3, 0); mv.visitLocalVariable("aID", "I", null, l0, l3, 1); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 2); mv.visitLocalVariable("aNameRegional", "Ljava/lang/String;", null, l0, l3, 3); @@ -525,23 +548,23 @@ public class ClassTransformer_GT_BusPatch { mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 2); - mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output", "getSlots", "(I)I", false); + mv.visitMethodInsn(INVOKESTATIC, ""+aSuperOutputFormatted+"", "getSlots", "(I)I", false); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ALOAD, 4); - mv.visitMethodInsn(INVOKESPECIAL, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); + mv.visitMethodInsn(INVOKESPECIAL, ""+aOutputFormatted+"", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); Label l1 = new Label(); mv.visitLabel(l1); mv.visitLineNumber(18, l1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aSuperOutputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(26, l2); mv.visitInsn(RETURN); Label l3 = new Label(); mv.visitLabel(l3); - mv.visitLocalVariable("this", "LgtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output;", null, l0, l3, 0); + mv.visitLocalVariable("this", "L"+aSuperOutputFormatted+";", null, l0, l3, 0); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 1); mv.visitLocalVariable("aTier", "I", null, l0, l3, 2); mv.visitLocalVariable("aDescription", "Ljava/lang/String;", null, l0, l3, 3); @@ -560,25 +583,25 @@ public class ClassTransformer_GT_BusPatch { mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 2); - mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output", "getSlots", "(I)I", false); + mv.visitMethodInsn(INVOKESTATIC, ""+aSuperOutputFormatted+"", "getSlots", "(I)I", false); mv.visitVarInsn(ALOAD, 3); mv.visitInsn(ICONST_0); mv.visitInsn(AALOAD); mv.visitVarInsn(ALOAD, 4); - mv.visitMethodInsn(INVOKESPECIAL, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); + mv.visitMethodInsn(INVOKESPECIAL, ""+aOutputFormatted+"", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); Label l1 = new Label(); mv.visitLabel(l1); mv.visitLineNumber(18, l1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aSuperOutputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(30, l2); mv.visitInsn(RETURN); Label l3 = new Label(); mv.visitLabel(l3); - mv.visitLocalVariable("this", "LgtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output;", null, l0, l3, 0); + mv.visitLocalVariable("this", "L"+aSuperOutputFormatted+";", null, l0, l3, 0); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 1); mv.visitLocalVariable("aTier", "I", null, l0, l3, 2); mv.visitLocalVariable("aDescription", "[Ljava/lang/String;", null, l0, l3, 3); @@ -612,7 +635,7 @@ public class ClassTransformer_GT_BusPatch { @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor methodVisitor; - if ((mClassName.equals(aSuperInput) || mClassName.equals(aSuperOutput)) && access == ACC_PUBLIC && name.equals("<init>") && (desc.equals("(Ljava/lang/String;ILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V") || desc.equals("(Ljava/lang/String;I[Ljava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V"))) { + if ((mClassName.equals(ClassesToTransform.GTPP_MTE_HATCH_SUPER_INPUT_BUS) || mClassName.equals(ClassesToTransform.GTPP_MTE_HATCH_SUPER_OUTPUT_BUS)) && access == ACC_PUBLIC && name.equals("<init>") && (desc.equals("(Ljava/lang/String;ILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V") || desc.equals("(Ljava/lang/String;I[Ljava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V"))) { FMLRelaunchLog.log("[GT++ ASM] Gregtech Bus Patch", Level.INFO, "Found Constructor, "+"'"+access+"', "+"'"+name+"', "+"'"+desc+"', "+"'"+signature+"'"); methodVisitor = null; } diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client.java index da6abfe57c..e2d34c38e7 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client.java @@ -152,19 +152,24 @@ public class ClassTransformer_GT_Client { } if (aGregtech != null) { + File file = aGregtech; + FileInputStream fis; + JarInputStream jis; try { - File file = aGregtech; - FileInputStream fis = new FileInputStream(file); - JarInputStream jis = new JarInputStream(fis); + fis = new FileInputStream(file); + jis = new JarInputStream(fis); System.out.println(jis.markSupported()); JarEntry je; while((je=jis.getNextJarEntry())!=null){ if (je.getName().contains("GT_MetaTileEntity_AssemblyLine")) { FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Patchable class | "+je.getName()); + jis.close(); return true; } } - jis.close(); + if (jis != null) { + jis.close(); + } return true; } catch (IOException e1) { } diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_MetaGenerated_Tool.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_MetaGenerated_Tool.java new file mode 100644 index 0000000000..b6cd9c8d67 --- /dev/null +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_MetaGenerated_Tool.java @@ -0,0 +1,116 @@ +package gtPlusPlus.preloader.asm.transformers; + +import static org.objectweb.asm.Opcodes.ACC_FINAL; +import static org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static org.objectweb.asm.Opcodes.ALOAD; +import static org.objectweb.asm.Opcodes.ASM5; +import static org.objectweb.asm.Opcodes.INVOKESTATIC; +import static org.objectweb.asm.Opcodes.RETURN; + +import org.apache.logging.log4j.Level; +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; + +import gtPlusPlus.preloader.Preloader_Logger; + +public class ClassTransformer_GT_MetaGenerated_Tool { + + private final boolean isValid; + private final ClassReader reader; + private final ClassWriter writer; + + public ClassTransformer_GT_MetaGenerated_Tool(byte[] basicClass) { + ClassReader aTempReader = null; + ClassWriter aTempWriter = null; + aTempReader = new ClassReader(basicClass); + aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); + aTempReader.accept(new LocalClassVisitor(aTempWriter), 0); + boolean completed = injectMethod("getSubItems", aTempWriter); + if (aTempReader != null && aTempWriter != null && completed) { + isValid = true; + } else { + isValid = false; + } + Preloader_Logger.LOG("GT Tool Fix", Level.INFO, "Valid? " + isValid + "."); + reader = aTempReader; + writer = aTempWriter; + } + + public boolean isValidTransformer() { + return isValid; + } + + public ClassReader getReader() { + return reader; + } + + public ClassWriter getWriter() { + return writer; + } + + public boolean injectMethod(String aMethodName, ClassWriter cw) { + MethodVisitor mv; + boolean didInject = false; + Preloader_Logger.LOG("GT Tool Fix", Level.INFO, "Injecting " + aMethodName + "."); + if (aMethodName.equals("getSubItems")) { + { + mv = cw.visitMethod(ACC_PUBLIC + ACC_FINAL, "getSubItems", "(Lnet/minecraft/item/Item;Lnet/minecraft/creativetab/CreativeTabs;Ljava/util/List;)V", null, null); + { + AnnotationVisitor av0 = mv.visitAnnotation("Lcpw/mods/fml/relauncher/SideOnly;", true); + av0.visitEnum("value", "Lcpw/mods/fml/relauncher/Side;", "CLIENT"); + av0.visitEnd(); + } + mv.visitCode(); + Label l0 = new Label(); + mv.visitLabel(l0); + mv.visitLineNumber(321, l0); + mv.visitVarInsn(ALOAD, 0); + mv.visitVarInsn(ALOAD, 1); + mv.visitVarInsn(ALOAD, 2); + mv.visitVarInsn(ALOAD, 3); + mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/preloader/asm/helpers/MethodHelper_GT", "getSubItems", "(Lgregtech/api/items/GT_MetaGenerated_Tool;Lnet/minecraft/item/Item;Lnet/minecraft/creativetab/CreativeTabs;Ljava/util/List;)V", false); + Label l1 = new Label(); + mv.visitLabel(l1); + mv.visitLineNumber(322, l1); + mv.visitInsn(RETURN); + Label l2 = new Label(); + mv.visitLabel(l2); + mv.visitLocalVariable("this", "Lgregtech/api/items/GT_MetaGenerated_Tool;", null, l0, l2, 0); + mv.visitLocalVariable("var1", "Lnet/minecraft/item/Item;", null, l0, l2, 1); + mv.visitLocalVariable("aCreativeTab", "Lnet/minecraft/creativetab/CreativeTabs;", null, l0, l2, 2); + mv.visitLocalVariable("aList", "Ljava/util/List;", null, l0, l2, 3); + mv.visitMaxs(4, 4); + mv.visitEnd(); + didInject = true; + } + + } + Preloader_Logger.LOG("GT Tool Fix", Level.INFO, "Method injection complete."); + return didInject; + } + + public final class LocalClassVisitor extends ClassVisitor { + + public LocalClassVisitor(ClassVisitor cv) { + super(ASM5, cv); + } + + @Override + public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { + MethodVisitor methodVisitor; + if (name.equals("getSubItems") && desc.equals("(Lnet/minecraft/item/Item;Lnet/minecraft/creativetab/CreativeTabs;Ljava/util/List;)V")) { + methodVisitor = null; + Preloader_Logger.LOG("GT Tool Fix", Level.INFO, "Found method "+name+", removing."); + } + else { + methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); + } + return methodVisitor; + } + } + +} diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Utility.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Utility.java index 36c09688bc..307900ad9e 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Utility.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Utility.java @@ -15,6 +15,7 @@ import org.objectweb.asm.Label; import org.objectweb.asm.MethodVisitor; import cpw.mods.fml.relauncher.FMLRelaunchLog; +import gtPlusPlus.core.util.Utils; public class ClassTransformer_GT_Utility { @@ -66,7 +67,8 @@ public class ClassTransformer_GT_Utility { MethodVisitor mv; boolean didInject = false; ClassWriter cw = getWriter(); - FMLRelaunchLog.log("[GT++ ASM] Gregtech Utilities Patch", Level.INFO, "Injecting " + aMethodName + "."); + String aClassNameFormatted = Utils.class.getName().replace(".", "/"); + FMLRelaunchLog.log("[GT++ ASM] Gregtech Utilities Patch", Level.INFO, "Injecting " + aMethodName + ", static replacement call to "+aClassNameFormatted+"."); if (aMethodName.equals("getTier")) { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "getTier", "(J)B", null, null); mv.visitCode(); @@ -74,7 +76,7 @@ public class ClassTransformer_GT_Utility { mv.visitLabel(l0); mv.visitLineNumber(23, l0); mv.visitVarInsn(LLOAD, 0); - mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/core/util/Utils", "getTier", "(J)B", false); + mv.visitMethodInsn(INVOKESTATIC, aClassNameFormatted, "getTier", "(J)B", false); mv.visitInsn(IRETURN); Label l1 = new Label(); mv.visitLabel(l1); diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java index 507e2cf974..443337bd35 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java @@ -1,40 +1,5 @@ package gtPlusPlus.preloader.asm.transformers; -import static org.objectweb.asm.Opcodes.*; - -import java.lang.reflect.Field; -import java.util.*; - -import org.apache.logging.log4j.Level; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.FieldVisitor; -import org.objectweb.asm.MethodVisitor; - -import cpw.mods.fml.relauncher.FMLRelaunchLog; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; -import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import gregtech.api.GregTech_API; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.BaseMetaTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.common.blocks.GT_Block_Machines; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.api.objects.random.XSTR; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.NBTUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; - public class Preloader_ClassTransformer2 { /** @@ -48,321 +13,4 @@ public class Preloader_ClassTransformer2 { * */ - - - public static boolean mHasSetField = false; - - private final static Class<BaseMetaTileEntity> customTransformer2 = BaseMetaTileEntity.class; - public static final class GT_MetaTile_Visitor extends ClassVisitor { - private boolean isGt_Block_Machines = false; - - public GT_MetaTile_Visitor(ClassVisitor cv, boolean isGt_Block_Machines) { - super(ASM5, cv); - this.isGt_Block_Machines = isGt_Block_Machines; - } - - @Override - public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { - FieldVisitor j = super.visitField(access, name, desc, signature, value); - if (!mHasSetField && !isGt_Block_Machines) { - mHasSetField = true; - FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Injecting field 'mItemStorageNBT' into BaseMetaTileEntity.java. Access OpCode: "+access); - j = cv.visitField(0, "mItemStorageNBT", "Lnet/minecraft/nbt/NBTTagCompound;", null, null); - j.visitEnd(); - } - return j; - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - MethodVisitor methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); - - if (isGt_Block_Machines) { //Lnet/minecraft/world/World;IIILnet/minecraft/block/Block;I)V - if(name.equals("breakBlock") && desc.equals("(Lnet/minecraft/world/World;IIILnet/minecraft/block/Block;I)V")) { - FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Found target method 'breakBlock' [Unobfuscated]. Access OpCode: "+access); - return new swapBreakBlock(methodVisitor); - } - else if (name.equals("breakBlock") && !desc.equals("(Lnet/minecraft/world/World;IIILnet/minecraft/block/Block;I)V")) { - FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Found target method 'breakBlock' [Obfuscated]. Access OpCode: "+access); - return new swapBreakBlock(methodVisitor); - } - } - else { - if(name.equals("getDrops") && desc.equals("()Ljava/util/ArrayList;")) { - FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Found target method 'getDrops'. Access OpCode: "+access); - return new swapGetDrops(methodVisitor); - } - } - return methodVisitor; - } - - } - - - - - private static final class swapGetDrops extends MethodVisitor { - - public swapGetDrops(MethodVisitor mv) { - super(ASM5, mv); - } - - @Override - public void visitCode() { - FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Fixing Greg & Blood's poor attempt at setItemNBT()."); - super.visitCode(); - //ALOAD 0 - //INVOKESTATIC gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2 getDrops (Lgregtech/api/metatileentity/BaseMetaTileEntity;)Ljava/util/ArrayList; - //ARETURN - - super.visitVarInsn(ALOAD, 0); - super.visitMethodInsn(INVOKESTATIC, - "gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2", - "getDrops", - "(Lgregtech/api/metatileentity/BaseMetaTileEntity;)Ljava/util/ArrayList;", - false); - FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Method should now be replaced."); - //super.visitVarInsn(ARETURN, 0); - super.visitInsn(ARETURN); - } - - } - - private static final class swapBreakBlock extends MethodVisitor { - - public swapBreakBlock(MethodVisitor mv) { - super(ASM5, mv); - } - - @Override - public void visitCode() { - FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Fixing breakBlock() in GT_Block_Machines.class"); - super.visitCode(); - //super.visitVarInsn(ALOAD, 0); - - super.visitVarInsn(ALOAD, 1); - super.visitVarInsn(ILOAD, 2); - super.visitVarInsn(ILOAD, 3); - super.visitVarInsn(ILOAD, 4); - super.visitVarInsn(ALOAD, 5); - super.visitVarInsn(ILOAD, 6); - - super.visitMethodInsn(INVOKESTATIC, - "gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2", - "breakBlock", - "(Lnet/minecraft/world/World;IIILnet/minecraft/block/Block;I)V", - false); - FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Method should now be replaced."); - super.visitInsn(RETURN); - } - - } - - - - - - - - - - - - - - - - - - - - - - - - - public static ArrayList<ItemStack> getDrops(BaseMetaTileEntity o) { - Logger.INFO("BaseMetaTileEntity.getDrops(BaseMetaTileEntity(this))"); - try { - short tID = (short) ReflectionUtils.getField(customTransformer2, "mID").get(o); - ItemStack rStack = new ItemStack(GregTech_API.sBlockMachines, 1, tID); - - NBTTagCompound i = new NBTTagCompound(); - - i = stupidFuckingNBTMap.get(new BlockPos(o.xCoord, o.yCoord, o.zCoord, o.getWorld())); - Logger.INFO("Got NBT Tag Value from map."); - - NBTTagCompound tNBT = i; - if (tNBT == null) { - Logger.INFO("Map tag was null."); - tNBT = generateGetDropsNBT(o); - } - if (!tNBT.hasNoTags()) { - rStack.setTagCompound(tNBT); - Logger.INFO("Iterating rStack NBT."); - NBTUtils.tryIterateNBTData(rStack); - } - return new ArrayList<ItemStack>(Arrays.asList(rStack)); - } - catch (IllegalArgumentException | IllegalAccessException a){ - Logger.REFLECTION("getDropsHack2"); - a.printStackTrace(); - } - ArrayList<ItemStack> u = new ArrayList<ItemStack>(Arrays.asList(new ItemStack[]{ItemUtils.getSimpleStack(Blocks.bedrock)})); - return u; - } - - public static Map<BlockPos, NBTTagCompound> stupidFuckingNBTMap = new HashMap<BlockPos, NBTTagCompound>(); - public static void breakBlock(final World aWorld, final int aX, final int aY, final int aZ, final Block block, - final int meta) { - Logger.INFO("GT_Block_Machines.breakBlock()"); - GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); - final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity) { - final IGregTechTileEntity tGregTechTileEntity = (IGregTechTileEntity) tTileEntity; - final Random tRandom = new XSTR(); - GT_Block_Machines.mTemporaryTileEntity.set(tGregTechTileEntity); - - //Try inject this - Logger.INFO("Hopefully saving ItemNBT data."); - - NBTTagCompound tNBT = new NBTTagCompound(); - tNBT = generateGetDropsNBT(tGregTechTileEntity.getMetaTileEntity().getBaseMetaTileEntity()); - tGregTechTileEntity.getMetaTileEntity().setItemNBT(tNBT); - Field fffff; - try { - fffff = ReflectionUtils.getField(tGregTechTileEntity.getClass(), "mItemStorageNBT"); - if (fffff == null) { - Logger.REFLECTION("Injected field is null."); - } - else { - fffff.set(tGregTechTileEntity.getMetaTileEntity().getBaseMetaTileEntity(), tNBT); - Logger.REFLECTION("Hopefully injected field data."); - stupidFuckingNBTMap.put(new BlockPos(aX, aY, aZ, tGregTechTileEntity.getMetaTileEntity().getBaseMetaTileEntity().getWorld()), tNBT); - Logger.INFO("Set NBT Tag Value to map."); - } - } - catch (IllegalArgumentException | IllegalAccessException e) { - e.printStackTrace(); - } - - for (int i = 0; i < tGregTechTileEntity.getSizeInventory(); ++i) { - final ItemStack tItem = tGregTechTileEntity.getStackInSlot(i); - if (tItem != null && tItem.stackSize > 0 && tGregTechTileEntity.isValidSlot(i)) { - - - - final EntityItem tItemEntity = new EntityItem(aWorld, - (double) (aX + tRandom.nextFloat() * 0.8f + 0.1f), - (double) (aY + tRandom.nextFloat() * 0.8f + 0.1f), - (double) (aZ + tRandom.nextFloat() * 0.8f + 0.1f), - new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage())); - if (tItem.hasTagCompound()) { - tItemEntity.getEntityItem().setTagCompound((NBTTagCompound) tItem.getTagCompound().copy()); - } - tItemEntity.motionX = tRandom.nextGaussian() * 0.0500000007450581; - tItemEntity.motionY = tRandom.nextGaussian() * 0.0500000007450581 + 0.2000000029802322; - tItemEntity.motionZ = tRandom.nextGaussian() * 0.0500000007450581; - aWorld.spawnEntityInWorld((Entity) tItemEntity); - tItem.stackSize = 0; - tGregTechTileEntity.setInventorySlotContents(i, (ItemStack) null); - } - } - } - - //gtPlusPlus.preloader.asm.transformers.Preloader_ClassTransformer2.breakBlockWorld(aWorld, aX, aY, aZ, block, meta); - aWorld.removeTileEntity(aX, aY, aZ); - } - - public static void breakBlockWorld(World world, int aX, int aY, int aZ, Block block, int meta){ - if (block.hasTileEntity(meta) && !(block instanceof BlockContainer)) - { - world.removeTileEntity(aX, aY, aZ); - } - } - - public static NBTTagCompound generateGetDropsNBT(IGregTechTileEntity iGregTechTileEntity) { - Logger.INFO("generateGetDropsNBT()"); - try { - short tID = (short) ReflectionUtils.getField(customTransformer2, "mID").get(iGregTechTileEntity); - NBTTagCompound tRecipeStuff = (NBTTagCompound) ReflectionUtils.getField(customTransformer2, "mRecipeStuff").get(iGregTechTileEntity); - boolean tMuffler = (boolean) ReflectionUtils.getField(customTransformer2, "mMuffler").get(iGregTechTileEntity); - boolean tLockUpgrade = (boolean) ReflectionUtils.getField(customTransformer2, "mLockUpgrade").get(iGregTechTileEntity); - boolean tSteamConverter = (boolean) ReflectionUtils.getField(customTransformer2, "mSteamConverter").get(iGregTechTileEntity); - byte tColor = (byte) ReflectionUtils.getField(customTransformer2, "mColor").get(iGregTechTileEntity); - byte tOtherUpgrades = (byte) ReflectionUtils.getField(customTransformer2, "mOtherUpgrades").get(iGregTechTileEntity); - byte tStrongRedstone = (byte) ReflectionUtils.getField(customTransformer2, "mStrongRedstone").get(iGregTechTileEntity); - int[] tCoverSides = (int[]) ReflectionUtils.getField(customTransformer2, "mCoverSides").get(iGregTechTileEntity); - int[] tCoverData = (int[]) ReflectionUtils.getField(customTransformer2, "mCoverData").get(iGregTechTileEntity); - - NBTTagCompound mItemStorageNBT; - MetaTileEntity tMetaTileEntity = (MetaTileEntity) ReflectionUtils.getField(customTransformer2, "mMetaTileEntity").get(iGregTechTileEntity); - Field fffff = ReflectionUtils.getField(customTransformer2, "mItemStorageNBT"); - if (fffff == null) { - Logger.REFLECTION("Injected field is null."); - mItemStorageNBT = new NBTTagCompound(); - } - else { - Logger.REFLECTION("Injected field exists."); - if (fffff.get(iGregTechTileEntity) != null) { - Logger.REFLECTION("Injected field has value."); - mItemStorageNBT = (NBTTagCompound) fffff.get(iGregTechTileEntity); - } - else { - Logger.REFLECTION("Injected field has no value."); - mItemStorageNBT = null; - } - } - - //BaseMetaTileEntity tMetaTileEntity = o; - - Logger.REFLECTION("tID: "+(tID != 0)); - Logger.REFLECTION("tRecipeStuff: "+(tRecipeStuff != null)); - Logger.REFLECTION("tMuffler: "+(tMuffler != false)); - Logger.REFLECTION("tLockUpgrade: "+(tLockUpgrade != false)); - Logger.REFLECTION("tSteamConverter: "+(tSteamConverter != false)); - Logger.REFLECTION("tColor: "+(tColor != 0)); - Logger.REFLECTION("tOtherUpgrades: "+(tOtherUpgrades != 0)); - Logger.REFLECTION("tCoverSides: "+(tCoverSides != null)); - Logger.REFLECTION("tCoverData: "+(tCoverData != null)); - Logger.REFLECTION("tMetaTileEntity: "+(tMetaTileEntity != null)); - Logger.REFLECTION("mItemStorageNBT: "+(mItemStorageNBT != null)); - - //mItemStorageNBT - NBTTagCompound tNBT = new NBTTagCompound(); - - if (tRecipeStuff != null && !tRecipeStuff.hasNoTags()) tNBT.setTag("GT.CraftingComponents", tRecipeStuff); - if (mItemStorageNBT != null && !mItemStorageNBT.hasNoTags()) tNBT.setTag("mItemStorageNBT", mItemStorageNBT); - if (tMuffler) tNBT.setBoolean("mMuffler", tMuffler); - if (tLockUpgrade) tNBT.setBoolean("mLockUpgrade", tLockUpgrade); - if (tSteamConverter) tNBT.setBoolean("mSteamConverter", tSteamConverter); - if (tColor > 0) tNBT.setByte("mColor", tColor); - //if (tFluid != null) tFluid.writeToNBT(tNBT); - //if (tFluid != null) tNBT.setTag("mFluid", tFluid); - if (tOtherUpgrades > 0) tNBT.setByte("mOtherUpgrades", tOtherUpgrades); - if (tStrongRedstone > 0) tNBT.setByte("mStrongRedstone", tStrongRedstone); - for (byte i = 0; i < tCoverSides.length; i++) { - if (tCoverSides[i] != 0) { - tNBT.setIntArray("mCoverData", tCoverData); - tNBT.setIntArray("mCoverSides", tCoverSides); - break; - } - } - - //Set stack NBT - if (!tNBT.hasNoTags()) { - Logger.INFO("Returning Valid NBT data"); - return tNBT; - } - else { - Logger.INFO("Returning Invalid NBT data"); - } - } - catch (IllegalArgumentException | IllegalAccessException a){ - Logger.REFLECTION("getDropsHack2"); - a.printStackTrace(); - } - return new NBTTagCompound(); - } - } diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java index d378883665..22a53465ff 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java @@ -1,34 +1,50 @@ package gtPlusPlus.preloader.asm.transformers; +import static gtPlusPlus.preloader.asm.ClassesToTransform.*; + import java.io.File; import java.io.IOException; -import org.apache.logging.log4j.Level; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter; import cpw.mods.fml.relauncher.CoreModManager; -import cpw.mods.fml.relauncher.FMLRelaunchLog; import cpw.mods.fml.relauncher.ReflectionHelper; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.preloader.CORE_Preloader; +import gtPlusPlus.preloader.DevHelper; +import gtPlusPlus.preloader.Preloader_Logger; import gtPlusPlus.preloader.asm.AsmConfig; +import gtPlusPlus.preloader.asm.ClassesToTransform; import gtPlusPlus.preloader.asm.transformers.Preloader_ClassTransformer.OreDictionaryVisitor; import net.minecraft.launchwrapper.IClassTransformer; import net.minecraft.launchwrapper.Launch; public class Preloader_Transformer_Handler implements IClassTransformer { - private final boolean mEnabled = false; public static final AsmConfig mConfig; - - private static final String class_Block_Machines = "gregtech.common.blocks.GT_Block_Machines"; - private static final String class_GT_MetaPipeEntity_Item = "gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Item"; - private static final String class_GT_MetaPipeEntity_Frame = "gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Frame"; - private static final String class_GT_MetaPipeEntity_Fluid = "gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid"; + public static final AutoMap<String> IC2_WRENCH_PATCH_CLASS_NAMES = new AutoMap<String>(); static { mConfig = new AsmConfig(new File("config/GTplusplus/asm.cfg")); - System.out.println("[GT++ ASM] Asm Config Location: "+mConfig.config.getConfigFile().getAbsolutePath()); - System.out.println("[GT++ ASM] Is DevHelper Valid? "+gtPlusPlus.preloader.DevHelper.mIsValidHelper); + Preloader_Logger.INFO("Config Location: "+AsmConfig.config.getConfigFile().getAbsolutePath()); + Preloader_Logger.INFO("Is DevHelper Valid? "+DevHelper.mIsValidHelper); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_BASE_TILE_ENTITY); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_MACHINE1); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_MACHINE2); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_MACHINE3); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_KINETIC_GENERATOR); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_HEAT_GENERATOR); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_GENERATOR); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_REACTOR_ACCESS_HATCH); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_REACTOR_CHAMBER); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_REACTOR_FLUID_PORT); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_REACTOR_REDSTONE_PORT); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_REACTOR_VESSEL); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_PERSONAL); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_CHARGEPAD); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_ELECTRIC); + IC2_WRENCH_PATCH_CLASS_NAMES.add(IC2_BLOCK_LUMINATOR); } private static Boolean mObf = null; @@ -65,89 +81,88 @@ public class Preloader_Transformer_Handler implements IClassTransformer { * Only EntityLivingBase is left untouched, as nothing else truly needs to be calling this method and avoiding forge hooks. * May exclude all vanilla/forge class if this causes issues though. */ - PatchForge : if (mConfig.enabledFixEntitySetHealth && !transformedName.contains("gtPlusPlus.preloader")) { - - //Skip Vanilla/Forge Classes - if (transformedName.contains("net.minecraft.") || transformedName.contains("cpw.")) { - //break PatchForge; - } - - ClassTransformer_Forge_EntityLivingBase_SetHealth aForgeHealthFix = new ClassTransformer_Forge_EntityLivingBase_SetHealth(transformedName, basicClass); - if (aForgeHealthFix.isValidTransformer() && aForgeHealthFix.didPatchClass()) { - FMLRelaunchLog.log("[GT++ ASM] Fix EntityLivingBase.setHealth misuse", Level.INFO, "Transforming %s", transformedName); - basicClass = aForgeHealthFix.getWriter().toByteArray(); - } - } + /* PatchForge : if (AsmConfig.enabledFixEntitySetHealth && !transformedName.contains("gtPlusPlus.preloader")) { + + //Skip Vanilla/Forge Classes + if (transformedName.contains("net.minecraft.") || transformedName.contains("cpw.")) { + //break PatchForge; + } + + ClassTransformer_Forge_EntityLivingBase_SetHealth aForgeHealthFix = new ClassTransformer_Forge_EntityLivingBase_SetHealth(transformedName, basicClass); + if (aForgeHealthFix.isValidTransformer() && aForgeHealthFix.didPatchClass()) { + Preloader_Logger.INFO("Fix EntityLivingBase.setHealth misuse", "Transforming "+transformedName); + basicClass = aForgeHealthFix.getWriter().toByteArray(); + } + }*/ // Is this environment obfuscated? (Extra checks just in case some weird shit happens during the check) - boolean obfuscated = checkObfuscated(); - boolean probablyShouldBeFalse = false; + final boolean obfuscated = checkObfuscated(); // Fix LWJGL index array out of bounds on keybinding IDs - if ((transformedName.equals("org.lwjgl.input.Keyboard") || transformedName.equals("bbj") || transformedName.equals("net.minecraft.client.settings.GameSettings")) && mConfig.enabledLwjglKeybindingFix) { + if ((transformedName.equals(LWJGL_KEYBOARD) || transformedName.equals(MINECRAFT_GAMESETTINGS_OBF) || transformedName.equals(MINECRAFT_GAMESETTINGS)) && AsmConfig.enabledLwjglKeybindingFix) { boolean isClientSettingsClass = false; if (!transformedName.equals("org.lwjgl.input.Keyboard")) { isClientSettingsClass = true; } - FMLRelaunchLog.log("[GT++ ASM] LWJGL Keybinding index out of bounds fix", Level.INFO, "Transforming %s", transformedName); + Preloader_Logger.INFO("LWJGL Keybinding index out of bounds fix", "Transforming "+transformedName); return new ClassTransformer_LWJGL_Keyboard(basicClass, isClientSettingsClass).getWriter().toByteArray(); } //Enable mapping of Tickets and loaded chunks. - Forge - if (transformedName.equals("net.minecraftforge.common.ForgeChunkManager") && mConfig.enableChunkDebugging) { - FMLRelaunchLog.log("[GT++ ASM] Chunkloading Patch", Level.INFO, "Transforming %s", transformedName); - return new ClassTransformer_Forge_ChunkLoading(basicClass, probablyShouldBeFalse).getWriter().toByteArray(); + if (transformedName.equals(FORGE_CHUNK_MANAGER) && AsmConfig.enableChunkDebugging) { + Preloader_Logger.INFO("Chunkloading Patch", "Transforming "+transformedName); + return new ClassTransformer_Forge_ChunkLoading(basicClass, false).getWriter().toByteArray(); } // Fix the OreDictionary - Forge - if (transformedName.equals("net.minecraftforge.oredict.OreDictionary")) { - FMLRelaunchLog.log("[GT++ ASM] OreDictTransformer", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(FORGE_ORE_DICTIONARY) && AsmConfig.enableOreDictPatch) { + Preloader_Logger.INFO("OreDictTransformer", "Transforming "+transformedName); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES); new ClassReader(basicClass).accept(new OreDictionaryVisitor(classWriter), 0); return classWriter.toByteArray(); } // Fix the OreDictionary COFH - if (transformedName.equals("cofh.core.util.oredict.OreDictionaryArbiter") && (mConfig.enableCofhPatch || !obfuscated)) { - FMLRelaunchLog.log("[GT++ ASM] COFH", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(COFH_ORE_DICTIONARY_ARBITER) && (AsmConfig.enableCofhPatch || !obfuscated)) { + Preloader_Logger.INFO("COFH", "Transforming "+transformedName); return new ClassTransformer_COFH_OreDictionaryArbiter(basicClass).getWriter().toByteArray(); } // Fix Tinkers Fluids - if (transformedName.equals("tconstruct.smeltery.blocks.TConstructFluid") && mConfig.enableTiConFluidLighting) { - FMLRelaunchLog.log("[GT++ ASM] Bright Fluids", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(TINKERS_FLUID_BLOCK) && AsmConfig.enableTiConFluidLighting) { + Preloader_Logger.INFO("Bright Fluids", "Transforming "+transformedName); return new ClassTransformer_TiConFluids("getLightValue", obfuscated, basicClass).getWriter().toByteArray(); } //Fix RC stuff //Patching PROCESS_VOLUME to allow more transfer limits - if (transformedName.equals("mods.railcraft.common.fluids.FluidHelper") && (mConfig.enableRcFlowFix && mConfig.maxRailcraftTankProcessVolume != 4000)) { - FMLRelaunchLog.log("[GT++ ASM] Railcraft PROCESS_VOLUME Patch", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(RAILCRAFT_FLUID_HELPER) && (AsmConfig.enableRcFlowFix && AsmConfig.maxRailcraftTankProcessVolume != 4000)) { + Preloader_Logger.INFO("Railcraft PROCESS_VOLUME Patch", "Transforming "+transformedName); return new ClassTransformer_Railcraft_FluidHelper(basicClass, obfuscated).getWriter().toByteArray(); } //Patching TRANSFER_RATE in Fluid Loaders/Unloaders - if ((transformedName.equals("mods.railcraft.common.blocks.machine.gamma.TileFluidLoader") && mConfig.maxRailcraftFluidLoaderFlow != 20) || (transformedName.equals("mods.railcraft.common.blocks.machine.gamma.TileFluidUnloader") && mConfig.maxRailcraftFluidUnloaderFlow != 80)) { - FMLRelaunchLog.log("[GT++ ASM] Railcraft TRANSFER_RATE Patch", Level.INFO, "Transforming %s", transformedName); + if ((transformedName.equals(RAILCRAFT_TILE_FLUID_LOADER) && AsmConfig.maxRailcraftFluidLoaderFlow != 20) || (transformedName.equals("mods.railcraft.common.blocks.machine.gamma.TileFluidUnloader") && AsmConfig.maxRailcraftFluidUnloaderFlow != 80)) { + Preloader_Logger.INFO("Railcraft TRANSFER_RATE Patch", "Transforming "+transformedName); return new ClassTransformer_Railcraft_FluidCartHandling(basicClass, obfuscated, transformedName).getWriter().toByteArray(); } //Fix Weird glitch involving negative itemstacks. - if (transformedName.equals("mods.railcraft.common.util.inventory.InvTools") && mConfig.enableRcItemDupeFix) { - FMLRelaunchLog.log("[GT++ ASM] Railcraft negative ItemStack Fix", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(RAILCRAFT_INVENTORY_TOOLS) && AsmConfig.enableRcItemDupeFix) { + Preloader_Logger.INFO("Railcraft negative ItemStack Fix", "Transforming "+transformedName); return new ClassTransformer_Railcraft_InvTools(basicClass, obfuscated).getWriter().toByteArray(); } //Fix GC stuff - if (mConfig.enableGcFuelChanges) { - if (transformedName.equals("micdoodle8.mods.galacticraft.core.util.FluidUtil")) { - FMLRelaunchLog.log("[GT++ ASM] Galacticraft FluidUtils Patch", Level.INFO, "Transforming %s", transformedName); - return new ClassTransformer_GC_FluidUtil(basicClass, probablyShouldBeFalse).getWriter().toByteArray(); + if (AsmConfig.enableGcFuelChanges) { + if (transformedName.equals(GALACTICRAFT_FLUID_UTILS)) { + Preloader_Logger.INFO("Galacticraft FluidUtils Patch", "Transforming "+transformedName); + return new ClassTransformer_GC_FluidUtil(basicClass, false).getWriter().toByteArray(); } - if (transformedName.equals("micdoodle8.mods.galacticraft.core.tile.TileEntityFuelLoader")) { - FMLRelaunchLog.log("[GT++ ASM] Galacticraft Fuel_Loader Patch", Level.INFO, "Transforming %s", transformedName); - return new ClassTransformer_GC_FuelLoader(basicClass, probablyShouldBeFalse).getWriter().toByteArray(); + if (transformedName.equals(GALACTICRAFT_TILE_ENTITY_FUEL_LOADER)) { + Preloader_Logger.INFO("Galacticraft Fuel_Loader Patch", "Transforming "+transformedName); + return new ClassTransformer_GC_FuelLoader(basicClass, false).getWriter().toByteArray(); } - if (transformedName.equals("micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket")) { - FMLRelaunchLog.log("[GT++ ASM] Galacticraft EntityAutoRocket Patch", Level.INFO, "Transforming %s", transformedName); - return new ClassTransformer_GC_EntityAutoRocket(basicClass, probablyShouldBeFalse).getWriter().toByteArray(); + if (transformedName.equals(GALACTICRAFT_ENTITY_AUTO_ROCKET)) { + Preloader_Logger.INFO("Galacticraft EntityAutoRocket Patch", "Transforming "+transformedName); + return new ClassTransformer_GC_EntityAutoRocket(basicClass, false).getWriter().toByteArray(); } } @@ -161,42 +176,46 @@ public class Preloader_Transformer_Handler implements IClassTransformer { */ //Make GT_Utilities safer - if (transformedName.equals("gtPlusPlus.preloader.asm.transformers.ClassTransformer_GT_Utility")) { - FMLRelaunchLog.log("[GT++ ASM] Gregtech Utilities Patch", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(GT_UTILITY)) { + Preloader_Logger.INFO("Gregtech Utilities Patch", "Transforming "+transformedName); return new ClassTransformer_GT_Utility(basicClass, transformedName).getWriter().toByteArray(); } //Inject Custom constructors for Busses - if (transformedName.equals(ClassTransformer_GT_BusPatch.aInput) || transformedName.equals(ClassTransformer_GT_BusPatch.aOutput) || transformedName.equals(ClassTransformer_GT_BusPatch.aSuperInput) || transformedName.equals(ClassTransformer_GT_BusPatch.aSuperOutput)) { - FMLRelaunchLog.log("[GT++ ASM] Gregtech Bus Patch", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(GT_MTE_HATCH_INPUTBUS) || transformedName.equals(GT_MTE_HATCH_OUTPUTBUS) || transformedName.equals(GTPP_MTE_HATCH_SUPER_INPUT_BUS) || transformedName.equals(GTPP_MTE_HATCH_SUPER_OUTPUT_BUS)) { + Preloader_Logger.INFO("Gregtech Bus Patch", "Transforming "+transformedName); return new ClassTransformer_GT_BusPatch(basicClass, transformedName).getWriter().toByteArray(); } //Try patch achievements - if (transformedName.equals("gregtech.loaders.misc.GT_Achievements")) { - FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(GT_ACHIEVEMENTS)) { + Preloader_Logger.INFO("Gregtech Achievements Patch", "Transforming "+transformedName); return new ClassTransformer_GT_Achievements_CrashFix(basicClass, obfuscated).getWriter().toByteArray(); } //Fix bad handling of a loop left from original decompilation //Also Fix Achievements, although currently disabled. - if (transformedName.equals("gregtech.common.GT_Client")) { - FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(GT_CLIENT_PROXY)) { + Preloader_Logger.INFO("Gregtech Client Proxy Patch", "Transforming "+transformedName); return new ClassTransformer_GT_Client(basicClass, obfuscated).getByteArray(); } //Make GT packets safer, fill them with debug info. - if (transformedName.equals("gregtech.api.net.GT_Packet_TileEntity")) { - FMLRelaunchLog.log("[GT++ ASM] Gregtech GT_Packet_TileEntity Patch", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(GT_PACKET_TILE_ENTITY)) { + Preloader_Logger.INFO("Gregtech GT_Packet_TileEntity Patch", "Transforming "+transformedName); return new ClassTransformer_GT_Packet_TileEntity(basicClass, obfuscated).getWriter().toByteArray(); } //Make the setting of GT Tiles safer, so as not to crash the client. - if (transformedName.equals("gregtech.api.metatileentity.BaseMetaTileEntity")) { - FMLRelaunchLog.log("[GT++ ASM] Gregtech setMetaTileEntity Patch", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(GT_BASE_META_TILE_ENTITY)) { + Preloader_Logger.INFO("Gregtech setMetaTileEntity Patch", "Transforming "+transformedName); return new ClassTransformer_GT_BaseMetaTileEntity(basicClass).getWriter().toByteArray(); } - + //Add extra tools if we're in a dev environment. + if (transformedName.equals(GT_METAGENERATED_TOOL) && CORE_Preloader.DEV_ENVIRONMENT) { + Preloader_Logger.INFO("Gregtech Additional Tools Patch", "Transforming "+transformedName); + return new ClassTransformer_GT_MetaGenerated_Tool(basicClass).getWriter().toByteArray(); + } //Fix log handling on the charcoal pit - if (transformedName.equals("gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_Charcoal_Pit") && mConfig.enableGtCharcoalPitFix) { - FMLRelaunchLog.log("[GT++ ASM] GT Charcoal Pit Fix", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(GT_MTE_CHARCOAL_PIT) && AsmConfig.enableGtCharcoalPitFix) { + Preloader_Logger.INFO("GT Charcoal Pit Fix", "Transforming "+transformedName); return new ClassTransformer_GT_CharcoalPit(basicClass, obfuscated).getWriter().toByteArray(); } @@ -204,71 +223,53 @@ public class Preloader_Transformer_Handler implements IClassTransformer { //Patching Meta Tile Tooltips - if (transformedName.equals("gregtech.common.blocks.GT_Item_Machines") && mConfig.enableGtTooltipFix) { - FMLRelaunchLog.log("[GT++ ASM] Gregtech Tooltip Patch", Level.INFO, "Transforming %s", transformedName); - return new ClassTransformer_GT_ItemMachines_Tooltip(basicClass, probablyShouldBeFalse).getWriter().toByteArray(); + if (transformedName.equals(GT_ITEM_MACHINES) && AsmConfig.enableGtTooltipFix) { + Preloader_Logger.INFO("Gregtech Tooltip Patch", "Transforming "+transformedName); + return new ClassTransformer_GT_ItemMachines_Tooltip(basicClass, false).getWriter().toByteArray(); } - if (transformedName.equals(class_Block_Machines)) { + if (transformedName.equals(GT_BLOCK_MACHINES)) { //Fix GT NBT Persistency issue - FMLRelaunchLog.log("[GT++ ASM] Gregtech NBT Persistency Patch", Level.INFO, "Transforming %s", transformedName); - byte[] g = new ClassTransformer_GT_BlockMachines_NBT(basicClass, probablyShouldBeFalse).getWriter().toByteArray(); - FMLRelaunchLog.log("[GT++ ASM] Gregtech getTileEntityBaseType Patch", Level.INFO, "Transforming %s", transformedName); - return new ClassTransformer_GT_BlockMachines_MetaPipeEntity(g, probablyShouldBeFalse, 0).getWriter().toByteArray(); + Preloader_Logger.INFO("Gregtech NBT Persistency Patch", "Transforming "+transformedName); + byte[] g = new ClassTransformer_GT_BlockMachines_NBT(basicClass, false).getWriter().toByteArray(); + Preloader_Logger.INFO("Gregtech getTileEntityBaseType Patch", "Transforming "+transformedName); + return new ClassTransformer_GT_BlockMachines_MetaPipeEntity(g, 0).getWriter().toByteArray(); } - if (transformedName.equals(class_GT_MetaPipeEntity_Item) || transformedName.equals(class_GT_MetaPipeEntity_Frame) || transformedName.equals(class_GT_MetaPipeEntity_Fluid)) { - FMLRelaunchLog.log("[GT++ ASM] Gregtech getTileEntityBaseType Patch", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(GT_METAPIPE_ITEM) || transformedName.equals(GT_METAPIPE_FRAME) || transformedName.equals(GT_METAPIPE_FLUID)) { + Preloader_Logger.INFO("Gregtech getTileEntityBaseType Patch", "Transforming "+transformedName); int mode = 0; - if (transformedName.equals(class_GT_MetaPipeEntity_Item)) { + if (transformedName.equals(GT_METAPIPE_ITEM)) { mode = 1; } - else if (transformedName.equals(class_GT_MetaPipeEntity_Frame)) { + else if (transformedName.equals(GT_METAPIPE_FRAME)) { mode = 2; } else { mode = 3; } - return new ClassTransformer_GT_BlockMachines_MetaPipeEntity(basicClass, probablyShouldBeFalse, mode).getWriter().toByteArray(); + return new ClassTransformer_GT_BlockMachines_MetaPipeEntity(basicClass, mode).getWriter().toByteArray(); } - String[] aIC2ClassNames = new String[] { - "ic2.core.block.BlockTileEntity", - "ic2.core.block.machine.BlockMachine", - "ic2.core.block.machine.BlockMachine2", - "ic2.core.block.machine.BlockMachine3", - "ic2.core.block.kineticgenerator.block.BlockKineticGenerator", - "ic2.core.block.heatgenerator.block.BlockHeatGenerator", - "ic2.core.block.generator.block.BlockGenerator", - "ic2.core.block.reactor.block.BlockReactorAccessHatch", - "ic2.core.block.reactor.block.BlockReactorChamber", - "ic2.core.block.reactor.block.BlockReactorFluidPort", - "ic2.core.block.reactor.block.BlockReactorRedstonePort", - "ic2.core.block.reactor.block.BlockReactorVessel", - "ic2.core.block.personal.BlockPersonal.class", - "ic2.core.block.wiring.BlockChargepad.class", - "ic2.core.block.wiring.BlockElectric.class", - "ic2.core.block.wiring.BlockLuminator.class", - }; - - //Fix IC2 Shit - for (String y : aIC2ClassNames) { + + //Fix IC2 Wrench Harvesting + for (String y : IC2_WRENCH_PATCH_CLASS_NAMES) { if (transformedName.equals(y)) { - FMLRelaunchLog.log("[GT++ ASM] IC2 getHarvestTool Patch", Level.INFO, "Transforming %s", transformedName); + Preloader_Logger.INFO("IC2 getHarvestTool Patch", "Transforming "+transformedName); return new ClassTransformer_IC2_GetHarvestTool(basicClass, obfuscated, transformedName).getWriter().toByteArray(); } } //Fix IC2 Hazmat - if (transformedName.equals("ic2.core.item.armor.ItemArmorHazmat")) { - FMLRelaunchLog.log("[GT++ ASM] IC2 Hazmat Patch", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(IC2_ITEM_ARMOUR_HAZMAT)) { + Preloader_Logger.INFO("IC2 Hazmat Patch", "Transforming "+transformedName); return new ClassTransformer_IC2_Hazmat(basicClass, transformedName).getWriter().toByteArray(); } //Fix Thaumcraft Shit //Patching ItemWispEssence to allow invalid item handling - if (transformedName.equals("thaumcraft.common.items.ItemWispEssence") && mConfig.enableTcAspectSafety) { - FMLRelaunchLog.log("[GT++ ASM] Thaumcraft WispEssence_Patch", Level.INFO, "Transforming %s", transformedName); + if (transformedName.equals(THAUMCRAFT_ITEM_WISP_ESSENCE) && AsmConfig.enableTcAspectSafety) { + Preloader_Logger.INFO("Thaumcraft WispEssence_Patch", "Transforming "+transformedName); return new ClassTransformer_TC_ItemWispEssence(basicClass, obfuscated).getWriter().toByteArray(); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java index 663804bc81..e7ac605450 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java @@ -7,6 +7,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import codechicken.nei.api.API; import cpw.mods.fml.common.event.FMLLoadCompleteEvent; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; @@ -23,7 +24,9 @@ import gtPlusPlus.api.helpers.GregtechPlusPlus_API.Multiblock_API; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.data.Pair; +import gtPlusPlus.api.objects.minecraft.multi.NoEUBonusMultiBehaviour; import gtPlusPlus.api.objects.minecraft.multi.NoOutputBonusMultiBehaviour; +import gtPlusPlus.api.objects.minecraft.multi.NoSpeedBonusMultiBehaviour; import gtPlusPlus.australia.gen.gt.WorldGen_GT_Australia; import gtPlusPlus.core.handler.COMPAT_HANDLER; import gtPlusPlus.core.handler.OldCircuitHandler; @@ -131,6 +134,8 @@ public class HANDLER_GT { // Register the No-Bonus Special Behaviour. Multiblock_API.registerSpecialMultiBehaviour(new NoOutputBonusMultiBehaviour()); + Multiblock_API.registerSpecialMultiBehaviour(new NoSpeedBonusMultiBehaviour()); + Multiblock_API.registerSpecialMultiBehaviour(new NoEUBonusMultiBehaviour()); //Register some custom recipe maps for any enabled multiblocks. //MultiblockRecipeMapHandler.run(); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index cd4b0947e4..c7fe473c44 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -2,13 +2,14 @@ package gtPlusPlus.xmod.gregtech.api.enums; import static gregtech.api.enums.GT_Values.W; -import gregtech.api.util.*; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; import gtPlusPlus.xmod.gregtech.api.interfaces.GregtechItemContainer; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; /** * Class containing all non-OreDict Items of GregTech. @@ -130,6 +131,14 @@ public enum GregtechItemList implements GregtechItemContainer { Farm_Processor_ZPM, Farm_Processor_UV, + // Upgrade chip for Distillus + Distillus_Upgrade_Chip, + + + // Chips used to nerf my multis via custom behavioural attachments + Chip_MultiNerf_NoOutputBonus, + Chip_MultiNerf_NoSpeedBonus, + Chip_MultiNerf_NoEuBonus, //---------------------------------------------------------------------------- @@ -308,7 +317,9 @@ public enum GregtechItemList implements GregtechItemContainer { Machine_Adv_ImplosionCompressor, Machine_Adv_DistillationTower, - + //Advanced Assembly Line + Machine_Adv_AssemblyLine, + //Advanced Vacuum Freezer Industrial_Cryogenic_Freezer, Casing_AdvancedVacuum, @@ -579,6 +590,7 @@ public enum GregtechItemList implements GregtechItemContainer { Generator_SemiFluid_LV, Generator_SemiFluid_MV, Generator_SemiFluid_HV, + Controller_LargeSemifluidGenerator, //Advanced Mixer 4x4 diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index ef5429af62..b6b75808fc 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -16,7 +16,6 @@ import org.apache.commons.lang3.ArrayUtils; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; -import gregtech.api.enums.TAE; import gregtech.api.gui.GT_Container_MultiMachine; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -2213,7 +2212,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult } } - return super.addDynamoToMachineList(aTileEntity, aBaseCasingIndex); + return addToMachineList(aTileEntity, aBaseCasingIndex); } @@ -2536,9 +2535,10 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult boolean isHatch = false; if (aBaseMetaTileEntity != null) { - if (aCasingID < 64) { + // Unsure why this check exists? + /*if (aCasingID < 64) { aCasingID = TAE.GTPP_INDEX(aCasingID); - } + }*/ isHatch = this.addToMachineList(aBaseMetaTileEntity, aCasingID); if (isHatch) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java index 5d4cf5ea94..232d4e2cd7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java @@ -363,6 +363,15 @@ public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 { for (int aIndex=0;aIndex<10;aIndex++){ aTransParts[aIndex].set(this.addItem(aStartID++, "Transmission Component ("+GT_Values.VN[aIndex]+")", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, aIndex), getTcAspectStack(TC_Aspects.MACHINA, aIndex), getTcAspectStack(TC_Aspects.MAGNETO, aIndex)})); } + + // Distillus Chip + GregtechItemList.Distillus_Upgrade_Chip.set(this.addItem(151, "Upgrade Chip", "Used to upgrade Distillus to Tier 2")); + + + GregtechItemList.Chip_MultiNerf_NoOutputBonus.set(this.addItem(160, "No-Bonus Chip", "You won't like using this")); + GregtechItemList.Chip_MultiNerf_NoSpeedBonus.set(this.addItem(161, "No-Bonus Chip", "You won't like using this")); + GregtechItemList.Chip_MultiNerf_NoEuBonus.set(this.addItem(162, "No-Bonus Chip", "You won't like using this")); + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java index 9f50cf6d91..bd9708108b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java @@ -8,6 +8,7 @@ import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; @@ -15,10 +16,9 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.GTPP_MTE_BasicLosslessGenerator; import net.minecraft.item.ItemStack; -public class GT_MetaTileEntity_SemiFluidGenerator extends GTPP_MTE_BasicLosslessGenerator{ +public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_BasicGenerator { public static final int BASE_POLLUTION = 2; public int mEfficiency; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java index 0939a9e6be..738c8c7cf9 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java @@ -148,7 +148,7 @@ public class GregtechMetaTileEntity_IndustrialPlatePress extends GregtechMeta_Mu Block aBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); int aMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); - if (!isValidBlockForStructure(tTileEntity, 4, true, aBlock, aMeta, + if (!isValidBlockForStructure(tTileEntity, TAE.getIndexFromPage(0, 4), true, aBlock, aMeta, ModBlocks.blockCasingsMisc, 4)) { Logger.INFO("Bad material press casing"); return false; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java new file mode 100644 index 0000000000..eab997adb4 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java @@ -0,0 +1,623 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced; + +import java.util.ArrayList; +import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.TAE; +import gregtech.api.enums.Textures; +import gregtech.api.gui.GT_GUIContainer_MultiMachine; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.util.minecraft.LangUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Naquadah; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +public class GregtechMetaTileEntity_Adv_AssemblyLine + extends GregtechMeta_MultiBlockBase { + + public ArrayList<GT_MetaTileEntity_Hatch_DataAccess> mDataAccessHatches = new ArrayList<GT_MetaTileEntity_Hatch_DataAccess>(); + + public static String[] mCasingName = new String[5]; + private final int CASING_TEXTURE_ID = TAE.getIndexFromPage(0, 13); + private final int META_BaseCasing = 0; //4 + private final int META_ContainmentCasing = 15; //3 + private final int META_Shielding = 13; //1 + private final int META_PipeCasing = 1; //4 + private final int META_IntegralCasing = 6; //0 + private final int META_ContainmentChamberCasing = 2; //4 + + + public GregtechMetaTileEntity_Adv_AssemblyLine(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0); + mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1); + mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2); + mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15); + mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13); + } + + public GregtechMetaTileEntity_Adv_AssemblyLine(String aName) { + super(aName); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_Adv_AssemblyLine(this.mName); + } + + public String[] getTooltip() { + if (mCasingName[0].toLowerCase().contains(".name")) { + mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0); + } + if (mCasingName[1].toLowerCase().contains(".name")) { + mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1); + } + if (mCasingName[2].toLowerCase().contains(".name")) { + mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2); + } + if (mCasingName[3].toLowerCase().contains(".name")) { + mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15); + } + if (mCasingName[4].toLowerCase().contains(".name")) { + mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13); + } + return new String[]{ + "Advanced Integrated Assembly Line" + }; + } + + private Block getCasing(int casingID) { + if (casingID == 1) { + return ModBlocks.blockCasingsMisc; + } + else if (casingID == 2) { + return ModBlocks.blockCasings2Misc; + } + else if (casingID == 3) { + return ModBlocks.blockCasings3Misc; + } + else if (casingID == 4) { + return ModBlocks.blockCasings4Misc; + } + else { + return ModBlocks.blockCasingsTieredGTPP; + } + } + + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[16], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[16]}; + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "AssemblyLine.png"); + } + + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return null; + } + + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; + } + + public boolean checkRecipe(ItemStack aStack) { + if(GT_Values.D1)System.out.println("Start ALine recipe check"); + ArrayList<ItemStack> tDataStickList = getDataItems(2); + if (tDataStickList.size() == 0) return false; + if(GT_Values.D1)System.out.println("Stick accepted, " + tDataStickList.size() + " Data Sticks found"); + + ItemStack tStack[] = new ItemStack[15]; + FluidStack[] tFluids = new FluidStack[4]; + boolean findRecipe = false; + nextDS:for (ItemStack tDataStick : tDataStickList){ + NBTTagCompound tTag = tDataStick.getTagCompound(); + if (tTag == null) continue; + for (int i = 0; i < 15; i++) { + int count = tTag.getInteger("a"+i); + if (!tTag.hasKey("" + i) && count <= 0) continue; + if (mInputBusses.get(i) == null) { + continue nextDS; + } + + ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0); + boolean flag = true; + if (count > 0) { + for (int j = 0; j < count; j++) { + tStack[i] = GT_Utility.loadItem(tTag, "a" + i + ":" + j); + if (tStack[i] == null) continue; + if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName()); + if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) { + flag = false; + break; + } + } + } + if (flag) { + tStack[i] = GT_Utility.loadItem(tTag, "" + i); + if (tStack[i] == null) { + flag = false; + continue; + } + if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName()); + if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) { + flag = false; + } + } + if(GT_Values.D1) System.out.println(i + (flag ? " not accepted" : " accepted")); + if (flag) continue nextDS; + } + + if(GT_Values.D1)System.out.println("All Items done, start fluid check"); + for (int i = 0; i < 4; i++) { + if (!tTag.hasKey("f" + i)) continue; + tFluids[i] = GT_Utility.loadFluid(tTag, "f" + i); + if (tFluids[i] == null) continue; + if(GT_Values.D1)System.out.println("Fluid "+i+" "+tFluids[i].getUnlocalizedName()); + if (mInputHatches.get(i) == null) { + continue nextDS; + } + FluidStack fluidInHatch = mInputHatches.get(i).mFluid; + if (fluidInHatch == null || !GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) { + if(GT_Values.D1)System.out.println(i+" not accepted"); + continue nextDS; + } + if(GT_Values.D1)System.out.println(i+" accepted"); + } + + if(GT_Values.D1)System.out.println("Input accepted, check other values"); + if (!tTag.hasKey("output")) continue; + mOutputItems = new ItemStack[]{GT_Utility.loadItem(tTag, "output")}; + if (mOutputItems[0] == null || !GT_Utility.isStackValid(mOutputItems[0])) + continue; + + if (!tTag.hasKey("time")) continue; + mMaxProgresstime = tTag.getInteger("time"); + if (mMaxProgresstime <= 0) continue; + + if (!tTag.hasKey("eu")) continue; + mEUt = tTag.getInteger("eu"); + + if(GT_Values.D1)System.out.println("Find avaiable recipe"); + findRecipe = true; + break; + } + if (!findRecipe) return false; + + if(GT_Values.D1)System.out.println("All checked start consuming inputs"); + for (int i = 0; i < 15; i++) { + if (tStack[i] == null) continue; + ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0); + stackInSlot.stackSize -= tStack[i].stackSize; + } + + for (int i = 0; i < 4; i++) { + if (tFluids[i] == null) continue; + mInputHatches.get(i).mFluid.amount -= tFluids[i].amount; + if (mInputHatches.get(i).mFluid.amount <= 0) { + mInputHatches.get(i).mFluid = null; + } + } + if(GT_Values.D1)System.out.println("Check overclock"); + + byte tTier = (byte) Math.max(1, GT_Utility.getTier(getMaxInputVoltage())); + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + if (mEUt <= 16) { + this.mEUt = (mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = (mMaxProgresstime / (1 << tTier - 1)); + } else { + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + } + if (this.mEUt > 0) { + this.mEUt = -this.mEUt; + } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + updateSlots(); + if(GT_Values.D1)System.out.println("Recipe sucessfull"); + return true; + } + + public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { + super.startSoundLoop(aIndex, aX, aY, aZ); + if (aIndex == 20) { + GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(212), 10, 1.0F, aX, aY, aZ); + } + } + + public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 4; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 4; + + // Counts for all Casing Types + int aBaseCasingCount = 0; + int aContainmentCasingCount = 0; + int aShieldingCount = 0; + int aPipeCount = 0; + int aIntegralCasingCount = 0; + int aContainmentChamberCount = 0; + + // Bottom Layer + aBaseCasingCount += checkEntireLayer(aBaseMetaTileEntity, getCasing(4), META_BaseCasing, -7, xDir, zDir); + log("Bottom Layer is Valid. Moving to Layer 1."); + + // Layer 1 + aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -6, xDir, zDir); + aIntegralCasingCount += checkIntegralRing(aBaseMetaTileEntity, getCasing(0), this.META_IntegralCasing, -6, xDir, zDir); + aContainmentChamberCount += checkContainmentRing(aBaseMetaTileEntity, getCasing(4), this.META_ContainmentChamberCasing, -6, xDir, zDir); + log("Layer 1 is Valid. Moving to Layer 2."); + + // Layer 2 + aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -5, xDir, zDir); + aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -5, xDir, zDir); + log("Layer 2 is Valid. Moving to Layer 3."); + + // Layer 3 + aContainmentCasingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(3), this.META_ContainmentCasing, -4, xDir, zDir); + aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -4, xDir, zDir); + log("Layer 3 is Valid. Moving to Layer 4."); + + // Layer 4 + aContainmentCasingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(3), this.META_ContainmentCasing, -3, xDir, zDir); + aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -3, xDir, zDir); + log("Layer 4 is Valid. Moving to Layer 5."); + + // Layer 5 + aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -2, xDir, zDir); + aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -2, xDir, zDir); + log("Layer 5 is Valid. Moving to Layer 6."); + + // Layer 6 + aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -1, xDir, zDir); + aIntegralCasingCount += checkIntegralRing(aBaseMetaTileEntity, getCasing(0), this.META_IntegralCasing, -1, xDir, zDir); + aContainmentChamberCount += checkContainmentRing(aBaseMetaTileEntity, getCasing(4), this.META_ContainmentChamberCasing, -1, xDir, zDir); + log("Layer 6 is Valid. Moving to Top Layer."); + + // Top Layer + aBaseCasingCount += checkEntireLayer(aBaseMetaTileEntity, getCasing(4), META_BaseCasing, 0, xDir, zDir); + + log("Found "+aBaseCasingCount+" "+mCasingName[0]+"s"); + log("Found "+aShieldingCount+" "+mCasingName[4]+"s"); + log("Found "+aPipeCount+" "+mCasingName[1]+"s"); + log("Found "+aContainmentCasingCount+" "+mCasingName[3]+"s"); + log("Found "+aIntegralCasingCount+" "+LangUtils.getLocalizedNameOfBlock(getCasing(0), 6)+"s"); + log("Found "+aContainmentChamberCount+" "+mCasingName[2]+"s"); + + // Try mesage player + String aOwnerName = this.getBaseMetaTileEntity().getOwnerName(); + EntityPlayer aOwner = null; + if (aOwnerName != null && aOwnerName.length() > 0) { + aOwner = PlayerUtils.getPlayer(aOwnerName); + } + + if (aShieldingCount != 128) { + log("Not enough "+mCasingName[4]+"s, require 128."); + if (aOwner != null) { + PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[4]+"s, require 128."); + } + return false; + } + if (aPipeCount != 20) { + log("Not enough "+mCasingName[1]+"s, require 20."); + if (aOwner != null) { + PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[1]+"s, require 20."); + } + return false; + } + if (aContainmentCasingCount != 64) { + log("Not enough "+mCasingName[3]+"s, require 64."); + if (aOwner != null) { + PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[3]+"s, require 64."); + } + return false; + } + if (aContainmentChamberCount != 42) { + log("Not enough "+mCasingName[2]+"s, require 42."); + if (aOwner != null) { + PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[2]+"s, require 42."); + } + return false; + } + if (aBaseCasingCount < 140) { + log("Not enough "+mCasingName[0]+"s, require 140 at a minimum."); + if (aOwner != null) { + PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[0]+"s, require 140 at a minimum."); + } + return false; + } + if (aIntegralCasingCount != 48) { + log("Not enough "+LangUtils.getLocalizedNameOfBlock(getCasing(0), 6)+"s, require 48."); + if (aOwner != null) { + PlayerUtils.messagePlayer(aOwner, "Not enough "+LangUtils.getLocalizedNameOfBlock(getCasing(0), 6)+"s, require 48."); + } + return false; + } + log("LNR Formed."); + if (aOwner != null) { + PlayerUtils.messagePlayer(aOwner, "Large Naquadah Reactor has formed successfully."); + } + return true; + } + + public boolean addNaquadahHatchToMachineInput(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity); + } + return false; + } + + public int checkEntireLayer(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) { + int aCasingCount = 0; + for (int x = -4; x < 5; x++) { + for (int z = -4; z < 5; z++) { + int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x; + int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY; + int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z; + //Skip the corners + if ((x == 4 && z == 4) || (x == -4 && z == -4) || (x == 4 && z == -4) || (x == -4 && z == 4)) { + continue; + } + // Skip controller + if (aY == 0 && x == 0 && z == 0) { + continue; + } + + Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z); + int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z); + if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) { + aCasingCount++; + } + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z); + if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, true, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) { + log("Layer has error. Height: "+aY); + //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3); + return 0; + } + } + } + return aCasingCount; + } + + public int checkOuterRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) { + int aCasingCount = 0; + for (int x = -4; x < 5; x++) { + for (int z = -4; z < 5; z++) { + int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x; + int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY; + int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z; + //Skip the corners + if ((x == 4 && z == 4) || (x == -4 && z == -4) || (x == 4 && z == -4) || (x == -4 && z == 4)) { + continue; + } + + // If we are on the 5x5 ring, proceed + if ((x > -4 && x < 4 ) && (z > -4 && z < 4)) { + if ((x == 3 && z == 3) || (x == -3 && z == -3) || (x == 3 && z == -3) || (x == -3 && z == 3)) { + //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3); + } + else { + continue; + } + } + + Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z); + int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z); + if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) { + aCasingCount++; + } + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z); + if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) { + log("Layer has error. Height: "+aY); + //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3); + return 0; + } + } + } + return aCasingCount; + } + public int checkIntegralRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) { + int aCasingCount = 0; + for (int x = -3; x < 4; x++) { + for (int z = -3; z < 4; z++) { + int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x; + int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY; + int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z; + //Skip the corners + if ((x == 3 && z == 3) || (x == -3 && z == -3) || (x == 3 && z == -3) || (x == -3 && z == 3)) { + continue; + } + + // If we are on the 5x5 ring, proceed + if ((x > -3 && x < 3 ) && (z > -3 && z < 3)) { + if ((x == 2 && z == 2) || (x == -2 && z == -2) || (x == 2 && z == -2) || (x == -2 && z == 2)) { + //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3); + } + else { + continue; + } + } + + Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z); + int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z); + if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) { + aCasingCount++; + } + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z); + if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) { + log("Layer has error. Height: "+aY); + //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3); + return 0; + } + } + } + return aCasingCount; + } + + public int checkPipes(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) { + int aCasingCount = 0; + for (int x = -1; x < 2; x++) { + for (int z = -1; z < 2; z++) { + int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x; + int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY; + int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z; + //Skip the corners + if ((x == 1 && z == 1) || (x == -1 && z == -1) || (x == 1 && z == -1) || (x == -1 && z == 1) || (x == 0 && z == 0)) { + Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z); + int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z); + if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) { + aCasingCount++; + } + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z); + if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) { + log("Pipe has error. Height: "+aY); + //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3); + return 0; + }; + } + } + } + return aCasingCount; + } + + public int checkContainmentRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) { + int aCasingCount = 0; + for (int x = -2; x < 3; x++) { + for (int z = -2; z < 3; z++) { + int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x; + int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY; + int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z; + //Skip the corners + if ((x == 2 && z == 2) || (x == -2 && z == -2) || (x == 2 && z == -2) || (x == -2 && z == 2)) { + continue; + } + + Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z); + int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z); + if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) { + aCasingCount++; + } + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z); + if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) { + log("Layer has error. Height: "+aY); + //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3); + return 0; + } + } + } + return aCasingCount; + } + + /** + * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb + */ + private boolean isCorrectDataItem(ItemStack aStack, int state){ + if ((state & 1) != 0 && ItemList.Circuit_Integrated.isStackEqual(aStack, true, true)) return true; + if ((state & 2) != 0 && ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) return true; + if ((state & 4) != 0 && ItemList.Tool_DataOrb.isStackEqual(aStack, false, true)) return true; + return false; + } + + /** + * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb + */ + public ArrayList<ItemStack> getDataItems(int state) { + ArrayList<ItemStack> rList = new ArrayList<ItemStack>(); + if (GT_Utility.isStackValid(mInventory[1]) && isCorrectDataItem(mInventory[1], state)) { + rList.add(mInventory[1]); + } + for (GT_MetaTileEntity_Hatch_DataAccess tHatch : mDataAccessHatches) { + if (isValidMetaTileEntity(tHatch)) { + for (int i = 0; i < tHatch.getBaseMetaTileEntity().getSizeInventory(); i++) { + if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null + && isCorrectDataItem(tHatch.getBaseMetaTileEntity().getStackInSlot(i), state)) + rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); + } + } + } + return rList; + } + + public boolean addDataAccessToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity); + } + return false; + } + + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + public int getPollutionPerTick(ItemStack aStack) { + return 0; + } + + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } + + @Override + public boolean hasSlotInGUI() { + return false; + } + + @Override + public String getCustomGUIResourceName() { + return null; + } + + @Override + public String getMachineType() { + return "Assembly Line"; + } + + @Override + public int getMaxParallelRecipes() { + return 0; + } + + @Override + public int getEuDiscountForParallelism() { + return 0; + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java index e5387d8c6f..7471963eac 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java @@ -1,5 +1,9 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced; +import java.util.ArrayList; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; @@ -8,13 +12,16 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; @@ -23,94 +30,86 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; -import org.apache.commons.lang3.ArrayUtils; - -import java.util.ArrayList; public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_MultiBlockBase { - - private static final int CASING_INDEX = 49; - - private short mControllerY = 0; - - private byte mMode = 0; - - public GregtechMetaTileEntity_Adv_DistillationTower(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_Adv_DistillationTower(String aName) { - super(aName); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_Adv_DistillationTower(this.mName); - } - - public String[] getTooltip() { + + private short mControllerY = 0; + private byte mMode = 0; + private boolean mUpgraded = false; + + public GregtechMetaTileEntity_Adv_DistillationTower(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GregtechMetaTileEntity_Adv_DistillationTower(String aName) { + super(aName); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_Adv_DistillationTower(this.mName); + } + + public String[] getTooltip() { String s = "Max parallel dictated by tower tier and mode"; String s1 = "DTower Mode: T1=4, T2=12"; String s2 = "Distilery Mode: Tower Tier * (4*InputTier)"; - return new String[]{ - "Controller Block for the Advanced Distillation Tower", - "T1 constructed identical to standard DT", - "T2 is currently disabled.", - "T2 is not variable height", - "Size(WxHxD): 3x26x3", - "Controller (Front bottom)", - "1x Input Hatch (Any bottom layer casing)", - "24x Output Hatch (One per layer except bottom/top layer)", - "1x Output Bus (Any bottom layer casing)", - "1x Maintenance Hatch (Any casing)", - "1x Energy Hatch (Any casing)", - "Integral Framework I's for the rest", - s, - s1, - s2}; - } - - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_INDEX], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER)}; - } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_INDEX]}; - } - - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DistillationTower.png"); - } - - public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return mMode == 0 ? GT_Recipe.GT_Recipe_Map.sDistillationRecipes : GT_Recipe.GT_Recipe_Map.sDistilleryRecipes; - } - - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - public boolean isFacingValid(byte aFacing) { - return aFacing > 1; - } - - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - public int getPollutionPerTick(ItemStack aStack) { + return new String[]{ + "Controller Block for the Advanced Distillation Tower", + "T1 constructed identical to standard DT", + "Place Distillus Upgrade Chip into Controller GUI to upgrade to T2", + "T2 is not variable height", + "Size(WxHxD): 3x26x3", + "Controller (Front bottom)", + "1x Input Hatch (Any bottom layer casing)", + "24x Output Hatch (One per layer except bottom/top layer)", + "1x Output Bus (Any bottom layer casing)", + "1x Maintenance Hatch (Any casing)", + "1x Energy Hatch (Any casing)", + "Integral Framework I's for the rest", + s, + s1, + s2}; + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName()+(mUpgraded ? " T2" : ""), "MultiblockDisplay.png"); + } + + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return mMode == 0 ? GT_Recipe.GT_Recipe_Map.sDistillationRecipes : GT_Recipe.GT_Recipe_Map.sDistilleryRecipes; + } + + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; + } + + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + public int getPollutionPerTick(ItemStack aStack) { return this.mMode == 1 ? 12 : 24; - } - + } + @Override public void saveNBTData(NBTTagCompound aNBT) { aNBT.setByte("mMode", mMode); + aNBT.setInteger("mCasingTier", this.mCasingTier); + aNBT.setBoolean("mUpgraded", mUpgraded); super.saveNBTData(aNBT); } @Override public void loadNBTData(NBTTagCompound aNBT) { mMode = aNBT.getByte("mMode"); + mCasingTier = aNBT.getInteger("mCasingTier"); + mUpgraded = aNBT.getBoolean("mUpgraded"); super.loadNBTData(aNBT); - } + } @Override public String getSound() { @@ -134,44 +133,44 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_M } } - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } - - @Override - public boolean addOutput(FluidStack aLiquid) { - if (aLiquid == null) return false; - FluidStack tLiquid = aLiquid.copy(); - for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { - if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) { - if (tHatch.getBaseMetaTileEntity().getYCoord() == this.mControllerY + 1) { - int tAmount = tHatch.fill(tLiquid, false); - if (tAmount >= tLiquid.amount) { - return tHatch.fill(tLiquid, true) >= tLiquid.amount; - } else if (tAmount > 0) { - tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true); - } - } - } - } - return false; - } - - @Override - protected void addFluidOutputs(FluidStack[] mOutputFluids2) { - for (int i = 0; i < mOutputFluids2.length; i++) { - if (mOutputHatches.size() > i && mOutputHatches.get(i) != null && mOutputFluids2[i] != null && isValidMetaTileEntity(mOutputHatches.get(i))) { - if (mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord() == this.mControllerY + 1 + i) { - mOutputHatches.get(i).fill(mOutputFluids2[i], true); - } - } - } - - } + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } + + @Override + public boolean addOutput(FluidStack aLiquid) { + if (aLiquid == null) return false; + FluidStack tLiquid = aLiquid.copy(); + for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { + if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) { + if (tHatch.getBaseMetaTileEntity().getYCoord() == this.mControllerY + 1) { + int tAmount = tHatch.fill(tLiquid, false); + if (tAmount >= tLiquid.amount) { + return tHatch.fill(tLiquid, true) >= tLiquid.amount; + } else if (tAmount > 0) { + tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true); + } + } + } + } + return false; + } + + @Override + protected void addFluidOutputs(FluidStack[] mOutputFluids2) { + for (int i = 0; i < mOutputFluids2.length; i++) { + if (mOutputHatches.size() > i && mOutputHatches.get(i) != null && mOutputFluids2[i] != null && isValidMetaTileEntity(mOutputHatches.get(i))) { + if (mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord() == this.mControllerY + 1 + i) { + mOutputHatches.get(i).fill(mOutputFluids2[i], true); + } + } + } + + } @Override public boolean hasSlotInGUI() { @@ -192,7 +191,7 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_M public String getMachineType() { return "Distillery, Distillation Tower"; } - + @Override public boolean checkRecipe(final ItemStack aStack) { for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) { @@ -251,28 +250,28 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_M } return false; } - + private int getTierOfTower() { - return 1; + return mUpgraded ? 2 : 1; } - + private boolean checkTierOneTower(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mControllerY = aBaseMetaTileEntity.getYCoord(); - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - int y = 0; //height - int casingAmount = 0; - boolean reachedTop = false; - - for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width + mControllerY = aBaseMetaTileEntity.getYCoord(); + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + int y = 0; //height + int casingAmount = 0; + boolean reachedTop = false; + + for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth if (x != 0 || z != 0) { IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z); Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z); - if (!addInputToMachineList(tileEntity, CASING_INDEX) - && !addOutputToMachineList(tileEntity, CASING_INDEX) - && !addMaintenanceToMachineList(tileEntity, CASING_INDEX) - && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) { + if (!addInputToMachineList(tileEntity, getCasingTextureID()) + && !addOutputToMachineList(tileEntity, getCasingTextureID()) + && !addMaintenanceToMachineList(tileEntity, getCasingTextureID()) + && !addEnergyInputToMachineList(tileEntity, getCasingTextureID())) { if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) { casingAmount++; } else { @@ -282,55 +281,55 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_M } } } - y++; - - while (y < 12 && !reachedTop) { - for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width - for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth - IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z); - Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z); - if (aBaseMetaTileEntity.getAirOffset(x, y, z)) { - if (x != xDir || z != zDir) { - return false; - } - } else { - if (x == xDir && z == zDir) { - reachedTop = true; - } - if (!addOutputToMachineList(tileEntity, CASING_INDEX) - && !addMaintenanceToMachineList(tileEntity, CASING_INDEX) - && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) { - if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) { - casingAmount++; - } else { - return false; - } - } - } - } - } - y++; - } - return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop; - } - + y++; + + while (y < 12 && !reachedTop) { + for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width + for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth + IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z); + Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z); + if (aBaseMetaTileEntity.getAirOffset(x, y, z)) { + if (x != xDir || z != zDir) { + return false; + } + } else { + if (x == xDir && z == zDir) { + reachedTop = true; + } + if (!addOutputToMachineList(tileEntity, getCasingTextureID()) + && !addMaintenanceToMachineList(tileEntity, getCasingTextureID()) + && !addEnergyInputToMachineList(tileEntity, getCasingTextureID())) { + if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) { + casingAmount++; + } else { + return false; + } + } + } + } + } + y++; + } + return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop; + } + private boolean checkTierTwoTower(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mControllerY = aBaseMetaTileEntity.getYCoord(); - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - int y = 0; //height - int casingAmount = 0; - boolean reachedTop = false; - - for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width + mControllerY = aBaseMetaTileEntity.getYCoord(); + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + int y = 0; //height + int casingAmount = 0; + boolean reachedTop = false; + + for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth if (x != 0 || z != 0) { IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z); Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z); - if (!addInputToMachineList(tileEntity, CASING_INDEX) - && !addOutputToMachineList(tileEntity, CASING_INDEX) - && !addMaintenanceToMachineList(tileEntity, CASING_INDEX) - && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) { + if (!addInputToMachineList(tileEntity, getCasingTextureID()) + && !addOutputToMachineList(tileEntity, getCasingTextureID()) + && !addMaintenanceToMachineList(tileEntity, getCasingTextureID()) + && !addEnergyInputToMachineList(tileEntity, getCasingTextureID())) { if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) { casingAmount++; } else { @@ -340,36 +339,159 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_M } } } - y++; - - while (y < 12 && !reachedTop) { - for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width - for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth - IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z); - Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z); - if (aBaseMetaTileEntity.getAirOffset(x, y, z)) { - if (x != xDir || z != zDir) { - return false; - } - } else { - if (x == xDir && z == zDir) { - reachedTop = true; - } - if (!addOutputToMachineList(tileEntity, CASING_INDEX) - && !addMaintenanceToMachineList(tileEntity, CASING_INDEX) - && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) { - if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) { - casingAmount++; - } else { - return false; - } - } - } - } - } - y++; - } - return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop; - } - + y++; + + while (y < 12 && !reachedTop) { + for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width + for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth + IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z); + Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z); + if (aBaseMetaTileEntity.getAirOffset(x, y, z)) { + if (x != xDir || z != zDir) { + return false; + } + } else { + if (x == xDir && z == zDir) { + reachedTop = true; + } + if (!addOutputToMachineList(tileEntity, getCasingTextureID()) + && !addMaintenanceToMachineList(tileEntity, getCasingTextureID()) + && !addEnergyInputToMachineList(tileEntity, getCasingTextureID())) { + if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) { + casingAmount++; + } else { + return false; + } + } + } + } + } + y++; + } + return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop; + } + + + private int mCasingTier = 0; + + private int getMachineCasingTier() { + return mCasingTier; + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + + ITexture aOriginalTexture; + + // Check things exist client side (The worst code ever) + if (aBaseMetaTileEntity.getWorld() != null) { + + } + // Check the Tier Client Side + int aTier = mCasingTier; + + if (aTier == 0) { + aOriginalTexture = Textures.BlockIcons.CASING_BLOCKS[49]; + } + else if (aTier == 1) { + aOriginalTexture = Textures.BlockIcons.CASING_BLOCKS[43]; + } + else { + aOriginalTexture = Textures.BlockIcons.CASING_BLOCKS[49]; + } + + if (aSide == aFacing) { + return new ITexture[]{aOriginalTexture, new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER)}; + } + return new ITexture[]{aOriginalTexture}; + } + + private int getCasingTextureID() { + // Check the Tier Client Side + int aTier = mCasingTier; + + if (aTier == 1) { + return 49; + } + else if (aTier == 2) { + return 43; + } + else { + return 49; + } + } + + public boolean addToMachineList(IGregTechTileEntity aTileEntity) { + int aMaxTier = getMachineCasingTier(); + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock) { + GT_MetaTileEntity_TieredMachineBlock aMachineBlock = (GT_MetaTileEntity_TieredMachineBlock) aMetaTileEntity; + int aTileTier = aMachineBlock.mTier; + if (aTileTier > aMaxTier) { + Logger.INFO("Hatch tier too high."); + return false; + } + else { + return addToMachineList(aTileEntity, getCasingTextureID()); + } + } + else { + Logger.INFO("Bad Tile Entity being added to hatch map."); // Shouldn't ever happen, but.. ya know.. + return false; + } + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + if (aTick % 20 == 0 && !mUpgraded) { + ItemStack aGuiStack = this.getGUIItemStack(); + if (aGuiStack != null) { + if (GT_Utility.areStacksEqual(aGuiStack, GregtechItemList.Distillus_Upgrade_Chip.get(1))) { + this.mUpgraded = true; + ItemUtils.depleteStack(aGuiStack); + } + } + } + // Silly Client Syncing + if (aBaseMetaTileEntity.isClientSide()) { + this.mCasingTier = getCasingTierOnClientSide(); + } + } + + + + @SideOnly(Side.CLIENT) + private final int getCasingTierOnClientSide() { + if (this == null || this.getBaseMetaTileEntity().getWorld() == null) { + return 0; + } + try { + Block aInitStructureCheck; + int aInitStructureCheckMeta; + IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); + for (int i=1;1<10;i++) { + aInitStructureCheck = aBaseMetaTileEntity.getBlockOffset(0, i, 0); + aInitStructureCheckMeta = aBaseMetaTileEntity.getMetaIDOffset(0, i, 0); + if (aInitStructureCheck == GregTech_API.sBlockCasings4 && aInitStructureCheckMeta == 1) { + return 0; + } + else if (aInitStructureCheck == ModBlocks.blockCasingsTieredGTPP) { + return 1; + } + } + } + catch (Throwable t) { + t.printStackTrace(); + return 0; + } + + } + + @Override + public void setItemNBT(NBTTagCompound aNBT) { + aNBT.setBoolean("mUpgraded", mUpgraded); + super.setItemNBT(aNBT); + } + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java index 6e7039f8ca..620bb9f4b3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java @@ -251,7 +251,7 @@ extends GregtechMeta_MultiBlockBase Block aBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); int aMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); - if (!isValidBlockForStructure(tTileEntity, 1, true, aBlock, aMeta, + if (!isValidBlockForStructure(tTileEntity, TAE.getIndexFromPage(1, 11), true, aBlock, aMeta, ModBlocks.blockCasings2Misc, 11)) { log("Bad Thermal Boiler casing"); return false; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java new file mode 100644 index 0000000000..2425e86c30 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java @@ -0,0 +1,317 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; + +import java.util.ArrayList; +import java.util.Collection; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.enums.Textures; +import gregtech.api.gui.GT_GUIContainer_MultiMachine; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; +import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.FluidStack; + +public class GregtechMetaTileEntity_LargeSemifluidGenerator extends GregtechMeta_MultiBlockBase { + + protected int fuelConsumption = 0; + protected int fuelValue = 0; + protected int fuelRemaining = 0; + protected boolean boostEu = false; + + public GregtechMetaTileEntity_LargeSemifluidGenerator(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GregtechMetaTileEntity_LargeSemifluidGenerator(String aName) { + super(aName); + } + + public String[] getTooltip() { + return new String[]{ + "Controller Block for the Large Semifluid Generator", + "Engine Intake Casings must not be obstructed in front (only air blocks)", + "Supply Semifluid Fuels and 2000L of Lubricant per hour to run.", + "Supply 80L of Oxygen per second to boost output (optional).", + "Default: Produces 2048EU/t at 100% efficiency", + "Boosted: Produces 6144EU/t at 150% efficiency", + "Size(WxHxD): 3x3x4, Controller (front centered)", + "3x3x4 of Stable Titanium Machine Casing (hollow, Min 16!)", + "All hatches except dynamo can replace any Stable Titanium casing in middle two segments", + "2x Steel Gear Box Machine Casing inside the Hollow Casing", + "8x Engine Intake Machine Casing (around controller)", + "2x Input Hatch (Fuel/Lubricant)", + "1x Maintenance Hatch", + "1x Muffler Hatch", + "1x Dynamo Hatch (back centered)", + }; + } + + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[50], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[50]}; + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return getMaxEfficiency(aStack) > 0; + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeDieselEngine.png"); + } + + @Override + public boolean checkRecipe(ItemStack aStack) { + ArrayList<FluidStack> tFluids = getStoredFluids(); + Collection<GT_Recipe> tRecipeList = Gregtech_Recipe_Map.sSemiFluidLiquidFuels.mRecipeList; + + if(tFluids.size() > 0 && tRecipeList != null) { //Does input hatch have a semifluid fuel? + for (FluidStack hatchFluid1 : tFluids) { //Loops through hatches + for(GT_Recipe aFuel : tRecipeList) { //Loops through semifluid fuel recipes + FluidStack tLiquid; + if ((tLiquid = GT_Utility.getFluidForFilledItem(aFuel.getRepresentativeInput(0), true)) != null) { //Create fluidstack from current recipe + if (hatchFluid1.isFluidEqual(tLiquid)) { //Has a semifluid fluid + fuelConsumption = tLiquid.amount = boostEu ? (4096 / aFuel.mSpecialValue) : (2048 / aFuel.mSpecialValue); //Calc fuel consumption + if(depleteInput(tLiquid)) { //Deplete that amount + boostEu = depleteInput(Materials.Oxygen.getGas(4L)); + if(tFluids.contains(Materials.Lubricant.getFluid(2L))) { //Has lubricant? + //Deplete Lubricant. 2000L should = 1 hour of runtime (if baseEU = 2048) + if(mRuntime % 72 == 0 || mRuntime == 0) { + depleteInput(Materials.Lubricant.getFluid(boostEu ? 2 : 1)); + } + } + else { + return false; + } + + fuelValue = aFuel.mSpecialValue; + fuelRemaining = hatchFluid1.amount; //Record available fuel + this.mEUt = mEfficiency < 2000 ? 0 : 2048; //Output 0 if startup is less than 20% + this.mProgresstime = 1; + this.mMaxProgresstime = 1; + this.mEfficiencyIncrease = 15; + return true; + } + } + } + } + } + } + this.mEUt = 0; + this.mEfficiency = 0; + return false; + } + + @Override + public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + byte tSide = aBaseMetaTileEntity.getBackFacing(); + int aTileX = aBaseMetaTileEntity.getXCoord(); + int aTileY = aBaseMetaTileEntity.getYCoord(); + int aTileZ = aBaseMetaTileEntity.getZCoord(); + boolean xFacing = (tSide == 4 || tSide == 5); + boolean zFacing = (tSide == 2 || tSide == 3); + int aCasingCount = 0; + // Check Intake Hatches + for (int aHorizontalOffset = -1; aHorizontalOffset < 2; aHorizontalOffset++) { + for (int aVerticalOffset = -1; aVerticalOffset < 2; aVerticalOffset++) { + if (aHorizontalOffset == 0 && aVerticalOffset == 0) { + continue; + } + int aX = !xFacing ? (aTileX + aHorizontalOffset) : aTileX; + int aY = aTileY + aVerticalOffset; + int aZ = !zFacing ? (aTileZ + aHorizontalOffset) : aTileZ; + Block aIntakeBlock = aBaseMetaTileEntity.getBlock(aX, aY, aZ); + int aIntakeMeta = aBaseMetaTileEntity.getMetaID(aX, aY, aZ); + if (!isValidBlockForStructure(null, 0, false, aIntakeBlock, aIntakeMeta, getIntakeBlock(), getIntakeMeta())) { + return false; // Not intake casing surrounding controller + } + } + } + // Check Casings + int aStartDepthOffset = (tSide == 2 || tSide == 4) ? -1 : 1; + int aFinishDepthOffset = (tSide == 2 || tSide == 4) ? -4 : 4; + for (int aDepthOffset = aStartDepthOffset; aDepthOffset != aFinishDepthOffset;) { + for (int aHorizontalOffset = -1; aHorizontalOffset < 2; aHorizontalOffset++) { + for (int aVerticalOffset = -1; aVerticalOffset < 2; aVerticalOffset++) { + if (aHorizontalOffset == 0 && aVerticalOffset == 0) { + continue; + } + int aX = !xFacing ? (aTileX + aHorizontalOffset) : (aTileX + aDepthOffset); + int aY = aTileY + aVerticalOffset; + int aZ = !zFacing ? (aTileZ + aHorizontalOffset) : (aTileZ + aDepthOffset); + Block aCasingBlock = aBaseMetaTileEntity.getBlock(aX, aY, aZ); + int aCasingMeta = aBaseMetaTileEntity.getMetaID(aX, aY, aZ); + IGregTechTileEntity aTileEntity = getBaseMetaTileEntity().getIGregTechTileEntity(aX, aY, aZ); + // Side areas + if (aDepthOffset < 3) { + if (!isValidBlockForStructure(aTileEntity, getCasingTextureIndex(), true, aCasingBlock, aCasingMeta, getCasingBlock(), getCasingMeta())) { + return false; // Not valid casing + } + else { + if (aTileEntity == null) { + aCasingCount++; + } + } + } + else { + if (!isValidBlockForStructure(null, 0, false, aCasingBlock, aCasingMeta, getCasingBlock(), getCasingMeta())) { + return false; // Not valid casing + } + else { + aCasingCount++; + } + } + } + } + // Count Backwards for 2 axis + if (aStartDepthOffset == -1) { + aDepthOffset--; + } + // Count Forwards for 2 axis + else { + aDepthOffset++; + } + } + + // Check Gear Boxes + if(aBaseMetaTileEntity.getBlockAtSideAndDistance(tSide, 1) != getGearboxBlock() && aBaseMetaTileEntity.getBlockAtSideAndDistance(tSide, 2) != getGearboxBlock()) { + return false; + } + if(aBaseMetaTileEntity.getMetaIDAtSideAndDistance(tSide, 1) != getGearboxMeta() && aBaseMetaTileEntity.getMetaIDAtSideAndDistance(tSide, 2) != getGearboxMeta()) { + return false; + } + + // Check Dynamo + this.mDynamoHatches.clear(); + IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 3); + if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) { + if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Dynamo)) { + this.addDynamoToMachineList(tTileEntity, getCasingTextureIndex()); + } else { + return false; + } + } + return aCasingCount >= 16; + } + + public Block getCasingBlock() { + return GregTech_API.sBlockCasings4; + } + + public byte getCasingMeta() { + return 2; + } + + public Block getIntakeBlock() { + return GregTech_API.sBlockCasings4; + } + + public byte getIntakeMeta() { + return 13; + } + + public Block getGearboxBlock() { + return GregTech_API.sBlockCasings2; + } + + public byte getGearboxMeta() { + return 3; + } + + public byte getCasingTextureIndex() { + return 50; + } + + private boolean addToMachineList(IGregTechTileEntity tTileEntity) { + return ((addMaintenanceToMachineList(tTileEntity, getCasingTextureIndex())) || (addInputToMachineList(tTileEntity, getCasingTextureIndex())) || (addOutputToMachineList(tTileEntity, getCasingTextureIndex())) || (addMufflerToMachineList(tTileEntity, getCasingTextureIndex()))); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_LargeSemifluidGenerator(this.mName); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 1; + } + + public int getMaxEfficiency(ItemStack aStack) { + return boostEu ? 20000 : 10000; + } + + @Override + public int getPollutionPerTick(ItemStack aStack) { + return 64; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return true; + } + + @Override + public String[] getExtraInfoData() { + return new String[]{ + "Large Semifluid Generator", + "Current Output: " + mEUt * mEfficiency / 10000 + " EU/t", + "Fuel Consumption: " + fuelConsumption + "L/t", + "Fuel Value: " + fuelValue + " EU/L", + "Fuel Remaining: " + fuelRemaining + " Litres", + "Current Efficiency: " + (mEfficiency / 100) + "%", + getIdealStatus() == getRepairStatus() ? "No Maintainance issues" : "Needs Maintainance"}; + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public boolean hasSlotInGUI() { + return false; + } + + @Override + public String getCustomGUIResourceName() { + return null; + } + + @Override + public String getMachineType() { + return "Semifluid Generator"; + } + + @Override + public int getMaxParallelRecipes() { + return 0; + } + + @Override + public int getEuDiscountForParallelism() { + return 0; + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java index 60c0ade62f..f0c5d9388f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java @@ -755,7 +755,6 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { if (aBaseMetaTileEntity.isClientSide()) { this.mSolidCasingTier = getCasingTierOnClientSide(); } - } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java index 2b4e52abb9..3c74c4166d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java @@ -210,11 +210,11 @@ public class RecipeGen_Fluids extends RecipeGen_Base { // Shape_Mold_Ring, - ItemList mold_Rod = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Rod", null); - ItemList mold_Rod_Long = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Rod_Long", null); - ItemList mold_Bolt = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Bolt", null); - ItemList mold_Screw = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Screw", null); - ItemList mold_Ring = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Ring", null); + ItemList mold_Rod = ItemUtils.getValueOfItemList("Shape_Mold_Rod", null); + ItemList mold_Rod_Long = ItemUtils.getValueOfItemList("Shape_Mold_Rod_Long", null); + ItemList mold_Bolt = ItemUtils.getValueOfItemList("Shape_Mold_Bolt", null); + ItemList mold_Screw = ItemUtils.getValueOfItemList("Shape_Mold_Screw", null); + ItemList mold_Ring = ItemUtils.getValueOfItemList("Shape_Mold_Ring", null); // Rod if (ItemUtils.checkForInvalidItems(material.getRod(1))) diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java index 3490e8d8be..5d2f5b414d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java @@ -197,7 +197,7 @@ public class GregtechComponentAssembler { ItemStack Input[] = { wireStack, cableStack, rodStack, magrodStack }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Electric_Motor_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getElectricMotor(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } catch (Throwable t) { @@ -213,12 +213,12 @@ public class GregtechComponentAssembler { ItemStack rodStack = ItemUtils.getGregtechOreStack(OrePrefixes.stick, mat, 2); ItemStack plateStack = ItemUtils.getGregtechOreStack(OrePrefixes.plate, mat, 3); ItemStack gearStack = ItemUtils.getGregtechOreStack(OrePrefixes.gearGtSmall, mat, 1); - ItemStack motorStack = ItemList.valueOf("Electric_Motor_" + GT_Values.VN[tier]).get(1); + ItemStack motorStack = CI.getElectricMotor(tier, 1); ItemStack Input[] = { plateStack, cableStack, rodStack, gearStack, motorStack }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Electric_Piston_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getElectricPiston(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } catch (Throwable t) { @@ -230,7 +230,7 @@ public class GregtechComponentAssembler { try { OrePrefixes prefixCable = OrePrefixes.cableGt01; ItemStack cableStack = ItemUtils.getGregtechOreStack(prefixCable, cable, 1); - ItemStack motorStack = ItemList.valueOf("Electric_Motor_" + GT_Values.VN[tier]).get(2); + ItemStack motorStack = CI.getElectricMotor(tier, 2); boolean mAdd[]; final ArrayList<ItemStack> oreDictList = OreDictionary.getOres("plateAnyRubber"); if (!oreDictList.isEmpty()) { @@ -241,7 +241,7 @@ public class GregtechComponentAssembler { returnValue.stackSize = 6; ItemStack Input[] = { cableStack, motorStack, returnValue }; mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Conveyor_Module_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getConveyor(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } int added = 0; @@ -261,7 +261,7 @@ public class GregtechComponentAssembler { ItemStack Input[] = { cableStack, motorStack, ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateRubber", 6) }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Conveyor_Module_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getConveyor(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } @@ -277,7 +277,7 @@ public class GregtechComponentAssembler { ItemStack screwStack = ItemUtils.getGregtechOreStack(OrePrefixes.screw, main, 1); ItemStack rotorStack = ItemUtils.getGregtechOreStack(OrePrefixes.rotor, main, 1); ItemStack pipeStack = ItemUtils.getGregtechOreStack(OrePrefixes.pipeMedium, pipe, 1); - ItemStack motorStack = ItemList.valueOf("Electric_Motor_" + GT_Values.VN[tier]).get(1); + ItemStack motorStack = CI.getElectricMotor(tier, 1); boolean mAdd[]; final ArrayList<ItemStack> oreDictList = OreDictionary.getOres("ringAnyRubber"); if (!oreDictList.isEmpty()) { @@ -288,7 +288,7 @@ public class GregtechComponentAssembler { returnValue.stackSize = 2; ItemStack Input[] = { cableStack, screwStack, rotorStack, pipeStack, motorStack, returnValue }; mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Electric_Pump_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getElectricPump(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } int added = 0; @@ -308,7 +308,7 @@ public class GregtechComponentAssembler { ItemStack Input[] = { cableStack, screwStack, rotorStack, pipeStack, motorStack, ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ringRubber", 2) }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Electric_Pump_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getElectricPump(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } @@ -322,8 +322,8 @@ public class GregtechComponentAssembler { try { ItemStack cableStack = ItemUtils.getGregtechOreStack(OrePrefixes.cableGt01, cable, 3); ItemStack rodStack = ItemUtils.getGregtechOreStack(OrePrefixes.stick, stick, 2); - ItemStack motorStack = ItemList.valueOf("Electric_Motor_" + GT_Values.VN[tier]).get(2); - ItemStack pistonStack = ItemList.valueOf("Electric_Piston_" + GT_Values.VN[tier]).get(1); + ItemStack motorStack = CI.getElectricMotor(tier, 2); + ItemStack pistonStack = CI.getElectricPiston(tier, 1); boolean mAdd[]; final ItemStack oreDictList[] = CI.getAllCircuitsOfTier(tier); @@ -335,7 +335,7 @@ public class GregtechComponentAssembler { returnValue.stackSize = 1; ItemStack Input[] = { returnValue, cableStack, rodStack, pistonStack, motorStack }; mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Robot_Arm_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getRobotArm(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } for (boolean y : mAdd) { @@ -353,7 +353,7 @@ public class GregtechComponentAssembler { else { ItemStack Input[] = { ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(tier), 1), cableStack, rodStack, pistonStack, motorStack }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Robot_Arm_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getRobotArm(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } @@ -381,8 +381,8 @@ public class GregtechComponentAssembler { else mWT = "01"; - ItemStack eyeQuantum = ItemList.valueOf("QuantumEye").get(1); - ItemStack starQuantum = ItemList.valueOf("QuantumStar").get(1); + ItemStack eyeQuantum = ItemUtils.getValueOfItemList("QuantumEye", 1, ItemUtils.getSimpleStack(Items.ender_eye, 4)); + ItemStack starQuantum = ItemUtils.getValueOfItemList("QuantumStar", 1, ItemUtils.getSimpleStack(Items.nether_star, 4)); if (tier == 1) gem = ItemUtils.getSimpleStack(Items.ender_pearl); @@ -410,7 +410,7 @@ public class GregtechComponentAssembler { returnValue.stackSize = 4; ItemStack Input[] = { returnValue, wireStack, gem }; mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Field_Generator_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getFieldGenerator(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } for (boolean y : mAdd) { @@ -428,7 +428,7 @@ public class GregtechComponentAssembler { else { ItemStack Input[] = { ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(tier), 4), wireStack, gem }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Field_Generator_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getFieldGenerator(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } @@ -454,7 +454,7 @@ public class GregtechComponentAssembler { returnValue.stackSize = 2; ItemStack Input[] = { returnValue, cableStack, gemstack, magrodStack }; mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Emitter_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getEmitter(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } for (boolean y : mAdd) { @@ -472,7 +472,7 @@ public class GregtechComponentAssembler { else { ItemStack Input[] = { ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(tier), 2), cableStack, gemstack, magrodStack }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Emitter_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getEmitter(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } @@ -500,7 +500,7 @@ public class GregtechComponentAssembler { returnValue.stackSize = 1; ItemStack Input[] = { gemStack, cableStack, returnValue, magrodStack }; mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Sensor_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getSensor(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } for (boolean y : mAdd) { @@ -518,7 +518,7 @@ public class GregtechComponentAssembler { else { ItemStack Input[] = { gemStack, cableStack, magrodStack, ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(tier), 1) }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Sensor_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getSensor(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java index 54e4fbf024..2c622b9d8e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java @@ -5,8 +5,8 @@ import java.lang.reflect.InvocationTargetException; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_AirIntake; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ControlCore; @@ -23,12 +23,9 @@ public class GregtechCustomHatches { if (gtPlusPlus.core.lib.LoadedMods.Gregtech) { Logger.INFO("Gregtech5u Content | Registering Custom Fluid Hatches."); run1(); - - //No pollution in 5.08 - if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + if (PollutionUtils.isPollutionEnabled()) { run2(); - } - + } run3(); } } @@ -201,32 +198,31 @@ public class GregtechCustomHatches { Class<?> aBusEntity = aClass; Constructor<?> constructor; try { - constructor = aBusEntity.getConstructor(int.class, String.class, String.class, int.class, int.class); + constructor = aBusEntity.getConstructor(int.class, String.class, String.class, int.class, int.class); if (constructor != null) { - Object aPipe; + Object aBus; try { - aPipe = constructor.newInstance( + aBus = constructor.newInstance( aID, aUnlocalName, aLocalName, aTier, (1+ aTier) * 32); - if (aPipe == null) { - //Logger.INFO("Failed to Generate "+aMaterial+" Hexadecuple pipes."); + if (aBus == null) { + Logger.INFO("Failed to Generate "+aLocalName+"."); } else { Logger.INFO("Generated "+aLocalName+"."); - return aPipe; - //GT_OreDictUnificator.registerOre("pipeHexadecuple" + aMaterial, aPipe.getStackForm(1L)); + return aBus; } } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - //Logger.INFO("Failed to Generate "+aMaterial+" Hexadecuple pipes. [Ecx]"); e.printStackTrace(); + Logger.INFO("Failed to Generate "+aLocalName+"."); } } } catch (NoSuchMethodException | SecurityException e1) { - // TODO Auto-generated catch block e1.printStackTrace(); + Logger.INFO("Failed to Generate "+aLocalName+"."); } return null; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java index 86cbdb75fa..67c54a7699 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java @@ -1,8 +1,10 @@ package gtPlusPlus.xmod.gregtech.registration.gregtech; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialVacuumFreezer; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_AssemblyLine; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_DistillationTower; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_EBF; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_Fusion_MK4; @@ -24,6 +26,9 @@ public class GregtechFactoryGradeReplacementMultis { //31021 GregtechItemList.Machine_Adv_DistillationTower.set(new GregtechMetaTileEntity_Adv_DistillationTower(31021, "multimachine.adv.distillationtower", "Dangote Distillus").getStackForm(1L)); + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + GregtechItemList.Machine_Adv_AssemblyLine.set(new GregtechMetaTileEntity_Adv_AssemblyLine(31024, "multimachine.adv.assemblyline", "Compound Fabricator").getStackForm(1L)); + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java index 2d548a57b7..5a7d3a50d7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java @@ -12,7 +12,7 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GregtechMetaTileEntityRocketFuelGenerator; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_LargeRocketEngine; @@ -28,13 +28,13 @@ public class GregtechRocketFuelGenerator { } } - + private static void run1() { GregtechItemList.Controller_RocketEngine.set( new GregtechMetaTileEntity_LargeRocketEngine(996, "gtpp.multimachine.rocketengine", "Rocketdyne F-1A Engine").getStackForm(1L)); - ItemList aDieselEngine = Utils.getValueOfItemList("Machine_Multi_DieselEngine", ItemList.Machine_Multi_LargeBoiler_TungstenSteel); + ItemList aDieselEngine = ItemUtils.getValueOfItemList("Machine_Multi_DieselEngine", ItemList.Machine_Multi_LargeBoiler_TungstenSteel); GT_ModHandler.addCraftingRecipe( GregtechItemList.Controller_RocketEngine.get(1L), diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSemiFluidgenerators.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSemiFluidgenerators.java index c4141a6a77..6b38415db1 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSemiFluidgenerators.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSemiFluidgenerators.java @@ -2,6 +2,7 @@ package gtPlusPlus.xmod.gregtech.registration.gregtech; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GT_MetaTileEntity_SemiFluidGenerator; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_LargeSemifluidGenerator; public class GregtechSemiFluidgenerators { @@ -12,6 +13,8 @@ public class GregtechSemiFluidgenerators { "Advanced Semi-Fluid Generator", 2).getStackForm(1L)); GregtechItemList.Generator_SemiFluid_HV.set(new GT_MetaTileEntity_SemiFluidGenerator(839, "basicgenerator.semifluid.tier.03", "Turbo Semi-Fluid Generator", 3).getStackForm(1L)); + GregtechItemList.Controller_LargeSemifluidGenerator.set(new GregtechMetaTileEntity_LargeSemifluidGenerator(31026, "gtpp.multimachine.semifluidgenerator", "Large Semifluid Burner").getStackForm(1L)); + } } diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java b/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java index f23a5db6fe..4f1006693e 100644 --- a/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java +++ b/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java @@ -159,7 +159,9 @@ public class ThaumcraftUtils { rResearch.setItemTriggers(aResearchTriggers); rResearch.setHidden(); } - rResearch.setPages((TC_ResearchPage_Wrapper[]) tPages.toArray(new TC_ResearchPage_Wrapper[tPages.size()])); + + Object[] aVarArgs = (TC_ResearchPage_Wrapper[]) tPages.toArray(new TC_ResearchPage_Wrapper[tPages.size()]); + rResearch.setPages(aVarArgs); return rResearch.registerResearchItem(); } diff --git a/src/resources/GradleStartClient.java b/src/resources/GradleStartClient.java new file mode 100644 index 0000000000..97edde8b04 --- /dev/null +++ b/src/resources/GradleStartClient.java @@ -0,0 +1,103 @@ +import java.io.File; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Arrays; + +import com.google.common.base.Strings; + +import net.minecraftforge.gradle.GradleStartCommon; + +public class GradleStartClient extends GradleStart { + + public static void main(String[] args) { + + // hack natives. + try { + GradleStartCommon.LOGGER.info("Injecting Natives!"); + hack(); + GradleStartCommon.LOGGER.info("Natives Injected!"); + // launch + Method launch = GradleStartCommon.class.getDeclaredMethod("launch", String[].class); + if (launch != null) { + launch.setAccessible(true); + GradleStart aStart = new GradleStart(); + GradleStartCommon.LOGGER.info("Launching!"); + launch.invoke(aStart, new Object[]{args}); + } + } + catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + e.printStackTrace(); + } + } + + private static final void hack() { + GradleStartCommon.LOGGER.info("[FG_1.3] Doing Classloader hack."); + String paths = System.getProperty("java.library.path"); + String nativesDir = "@@NATIVESDIR@@"; + + if (Strings.isNullOrEmpty(paths)) + paths = nativesDir; + else + paths += File.pathSeparator + nativesDir; + + hackNativesFixed(paths); + //addLibraryPath(nativesDir); + //addLibraryPath(paths); + } + + private static final void hackNativesFixed(String paths) { + System.setProperty("java.library.path", paths); + // hack the classloader now. + try + { + String aPathData = System.getProperty("java.library.path"); + final Method initializePathMethod = ClassLoader.class.getDeclaredMethod("initializePath", String.class); + GradleStartCommon.LOGGER.info("[FG_1.3] Setting private method 'initializePath' to be accessible."); + initializePathMethod.setAccessible(true); + GradleStartCommon.LOGGER.info("[FG_1.3] Invoking 'initializePath' with arg 'java.library.path'."); + GradleStartCommon.LOGGER.info("[FG_1.3] Path Value: "+aPathData); + final Object usrPathsValue = initializePathMethod.invoke(null, "java.library.path"); + final Field usrPathsField = ClassLoader.class.getDeclaredField("usr_paths"); + GradleStartCommon.LOGGER.info("[FG_1.3] Setting private field 'usr_paths' to be accessible."); + usrPathsField.setAccessible(true); + GradleStartCommon.LOGGER.info("[FG_1.3] Injecting path data."); + usrPathsField.set(null, usrPathsValue); + GradleStartCommon.LOGGER.info("[FG_1.3] Finished Classloader hack."); + } + catch(Throwable t) { + GradleStartCommon.LOGGER.info("[FG_1.3] Error handling Classloader hack, printing stack trace."); + t.printStackTrace(); + }; + } + + public static void addLibraryPath(String pathToAdd){ + Field usrPathsField; + try { + usrPathsField = ClassLoader.class.getDeclaredField("usr_paths"); + usrPathsField.setAccessible(true); + + //get array of paths + final String[] paths = (String[])usrPathsField.get(null); + + //check if the path to add is already present + for(String path : paths) { + if(path.equals(pathToAdd)) { + GradleStartCommon.LOGGER.info("[FG_1.3] Found existing PATH data, skipping."); + return; + } + } + GradleStartCommon.LOGGER.info("[FG_1.3] Injecting path data. ["+pathToAdd+"]"); + //add the new path + final String[] newPaths = Arrays.copyOf(paths, paths.length + 1); + newPaths[newPaths.length-1] = pathToAdd; + usrPathsField.set(null, newPaths); + } + catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { + GradleStartCommon.LOGGER.info("[FG_1.3] Error handling Classloader hack, printing stack trace."); + e.printStackTrace(); + } + + } + +} diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/151.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/151.png Binary files differnew file mode 100644 index 0000000000..29ba464570 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/151.png diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/160.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/160.png Binary files differnew file mode 100644 index 0000000000..fa7f814d3a --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/160.png diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/161.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/161.png Binary files differnew file mode 100644 index 0000000000..673c6e011b --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/161.png diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/162.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/162.png Binary files differnew file mode 100644 index 0000000000..65fc3f7d6e --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/162.png |