diff options
Diffstat (limited to 'src')
43 files changed, 1761 insertions, 189 deletions
diff --git a/src/Java/gregtech/api/enums/TAE.java b/src/Java/gregtech/api/enums/TAE.java index c6fc8c7790..248722269b 100644 --- a/src/Java/gregtech/api/enums/TAE.java +++ b/src/Java/gregtech/api/enums/TAE.java @@ -1,16 +1,22 @@ package gregtech.api.enums; +import java.lang.reflect.Field; + +import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.interfaces.ITexture; import gregtech.api.objects.GT_CopiedBlockTexture; import gregtech.api.objects.GT_RenderedTexture; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; public class TAE { //TAE stands for Texture Array Expansion. - + public static int gtTexturesArrayStartOrigin; - public static int gtPPLastUsedIndex = 96; + public static int gtPPLastUsedIndex = 64; + public static int secondaryIndex = 0; public static boolean hasArrayBeenExpanded = false; public static boolean hookGtTextures() { @@ -42,22 +48,51 @@ public class TAE { }*/ public static boolean registerTextures(GT_CopiedBlockTexture gt_CopiedBlockTexture) { - Textures.BlockIcons.CASING_BLOCKS[gtPPLastUsedIndex] = gt_CopiedBlockTexture; - gtPPLastUsedIndex++; - //Just so I know registration is done. - return true; + try { + + //Handle page 2. + if (gtPPLastUsedIndex >= 128) { + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && Utils.getGregtechSubVersion() > 30) { + Field x = ReflectionUtils.getField(Textures.BlockIcons.class, "casingTexturePages"); + if (x != null) { + ITexture[][] h = (ITexture[][]) x.get(null); + if (h != null) { + h[64][secondaryIndex++] = gt_CopiedBlockTexture; + x.set(null, h); + return true; + } + } + } + } + + //set to page 1. + else { + Textures.BlockIcons.CASING_BLOCKS[gtPPLastUsedIndex] = gt_CopiedBlockTexture; + gtPPLastUsedIndex++; + return true; + } + } + catch (Throwable t) { + t.printStackTrace(); + } + return false; } - + public static ITexture getTexture(int index){ - if (!hasArrayBeenExpanded){ - return null; - } - else { - return Textures.BlockIcons.CASING_BLOCKS[(96+index)]; + if (gtPPLastUsedIndex >= 128) { + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && Utils.getGregtechSubVersion() > 30) { + return Textures.BlockIcons.CASING_BLOCKS[((64*128)+index)]; + } } + return Textures.BlockIcons.CASING_BLOCKS[(64+index)]; } - + public static int GTPP_INDEX(int ID){ - return (96+ID); + if (gtPPLastUsedIndex >= 128) { + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && Utils.getGregtechSubVersion() > 30) { + return (ID); + } + } + return (64+ID); } } diff --git a/src/Java/gregtech/api/util/FishPondFakeRecipe.java b/src/Java/gregtech/api/util/FishPondFakeRecipe.java new file mode 100644 index 0000000000..5aef1bcd8a --- /dev/null +++ b/src/Java/gregtech/api/util/FishPondFakeRecipe.java @@ -0,0 +1,75 @@ +package gregtech.api.util; + +import java.util.ArrayList; + +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.array.AutoMap; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.item.ItemStack; +import net.minecraft.util.WeightedRandomFishable; +import net.minecraftforge.common.FishingHooks; +import net.minecraftforge.fluids.FluidStack; + +public class FishPondFakeRecipe { + + public static ArrayList<WeightedRandomFishable> fish = new ArrayList<WeightedRandomFishable>(); + public static ArrayList<WeightedRandomFishable> junk = new ArrayList<WeightedRandomFishable>(); + public static ArrayList<WeightedRandomFishable> treasure = new ArrayList<WeightedRandomFishable>(); + + @SuppressWarnings("unchecked") + public static boolean generateFishPondRecipes() { + + try { + fish = (ArrayList<WeightedRandomFishable>) ReflectionUtils.getField(FishingHooks.class, "fish").get(null); + junk = (ArrayList<WeightedRandomFishable>) ReflectionUtils.getField(FishingHooks.class, "junk").get(null); + treasure = (ArrayList<WeightedRandomFishable>) ReflectionUtils.getField(FishingHooks.class, "treasure").get(null); + } + catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException e) { + Logger.INFO("Error generating Fish Pond Recipes. [1]"); + e.printStackTrace(); + } + + AutoMap<ArrayList<WeightedRandomFishable>> mega = new AutoMap<ArrayList<WeightedRandomFishable>>(); + mega.put(fish); + mega.put(junk); + mega.put(treasure); + + int mType = 14; + for (ArrayList<WeightedRandomFishable> f : mega.values()) { + for (int e=0;e<f.size();e++) { + if (f.get(e) != null) { + WeightedRandomFishable u = f.get(e); + try { + ItemStack t = (ItemStack) ReflectionUtils.getField(WeightedRandomFishable.class, "field_150711_b").get(u); + addNewFishPondLoot(mType, new ItemStack[]{t}, new int[] {10000}); + } + catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException e1) { + Logger.INFO("Error generating Fish Pond Recipes. [2]"); + e1.printStackTrace(); + } + } + } + mType++; + } + + return true; + } + + public static void addNewFishPondLoot(int circuit, ItemStack[] outputItems, int[] chances) { + GT_Recipe x = new GT_Recipe( + true, + new ItemStack[]{CI.getNumberedCircuit(circuit)}, + outputItems, + null, + chances, + new FluidStack[]{null}, + new FluidStack[]{null}, + 100, //1 Tick + 0, //No Eu produced + 0 //Magic Number + ); + Recipe_GT.Gregtech_Recipe_Map.sFishPondRecipes.addRecipe(x); + } + +} diff --git a/src/Java/gregtech/api/util/Recipe_GT.java b/src/Java/gregtech/api/util/Recipe_GT.java index 351814f386..342add5b63 100644 --- a/src/Java/gregtech/api/util/Recipe_GT.java +++ b/src/Java/gregtech/api/util/Recipe_GT.java @@ -281,6 +281,8 @@ public class Recipe_GT extends GT_Recipe{ //Component Assembler public static final GT_Recipe_Map sComponentAssemblerRecipes = new GT_Recipe_Map_Assembler(new HashSet<GT_Recipe>(300), "gt.recipe.componentassembler", "Component Assembler", null, RES_PATH_GUI + "basicmachines/Assembler", 6, 1, 1, 0, 1, E, 1, E, true, true); + public static final GT_Recipe_Map sFishPondRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(3), "gt.recipe.fishpond", "Zhuhai - Fishing Port", null, RES_PATH_GUI + "basicmachines/PotionBrewer", 0, 1, 0, 0, 1, E, 1, E, true, true); + /** diff --git a/src/Java/gtPlusPlus/api/objects/Logger.java b/src/Java/gtPlusPlus/api/objects/Logger.java index 6e2e9f6107..1ecdaa9e86 100644 --- a/src/Java/gtPlusPlus/api/objects/Logger.java +++ b/src/Java/gtPlusPlus/api/objects/Logger.java @@ -75,7 +75,7 @@ public class Logger { // ASM Comments public static void LOG_ASM(final String s) { - FMLRelaunchLog.info("", s); + FMLRelaunchLog.info("[Special ASM Logging] ", s); } diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java index 24e589ad97..04ada83922 100644 --- a/src/Java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java @@ -23,6 +23,7 @@ import gtPlusPlus.core.block.machine.Machine_WorkbenchAdvanced; import gtPlusPlus.core.fluids.FluidRegistryHandler; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks3; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraftforge.fluids.Fluid; @@ -39,6 +40,7 @@ public final class ModBlocks { public static Block blockGriefSaver; public static Block blockCasingsMisc; public static Block blockCasings2Misc; + public static Block blockCasings3Misc; public static Block blockMetaTileEntity; public static Block blockHeliumGenerator; public static Block blockNHG; diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index c6aff47c5b..953d32f138 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -44,19 +44,14 @@ public class COMPAT_HANDLER { //Free IDs /* - 829 --- - //837 - //to - //839 - --- - 851 + 859 to 868 --- - 890 + 899 to - 950 + 945 */ new RECIPES_LaserEngraver(); @@ -102,6 +97,8 @@ public class COMPAT_HANDLER { GregtechMiniRaFusion.run(); GregtechComponentAssembler.run(); GregtechTeslaTower.run(); + GregtechSuperTanks.run(); + GregtechIndustrialFishPond.run(); //New Horizons Content NewHorizonsAccelerator.run(); diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index 5197b2e34b..eca3c595ec 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -348,7 +348,7 @@ public class Material { sets.put(r.getStackMaterial()); } } - TextureSet mostUsedTypeTextureSet = (TextureSet) MaterialUtils.getMostCommonTextureSet(new ArrayList(sets.values())); + TextureSet mostUsedTypeTextureSet = (TextureSet) MaterialUtils.getMostCommonTextureSet(new ArrayList<Material>(sets.values())); if (mostUsedTypeTextureSet != null && mostUsedTypeTextureSet instanceof TextureSet) { Logger.MATERIALS("Set textureset for "+this.localizedName+" to be "+mostUsedTypeTextureSet.mSetName+"."); return mostUsedTypeTextureSet; @@ -611,6 +611,10 @@ public class Material { } private final short getComponentCount(final MaterialStack[] inputs){ + + if (inputs == null || inputs.length < 1) { + return 1; + } int counterTemp = 0; for (final MaterialStack m : inputs){ if (m.getStackMaterial() != null){ @@ -729,7 +733,7 @@ public class Material { } final Materials isValid = Materials.get(this.getLocalizedName()); - Logger.INFO("Is "+this.getLocalizedName()+" a Gregtech material? "+(isValid != null && isValid != Materials._NULL)+" | Found "+isValid.mDefaultLocalName); + //Logger.MATERIALS("Is "+this.getLocalizedName()+" a Gregtech material? "+(isValid != null && isValid != Materials._NULL)+" | Found "+isValid.mDefaultLocalName); if (isValid != Materials._NULL){ for (Materials m : invalidMaterials.values()){ if (isValid == m){ @@ -800,7 +804,7 @@ public class Material { //Generate a Cell if we need to if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1) == null){ if (this.vGenerateCells){ - final Item temp = new BaseItemCell(this); + new BaseItemCell(this); Logger.INFO("Generated a cell for "+this.getUnlocalizedName()); } else { diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index 653094cdda..a460d7ca59 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -7,6 +7,7 @@ import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.ModItems; 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.item.ItemUtils; import gtPlusPlus.core.util.recipe.RecipeUtils; @@ -141,6 +142,7 @@ public class RECIPES_Machines { public static ItemStack EV_MACHINE_Wiremill; public static ItemStack HV_MACHINE_Macerator; public static ItemStack EV_MACHINE_Macerator; + public static ItemStack EV_MACHINE_Cutter; public static ItemStack EV_MACHINE_MassFabricator; @@ -213,6 +215,7 @@ public class RECIPES_Machines { EV_MACHINE_Macerator= ItemList.Machine_EV_Macerator.get(1); EV_MACHINE_MassFabricator= ItemList.Machine_EV_Massfab.get(1); EV_MACHINE_Centrifuge= ItemList.Machine_EV_Centrifuge.get(1); + EV_MACHINE_Cutter = ItemList.Machine_EV_Cutter.get(1); } @@ -1083,6 +1086,21 @@ public class RECIPES_Machines { ItemUtils.getSimpleStack(ModBlocks.blockProjectTable)); } + if (CORE.ConfigSwitches.enableMultiblock_IndustrialCuttingMachine){ + ItemStack plate = ALLOY.MARAGING300.getPlate(1); + RecipeUtils.recipeBuilder( + plate, CI.craftingToolHammer_Hard, plate, + "plateStellite", "frameGtTalonite", "plateStellite", + plate, CI.craftingToolWrench, plate, + GregtechItemList.Casing_CuttingFactoryFrame.get(Casing_Amount)); + + RecipeUtils.recipeBuilder( + plate,CI.getTieredCircuit(3),plate, + "wireFinePlatinum", EV_MACHINE_Cutter, "wireFinePlatinum", + plate,CI.getTieredCircuit(4),plate, + GregtechItemList.Industrial_CuttingFactoryController.get(1)); + } + //Wireless Chargers RecipeUtils.addShapedGregtechRecipe( CI.emitter_LV, CI.circuitTier1, CI.emitter_LV, diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java index 89c41452d5..c6edd94238 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java @@ -2,168 +2,108 @@ package gtPlusPlus.preloader.asm.transformers; import static org.objectweb.asm.Opcodes.*; +import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.Random; import org.apache.logging.log4j.Level; import org.objectweb.asm.*; -import org.objectweb.asm.commons.GeneratorAdapter; import cpw.mods.fml.relauncher.FMLRelaunchLog; import gregtech.api.GregTech_API; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.BaseMetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.common.blocks.GT_Block_Machines; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.XSTR; +import gtPlusPlus.core.util.array.BlockPos; import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.util.nbt.NBTUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; +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.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.FluidStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; public class Preloader_ClassTransformer2 { - private final static Class<BaseMetaTileEntity> customTransformer2 = BaseMetaTileEntity.class; + /** + * + * So what I'd try is something like patch a new field into BaseMetaTileEntity to hold the ItemNBT, + * then patch GT_Block_Machines.breakBlock to store the ItemNBT into that field by calling setItemNBT, + * and then patch BaseMetaTileEntity.getDrops to retrieve that field instead of calling setItemNBT + * But there's probably a simpler solution if all you want to do is fix this + * for your super tanks rather than for all GT machines + * (which would only include saving the output count for chest buffers and item distributors...) + * + */ - public static ArrayList<ItemStack> getDrops(BaseMetaTileEntity o) { - Logger.INFO("DROP!"); - try { - short tID = (short) ReflectionUtils.getField(customTransformer2, "mID").get(o); - NBTTagCompound tRecipeStuff = (NBTTagCompound) ReflectionUtils.getField(customTransformer2, "mRecipeStuff").get(o); - boolean tMuffler = (boolean) ReflectionUtils.getField(customTransformer2, "mMuffler").get(o); - boolean tLockUpgrade = (boolean) ReflectionUtils.getField(customTransformer2, "mLockUpgrade").get(o); - boolean tSteamConverter = (boolean) ReflectionUtils.getField(customTransformer2, "mSteamConverter").get(o); - byte tColor = (byte) ReflectionUtils.getField(customTransformer2, "mColor").get(o); - byte tOtherUpgrades = (byte) ReflectionUtils.getField(customTransformer2, "mOtherUpgrades").get(o); - byte tStrongRedstone = (byte) ReflectionUtils.getField(customTransformer2, "mStrongRedstone").get(o); - int[] tCoverSides = (int[]) ReflectionUtils.getField(customTransformer2, "mCoverSides").get(o); - int[] tCoverData = (int[]) ReflectionUtils.getField(customTransformer2, "mCoverData").get(o); - FluidStack tFluid = null; - if (GT_MetaTileEntity_BasicTank.class.isInstance(o)) { - try { - tFluid = (FluidStack) ReflectionUtils.getField(GT_MetaTileEntity_BasicTank.class, "mFluid").get(o); - } - catch (Throwable t) { - Logger.REFLECTION("mFluid was not set."); - } - } - else { - Logger.REFLECTION("mFluid was not found."); - } - 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)); - - ItemStack rStack = new ItemStack(GregTech_API.sBlockMachines, 1, tID); - NBTTagCompound tNBT = new NBTTagCompound(); - if (tRecipeStuff != null && !tRecipeStuff.hasNoTags()) tNBT.setTag("GT.CraftingComponents", tRecipeStuff); - 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.tag); - 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 Item NBT - if (!o.isInvalid()){ - ((IMetaTileEntity) tMetaTileEntity).setItemNBT(tNBT); //Valid? Idk - } - else { - try { - Logger.REFLECTION("Trying to set NBT data to Itemstack from invalid tile, World might explode."); - ((IMetaTileEntity) tMetaTileEntity).setItemNBT(tNBT); //Valid? Idk - } - catch (Throwable t){ - Logger.REFLECTION("getDropsHack1"); - t.printStackTrace(); - } - } - - //Set stack NBT - if (!tNBT.hasNoTags()) rStack.setTagCompound(tNBT); - return new ArrayList<ItemStack>(Arrays.asList(rStack)); - } - catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException a){ - Logger.REFLECTION("getDropsHack2"); - a.printStackTrace(); - } - ArrayList<ItemStack> u = new ArrayList<ItemStack>(Arrays.asList(new ItemStack[]{ItemUtils.getSimpleStack(Blocks.bedrock)})); - return u; - } + 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) { + 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(name.equals("getDrops") && desc.equals("()Ljava/util/ArrayList;")) { - FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Found target method. Access OpCode: "+access); - //return new TrySwapMethod(methodVisitor, access, name, desc); - return new SwapTwo(methodVisitor); + 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 TrySwapMethod extends GeneratorAdapter { - public TrySwapMethod(MethodVisitor mv, int access, String name, String desc) { - super(Opcodes.ASM5, mv, access, name, desc); - FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Created method swapper for '"+name+"' in 'gregtech/api/metatileentity/BaseMetaTileEntity'. Desc: "+desc); - } - - @Override - public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { - //gtPlusPlus.preloader.asm.transformers.Preloader_ClassTransformer2 - if(opcode==INVOKESPECIAL && owner.equals("net/minecraft/item/ItemStack") - && name.equals("<init>") && desc.equals("(Lnet/minecraft/block/Block;II)V")) { - FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Trying to proccess '"+name+"' | Opcode: "+opcode+" | Desc: "+desc+" | Owner: "+owner); - FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Fixing Greg & Blood's poor attempt at setItemNBT()."); - // not relaying the original instruction to super effectively removes the original - // instruction, instead we're producing a different instruction: - super.visitVarInsn(ALOAD, 0); - super.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2", - "getDrops", "()Ljava/util/ArrayList;", false); - FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Method should now be replaced."); - } - else { // relaying to super will reproduce the same instruction - //FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Original method call."); - super.visitMethodInsn(opcode, owner, name, desc, itf); - } - } - // all other, not overridden visit methods reproduce the original instructions - }*/ - private static final class SwapTwo extends MethodVisitor { + private static final class swapGetDrops extends MethodVisitor { - public SwapTwo(MethodVisitor mv) { + public swapGetDrops(MethodVisitor mv) { super(ASM5, mv); } @@ -174,7 +114,7 @@ public class Preloader_ClassTransformer2 { //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", @@ -188,4 +128,243 @@ public class Preloader_ClassTransformer2 { } + 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)); + 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 | NoSuchFieldException 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), tNBT); + Logger.INFO("Set NBT Tag Value to map."); + } + } + catch (NoSuchFieldException | 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 + + ItemStack rStack = new ItemStack(GregTech_API.sBlockMachines, 1, tID); + 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 | NoSuchFieldException 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 723061f998..9163b54709 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java @@ -11,6 +11,8 @@ import net.minecraft.launchwrapper.IClassTransformer; public class Preloader_Transformer_Handler implements IClassTransformer { + private final boolean mEnabled = false; + public byte[] transform(String name, String transformedName, byte[] basicClass) { if(transformedName.equals("net.minecraftforge.oredict.OreDictionary")) { FMLRelaunchLog.log("[GT++ ASM] OreDictTransformer", Level.INFO, "Transforming %s", transformedName); @@ -18,12 +20,21 @@ public class Preloader_Transformer_Handler implements IClassTransformer { new ClassReader(basicClass).accept(new OreDictionaryVisitor(classWriter), 0); return classWriter.toByteArray(); } - if(transformedName.equals("gregtech.api.metatileentity.BaseMetaTileEntity")) { - FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Transforming %s", transformedName); - ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES); - ClassReader x = new ClassReader(basicClass); - x.accept(new GT_MetaTile_Visitor(classWriter), ClassReader.EXPAND_FRAMES); - return classWriter.toByteArray(); + if (mEnabled) { + if(transformedName.equals("gregtech.api.metatileentity.BaseMetaTileEntity")) { + FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Transforming %s", transformedName); + ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES); + ClassReader x = new ClassReader(basicClass); + x.accept(new GT_MetaTile_Visitor(classWriter, false), ClassReader.EXPAND_FRAMES); + return classWriter.toByteArray(); + } + if(transformedName.equals("gregtech.common.blocks.GT_Block_Machines")) { + FMLRelaunchLog.log("[GT++ ASM] NBTFixer", Level.INFO, "Transforming %s", transformedName); + ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES); + ClassReader x = new ClassReader(basicClass); + x.accept(new GT_MetaTile_Visitor(classWriter, true), ClassReader.EXPAND_FRAMES); + return classWriter.toByteArray(); + } } return basicClass; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index 898565352b..da2b24e38f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -278,7 +278,13 @@ public enum GregtechItemList implements GregtechItemContainer { //Tesla Tower TelsaTower, - Battery_Gem_1, Battery_Gem_2, Battery_Gem_3, + Battery_Gem_1, Battery_Gem_2, Battery_Gem_3, + + //Super Tier Chests + Super_Chest_LV, Super_Chest_MV, Super_Chest_HV, Super_Chest_EV, Super_Chest_IV, + + //Fish Pond + Casing_FishPond, Industrial_FishingPond, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SuperChest.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SuperChest.java new file mode 100644 index 0000000000..8caf8fe575 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SuperChest.java @@ -0,0 +1,69 @@ +package gtPlusPlus.xmod.gregtech.api.gui; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_Slot_Output; +import gregtech.api.gui.GT_Slot_Render; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_TieredChest; + +import java.util.Iterator; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; + +public class CONTAINER_SuperChest extends GT_ContainerMetaTile_Machine { + public int mContent = 0; + + public CONTAINER_SuperChest(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public void addSlots(InventoryPlayer aInventoryPlayer) { + this.addSlotToContainer(new Slot(this.mTileEntity, 0, 80, 17)); + this.addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 1, 80, 53)); + this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, 2, 59, 42)); + } + + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (!this.mTileEntity.isClientSide() && this.mTileEntity.getMetaTileEntity() != null) { + if (this.mTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_TieredChest) { + this.mContent = ((GT_MetaTileEntity_TieredChest) this.mTileEntity.getMetaTileEntity()).mItemCount; + } else { + this.mContent = 0; + } + + Iterator var2 = this.crafters.iterator(); + + while (var2.hasNext()) { + ICrafting var1 = (ICrafting) var2.next(); + var1.sendProgressBarUpdate(this, 100, this.mContent & 65535); + var1.sendProgressBarUpdate(this, 101, this.mContent >>> 16); + } + + } + } + + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 100 : + this.mContent = this.mContent & -65536 | par2; + break; + case 101 : + this.mContent = this.mContent & 65535 | par2 << 16; + } + + } + + public int getSlotCount() { + return 2; + } + + public int getShiftClickSlotCount() { + return 1; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SuperChest.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SuperChest.java new file mode 100644 index 0000000000..259f589950 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SuperChest.java @@ -0,0 +1,37 @@ +package gtPlusPlus.xmod.gregtech.api.gui; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Utility; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.StatCollector; + +public class GUI_SuperChest extends GT_GUIContainerMetaTile_Machine { + private final String mName; + + public GUI_SuperChest(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, + String aName) { + super(new CONTAINER_SuperChest(aInventoryPlayer, aTileEntity), "gregtech:textures/gui/BasicTank.png"); + this.mName = aName; + } + + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, + 4210752); + this.fontRendererObj.drawString(this.mName, 8, 6, 4210752); + if (this.mContainer != null) { + this.fontRendererObj.drawString("Item Amount", 10, 20, 16448255); + this.fontRendererObj.drawString( + GT_Utility.parseNumberToString(((CONTAINER_SuperChest) this.mContainer).mContent), 10, 30, + 16448255); + } + + } + + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (this.width - this.xSize) / 2; + int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + } +}
\ No newline at end of file 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 a5acb49faa..e0da8e9fc2 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 @@ -5,12 +5,13 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import gregtech.api.GregTech_API; import gregtech.api.util.GT_Utility; import net.minecraftforge.fluids.FluidStack; import org.apache.commons.lang3.ArrayUtils; import gregtech.api.enums.Materials; +import gregtech.api.gui.GT_Container_MultiMachine; +import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaGenerated_Tool; @@ -19,9 +20,7 @@ import gregtech.api.metatileentity.implementations.*; import gregtech.api.util.GT_Recipe; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.util.PollutionUtils; import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery; @@ -57,21 +56,27 @@ GT_MetaTileEntity_MultiBlockBase { .getMetaTileEntity() == aMetaTileEntity) && !aMetaTileEntity.getBaseMetaTileEntity().isDead(); } + + public abstract boolean hasSlotInGUI(); @Override - public Object getServerGUI(final int aID, - final InventoryPlayer aPlayerInventory, - final IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_MultiMachine(aPlayerInventory, - aBaseMetaTileEntity); + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + if (hasSlotInGUI()) { + return new GT_Container_MultiMachine(aPlayerInventory, aBaseMetaTileEntity); + } + else { + return new CONTAINER_MultiMachine(aPlayerInventory, aBaseMetaTileEntity); + } } @Override - public Object getClientGUI(final int aID, - final InventoryPlayer aPlayerInventory, - final IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, - this.getLocalName(), "MultiblockDisplay.png"); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + if (hasSlotInGUI()) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MultiblockDisplay.png"); + } + else { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MultiblockDisplay.png"); + } } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java new file mode 100644 index 0000000000..37f7f2cb16 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java @@ -0,0 +1,61 @@ +package gtPlusPlus.xmod.gregtech.common.blocks; + +import gregtech.api.enums.TAE; +import gregtech.api.objects.GT_CopiedBlockTexture; +import gregtech.api.util.GT_LanguageManager; +import gregtech.common.blocks.GT_Material_Casings; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.CasingTextureHandler2; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.CasingTextureHandler3; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +public class GregtechMetaCasingBlocks3 +extends GregtechMetaCasingBlocksAbstract { + + CasingTextureHandler3 TextureHandler = new CasingTextureHandler3(); + + public GregtechMetaCasingBlocks3() { + super(GregtechMetaCasingItems.class, "gtplusplus.blockcasings.3", GT_Material_Casings.INSTANCE); + for (byte i = 0; i < 16; i = (byte) (i + 1)) { + TAE.registerTextures(new GT_CopiedBlockTexture(this, 6, i)); + } + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Aquatic Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Placeholder"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Placeholder"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Placeholder"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Placeholder"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Placeholder"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Placeholder"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Placeholder");; + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Placeholder"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "Placeholder"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Placeholder"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Placeholder"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", "Placeholder"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "Placeholder"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", "Placeholder"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Placeholder"); + GregtechItemList.Casing_FishPond.set(new ItemStack(this, 1, 0)); + //GregtechItemList.Casing_Refinery_External.set(new ItemStack(this, 1, 1)); + //GregtechItemList.Casing_Refinery_Structural.set(new ItemStack(this, 1, 2)); + //GregtechItemList.Casing_Refinery_Internal.set(new ItemStack(this, 1, 3)); + //GregtechItemList.Casing_WashPlant.set(new ItemStack(this, 1, 4)); + //GregtechItemList.Casing_Sifter.set(new ItemStack(this, 1, 5)); + //GregtechItemList.Casing_SifterGrate.set(new ItemStack(this, 1, 6)); + //GregtechItemList.Casing_Vanadium_Redox.set(new ItemStack(this, 1, 7)); + //GregtechItemList.Casing_Power_SubStation.set(new ItemStack(this, 1, 8)); + //GregtechItemList.Casing_Cyclotron_Coil.set(new ItemStack(this, 1, 9)); + //GregtechItemList.Casing_Cyclotron_External.set(new ItemStack(this, 1, 10)); + //GregtechItemList.Casing_ThermalContainment.set(new ItemStack(this, 1, 11)); + //GregtechItemList.Casing_Autocrafter.set(new ItemStack(this, 1, 12)); + //GregtechItemList.Casing_CuttingFactoryFrame.set(new ItemStack(this, 1, 13)); + //GregtechItemList.Casing_TeslaTower.set(new ItemStack(this, 1, 14)); + //GregtechItemList.Casing_PLACEHOLDER_TreeFarmer.set(new ItemStack(this, 1, 15)); //Tree Farmer Textures + } + + @Override + public IIcon getIcon(final int aSide, final int aMeta) { + return CasingTextureHandler3.getIcon(aSide, aMeta); + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java index 17fa039c4e..d3bf4dfe51 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java @@ -50,7 +50,12 @@ public class CasingTextureHandler2 { return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon(); //Reactor Casing II case 13: - return TexturesGtBlock.Casing_Machine_Ultra.getIcon(); + if (aSide <2) { + return TexturesGtBlock.TEXTURE_TECH_A.getIcon(); + } + else { + return TexturesGtBlock.TEXTURE_TECH_B.getIcon(); + } case 14: return TexturesGtBlock.Casing_Material_RedSteel.getIcon(); case 15: diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler3.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler3.java new file mode 100644 index 0000000000..1bd59724fb --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler3.java @@ -0,0 +1,71 @@ +package gtPlusPlus.xmod.gregtech.common.blocks.textures; + +import gregtech.api.enums.Textures; +import net.minecraft.util.IIcon; + +public class CasingTextureHandler3 { + + public static IIcon getIcon(final int aSide, final int aMeta) { //Texture ID's. case 0 == ID[57] + if ((aMeta >= 0) && (aMeta < 16)) { + switch (aMeta) { + //Centrifuge + case 0: + return TexturesGtBlock.TEXTURE_METAL_PANEL_B.getIcon(); + //Coke Oven Frame + case 1: + return TexturesGtBlock._PlaceHolder.getIcon(); + //Coke Oven Casing Tier 1 + case 2: + return TexturesGtBlock._PlaceHolder.getIcon(); + //Coke Oven Casing Tier 2 + case 3: + return TexturesGtBlock._PlaceHolder.getIcon(); + //Material Press Casings + case 4: + return TexturesGtBlock._PlaceHolder.getIcon(); + //Sifter Structural + case 5: + return TexturesGtBlock._PlaceHolder.getIcon(); + //Sifter Sieve + case 6: + return TexturesGtBlock._PlaceHolder.getIcon(); + //Vanadium Radox Battery + case 7: + return TexturesGtBlock._PlaceHolder.getIcon(); + //Power Sub-Station Casing + case 8: + return TexturesGtBlock._PlaceHolder.getIcon(); + //Cyclotron Coil + case 9: + return TexturesGtBlock._PlaceHolder.getIcon(); + //Cyclotron External Casing + case 10: + return TexturesGtBlock._PlaceHolder.getIcon(); + //Multitank Exterior Casing + case 11: + return TexturesGtBlock._PlaceHolder.getIcon(); + //Reactor Casing I + case 12: + return TexturesGtBlock._PlaceHolder.getIcon(); + //Reactor Casing II + case 13: + if (aSide <2) { + return TexturesGtBlock._PlaceHolder.getIcon(); + } + else { + return TexturesGtBlock._PlaceHolder.getIcon(); + } + case 14: + return TexturesGtBlock._PlaceHolder.getIcon(); + case 15: + return TexturesGtBlock._PlaceHolder.getIcon(); //Tree Farmer Textures + + default: + return TexturesGtBlock._PlaceHolder.getIcon(); + + } + } + return TexturesGtBlock._PlaceHolder.getIcon(); + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java index 3795f9815f..dfe7d15bb7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java @@ -173,6 +173,8 @@ public class TexturesGtBlock { public static final CustomIcon Overlay_Machine_Vent_Fast = Internal_Overlay_Machine_Vent_Fast; private static final CustomIcon Internal_Overlay_Machine_Vent_Adv = new CustomIcon("TileEntities/adv_machine_vent_rotating"); public static final CustomIcon Overlay_Machine_Vent_Adv = Internal_Overlay_Machine_Vent_Adv; + //Grate Texture + public static final CustomIcon OVERLAY_GRATE_A = new CustomIcon("metro/OVERLAY_GRATE_A"); //Speaker Texture private static final CustomIcon Internal_Overlay_Machine_Sound = new CustomIcon("TileEntities/audio_out"); public static final CustomIcon Overlay_Machine_Sound = Internal_Overlay_Machine_Sound; @@ -228,5 +230,22 @@ public class TexturesGtBlock { public static final CustomIcon Overlay_Oil = Internal_Overlay_Oil; private static final CustomIcon Internal_Overlay_UU_Matter = new CustomIcon("TileEntities/adv_machine_uum"); public static final CustomIcon Overlay_UU_Matter = Internal_Overlay_UU_Matter; + + + //Metroid related + public static final CustomIcon TEXTURE_METAL_PANEL_A = new CustomIcon("metro/TEXTURE_METAL_PANEL_A"); + public static final CustomIcon TEXTURE_METAL_PANEL_B = new CustomIcon("metro/TEXTURE_METAL_PANEL_B"); + public static final CustomIcon TEXTURE_ORGANIC_PANEL_A = new CustomIcon("metro/TEXTURE_ORGANIC_PANEL_A"); + public static final CustomIcon TEXTURE_STONE_BIRD_A = new CustomIcon("metro/TEXTURE_STONE_BIRD_A"); + public static final CustomIcon TEXTURE_STONE_BIRD_A_LEFT = new CustomIcon("metro/TEXTURE_STONE_BIRD_A_LEFT"); + public static final CustomIcon TEXTURE_STONE_BIRD_A_RIGHT = new CustomIcon("metro/TEXTURE_STONE_BIRD_A_RIGHT"); + public static final CustomIcon TEXTURE_STONE_BLUE_A = new CustomIcon("metro/TEXTURE_STONE_BLUE_A"); + public static final CustomIcon TEXTURE_STONE_GREEN_A = new CustomIcon("metro/TEXTURE_STONE_GREEN_A"); + public static final CustomIcon TEXTURE_STONE_TABLET_A = new CustomIcon("metro/TEXTURE_STONE_TABLET_A"); + public static final CustomIcon TEXTURE_STONE_TABLET_B = new CustomIcon("metro/TEXTURE_STONE_TABLET_B"); + public static final CustomIcon TEXTURE_TECH_A = new CustomIcon("metro/TEXTURE_TECH_A"); + public static final CustomIcon TEXTURE_TECH_B = new CustomIcon("metro/TEXTURE_TECH_B"); + public static final CustomIcon TEXTURE_TECH_C = new CustomIcon("metro/TEXTURE_TECH_C"); + public static final CustomIcon TEXTURE_TECH_PANEL_A = new CustomIcon("metro/TEXTURE_TECH_PANEL_A"); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_TeslaTower.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_TeslaTower.java index db2e7e4dcf..b2b6b83d0b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_TeslaTower.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_TeslaTower.java @@ -72,6 +72,11 @@ public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase { } @Override + public boolean hasSlotInGUI() { + return false; + } + + @Override public String[] getDescription() { String casings = getCasingBlockItem().get(0).getDisplayName(); return new String[]{ diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java index 12329c875f..0654f431d7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java @@ -59,6 +59,11 @@ public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBloc } @Override + public boolean hasSlotInGUI() { + return true; + } + + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "ProcessingArray.png"); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java index e349ae1f53..4f16a937f6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java @@ -222,6 +222,11 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase } @Override + public boolean hasSlotInGUI() { + return true; + } + + @Override public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new GUI_TreeFarmer(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "TreeFarmer.png"); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java index 797875f2f6..37fd4b2f13 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java @@ -74,6 +74,11 @@ extends GregtechMeta_MultiBlockBase { } @Override + public boolean hasSlotInGUI() { + return false; + } + + @Override public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "ElectricBlastFurnace.png"); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Cyclotron.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Cyclotron.java index 4f276dfb37..55cfeffe6c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Cyclotron.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Cyclotron.java @@ -48,6 +48,11 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas } @Override + public boolean hasSlotInGUI() { + return false; + } + + @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_Container_MultiMachine(aPlayerInventory, aBaseMetaTileEntity); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java index bdf6db43ab..770575dc7c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java @@ -67,6 +67,11 @@ extends GregtechMeta_MultiBlockBase { } @Override + public boolean hasSlotInGUI() { + return false; + } + + @Override public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "IndustrialCentrifuge.png"); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java index a4add1ed45..e1a02d9cec 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java @@ -67,6 +67,11 @@ extends GregtechMeta_MultiBlockBase { } @Override + public boolean hasSlotInGUI() { + return true; + } + + @Override public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "CokeOven.png"); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCuttingMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCuttingMachine.java index 37aa33d246..76c6490480 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCuttingMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCuttingMachine.java @@ -12,6 +12,7 @@ import gregtech.api.util.GT_Recipe; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import net.minecraft.block.Block; @@ -37,7 +38,9 @@ extends GregtechMeta_MultiBlockBase { public String[] getDescription() { return new String[]{ "Controller Block for the Industrial Cutting Factory", - "60% faster than using single block machines of the same voltage", + "200% faster than using single block machines of the same voltage", + "Only uses 75% of the eu/t normally required", + "Processes four items per voltage tier", "Size: 3x3x5 [WxHxL] (Hollow)", "Controller (front centered)", "2x Input Bus (side centered)", "2x Output Bus (side centered)", @@ -58,6 +61,11 @@ extends GregtechMeta_MultiBlockBase { } @Override + public boolean hasSlotInGUI() { + return true; + } + + @Override public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "WireFactory.png"); } @@ -74,7 +82,7 @@ extends GregtechMeta_MultiBlockBase { @Override public boolean checkRecipe(final ItemStack aStack) { - return checkRecipeGeneric(2, 100, 60); + return checkRecipeGeneric((4*Utils.calculateVoltageTier(this.getMaxInputVoltage())), 75, 200); } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java index 1bc38dee93..32513a05ce 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java @@ -1,6 +1,5 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; -import gregtech.api.GregTech_API; import gregtech.api.enums.TAE; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -8,7 +7,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; 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.lib.CORE; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; @@ -59,6 +57,11 @@ extends GregtechMeta_MultiBlockBase { } @Override + public boolean hasSlotInGUI() { + return false; + } + + @Override public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "IndustrialElectrolyzer.png"); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialFishingPond.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialFishingPond.java new file mode 100644 index 0000000000..2e1b0aaa34 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialFishingPond.java @@ -0,0 +1,596 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; + +import static gtPlusPlus.core.util.array.ArrayUtils.removeNulls; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +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.objects.GT_RenderedTexture; +import gregtech.api.util.FishPondFakeRecipe; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gregtech.api.util.Recipe_GT; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.array.AutoMap; +import gtPlusPlus.core.util.fluid.FluidUtils; +import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine; +import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; +import ic2.core.init.BlocksItems; +import ic2.core.init.InternalName; +import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.WeightedRandomFishable; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +public class GregtechMetaTileEntity_IndustrialFishingPond +extends GregtechMeta_MultiBlockBase { + + private boolean isUsingControllerCircuit = false; + private static final Item circuit = CI.getNumberedCircuit(0).getItem(); + + public GregtechMetaTileEntity_IndustrialFishingPond(final int aID, final String aName, final String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GregtechMetaTileEntity_IndustrialFishingPond(final String aName) { + super(aName); + } + + @Override + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_IndustrialFishingPond(this.mName); + } + + @Override + public String[] getDescription() { + return new String[]{ + "Controller Block for the Fishing Pond", + "Size: 9x3x9 [WxHxL] (open)", + "X X", + "X X", + "XXXXXXXXX", + "Put a numbered circuit into the input bus.", + "Circuit 14 for Fish", + "Circuit 15 for Junk", + "Circuit 16 for Treasure", + "Controller (front centered)", + "1x Output Bus (Any casing)", + "1x Input Bus (Any casing)", + "1x Input Hatch (Any casing)", + "1x Maintenance Hatch (Any casing)", + "1x Energy Hatch (Any casing)", + CORE.GT_Tooltip + }; + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[getCasingTextureIndex()], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[getCasingTextureIndex()]}; + } + + @Override + public boolean hasSlotInGUI() { + return true; + } + + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "ProcessingArray.png"); + } + + @Override + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return Recipe_GT.Gregtech_Recipe_Map.sFishPondRecipes; + } + + @Override + public boolean isFacingValid(final byte aFacing) { + return aFacing > 1; + } + + @Override + public boolean checkRecipe(final ItemStack aStack) { + if (aStack != null) { + Logger.WARNING("Found "+aStack.getDisplayName()); + if (aStack.getItem() == circuit) { + this.isUsingControllerCircuit = true; + this.mMode = aStack.getItemDamage(); + Logger.WARNING("Found Circuit!"); + } + else { + this.isUsingControllerCircuit = false; + } + } + else { + this.isUsingControllerCircuit = false; + } + if (!hasGenerateRecipes) { + Logger.WARNING("Generating Recipes."); + generateRecipes(); + } + if (hasGenerateRecipes && checkForWater()) { + Logger.WARNING("Trying to run recipe."); + ArrayList<ItemStack> tItems = getStoredInputs(); + ArrayList<FluidStack> tFluids = getStoredFluids(); + ItemStack[] tItemInputs = tItems.toArray(new ItemStack[tItems.size()]); + FluidStack[] tFluidInputs = tFluids.toArray(new FluidStack[tFluids.size()]); + + if (!isUsingControllerCircuit && tItems.size() == 0) { + return false; + } + + return checkRecipeGeneric(tItemInputs, tFluidInputs, 1, 100, 80, 100); + } + return true; + } + + @Override + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + //Get Facing direction + int mDirectionX = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int mCurrentDirectionX; + int mCurrentDirectionZ; + int mOffsetX_Lower = 0; + int mOffsetX_Upper = 0; + int mOffsetZ_Lower = 0; + int mOffsetZ_Upper = 0; + + if (mDirectionX == 0){ + mCurrentDirectionX = 2; + mCurrentDirectionZ = 3; + } + else { + mCurrentDirectionX = 3; + mCurrentDirectionZ = 2; + } + + mOffsetX_Lower = -4; + mOffsetX_Upper = 4; + mOffsetZ_Lower = -4; + mOffsetZ_Upper = 4; + + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * mCurrentDirectionX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * mCurrentDirectionZ; + + Logger.WARNING("xDir"+(xDir)); + Logger.WARNING("zDir"+(zDir)); + /*if (!(aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir))) { + return false; + }*/ + int tAmount = 0; + for (int i = mOffsetX_Lower; i <=mOffsetX_Upper; ++i) { + for (int j = mOffsetZ_Lower; j <= mOffsetZ_Upper; ++j) { + for (int h = -1; h < 2; ++h) { + if ((h != 0) || ((((xDir + i != 0) || (zDir + j != 0))) && (((i != 0) || (j != 0))))) { + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, + zDir + j); + if (!addToMachineList(tTileEntity)) { + Logger.WARNING("X: "+i+" | Z: "+j); + Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); + byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); + if ((tBlock != getCasingBlock()) && (tMeta != getCasingMeta())) { + if ((i != mOffsetX_Lower && j != mOffsetZ_Lower + && i != mOffsetX_Upper && j != mOffsetZ_Upper) && (h == 0 || h == 1)){ + if (tBlock == Blocks.air){ + Logger.WARNING("Found Air"); + } + else if (tBlock == Blocks.water){ + Logger.WARNING("Found Water"); + } + } + else { + if (tBlock.getLocalizedName().contains("gt.blockmachines") || tBlock == Blocks.water || tBlock == Blocks.flowing_water || tBlock == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)) { + + } + else { + Logger.WARNING("[x] Did not form - Found: "+tBlock.getLocalizedName() + " | "+tBlock.getDamageValue(aBaseMetaTileEntity.getWorld(), aBaseMetaTileEntity.getXCoord()+ i, aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord() + j) + " | Special Meta: "+(tTileEntity == null ? "0" : tTileEntity.getMetaTileID())); + Logger.WARNING("[x] Did not form - Found: "+(aBaseMetaTileEntity.getXCoord()+xDir + i) +" | "+ aBaseMetaTileEntity.getYCoord()+" | "+ (aBaseMetaTileEntity.getZCoord()+zDir + j)); + return false; + } + } + + } + ++tAmount; + } + } + } + } + } + if ((tAmount >= 64)){ + Logger.WARNING("Made structure."); + } + else { + Logger.WARNING("Did not make structure."); + } + return (tAmount >= 64); + } + + @Override + public int getMaxEfficiency(final ItemStack aStack) { + return 10000; + } + + @Override + public int getPollutionPerTick(final ItemStack aStack) { + return 0; + } + + @Override + public int getAmountOfOutputs() { + return 1; + } + + @Override + public boolean explodesOnComponentBreak(final ItemStack aStack) { + return false; + } + + public Block getCasingBlock() { + return ModBlocks.blockCasings3Misc; + } + + + public byte getCasingMeta() { + return 0; + } + + + public byte getCasingTextureIndex() { + return (byte) TAE.GTPP_INDEX(32); + } + + private boolean addToMachineList(final IGregTechTileEntity tTileEntity) { + return ((this.addMaintenanceToMachineList(tTileEntity, this.getCasingTextureIndex())) + || (this.addInputToMachineList(tTileEntity, this.getCasingTextureIndex())) + || (this.addOutputToMachineList(tTileEntity, this.getCasingTextureIndex())) + || (this.addMufflerToMachineList(tTileEntity, this.getCasingTextureIndex())) + || (this.addEnergyInputToMachineList(tTileEntity, this.getCasingTextureIndex()))); + } + + public boolean checkForWater() { + + //Get Facing direction + IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); + int mDirectionX = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int mCurrentDirectionX; + int mCurrentDirectionZ; + int mOffsetX_Lower = 0; + int mOffsetX_Upper = 0; + int mOffsetZ_Lower = 0; + int mOffsetZ_Upper = 0; + + + if (mDirectionX == 0){ + mCurrentDirectionX = 2; + mCurrentDirectionZ = 3; + } + else { + mCurrentDirectionX = 3; + mCurrentDirectionZ = 2; + } + mOffsetX_Lower = -4; + mOffsetX_Upper = 4; + mOffsetZ_Lower = -4; + mOffsetZ_Upper = 4; + + //if (aBaseMetaTileEntity.fac) + + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * mCurrentDirectionX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * mCurrentDirectionZ; + + int tAmount = 0; + for (int i = mOffsetX_Lower + 1; i <= mOffsetX_Upper - 1; ++i) { + for (int j = mOffsetZ_Lower + 1; j <= mOffsetZ_Upper - 1; ++j) { + for (int h = 0; h < 2; ++h) { + Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); + byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); + if (tBlock == Blocks.air || tBlock == Blocks.flowing_water || tBlock == Blocks.water) { + if (this.getStoredFluids() != null) { + for (FluidStack stored : this.getStoredFluids()) { + if (stored.isFluidEqual(FluidUtils.getFluidStack("water", 1))) { + if (stored.amount >= 1000) { + //Utils.LOG_WARNING("Going to try swap an air block for water from inut bus."); + stored.amount -= 1000; + Block fluidUsed = null; + if (tBlock == Blocks.air || tBlock == Blocks.flowing_water) { + fluidUsed = Blocks.water; + } + if (tBlock == Blocks.water) { + fluidUsed = BlocksItems.getFluidBlock(InternalName.fluidDistilledWater); + } + aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getXCoord() + xDir + i, aBaseMetaTileEntity.getYCoord() + h, aBaseMetaTileEntity.getZCoord() + zDir + j, fluidUsed); + + + } + } + } + } + } + if (tBlock == Blocks.water) { + ++tAmount; + //Logger.WARNING("Found Water"); + } else if (tBlock == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)) { + ++tAmount; + ++tAmount; + //Logger.WARNING("Found Distilled Water"); + } + } + } + } + if ((tAmount >= 80)){ + Logger.WARNING("Filled structure."); + } + else { + Logger.WARNING("Did not fill structure."); + } + return (tAmount >= 80); + } + + private static AutoMap<AutoMap> categories = new AutoMap<AutoMap>(); + private static AutoMap<WeightedRandomFishable> categoryFish = new AutoMap<WeightedRandomFishable>(); + private static AutoMap<WeightedRandomFishable> categoryJunk = new AutoMap<WeightedRandomFishable>(); + private static AutoMap<WeightedRandomFishable> categoryLoot = new AutoMap<WeightedRandomFishable>(); + private static boolean hasGenerateRecipes = false; + private int mMode = 14; + private int mMax = 8; + + private boolean generateRecipes() { + if (!hasGenerateRecipes) { + categories.put(categoryFish); + categories.put(categoryJunk); + categories.put(categoryLoot); + for (WeightedRandomFishable h : FishPondFakeRecipe.fish) { + categoryFish.put(h); + } + for (WeightedRandomFishable h : FishPondFakeRecipe.junk) { + categoryJunk.put(h); + } + for (WeightedRandomFishable h : FishPondFakeRecipe.treasure) { + categoryLoot.put(h); + } + hasGenerateRecipes = true; + return true; + } + else { + return true; + } + } + + private int getCircuit(ItemStack[] t) { + if (!this.isUsingControllerCircuit) { + for (ItemStack j : t) { + if (j.getItem() == CI.getNumberedCircuit(0).getItem()) { + //Fish + if (j.getItemDamage() == 14) { + mMax = 8; + this.mMode = 14; + break; + } + //Junk + else if (j.getItemDamage() == 15) { + this.mMode = 15; + mMax = 4; + break; + } + //Loot + else if (j.getItemDamage() == 16) { + this.mMode = 16; + mMax = 4; + break; + } + else { + this.mMode = 0; + mMax = 0; + break; + } + } + else { + this.mMode = 0; + mMax = 0; + break; + } + } + } + return this.mMode; + } + + //reflection map + private static Map<WeightedRandomFishable, ItemStack> reflectiveFishMap = new HashMap<WeightedRandomFishable, ItemStack>(); + private ItemStack reflectiveFish(WeightedRandomFishable y) { + if (reflectiveFishMap.containsKey(y)) { + return reflectiveFishMap.get(y); + } + ItemStack t; + try { + t = (ItemStack) ReflectionUtils.getField(WeightedRandomFishable.class, "field_150711_b").get(y); + ItemStack k = ItemUtils.getSimpleStack(t, 1); + reflectiveFishMap.put(y, k); + return t; + } + catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException e) {} + return null; + } + + private ItemStack[] generateLoot(int mode) { + ItemStack[] mFishOutput = new ItemStack[this.mMax]; + if (this.mMode == 14) { + for (int k=0;k<this.mMax;k++) { + if (mFishOutput[k] == null) + for (WeightedRandomFishable g : categoryFish.values()) { + if (MathUtils.randInt(0, 75) <= 2) { + ItemStack t = reflectiveFish(g); + if (t != null) { + mFishOutput[k] = ItemUtils.getSimpleStack(t, 1); + } + } + } + } + } + else if (this.mMode == 15) { + for (int k=0;k<this.mMax;k++) { + if (mFishOutput[k] == null) + for (WeightedRandomFishable g : categoryJunk.values()) { + if (MathUtils.randInt(0, 100) <= 1) { + ItemStack t = reflectiveFish(g); + if (t != null) { + mFishOutput[k] = ItemUtils.getSimpleStack(t, 1); + } + } + } + } + } + else if (this.mMode == 16) { + for (int k=0;k<this.mMax;k++) { + if (mFishOutput[k] == null) + for (WeightedRandomFishable g : categoryLoot.values()) { + if (MathUtils.randInt(0, 1000) <= 2) { + ItemStack t = reflectiveFish(g); + if (t != null) { + mFishOutput[k] = ItemUtils.getSimpleStack(t, 1); + } + } + } + } + } + else { + mFishOutput = null; + } + return mFishOutput; + } + + @Override + public boolean checkRecipeGeneric( + ItemStack[] aItemInputs, FluidStack[] aFluidInputs, + int aMaxParallelRecipes, int aEUPercent, + int aSpeedBonusPercent, int aOutputChanceRoll) { + + + + // Based on the Processing Array. A bit overkill, but very flexible. + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + + int parallelRecipes = 1; + getCircuit(aItemInputs); + + /*GT_Recipe tRecipe = this.getRecipeMap().findRecipe( + getBaseMetaTileEntity(), mLastRecipe, false, + gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs);*/ + + ItemStack[] mFishOutput = generateLoot(this.mMode); + Logger.WARNING("Mode: "+this.mMode+" | Is loot valid? "+(mFishOutput != null)); + + int jslot = 0; + for (ItemStack x : mFishOutput) { + if (x != null) { + Logger.WARNING("Slot "+jslot+" in mFishOutput contains "+x.stackSize+"x "+x.getDisplayName()+"."); + } + else { + Logger.WARNING("Slot "+jslot+" in mFishOutput was null."); + } + jslot++; + } + + // EU discount + float tRecipeEUt = (32 * aEUPercent) / 100.0f; + float tTotalEUt = 0.0f; + + // Reset outputs and progress stats + this.mEUt = 0; + this.mMaxProgresstime = 0; + this.mOutputItems = new ItemStack[]{}; + this.mOutputFluids = new FluidStack[]{}; + + tTotalEUt = 8; + Logger.WARNING("Recipe Step. [1]"); + + if (parallelRecipes == 0) { + Logger.WARNING("Recipe Step. [-1]"); + return false; + } + + // Convert speed bonus to duration multiplier + // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration. + float tTimeFactor = 100.0f / (100.0f + 0); + + float modeMulti = 1; + modeMulti = (this.mMode == 14 ? 5 : (this.mMode == 15 ? 1 : 20)); + this.mMaxProgresstime = (int)((60*modeMulti) * tTimeFactor); + + this.mEUt = (int)Math.ceil(tTotalEUt); + + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + + Logger.WARNING("Recipe Step. [2]"); + // Overclock + if (this.mEUt <= 16) { + this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = (this.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); + + Logger.WARNING("Recipe Step. [3]"); + // Collect output item types + ItemStack[] tOutputItems = mFishOutput; + + + int rslot = 0; + tOutputItems = removeNulls(mFishOutput); + + for (ItemStack x : tOutputItems) { + if (x != null) { + Logger.WARNING("rSlot "+rslot+" in mFishOutput contains "+x.stackSize+"x "+x.getDisplayName()+"."); + } + else { + Logger.WARNING("rSlot "+rslot+" in mFishOutput was null."); + } + rslot++; + } + + // Commit outputs + for (ItemStack n : tOutputItems) { + this.addOutput(n); + } + + //this.mOutputItems = tOutputItems; + //updateSlots(); + + // Play sounds (GT++ addition - GT multiblocks play no sounds) + startProcess(); + + return true; + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java index 0b5441f913..13df329082 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java @@ -1,8 +1,5 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; import java.util.Random; import gregtech.api.GregTech_API; @@ -13,13 +10,11 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; 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.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; @@ -27,10 +22,6 @@ import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; -import org.apache.commons.lang3.ArrayUtils; - -import static gtPlusPlus.core.util.array.ArrayUtils.removeNulls; public class GregtechMetaTileEntity_IndustrialMacerator extends GregtechMeta_MultiBlockBase { @@ -54,8 +45,7 @@ extends GregtechMeta_MultiBlockBase { return new String[]{ "Controller Block for the Industrial Maceration Stack", "60% faster than using single block machines of the same voltage", - "Processes material several factors faster than single block macerators", - "Has extra chances on bonus outputs", + "Increased output chances on % outputs", "Processes 8*tier materials at a time", "ULV = Tier 0, LV = Tier 1, etc.", "-------------------------------------------------------", @@ -83,6 +73,11 @@ extends GregtechMeta_MultiBlockBase { } @Override + public boolean hasSlotInGUI() { + return false; + } + + @Override public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MacerationStack.png"); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java index 209bbb3728..357f600471 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java @@ -69,6 +69,11 @@ extends GregtechMeta_MultiBlockBase { } @Override + public boolean hasSlotInGUI() { + return true; + } + + @Override public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MaterialPress.png"); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSifter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSifter.java index 548b457f79..519c2c3f31 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSifter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSifter.java @@ -45,7 +45,7 @@ extends GregtechMeta_MultiBlockBase { "Controller Block for the Industrial Sifter", "400% faster than single-block machines of the same voltage", "Processes two items per voltage tier", - "Increased output chances", + "Increased output chances on % outputs", "Size[WxHxL]: 5x3x5", "Controller (Center Bottom)", "1x Input Bus (Any top or bottom edge casing)", @@ -66,6 +66,11 @@ extends GregtechMeta_MultiBlockBase { } @Override + public boolean hasSlotInGUI() { + return false; + } + + @Override public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MacerationStack.png"); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java index 3c09f3425a..2add242006 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java @@ -60,6 +60,11 @@ extends GregtechMeta_MultiBlockBase { } @Override + public boolean hasSlotInGUI() { + return false; + } + + @Override public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "WireFactory.png"); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java index 3bdfd53983..f70437475d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java @@ -6,6 +6,7 @@ import gregtech.api.enums.Textures; 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_Output; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; import gtPlusPlus.api.objects.Logger; @@ -13,6 +14,8 @@ import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.fluid.FluidUtils; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.world.darkworld.block.DarkWorldContentLoader; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import ic2.core.init.BlocksItems; @@ -47,6 +50,7 @@ extends GregtechMeta_MultiBlockBase { "Controller Block for the Industrial Ore Washing Plant", "80% faster than using single block machines of the same voltage", "Processes one item per voltage tier", + "Chance to output Sludge per process", "Size: 7x3x5 [WxHxL] (open)", "X X", "X X", @@ -70,6 +74,11 @@ extends GregtechMeta_MultiBlockBase { } @Override + public boolean hasSlotInGUI() { + return false; + } + + @Override public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "WireFactory.png"); } @@ -87,7 +96,9 @@ extends GregtechMeta_MultiBlockBase { @Override public boolean checkRecipe(final ItemStack aStack) { if (checkForWater()) { - return checkRecipeGeneric((1*Utils.calculateVoltageTier(this.getMaxInputVoltage())), 100, 80); + if (checkRecipeGeneric((1*Utils.calculateVoltageTier(this.getMaxInputVoltage())), 100, 80)) { + return addSludge(); + } } return false; } @@ -303,5 +314,24 @@ extends GregtechMeta_MultiBlockBase { } return (tAmount >= 45); } + + public boolean addSludge() { + if (MathUtils.randInt(0, 100) <= 4) { + if (this.mOutputHatches.size() > 0) { + for (GT_MetaTileEntity_Hatch_Output h : this.mOutputHatches) { + if (h.getFluid() == null || h.getFluid().isFluidEqual(FluidUtils.getFluidStack(DarkWorldContentLoader.SLUDGE, 1000))) { + FluidStack current = h.mFluid; + if (current == null) { + h.mFluid = FluidUtils.getFluidStack(DarkWorldContentLoader.SLUDGE, 1000); + } + else { + h.mFluid.amount += 1000; + } + } + } + } + } + return true; + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java index 5cad86bdc4..7d85324fa1 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java @@ -63,6 +63,11 @@ extends GregtechMeta_MultiBlockBase { } @Override + public boolean hasSlotInGUI() { + return false; + } + + @Override public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "WireFactory.png"); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java index 98ca91d7f6..8abc63e1df 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java @@ -90,6 +90,11 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } @Override + public boolean hasSlotInGUI() { + return false; + } + + @Override public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new GUI_MatterFab(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MatterFabricator.png"); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java index 7f2036fcc3..7176db5d97 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java @@ -222,6 +222,11 @@ extends GregtechMeta_MultiBlockBase { } @Override + public boolean hasSlotInGUI() { + return false; + } + + @Override public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "VacuumFreezer.png"); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java index b26201299b..ed5d46527a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java @@ -82,6 +82,11 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe } @Override + public boolean hasSlotInGUI() { + return false; + } + + @Override public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MatterFabricator.png"); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredChest.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredChest.java new file mode 100644 index 0000000000..cc6a22c372 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredChest.java @@ -0,0 +1,192 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.storage; + +import gregtech.api.enums.Textures.BlockIcons; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Utility; +import gregtech.common.gui.GT_Container_QuantumChest; +import gregtech.common.gui.GT_GUIContainer_QuantumChest; +import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_SuperChest; +import gtPlusPlus.xmod.gregtech.api.gui.GUI_SuperChest; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class GT_MetaTileEntity_TieredChest extends GT_MetaTileEntity_TieredMachineBlock { + public int mItemCount = 0; + public ItemStack mItemStack = null; + private final static double mStorageFactor = (270000.0D/16); + + public GT_MetaTileEntity_TieredChest(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 3, + "This Chest stores " + (int) (Math.pow(6.0D, (double) aTier) * mStorageFactor) + " Items", new ITexture[0]); + } + + public GT_MetaTileEntity_TieredChest(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 3, aDescription, aTextures); + } + + public GT_MetaTileEntity_TieredChest(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 3, aDescription, aTextures); + } + + public boolean isSimpleMachine() { + return true; + } + + public boolean isFacingValid(byte aFacing) { + return true; + } + + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; + } + + public boolean isValidSlot(int aIndex) { + return true; + } + + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_TieredChest(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); + } + + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } else { + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + } + + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new CONTAINER_SuperChest(aPlayerInventory, aBaseMetaTileEntity); + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_SuperChest(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName()); + } + + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { + if (this.getBaseMetaTileEntity().isServerSide() && this.getBaseMetaTileEntity().isAllowedToWork()) { + if (this.getItemCount() <= 0) { + this.mItemStack = null; + this.mItemCount = 0; + } + + if (this.mItemStack == null && this.mInventory[0] != null) { + this.mItemStack = this.mInventory[0].copy(); + } + + if (this.mInventory[0] != null && this.mItemCount < this.getMaxItemCount() + && GT_Utility.areStacksEqual(this.mInventory[0], this.mItemStack)) { + this.mItemCount += this.mInventory[0].stackSize; + if (this.mItemCount > this.getMaxItemCount()) { + this.mInventory[0].stackSize = this.mItemCount - this.getMaxItemCount(); + this.mItemCount = this.getMaxItemCount(); + } else { + this.mInventory[0] = null; + } + } + + if (this.mInventory[1] == null && this.mItemStack != null) { + this.mInventory[1] = this.mItemStack.copy(); + this.mInventory[1].stackSize = Math.min(this.mItemStack.getMaxStackSize(), this.mItemCount); + this.mItemCount -= this.mInventory[1].stackSize; + } else if (this.mItemCount > 0 && GT_Utility.areStacksEqual(this.mInventory[1], this.mItemStack) + && this.mInventory[1].getMaxStackSize() > this.mInventory[1].stackSize) { + int tmp = Math.min(this.mItemCount, + this.mInventory[1].getMaxStackSize() - this.mInventory[1].stackSize); + this.mInventory[1].stackSize += tmp; + this.mItemCount -= tmp; + } + + if (this.mItemStack != null) { + this.mInventory[2] = this.mItemStack.copy(); + this.mInventory[2].stackSize = Math.min(this.mItemStack.getMaxStackSize(), this.mItemCount); + } else { + this.mInventory[2] = null; + } + } + + } + + private int getItemCount() { + return this.mItemCount; + } + + public void setItemCount(int aCount) { + this.mItemCount = aCount; + } + + public int getProgresstime() { + return this.mItemCount + (this.mInventory[0] == null ? 0 : this.mInventory[0].stackSize) + + (this.mInventory[1] == null ? 0 : this.mInventory[1].stackSize); + } + + public int maxProgresstime() { + return this.getMaxItemCount(); + } + + public int getMaxItemCount() { + return (int) (Math.pow(6.0D, (double) this.mTier) * mStorageFactor - 128.0D); + } + + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return aIndex == 1; + } + + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return aIndex == 0 && (this.mInventory[0] == null || GT_Utility.areStacksEqual(this.mInventory[0], aStack)); + } + + public String[] getInfoData() { + return this.mItemStack == null + ? new String[]{"Super Storage Chest", "Stored Items:", "No Items", Integer.toString(0), + Integer.toString(this.getMaxItemCount())} + : new String[]{"Super Storage Chest", "Stored Items:", this.mItemStack.getDisplayName(), + Integer.toString(this.mItemCount), Integer.toString(this.getMaxItemCount())}; + } + + public boolean isGivingInformation() { + return true; + } + + public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setInteger("mItemCount", this.mItemCount); + if (this.mItemStack != null) { + aNBT.setTag("mItemStack", this.mItemStack.writeToNBT(new NBTTagCompound())); + } + + } + + public void loadNBTData(NBTTagCompound aNBT) { + if (aNBT.hasKey("mItemCount")) { + this.mItemCount = aNBT.getInteger("mItemCount"); + } + + if (aNBT.hasKey("mItemStack")) { + this.mItemStack = ItemStack.loadItemStackFromNBT((NBTTagCompound) aNBT.getTag("mItemStack")); + } + + } + + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, + boolean aActive, boolean aRedstone) { + return aBaseMetaTileEntity.getFrontFacing() == 0 && aSide == 4 + ? new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1], + new GT_RenderedTexture(BlockIcons.OVERLAY_QCHEST)} + : (aSide == aBaseMetaTileEntity.getFrontFacing() + ? new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1], + new GT_RenderedTexture(BlockIcons.OVERLAY_QCHEST)} + : new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1]}); + } + + public ITexture[][][] getTextureSet(ITexture[] aTextures) { + return new ITexture[0][0][0]; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java index a177cf76ae..66ce69ffca 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java @@ -133,11 +133,13 @@ public class GT_MetaTileEntity_TieredTank extends GT_MetaTileEntity_BasicTank { @Override public void setItemNBT(NBTTagCompound aNBT) { - Logger.INFO("Setting item nbt"); super.setItemNBT(aNBT); if (mFluid != null){ Logger.INFO("Setting item fluid nbt"); aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound())); + if (aNBT.hasKey("mFluid")) { + Logger.INFO("Set mFluid to NBT."); + } } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java index 90faa9b83a..7f59621324 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java @@ -6,6 +6,7 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks; import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks2; +import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks3; public class Gregtech_Blocks { @@ -19,6 +20,7 @@ public class Gregtech_Blocks { //Casing Blocks ModBlocks.blockCasingsMisc = new GregtechMetaCasingBlocks(); ModBlocks.blockCasings2Misc = new GregtechMetaCasingBlocks2(); + ModBlocks.blockCasings3Misc = new GregtechMetaCasingBlocks3(); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFishPond.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFishPond.java new file mode 100644 index 0000000000..93f8f7460a --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFishPond.java @@ -0,0 +1,26 @@ +package gtPlusPlus.xmod.gregtech.registration.gregtech; + +import gregtech.api.util.FishPondFakeRecipe; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.GregtechMetaTileEntity_IndustrialFishingPond; + +public class GregtechIndustrialFishPond { + + public static void run() { + if (gtPlusPlus.core.lib.LoadedMods.Gregtech) { + Logger.INFO("Gregtech5u Content | Registering Industrial Fishing Pond Multiblock."); + //if (CORE.ConfigSwitches.enableMultiblock_IndustrialWashPlant) { + FishPondFakeRecipe.generateFishPondRecipes(); + run1(); + //} + } + + } + + private static void run1() { + GregtechItemList.Industrial_FishingPond.set(new GregtechMetaTileEntity_IndustrialFishingPond(829, + "industrial.fishpond.controller.tier.single", "Zhuhai - Fishing Port").getStackForm(1L)); + + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSuperTanks.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSuperTanks.java new file mode 100644 index 0000000000..4f7ff4add9 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSuperTanks.java @@ -0,0 +1,52 @@ +package gtPlusPlus.xmod.gregtech.registration.gregtech; + +import static gtPlusPlus.core.recipe.common.CI.bitsd; + +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_ModHandler; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_TieredChest; + +public class GregtechSuperTanks { + + public static void run() { + int mId = 946; + GregtechItemList.Super_Chest_LV.set((new GT_MetaTileEntity_TieredChest(mId++, "super.chest.tier.01", "Super Chest I", 1)).getStackForm(1L)); + GregtechItemList.Super_Chest_MV.set((new GT_MetaTileEntity_TieredChest(mId++, "super.chest.tier.02", "Super Chest II", 2)).getStackForm(1L)); + GregtechItemList.Super_Chest_HV.set((new GT_MetaTileEntity_TieredChest(mId++, "super.chest.tier.03", "Super Chest III", 3)).getStackForm(1L)); + GregtechItemList.Super_Chest_EV.set((new GT_MetaTileEntity_TieredChest(mId++, "super.chest.tier.04", "Super Chest IV", 4)).getStackForm(1L)); + GregtechItemList.Super_Chest_IV.set((new GT_MetaTileEntity_TieredChest(mId++, "super.chest.tier.05", "Super Chest V", 5)).getStackForm(1L)); + + + GT_ModHandler.addCraftingRecipe(GregtechItemList.Super_Chest_LV.get(1L, new Object[0]), bitsd, + new Object[]{"DPD", "PMP", "DGD", Character.valueOf('M'), ItemList.Hull_LV, Character.valueOf('G'), + ItemList.Automation_ChestBuffer_LV, Character.valueOf('D'), + OrePrefixes.circuit.get(Materials.Basic), Character.valueOf('P'), + OrePrefixes.plate.get(Materials.Invar)}); + + GT_ModHandler.addCraftingRecipe(GregtechItemList.Super_Chest_MV.get(1L, new Object[0]), bitsd, + new Object[]{"DPD", "PMP", "DGD", Character.valueOf('M'), ItemList.Hull_MV, Character.valueOf('G'), + ItemList.Automation_ChestBuffer_MV, Character.valueOf('D'), OrePrefixes.circuit.get(Materials.Good), + Character.valueOf('P'), OrePrefixes.plate.get(Materials.Aluminium)}); + + GT_ModHandler.addCraftingRecipe(GregtechItemList.Super_Chest_HV.get(1L, new Object[0]), bitsd, + new Object[]{"DPD", "PMP", "DGD", Character.valueOf('M'), ItemList.Hull_HV, Character.valueOf('G'), + ItemList.Automation_ChestBuffer_HV, Character.valueOf('D'), OrePrefixes.circuit.get(Materials.Advanced), + Character.valueOf('P'), OrePrefixes.plate.get(Materials.StainlessSteel)}); + + GT_ModHandler.addCraftingRecipe(GregtechItemList.Super_Chest_EV.get(1L, new Object[0]), bitsd, + new Object[]{"DPD", "PMP", "DGD", Character.valueOf('M'), ItemList.Hull_EV, Character.valueOf('G'), + ItemList.Automation_ChestBuffer_EV, Character.valueOf('D'), OrePrefixes.circuit.get(Materials.Data), + Character.valueOf('P'), OrePrefixes.plate.get(Materials.Titanium)}); + + GT_ModHandler.addCraftingRecipe(GregtechItemList.Super_Chest_IV.get(1L, new Object[0]), bitsd, + new Object[]{"DPD", "PMP", "DGD", Character.valueOf('M'), ItemList.Hull_IV, Character.valueOf('G'), + ItemList.Automation_ChestBuffer_IV, Character.valueOf('D'), + OrePrefixes.circuit.get(Materials.Elite), Character.valueOf('P'), + OrePrefixes.plate.get(Materials.Tungsten)}); + } + +} diff --git a/src/resources/assets/miscutils/textures/items/StoneStatue.png b/src/resources/assets/miscutils/textures/items/StoneStatue.png Binary files differnew file mode 100644 index 0000000000..e92f69fce4 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/StoneStatue.png |