diff --git a/main/java/gregtech/api/enums/ItemList.java b/main/java/gregtech/api/enums/ItemList.java index 90ece775..f93f543b 100644 --- a/main/java/gregtech/api/enums/ItemList.java +++ b/main/java/gregtech/api/enums/ItemList.java @@ -643,8 +643,9 @@ public enum ItemList implements IItemContainer { Processing_Array, Distillation_Tower, Energy_LapotronicOrb2, - ZPM2, - NULL; + ZPM2, Quantum_Tank_LV,Quantum_Tank_MV,Quantum_Tank_HV,Quantum_Tank_EV,Quantum_Tank_IV, Quantum_Chest_LV, Quantum_Chest_MV, Quantum_Chest_HV, Quantum_Chest_EV, Quantum_Chest_IV, + + NULL, Cover_RedstoneTransmitterExternal,Cover_RedstoneTransmitterInternal,Cover_RedstoneReceiverExternal,Cover_RedstoneReceiverInternal; public static final ItemList[] DYE_ONLY_ITEMS = {Color_00, Color_01, Color_02, Color_03, Color_04, Color_05, Color_06, Color_07, Color_08, Color_09, Color_10, Color_11, Color_12, Color_13, Color_14, Color_15} diff --git a/main/java/gregtech/api/gui/GT_Container_BasicTank.java b/main/java/gregtech/api/gui/GT_Container_BasicTank.java index 3884ddea..7fe15f74 100644 --- a/main/java/gregtech/api/gui/GT_Container_BasicTank.java +++ b/main/java/gregtech/api/gui/GT_Container_BasicTank.java @@ -2,6 +2,7 @@ package gregtech.api.gui; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; +import gregtech.common.tileentities.storage.GT_MetaTileEntity_QuantumChest; import java.util.Iterator; @@ -39,7 +40,6 @@ public class GT_Container_BasicTank extends GT_ContainerMetaTile_Machine { mContent = ((GT_MetaTileEntity_BasicTank)mTileEntity.getMetaTileEntity()).mFluid.amount; else mContent = 0; - Iterator var2 = this.crafters.iterator(); while (var2.hasNext()) { ICrafting var1 = (ICrafting)var2.next(); diff --git a/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index 95d8cc19..4411c528 100644 --- a/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -184,7 +184,6 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { if (mOutputItems != null) for (ItemStack tStack : mOutputItems) if (tStack != null) addOutput(tStack); if (mOutputFluids != null&&mOutputFluids.length==1) {for (FluidStack tStack : mOutputFluids) if (tStack != null) addOutput(tStack);} else if(mOutputFluids!=null&&mOutputFluids.length>1){ - System.out.println("addfluids"); addFluidOutputs(mOutputFluids);} mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); mOutputItems = null; diff --git a/main/java/gregtech/common/gui/GT_Container_QuantumChest.java b/main/java/gregtech/common/gui/GT_Container_QuantumChest.java new file mode 100644 index 00000000..01c0a953 --- /dev/null +++ b/main/java/gregtech/common/gui/GT_Container_QuantumChest.java @@ -0,0 +1,69 @@ +package gregtech.common.gui; + +import java.util.Iterator; + +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +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 gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; +import gregtech.common.tileentities.storage.GT_MetaTileEntity_QuantumChest; + +public class GT_Container_QuantumChest extends GT_ContainerMetaTile_Machine { + + public GT_Container_QuantumChest(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + @Override + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new Slot(mTileEntity, 0, 80, 17)); + addSlotToContainer(new GT_Slot_Output(mTileEntity, 1, 80, 53)); + addSlotToContainer(new GT_Slot_Render(mTileEntity, 2, 59, 42)); + } + + public int mContent = 0; + + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return; + if (mTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_QuantumChest){ + mContent = ((GT_MetaTileEntity_QuantumChest)mTileEntity.getMetaTileEntity()).mItemCount; + }else{ + mContent = 0;} + + Iterator var2 = this.crafters.iterator(); + while (var2.hasNext()) { + ICrafting var1 = (ICrafting)var2.next(); + var1.sendProgressBarUpdate(this, 100, mContent & 65535); + var1.sendProgressBarUpdate(this, 101, mContent >>> 16); + } + } + + @Override + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 100: mContent = mContent & -65536 | par2; break; + case 101: mContent = mContent & 65535 | par2 << 16; break; + } + } + + @Override + public int getSlotCount() { + return 2; + } + + @Override + public int getShiftClickSlotCount() { + return 1; + } +} diff --git a/main/java/gregtech/common/gui/GT_GUIContainer_QuantumChest.java b/main/java/gregtech/common/gui/GT_GUIContainer_QuantumChest.java new file mode 100644 index 00000000..0838f102 --- /dev/null +++ b/main/java/gregtech/common/gui/GT_GUIContainer_QuantumChest.java @@ -0,0 +1,38 @@ +package gregtech.common.gui; + +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; +import gregtech.api.gui.GT_Container_BasicTank; +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Utility; +import gregtech.common.tileentities.storage.GT_MetaTileEntity_QuantumChest; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.StatCollector; + +public class GT_GUIContainer_QuantumChest extends GT_GUIContainerMetaTile_Machine { + + private final String mName; + + public GT_GUIContainer_QuantumChest(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { + super(new GT_Container_QuantumChest(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "BasicTank.png"); + mName = aName; + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 4210752); + fontRendererObj.drawString(mName, 8, 6, 4210752); + if (mContainer != null) { + fontRendererObj.drawString("Item Amount", 10, 20, 16448255); + fontRendererObj.drawString(GT_Utility.parseNumberToString(((GT_Container_QuantumChest)mContainer).mContent), 10, 30, 16448255); + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + } +} diff --git a/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java b/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java index 2fa6343d..d51d4255 100644 --- a/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java +++ b/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java @@ -42,6 +42,10 @@ import gregtech.api.util.GT_Utility; /* 38: */ import gregtech.common.covers.GT_Cover_ItemMeter; /* 39: */ import gregtech.common.covers.GT_Cover_LiquidMeter; /* 40: */ import gregtech.common.covers.GT_Cover_Pump; +import gregtech.common.covers.GT_Cover_RedstoneReceiverExternal; +import gregtech.common.covers.GT_Cover_RedstoneReceiverInternal; +import gregtech.common.covers.GT_Cover_RedstoneTransmitterExternal; +import gregtech.common.covers.GT_Cover_RedstoneTransmitterInternal; /* 41: */ import gregtech.common.covers.GT_Cover_Screen; /* 42: */ import gregtech.common.covers.GT_Cover_Shutter; /* 43: */ import gregtech.common.covers.GT_Cover_SolarPanel; @@ -754,7 +758,25 @@ import gregtech.api.util.GT_Utility; /* 741: */ /* 742:710 */ GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Good, 4L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.StainlessSteel, 2L), ItemList.Schematic.get(1L, new Object[0]), 3200, 4); /* 743:711 */ GT_Values.RA.addAssemblerRecipe(ItemList.Sensor_LV.get(1L, new Object[0]), ItemList.Emitter_LV.get(1L, new Object[0]), ItemList.NC_SensorKit.get(1L, new Object[0]), 1600, 2); -/* 744: */ } +/* 744: */ + ItemList.Cover_RedstoneTransmitterExternal.set(addItem(tLastID = 741, "Redstone Transmitter (Out)", "Transfers Redstonesignals wireless", new Object[] { new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1L) })); +/* 676:644 */ ItemList.Cover_RedstoneTransmitterInternal.set(addItem(tLastID = 742, "Redstone Transmitter (In)", "Transfers Redstonesignals wireless", new Object[] { new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1L) })); +/* 676:644 */ ItemList.Cover_RedstoneReceiverExternal.set(addItem(tLastID = 746, "Redstone Receiver (Out)", "Transfers Redstonesignals wireless", new Object[] { new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1L) })); +/* 676:644 */ ItemList.Cover_RedstoneReceiverInternal.set(addItem(tLastID = 747, "Redstone Receiver (In)", "Transfers Redstonesignals wireless", new Object[] { new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1L) })); +/* 676:644 */ + GregTech_API.registerCover(ItemList.Cover_RedstoneTransmitterExternal.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ACTIVITYDETECTOR) }), new GT_Cover_RedstoneTransmitterExternal()); +/* 706:674 */ GregTech_API.registerCover(ItemList.Cover_RedstoneTransmitterInternal.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ACTIVITYDETECTOR) }), new GT_Cover_RedstoneTransmitterInternal()); +/* 706:674 */ GregTech_API.registerCover(ItemList.Cover_RedstoneReceiverExternal.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FLUIDDETECTOR) }), new GT_Cover_RedstoneReceiverExternal()); +/* 706:674 */ GregTech_API.registerCover(ItemList.Cover_RedstoneReceiverInternal.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FLUIDDETECTOR) }), new GT_Cover_RedstoneReceiverInternal()); +/* 706:674 */ + GT_Values.RA.addAssemblerRecipe(ItemList.Emitter_EV.get(1L, new Object[0]), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.StainlessSteel, 1L),ItemList.Cover_RedstoneTransmitterExternal.get(1L, new Object[0]) , 3200, 128); +/* 743:711 */ GT_Values.RA.addAssemblerRecipe( ItemList.Sensor_EV.get(1L, new Object[0]), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.StainlessSteel, 1L),ItemList.Cover_RedstoneReceiverExternal.get(1L, new Object[0]), 3200, 128); +/* 743:711 */ GT_ModHandler.addShapelessCraftingRecipe(ItemList.Cover_RedstoneTransmitterInternal.get(1L, new Object[0]), new Object[]{ItemList.Cover_RedstoneTransmitterExternal.get(1L, new Object[0])}); + GT_ModHandler.addShapelessCraftingRecipe(ItemList.Cover_RedstoneReceiverInternal.get(1L, new Object[0]), new Object[]{ItemList.Cover_RedstoneReceiverExternal.get(1L, new Object[0])}); + GT_ModHandler.addShapelessCraftingRecipe(ItemList.Cover_RedstoneTransmitterExternal.get(1L, new Object[0]), new Object[]{ItemList.Cover_RedstoneTransmitterInternal.get(1L, new Object[0])}); + GT_ModHandler.addShapelessCraftingRecipe(ItemList.Cover_RedstoneReceiverExternal.get(1L, new Object[0]), new Object[]{ItemList.Cover_RedstoneReceiverInternal.get(1L, new Object[0])}); + +} /* 745: */ /* 746: */ public boolean onEntityItemUpdate(EntityItem aItemEntity) /* 747: */ { diff --git a/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumChest.java b/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumChest.java new file mode 100644 index 00000000..708fe4b1 --- /dev/null +++ b/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumChest.java @@ -0,0 +1,208 @@ +package gregtech.common.tileentities.storage; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import gregtech.api.enums.Textures; +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_Container_1by1; +import gregtech.api.gui.GT_Container_2by2; +import gregtech.api.gui.GT_Container_3by3; +import gregtech.api.gui.GT_Container_4by4; +import gregtech.api.gui.GT_Container_BasicTank; +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.gui.GT_GUIContainer_1by1; +import gregtech.api.gui.GT_GUIContainer_2by2; +import gregtech.api.gui.GT_GUIContainer_3by3; +import gregtech.api.gui.GT_GUIContainer_4by4; +import gregtech.api.gui.GT_GUIContainer_BasicTank; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; +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; + +public class GT_MetaTileEntity_QuantumChest extends GT_MetaTileEntity_TieredMachineBlock { + public GT_MetaTileEntity_QuantumChest(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 3, "This Chest stores "+((int)((Math.pow(6, aTier))*270000))+" Blocks"); + } + + + public int mItemCount = 0; + public ItemStack mItemStack = null; + + public GT_MetaTileEntity_QuantumChest(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 3, aDescription, aTextures); + } + + @Override public boolean isSimpleMachine() {return true;} + @Override public boolean isFacingValid(byte aFacing) {return true;} + @Override public boolean isAccessAllowed(EntityPlayer aPlayer) {return true;} + @Override public boolean isValidSlot(int aIndex) {return true;} + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_QuantumChest(mName, mTier, mDescription, mTextures); + } + + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) return true; + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + +// public void onRightclick(EntityPlayer aPlayer) +// { +// ItemStack tPlayerItem = aPlayer.inventory.getCurrentItem(); +// if (tPlayerItem == null) +// { +// if (this.mItemID > 0) +// { +// for (int i = 0; (this.mItemCount < getMaxItemCount()) && (i < aPlayer.field_71071_by.func_70302_i_()); i++) +// { +// if ((aPlayer.field_71071_by.func_70301_a(i) != null) && (aPlayer.field_71071_by.func_70301_a(i).field_77993_c == this.mItemID) && (aPlayer.field_71071_by.func_70301_a(i).func_77960_j() == this.mItemMeta) && (!aPlayer.field_71071_by.func_70301_a(i).func_77942_o())) +// { +// this.mItemCount += aPlayer.field_71071_by.func_70301_a(i).field_77994_a; +// if (aPlayer.field_71071_by.func_70301_a(i).field_77994_a == 111) +// { +// this.mItemCount = (getMaxItemCount() + 192 - (this.mItemCount + (this.mInventory[0] == null ? 0 : this.mInventory[0].field_77994_a) + (this.mInventory[1] == null ? 0 : this.mInventory[1].field_77994_a) + (this.mInventory[2] == null ? 0 : this.mInventory[2].field_77994_a))); +// } +// else if (this.mItemCount > getMaxItemCount()) +// { +// aPlayer.field_71071_by.func_70301_a(i).field_77994_a = (this.mItemCount - getMaxItemCount()); +// this.mItemCount = getMaxItemCount(); +// } +// else +// { +// aPlayer.field_71071_by.func_70301_a(i).field_77994_a = 0; +// } +// } +// if ((aPlayer.field_71071_by.func_70301_a(i) != null) && (aPlayer.field_71071_by.func_70301_a(i).field_77994_a <= 0)) { +// aPlayer.field_71071_by.func_70299_a(i, null); +// } +// } +// GT_Utility.sendChatToPlayer(aPlayer, this.mItemCount + (this.mInventory[0] == null ? 0 : this.mInventory[0].field_77994_a) + (this.mInventory[1] == null ? 0 : this.mInventory[1].field_77994_a) + (this.mInventory[2] == null ? 0 : this.mInventory[2].field_77994_a) + " of " + new ItemStack(this.mItemID, 1, this.mItemMeta).func_82833_r()); +// } +// } +// if (aPlayer.field_71069_bz != null) { +// aPlayer.field_71069_bz.func_75142_b(); +// } +// } + + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_QuantumChest(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_QuantumChest(aPlayerInventory, aBaseMetaTileEntity, getLocalName()); + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { + + if (getBaseMetaTileEntity().isServerSide()&& getBaseMetaTileEntity().isAllowedToWork()) + { + if ((getItemCount() <= 0) ){ + this.mItemStack = null; + this.mItemCount = 0; + } + if (this.mItemStack == null&&this.mInventory[0]!=null) + { + this.mItemStack = new ItemStack(mInventory[0].getItem()); + } + if ((this.mInventory[0]!=null)&&(this.mItemCount < getMaxItemCount()) && (this.mInventory[0].getItem() == this.mItemStack.getItem())) + { + this.mItemCount += this.mInventory[0].stackSize; + if (this.mItemCount > getMaxItemCount()) + { + this.mInventory[0].stackSize = (this.mItemCount - getMaxItemCount()); + this.mItemCount = getMaxItemCount(); + } + else + { + this.mInventory[0] = null; + } + } + if (this.mInventory[1] == null) + { + this.mInventory[1] = new ItemStack(mItemStack.getItem(),Math.min(mItemStack.getMaxStackSize(), this.mItemCount)); + this.mItemCount -= this.mInventory[1].stackSize; + } + else if ((this.mItemCount > 0) && (this.mInventory[1].getItem() == this.mItemStack.getItem())&&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]= new ItemStack(this.mItemStack.getItem()); + }else{this.mInventory[2]=null;} + } + } + + private int getItemCount() + { + return this.mItemCount; + } + + 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 getMaxItemCount(); + } + + public int getMaxItemCount() + { + return (int) (((Math.pow(6, mTier))*270000) - 128); + } + + public void setItemCount(int aCount) + { + this.mItemCount = aCount; + } + + @Override + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return true; + } + + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return true; + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setInteger("mItemCount", this.mItemCount); + aNBT.setTag("mItemStack", this.mItemStack.writeToNBT(new NBTTagCompound())); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + this.mItemCount = aNBT.getInteger("mItemCount"); + this.mItemStack = ItemStack.loadItemStackFromNBT((NBTTagCompound) aNBT.getTag("mItemStack")); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity,byte aSide, byte aFacing, byte aColorIndex, boolean aActive,boolean aRedstone) { + return aSide == aBaseMetaTileEntity.getFrontFacing() ? new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1],new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SCREEN)} :new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1]};//aSide != aFacing ? mMachineBlock != 0 ? new ITexture[] {Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]} : new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1]} : mMachineBlock != 0 ? aActive ? getTexturesActive(Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]) : getTexturesInactive(Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]) : aActive ? getTexturesActive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1]) : getTexturesInactive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1]); + } + + @Override + public ITexture[][][] getTextureSet(ITexture[] aTextures) { + return new ITexture[0][0][0]; + } +} \ No newline at end of file diff --git a/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumTank.java b/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumTank.java index 7810ea62..56b06add 100644 --- a/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumTank.java +++ b/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumTank.java @@ -1,126 +1,105 @@ package gregtech.common.tileentities.storage; +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.MetaTileEntity; import gregtech.api.metatileentity.implementations.*; +import gregtech.api.objects.GT_RenderedTexture; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; public class GT_MetaTileEntity_QuantumTank extends GT_MetaTileEntity_BasicTank { - public GT_MetaTileEntity_QuantumTank(int aID, String aName, String aNameRegional) - { - super(aID, aName, aNameRegional, aID, aID, aNameRegional, null); - } - - public boolean unbreakable() - { - return true; - } - - public boolean isSimpleMachine() - { - return false; - } - - public boolean isValidSlot(int aIndex) - { - return aIndex < 2; - } - - public boolean isFacingValid(byte aFacing) - { - return false; - } - - public void onRightclick(EntityPlayer aPlayer) - { - getBaseMetaTileEntity().openGUI(aPlayer, 114); - } - - public boolean isAccessAllowed(EntityPlayer aPlayer) - { - return true; - } - - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) - { - return new GT_MetaTileEntity_QuantumTank(mTier, mDescription, mDescription); - } - - public boolean doesFillContainers() - { - return true; - } - - public boolean doesEmptyContainers() - { - return true; - } - - public boolean canTankBeFilled() - { - return true; - } - - public boolean canTankBeEmptied() - { - return true; - } - - public boolean displaysItemStack() - { - return true; - } - - public boolean displaysStackSize() - { - return false; - } - - public boolean isFluidChangingAllowed() - { - return getBaseMetaTileEntity().isAllowedToWork(); - } - - public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) - { - if (aSide == 0) { - return 38; - } - if (aSide == 1) { - return 37; - } - return 36; - } - - public String[] getDescription() - { - return new String[]{"With a capacity of 488.28125 Chunks!"}; - } - - public int getCapacity() - { - return 2000000000; - } - - public int getTankPressure() - { - return 100; - } + public GT_MetaTileEntity_QuantumTank(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 3, "Stores "+((int)(Math.pow(6, aTier)*270000))+"L of fluid"); + } + + public GT_MetaTileEntity_QuantumTank(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 3, aDescription, aTextures); + } + + @Override + public ITexture[][][] getTextureSet(ITexture[] aTextures) { + return new ITexture[0][0][0]; + } -@Override -public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, - byte aSide, byte aFacing, byte aColorIndex, boolean aActive, - boolean aRedstone) { - // TODO Auto-generated method stub - return null; -} + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + return aSide ==1 ? new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1],new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SCREEN)} :new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1]};//aSide != aFacing ? mMachineBlock != 0 ? new ITexture[] {Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]} : new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1]} : mMachineBlock != 0 ? aActive ? getTexturesActive(Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]) : getTexturesInactive(Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]) : aActive ? getTexturesActive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1]) : getTexturesInactive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1]); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + } + + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) return true; + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + + @Override public boolean isSimpleMachine() {return true;} + @Override public boolean isFacingValid(byte aFacing) {return true;} + @Override public boolean isAccessAllowed(EntityPlayer aPlayer) {return true;} + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + } + + @Override + public final byte getUpdateData() { + return 0x00; + } + + @Override + public boolean doesFillContainers() { + return true; + } + + @Override + public boolean doesEmptyContainers() { + return true; + } + + @Override + public boolean canTankBeFilled() { + return true; + } + + @Override + public boolean canTankBeEmptied() { + return true; + } + + @Override + public boolean displaysItemStack() { + return false; + } + + @Override + public boolean displaysStackSize() { + return false; + } -@Override -public ITexture[][][] getTextureSet(ITexture[] aTextures) { - // TODO Auto-generated method stub - return null; -} -} + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_QuantumTank(mName, mTier, mDescription, mTextures); + } + + @Override + public int getCapacity() { + return (int) (Math.pow(6, mTier)*270000); + } + + @Override + public int getTankPressure() { + return 100; + } + +} \ No newline at end of file diff --git a/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java b/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java index 2c0188c3..6444c8f4 100644 --- a/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java +++ b/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java @@ -76,6 +76,8 @@ import gregtech.common.tileentities.machines.multi.*; /* 79: */ import gregtech.common.tileentities.machines.steam.GT_MetaTileEntity_Macerator_Bronze; /* 80: */ import gregtech.common.tileentities.machines.steam.GT_MetaTileEntity_Macerator_Steel; /* 81: */ import gregtech.common.tileentities.storage.GT_MetaTileEntity_Locker; +import gregtech.common.tileentities.storage.GT_MetaTileEntity_QuantumChest; +import gregtech.common.tileentities.storage.GT_MetaTileEntity_QuantumTank; /* 82: */ import java.io.PrintStream; /* 83: */ import java.util.Map; @@ -84,6 +86,7 @@ import gregtech.common.tileentities.machines.multi.*; import net.minecraft.item.Item; /* 85: */ import net.minecraft.item.ItemStack; /* 86: */ import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.oredict.OreDictionary; /* 87: */ /* 88: */ public class GT_Loader_MetaTileEntities /* 89: */ implements Runnable @@ -272,7 +275,7 @@ import net.minecraft.item.Item; /* 343: 284 */ GT_ModHandler.addCraftingRecipe(ItemList.Hatch_Input_ZPM.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "G", "M", Character.valueOf('M'), ItemList.Hull_ZPM, Character.valueOf('G'), new ItemStack(Blocks.glass, 1) }); /* 344: 285 */ GT_ModHandler.addCraftingRecipe(ItemList.Hatch_Input_UV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "G", "M", Character.valueOf('M'), ItemList.Hull_UV, Character.valueOf('G'), new ItemStack(Blocks.glass, 1) }); /* 345: 286 */ GT_ModHandler.addCraftingRecipe(ItemList.Hatch_Input_MAX.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "G", "M", Character.valueOf('M'), ItemList.Hull_MAX, Character.valueOf('G'), new ItemStack(Blocks.glass, 1) }); -/* 346: */ +/* 346: */ /* 347: 288 */ ItemList.Hatch_Output_ULV.set(new GT_MetaTileEntity_Hatch_Output(60, "hatch.output.tier.00", "Output Hatch", 0).getStackForm(1L)); /* 348: 289 */ ItemList.Hatch_Output_LV.set(new GT_MetaTileEntity_Hatch_Output(61, "hatch.output.tier.01", "Output Hatch", 1).getStackForm(1L)); /* 349: 290 */ ItemList.Hatch_Output_MV.set(new GT_MetaTileEntity_Hatch_Output(62, "hatch.output.tier.02", "Output Hatch", 2).getStackForm(1L)); @@ -284,6 +287,30 @@ import net.minecraft.item.Item; /* 355: 296 */ ItemList.Hatch_Output_UV.set(new GT_MetaTileEntity_Hatch_Output(68, "hatch.output.tier.08", "Output Hatch", 8).getStackForm(1L)); /* 356: 297 */ ItemList.Hatch_Output_MAX.set(new GT_MetaTileEntity_Hatch_Output(69, "hatch.output.tier.09", "Output Hatch", 9).getStackForm(1L)); /* 357: */ + ItemList.Quantum_Tank_LV.set(new GT_MetaTileEntity_QuantumTank(120, "quantum.tank.tier.01", "Quantum Tank I", 1).getStackForm(1L)); +/* 326: 267 */ ItemList.Quantum_Tank_MV.set(new GT_MetaTileEntity_QuantumTank(121, "quantum.tank.tier.02", "Quantum Tank II", 2).getStackForm(1L)); +/* 326: 267 */ ItemList.Quantum_Tank_HV.set(new GT_MetaTileEntity_QuantumTank(122, "quantum.tank.tier.03", "Quantum Tank III", 3).getStackForm(1L)); +/* 326: 267 */ ItemList.Quantum_Tank_EV.set(new GT_MetaTileEntity_QuantumTank(123, "quantum.tank.tier.04", "Quantum Tank IV", 4).getStackForm(1L)); +/* 326: 267 */ ItemList.Quantum_Tank_IV.set(new GT_MetaTileEntity_QuantumTank(124, "quantum.tank.tier.05", "Quantum Tank V", 5).getStackForm(1L)); +/* 326: 267 */ + GT_ModHandler.addCraftingRecipe(ItemList.Quantum_Tank_LV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "DGD", "PMP","DPD", 'M', ItemList.Hull_LV, 'G', ItemList.Field_Generator_LV ,'D',ItemList.Circuit_Parts_Crystal_Chip_Elite,'P',OrePrefixes.plate.get(Materials.StainlessSteel)}); +/* 337: 278 */ GT_ModHandler.addCraftingRecipe(ItemList.Quantum_Tank_MV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "DGD", "PMP","DPD", 'M', ItemList.Hull_MV, 'G', ItemList.Field_Generator_MV ,'D',ItemList.Circuit_Data,'P',OrePrefixes.plate.get(Materials.Titanium)}); +/* 337: 278 */ GT_ModHandler.addCraftingRecipe(ItemList.Quantum_Tank_HV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "DGD", "PMP","DPD", 'M', ItemList.Hull_HV, 'G', ItemList.Field_Generator_HV ,'D',ItemList.Circuit_Elite,'P',OrePrefixes.plate.get(Materials.TungstenSteel)}); +/* 337: 278 */ GT_ModHandler.addCraftingRecipe(ItemList.Quantum_Tank_EV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "DGD", "PMP","DPD", 'M', ItemList.Hull_EV, 'G', ItemList.Field_Generator_EV ,'D',ItemList.Circuit_Master,'P',OrePrefixes.plate.get(Materials.Europium)}); +/* 337: 278 */ GT_ModHandler.addCraftingRecipe(ItemList.Quantum_Tank_IV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "DGD", "PMP","DPD", 'M', ItemList.Hull_IV, 'G', ItemList.Field_Generator_IV ,'D',ItemList.Circuit_Master,'P',OrePrefixes.plate.get(Materials.Americium)}); +/* 337: 278 */ + ItemList.Quantum_Chest_LV.set(new GT_MetaTileEntity_QuantumChest(125, "quantum.chest.tier.01", "Quantum Chest I", 1).getStackForm(1L)); +/* 326: 267 */ ItemList.Quantum_Chest_MV.set(new GT_MetaTileEntity_QuantumChest(126, "quantum.chest.tier.02", "Quantum Chest II", 2).getStackForm(1L)); +/* 326: 267 */ ItemList.Quantum_Chest_HV.set(new GT_MetaTileEntity_QuantumChest(127, "quantum.chest.tier.03", "Quantum Chest III", 3).getStackForm(1L)); +/* 326: 267 */ ItemList.Quantum_Chest_EV.set(new GT_MetaTileEntity_QuantumChest(128, "quantum.chest.tier.04", "Quantum Chest IV", 4).getStackForm(1L)); +/* 326: 267 */ ItemList.Quantum_Chest_IV.set(new GT_MetaTileEntity_QuantumChest(129, "quantum.chest.tier.05", "Quantum Chest V", 5).getStackForm(1L)); +/* 326: 267 */ + GT_ModHandler.addCraftingRecipe(ItemList.Quantum_Chest_LV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "DPD", "PMP","DGD", 'M', ItemList.Hull_LV, 'G', ItemList.Field_Generator_LV ,'D',ItemList.Circuit_Parts_Crystal_Chip_Elite,'P',OrePrefixes.plate.get(Materials.StainlessSteel)}); +/* 337: 278 */ GT_ModHandler.addCraftingRecipe(ItemList.Quantum_Chest_MV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "DPD", "PMP","DGD", 'M', ItemList.Hull_MV, 'G', ItemList.Field_Generator_MV ,'D',ItemList.Circuit_Data,'P',OrePrefixes.plate.get(Materials.Titanium)}); +/* 337: 278 */ GT_ModHandler.addCraftingRecipe(ItemList.Quantum_Chest_HV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "DPD", "PMP","DGD", 'M', ItemList.Hull_HV, 'G', ItemList.Field_Generator_HV ,'D',ItemList.Circuit_Elite,'P',OrePrefixes.plate.get(Materials.TungstenSteel)}); +/* 337: 278 */ GT_ModHandler.addCraftingRecipe(ItemList.Quantum_Chest_EV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "DPD", "PMP","DGD", 'M', ItemList.Hull_EV, 'G', ItemList.Field_Generator_EV ,'D',ItemList.Circuit_Master,'P',OrePrefixes.plate.get(Materials.Europium)}); +/* 337: 278 */ GT_ModHandler.addCraftingRecipe(ItemList.Quantum_Chest_IV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "DPD", "PMP","DGD", 'M', ItemList.Hull_IV, 'G', ItemList.Field_Generator_IV ,'D',ItemList.Circuit_Master,'P',OrePrefixes.plate.get(Materials.Americium)}); +/* 337: 278 */ /* 358: 299 */ GT_ModHandler.addCraftingRecipe(ItemList.Hatch_Output_ULV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "M", "G", Character.valueOf('M'), ItemList.Hull_ULV, Character.valueOf('G'), new ItemStack(Blocks.glass, 1) }); /* 359: 300 */ GT_ModHandler.addCraftingRecipe(ItemList.Hatch_Output_LV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "M", "G", Character.valueOf('M'), ItemList.Hull_LV, Character.valueOf('G'), new ItemStack(Blocks.glass, 1) }); /* 360: 301 */ GT_ModHandler.addCraftingRecipe(ItemList.Hatch_Output_MV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "M", "G", Character.valueOf('M'), ItemList.Hull_MV, Character.valueOf('G'), new ItemStack(Blocks.glass, 1) });