diff options
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common')
25 files changed, 1071 insertions, 19 deletions
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."); + } } } |