diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2017-08-07 20:44:39 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2017-08-07 20:44:39 +1000 |
commit | 71b99388a66e7b55b2998439f3e32dffd3ce7651 (patch) | |
tree | 0415b5091edd8bc4ec9b7afd6f065f5c139af2bc | |
parent | 8f724ee98f334717842c665a02509ecd27576469 (diff) | |
download | GT5-Unofficial-71b99388a66e7b55b2998439f3e32dffd3ce7651.tar.gz GT5-Unofficial-71b99388a66e7b55b2998439f3e32dffd3ce7651.tar.bz2 GT5-Unofficial-71b99388a66e7b55b2998439f3e32dffd3ce7651.zip |
$ Fixed Shelving.
$ Fixed minor RTG error.
8 files changed, 438 insertions, 363 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index bd35116d70..cb8c0732cd 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -221,7 +221,13 @@ public enum GregtechItemList implements GregtechItemContainer { Gregtech_Computer_Cube, //Cyclotron - COMET_Cyclotron + COMET_Cyclotron, + + //GT4 Multiblocks + GT4_Thermal_Boiler, GT4_Multi_Crafter, + + //GT4 Shelves + GT4_Shelf, GT4_Shelf_Iron, GT4_Shelf_FileCabinet, GT4_Shelf_Desk, GT4_Shelf_Compartment diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java index 8897251334..447d0c7dc3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java @@ -1,17 +1,12 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.generators; -import java.lang.reflect.Field; - -import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gregtech.api.util.Recipe_GT; +import gregtech.api.util.*; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.PollutionUtils; import gtPlusPlus.core.util.Utils; @@ -91,6 +86,7 @@ public class GregtechMetaTileEntity_RTG extends GT_MetaTileEntity_BasicGenerator } } + @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isServerSide()){ if (this.mDayTick < 24000){ @@ -187,49 +183,59 @@ public class GregtechMetaTileEntity_RTG extends GT_MetaTileEntity_BasicGenerator super(aName, aTier, aDescription, aTextures); } + @Override public boolean isOutputFacing(byte aSide) { return ((aSide > 1) && (aSide != getBaseMetaTileEntity().getFrontFacing()) && (aSide != getBaseMetaTileEntity().getBackFacing())); } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntity_RTG(this.mName, this.mTier, this.mDescription, this.mTextures); } + @Override public GT_Recipe.GT_Recipe_Map getRecipes() { return Recipe_GT.Gregtech_Recipe_Map.sRTGFuels; } + @Override public int getCapacity() { return 0; } + @Override public int getEfficiency() { return this.mEfficiency = 100; } + @Override public ITexture[] getFront(byte aColor) { return new ITexture[] { super.getFront(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE) }; } + @Override public ITexture[] getBack(byte aColor) { return new ITexture[] { super.getBack(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP) }; } + @Override public ITexture[] getBottom(byte aColor) { return new ITexture[] { super.getBottom(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP) }; } + @Override public ITexture[] getTop(byte aColor) { return new ITexture[] { super.getTop(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP), new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_FLUID_SIDE) }; } + @Override public ITexture[] getSides(byte aColor) { return new ITexture[]{ gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS[this.mTier][(0)], @@ -237,28 +243,33 @@ public class GregtechMetaTileEntity_RTG extends GT_MetaTileEntity_BasicGenerator gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[getTier()]}; } + @Override public ITexture[] getFrontActive(byte aColor) { return new ITexture[] { super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE) }; } + @Override public ITexture[] getBackActive(byte aColor) { return new ITexture[] { super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP_ACTIVE) }; } + @Override public ITexture[] getBottomActive(byte aColor) { return new ITexture[] { super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP_ACTIVE) }; } + @Override public ITexture[] getTopActive(byte aColor) { return new ITexture[] { super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_FLUID_SIDE_ACTIVE) }; } + @Override public ITexture[] getSidesActive(byte aColor) { return new ITexture[]{ gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS[this.mTier][(0)], @@ -266,10 +277,12 @@ public class GregtechMetaTileEntity_RTG extends GT_MetaTileEntity_BasicGenerator gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[getTier()]}; } + @Override public int getPollution() { return 0; } + @Override public int getFuelValue(ItemStack aStack) { if ((GT_Utility.isStackInvalid(aStack)) || (getRecipes() == null)) return 0; @@ -301,7 +314,7 @@ public class GregtechMetaTileEntity_RTG extends GT_MetaTileEntity_BasicGenerator else { mTier2 = 0; } - ReflectionUtils.setByte(super.getClass(), "mTier", (byte) mTier2); + ReflectionUtils.setByte(super.getClass(), "mTier", mTier2); //ReflectionUtils.setFinalStatic(mTier2, GT_Values.V[0]); } catch (Exception e) { Utils.LOG_INFO("Failed setting mTier."); @@ -342,7 +355,7 @@ public class GregtechMetaTileEntity_RTG extends GT_MetaTileEntity_BasicGenerator @Override public String[] getInfoData() { return new String[] { "RTG", "Active:"+this.getBaseMetaTileEntity().isActive(), "Current Output: " + this.mVoltage + " EU/t", - "Days of Fuel remaining: "+(mTicksToBurnFor/20/60/20)), + "Days of Fuel remaining: "+(mTicksToBurnFor/20/60/20), "Hours of Fuel remaining: "+(mTicksToBurnFor/20/60/60), "Current Recipe input: "+ this.mCurrentRecipe != null ? this.mCurrentRecipe.mInputs[0].getDisplayName() + " x1" : "NUll" }; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf.java index ca5cf4af98..9960b0e4e8 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf.java @@ -1,178 +1,212 @@ -package gregtechmod.common.tileentities.storage; +package gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving; -import gregtechmod.api.enums.GT_Items; -import gregtechmod.api.enums.OrePrefixes; -import gregtechmod.api.interfaces.IGregTechTileEntity; -import gregtechmod.api.metatileentity.MetaTileEntity; -import gregtechmod.api.util.GT_Utility; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.lib.CORE; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -public class GT_MetaTileEntity_Shelf - extends MetaTileEntity +public class GT4Entity_Shelf +extends MetaTileEntity { - public byte mType = 0; - - public GT_MetaTileEntity_Shelf(int aID, String aName, String aNameRegional) - { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_Shelf() {} - - public boolean isSimpleMachine() - { - return true; - } - - public int getInvSize() - { - return 1; - } - - public boolean isFacingValid(byte aFacing) - { - return aFacing > 1; - } - - public boolean isAccessAllowed(EntityPlayer aPlayer) - { - return true; - } - - public boolean ownerControl() - { - return false; - } - - public boolean isEnetOutput() - { - return false; - } - - public boolean isEnetInput() - { - return false; - } - - public boolean isOutputFacing(byte aSide) - { - return false; - } - - public boolean isInputFacing(byte aSide) - { - return false; - } - - public void onRightclick(EntityPlayer aPlayer) - { - ItemStack tStack = aPlayer.field_71071_by.func_70301_a(aPlayer.field_71071_by.field_70461_c); - if (tStack == null) - { - if ((this.mInventory[0] != null) && (this.mInventory[0].field_77994_a > 0)) - { - aPlayer.field_71071_by.func_70299_a(aPlayer.field_71071_by.field_70461_c, this.mInventory[0]); - getBaseMetaTileEntity().func_70299_a(0, null); - this.mType = 0; - } - } - else if (this.mInventory[0] == null) { - if (OrePrefixes.paper.contains(tStack)) - { - aPlayer.field_71071_by.func_70299_a(aPlayer.field_71071_by.field_70461_c, null); - getBaseMetaTileEntity().func_70299_a(0, tStack); - this.mType = 1; - } - else if (OrePrefixes.book.contains(tStack)) - { - aPlayer.field_71071_by.func_70299_a(aPlayer.field_71071_by.field_70461_c, null); - getBaseMetaTileEntity().func_70299_a(0, tStack); - this.mType = 2; - } - else if ((GT_Items.IC2_Food_Can_Filled.isStackEqual(tStack, true, true)) || (GT_Items.IC2_Food_Can_Spoiled.isStackEqual(tStack, true, true)) || (GT_Items.IC2_Food_Can_Empty.isStackEqual(tStack, false, true))) - { - aPlayer.field_71071_by.func_70299_a(aPlayer.field_71071_by.field_70461_c, null); - getBaseMetaTileEntity().func_70299_a(0, tStack); - this.mType = 3; - } - } - } - - public void onLeftclick(EntityPlayer aPlayer) - { - if ((this.mInventory[0] != null) && (this.mInventory[0].field_77994_a > 0)) - { - ItemStack tOutput = GT_Utility.copy(new Object[] { this.mInventory[0] }); - if (!aPlayer.func_70093_af()) { - tOutput.field_77994_a = 1; - } - getBaseMetaTileEntity().func_70298_a(0, tOutput.field_77994_a); - EntityItem tEntity = new EntityItem(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 1) + 0.5D, getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1) + 0.5D, getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1) + 0.5D, tOutput); - tEntity.field_70159_w = 0.0D; - tEntity.field_70181_x = 0.0D; - tEntity.field_70179_y = 0.0D; - getBaseMetaTileEntity().getWorld().func_72838_d(tEntity); - if (this.mInventory[0] == null) { - this.mType = 0; - } - } - } - - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) - { - return new GT_MetaTileEntity_Shelf(); - } - - public void saveNBTData(NBTTagCompound aNBT) - { - aNBT.func_74768_a("mType", this.mType); - } - - public void loadNBTData(NBTTagCompound aNBT) - { - this.mType = ((byte)aNBT.func_74762_e("mType")); - } - - public void onValueUpdate(byte aValue) - { - this.mType = aValue; - } - - public byte getUpdateData() - { - return this.mType; - } - - public boolean allowCoverOnSide(byte aSide, int aCoverID) - { - return aSide != getBaseMetaTileEntity().getFrontFacing(); - } - - public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) - { - if (aSide == aFacing) { - return 208 + this.mType; - } - return 10; - } - - public String getDescription() - { - return "Decorative Item Storage"; - } - - public boolean allowPullStack(int aIndex, byte aSide, ItemStack aStack) - { - return false; - } - - public boolean allowPutStack(int aIndex, byte aSide, ItemStack aStack) - { - return false; - } + public byte mType = 0; + + public GT4Entity_Shelf(int aID, String aName, String aNameRegional) + { + super(aID, aName, aNameRegional, 1); + } + + public GT4Entity_Shelf(String aName) + { + super(aName, 1); + } + + @Override + public boolean isSimpleMachine() + { + return true; + } + + public int getInvSize() + { + return 1; + } + + @Override + public boolean isFacingValid(byte aFacing) + { + return aFacing > 1; + } + + @Override + public boolean isAccessAllowed(EntityPlayer aPlayer) + { + return true; + } + + @Override + public boolean ownerControl() + { + return false; + } + + @Override + public boolean isEnetOutput() + { + return false; + } + + @Override + public boolean isEnetInput() + { + return false; + } + + @Override + public boolean isOutputFacing(byte aSide) + { + return false; + } + + @Override + public boolean isInputFacing(byte aSide) + { + return false; + } + + public void onRightclick(EntityPlayer aPlayer) + { + ItemStack tStack = aPlayer.inventory.getStackInSlot(aPlayer.inventory.currentItem); + if (tStack == null) + { + if ((this.mInventory[0] != null) && (this.mInventory[0].stackSize > 0)) + { + aPlayer.inventory.setInventorySlotContents(aPlayer.inventory.currentItem, this.mInventory[0]); + getBaseMetaTileEntity().setInventorySlotContents(0, null); + this.mType = 0; + } + } + else if (this.mInventory[0] == null) { + if (OrePrefixes.paper.contains(tStack)) + { + aPlayer.inventory.setInventorySlotContents(aPlayer.inventory.currentItem, null); + getBaseMetaTileEntity().setInventorySlotContents(0, tStack); + this.mType = 1; + } + else if (OrePrefixes.book.contains(tStack)) + { + aPlayer.inventory.setInventorySlotContents(aPlayer.inventory.currentItem, null); + getBaseMetaTileEntity().setInventorySlotContents(0, tStack); + this.mType = 2; + } + else if ((ItemList.IC2_Food_Can_Filled.isStackEqual(tStack, true, true)) || (ItemList.IC2_Food_Can_Spoiled.isStackEqual(tStack, true, true)) || (ItemList.IC2_Food_Can_Empty.isStackEqual(tStack, false, true))) + { + aPlayer.inventory.setInventorySlotContents(aPlayer.inventory.currentItem, null); + getBaseMetaTileEntity().setInventorySlotContents(0, tStack); + this.mType = 3; + } + } + } + + public void onLeftclick(EntityPlayer aPlayer) + { + if ((this.mInventory[0] != null) && (this.mInventory[0].stackSize > 0)) + { + ItemStack tOutput = GT_Utility.copy(new Object[] { this.mInventory[0] }); + if (!aPlayer.isSneaking()) { + tOutput.stackSize = 1; + } + getBaseMetaTileEntity().decrStackSize(0, tOutput.stackSize); + EntityItem tEntity = new EntityItem(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 1) + 0.5D, getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1) + 0.5D, getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1) + 0.5D, tOutput); + tEntity.motionX = 0.0D; + tEntity.motionY = 0.0D; + tEntity.motionZ = 0.0D; + getBaseMetaTileEntity().getWorld().spawnEntityInWorld(tEntity); + if (this.mInventory[0] == null) { + this.mType = 0; + } + } + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) + { + return new GT4Entity_Shelf(this.mName); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) + { + aNBT.setInteger("mType", this.mType); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) + { + this.mType = ((byte)aNBT.getInteger("mType")); + } + + @Override + public void onValueUpdate(byte aValue) + { + this.mType = aValue; + } + + @Override + public byte getUpdateData() + { + return this.mType; + } + + public boolean allowCoverOnSide(byte aSide, int aCoverID) + { + return aSide != getBaseMetaTileEntity().getFrontFacing(); + } + + public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) + { + if (aSide == aFacing) { + return 208 + this.mType; + } + return 10; + } + + @Override + public String[] getDescription() + { + return new String[]{ + "Decorative Item Storage", + CORE.GT_Tooltip + }; + } + + + + @Override + public byte getTileEntityBaseType() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public boolean allowPullStack(IGregTechTileEntity p0, int p1, byte p2, ItemStack p3) { + return false; + } + + @Override + public boolean allowPutStack(IGregTechTileEntity p0, int p1, byte p2, ItemStack p3) { + return false; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity p0, byte p1, byte p2, byte p3, boolean p4, boolean p5) { + // TODO Auto-generated method stub + return null; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Compartment.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Compartment.java index 63a18f854d..91300a2d22 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Compartment.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Compartment.java @@ -1,108 +1,115 @@ -package gregtechmod.common.tileentities.storage; +package gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import gregtechmod.api.interfaces.IGregTechTileEntity; -import gregtechmod.api.metatileentity.MetaTileEntity; -import gregtechmod.api.util.GT_Utility; -import net.minecraft.client.renderer.texture.IconRegister; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.util.GT_Utility; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; -import net.minecraft.world.World; +import net.minecraft.util.IIcon; -public class GT_MetaTileEntity_Shelf_Compartment - extends GT_MetaTileEntity_Shelf +public class GT4Entity_Shelf_Compartment +extends GT4Entity_Shelf { - public static Icon[] sIconList = new Icon['?']; - - public GT_MetaTileEntity_Shelf_Compartment(int aID, String aName, String aNameRegional) - { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_Shelf_Compartment() {} - - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) - { - return new GT_MetaTileEntity_Shelf_Compartment(); - } - - public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) - { - if (aSide == 0) { - return 32; - } - if (aSide == 1) { - return 29; - } - return 40; - } - - public boolean allowCoverOnSide(byte aSide, int aCoverID) - { - return aSide != getBaseMetaTileEntity().getFrontFacing(); - } - - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) - { - if (aSide == getBaseMetaTileEntity().getFrontFacing()) { - this.mType = ((byte)((this.mType + 1) % 16)); - } - } - - public Icon getTextureIcon(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) - { - return aSide == aFacing ? sIconList[this.mType] : null; - } - - @SideOnly(Side.CLIENT) - public void registerIcons(IconRegister aBlockIconRegister) - { - for (int i = 0; i < 32; i++) { - sIconList[i] = aBlockIconRegister.func_94245_a("gregtech_addon:tile.Compartment/" + i); - } - } - - public void onLeftclick(EntityPlayer aPlayer) - { - if ((this.mInventory[0] != null) && (this.mInventory[0].field_77994_a > 0)) - { - ItemStack tOutput = GT_Utility.copy(new Object[] { this.mInventory[0] }); - if (!aPlayer.func_70093_af()) { - tOutput.field_77994_a = 1; - } - getBaseMetaTileEntity().func_70298_a(0, tOutput.field_77994_a); - EntityItem tEntity = new EntityItem(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 1) + 0.5D, getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1) + 0.5D, getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1) + 0.5D, tOutput); - tEntity.field_70159_w = 0.0D; - tEntity.field_70181_x = 0.0D; - tEntity.field_70179_y = 0.0D; - getBaseMetaTileEntity().getWorld().func_72838_d(tEntity); - } - } - - public void onRightclick(EntityPlayer aPlayer) - { - ItemStack tStack = aPlayer.field_71071_by.func_70301_a(aPlayer.field_71071_by.field_70461_c); - if (tStack == null) - { - if ((this.mInventory[0] != null) && (this.mInventory[0].field_77994_a > 0)) - { - aPlayer.field_71071_by.func_70299_a(aPlayer.field_71071_by.field_70461_c, this.mInventory[0]); - getBaseMetaTileEntity().func_70299_a(0, null); - } - } - else if (this.mInventory[0] == null) - { - aPlayer.field_71071_by.func_70299_a(aPlayer.field_71071_by.field_70461_c, null); - getBaseMetaTileEntity().func_70299_a(0, tStack); - } - } - - public boolean allowPullStack(int aIndex, byte aSide, ItemStack aStack) - { - return aIndex == 0; - } + public static IIcon[] sIconList = new IIcon['?']; + + public GT4Entity_Shelf_Compartment(int aID, String aName, String aNameRegional) + { + super(aID, aName, aNameRegional); + } + + public GT4Entity_Shelf_Compartment(String mName) { + super(mName); + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) + { + return new GT4Entity_Shelf_Compartment(this.mName); + } + + @Override + public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) + { + if (aSide == 0) { + return 32; + } + if (aSide == 1) { + return 29; + } + return 40; + } + + @Override + public boolean allowCoverOnSide(byte aSide, int aCoverID) + { + return aSide != getBaseMetaTileEntity().getFrontFacing(); + } + + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) + { + if (aSide == getBaseMetaTileEntity().getFrontFacing()) { + this.mType = ((byte)((this.mType + 1) % 16)); + } + } + + public IIcon getTextureIcon(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) + { + return aSide == aFacing ? sIconList[this.mType] : null; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) + { + for (int i = 0; i < 32; i++) { + sIconList[i] = aBlockIconRegister.registerIcon("gregtech_addon:tile.Compartment/" + i); + } + } + + @Override + public void onLeftclick(EntityPlayer aPlayer) + { + if ((this.mInventory[0] != null) && (this.mInventory[0].stackSize > 0)) + { + ItemStack tOutput = GT_Utility.copy(new Object[] { this.mInventory[0] }); + if (!aPlayer.isSneaking()) { + tOutput.stackSize = 1; + } + getBaseMetaTileEntity().decrStackSize(0, tOutput.stackSize); + EntityItem tEntity = new EntityItem(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 1) + 0.5D, getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1) + 0.5D, getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1) + 0.5D, tOutput); + tEntity.motionX = 0.0D; + tEntity.motionY = 0.0D; + tEntity.motionZ = 0.0D; + getBaseMetaTileEntity().getWorld().spawnEntityInWorld(tEntity); + } + } + + @Override + public void onRightclick(EntityPlayer aPlayer) + { + ItemStack tStack = aPlayer.inventory.getStackInSlot(aPlayer.inventory.currentItem); + if (tStack == null) + { + if ((this.mInventory[0] != null) && (this.mInventory[0].stackSize > 0)) + { + aPlayer.inventory.setInventorySlotContents(aPlayer.inventory.currentItem, this.mInventory[0]); + getBaseMetaTileEntity().setInventorySlotContents(0, null); + } + } + else if (this.mInventory[0] == null) + { + aPlayer.inventory.setInventorySlotContents(aPlayer.inventory.currentItem, null); + getBaseMetaTileEntity().setInventorySlotContents(0, tStack); + } + } + + public boolean allowPullStack(int aIndex, byte aSide, ItemStack aStack) + { + return aIndex == 0; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Desk.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Desk.java index 6514022338..034b48e3f2 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Desk.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Desk.java @@ -1,27 +1,30 @@ -package gregtechmod.common.tileentities.storage; +package gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving; -import gregtechmod.api.interfaces.IGregTechTileEntity; -import gregtechmod.api.metatileentity.MetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -public class GT_MetaTileEntity_Shelf_Desk - extends GT_MetaTileEntity_Shelf +public class GT4Entity_Shelf_Desk + extends GT4Entity_Shelf { - public GT_MetaTileEntity_Shelf_Desk(int aID, String aName, String aNameRegional) + public GT4Entity_Shelf_Desk(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } - public GT_MetaTileEntity_Shelf_Desk() {} + public GT4Entity_Shelf_Desk(String mName) { + super(mName); + } - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) + @Override +public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Shelf_Desk(); + return new GT4Entity_Shelf_Desk(this.mName); } - public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) + @Override +public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { return 222; @@ -35,22 +38,23 @@ public class GT_MetaTileEntity_Shelf_Desk return 40; } - public void onRightclick(EntityPlayer aPlayer) + @Override +public void onRightclick(EntityPlayer aPlayer) { - ItemStack tStack = aPlayer.field_71071_by.func_70301_a(aPlayer.field_71071_by.field_70461_c); + ItemStack tStack = aPlayer.inventory.getStackInSlot(aPlayer.inventory.currentItem); if (tStack == null) { - if ((this.mInventory[0] != null) && (this.mInventory[0].field_77994_a > 0)) + if ((this.mInventory[0] != null) && (this.mInventory[0].stackSize > 0)) { - aPlayer.field_71071_by.func_70299_a(aPlayer.field_71071_by.field_70461_c, this.mInventory[0]); - getBaseMetaTileEntity().func_70299_a(0, null); + aPlayer.inventory.setInventorySlotContents(aPlayer.inventory.currentItem, this.mInventory[0]); + getBaseMetaTileEntity().setInventorySlotContents(0, null); this.mType = 0; } } else if (this.mInventory[0] == null) { - aPlayer.field_71071_by.func_70299_a(aPlayer.field_71071_by.field_70461_c, null); - getBaseMetaTileEntity().func_70299_a(0, tStack); + aPlayer.inventory.setInventorySlotContents(aPlayer.inventory.currentItem, null); + getBaseMetaTileEntity().setInventorySlotContents(0, tStack); } } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_FileCabinet.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_FileCabinet.java index f888325b09..048b318e7a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_FileCabinet.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_FileCabinet.java @@ -1,34 +1,38 @@ -package gregtechmod.common.tileentities.storage; +package gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving; -import gregtechmod.api.interfaces.IGregTechTileEntity; -import gregtechmod.api.metatileentity.MetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; -public class GT_MetaTileEntity_Shelf_FileCabinet - extends GT_MetaTileEntity_Shelf +public class GT4Entity_Shelf_FileCabinet +extends GT4Entity_Shelf { - public GT_MetaTileEntity_Shelf_FileCabinet(int aID, String aName, String aNameRegional) - { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_Shelf_FileCabinet() {} - - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) - { - return new GT_MetaTileEntity_Shelf_FileCabinet(); - } - - public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) - { - if (aSide == aFacing) { - return 223; - } - if (aSide == 0) { - return 32; - } - if (aSide == 1) { - return 29; - } - return 40; - } + public GT4Entity_Shelf_FileCabinet(int aID, String aName, String aNameRegional) + { + super(aID, aName, aNameRegional); + } + + public GT4Entity_Shelf_FileCabinet(String mName) { + super(mName); + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) + { + return new GT4Entity_Shelf_FileCabinet(this.mName); + } + + @Override + public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) + { + if (aSide == aFacing) { + return 223; + } + if (aSide == 0) { + return 32; + } + if (aSide == 1) { + return 29; + } + return 40; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Iron.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Iron.java index bad2dc72dd..8b54128af4 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Iron.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Iron.java @@ -1,34 +1,38 @@ -package gregtechmod.common.tileentities.storage; +package gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving; -import gregtechmod.api.interfaces.IGregTechTileEntity; -import gregtechmod.api.metatileentity.MetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; -public class GT_MetaTileEntity_Shelf_Iron - extends GT_MetaTileEntity_Shelf +public class GT4Entity_Shelf_Iron +extends GT4Entity_Shelf { - public GT_MetaTileEntity_Shelf_Iron(int aID, String aName, String aNameRegional) - { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_Shelf_Iron() {} - - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) - { - return new GT_MetaTileEntity_Shelf_Iron(); - } - - public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) - { - if (aSide == aFacing) { - return 216 + this.mType; - } - if (aSide == 0) { - return 32; - } - if (aSide == 1) { - return 29; - } - return 40; - } + public GT4Entity_Shelf_Iron(int aID, String aName, String aNameRegional) + { + super(aID, aName, aNameRegional); + } + + public GT4Entity_Shelf_Iron(String mName) { + super(mName); + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) + { + return new GT4Entity_Shelf_Iron(this.mName); + } + + @Override + public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) + { + if (aSide == aFacing) { + return 216 + this.mType; + } + if (aSide == 0) { + return 32; + } + if (aSide == 1) { + return 29; + } + return 40; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java index 9139da59df..95c1f6c73f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java @@ -5,6 +5,9 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractGenerator; import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractTerminal; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.GT4Entity_AutoCrafter; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.GT4Entity_ThermalBoiler; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving.*; public class Gregtech4Content { @@ -32,13 +35,13 @@ public class Gregtech4Content private static void thermalBoiler(){ //Gregtech 4 Workbenches Utils.LOG_INFO("Gregtech 4 Content | Registering Thermal Boiler."); - GregtechItemList.GT4_Thermal_Boiler.set(new GT_MetaTileEntity_Multi_ThermalBoiler(810, "gtplusplus.thermal.boiler", "Thermal Boiler").getStackForm(1L)); + GregtechItemList.GT4_Thermal_Boiler.set(new GT4Entity_ThermalBoiler(810, "gtplusplus.thermal.boiler", "Thermal Boiler").getStackForm(1L)); } private static void multiCrafter(){ //Gregtech 4 Workbenches Utils.LOG_INFO("Gregtech 4 Content | Registering Multiblock Crafter."); - GregtechItemList.GT4_Multi_Crafter.set(new GT_MetaTileEntity_TesseractTerminal(811, "tesseract.terminal", "Tesseract Terminal", 4).getStackForm(1L)); + GregtechItemList.GT4_Multi_Crafter.set(new GT4Entity_AutoCrafter(811, "gtplusplus.autocrafter.multi", "Large Autocrafter").getStackForm(1L)); } private static void tesseracts(){ @@ -51,11 +54,11 @@ public class Gregtech4Content private static void shelves(){ //Gregtech 4 Workbenches Utils.LOG_INFO("Gregtech 4 Content | Registering Shelves."); - GregtechItemList.GT4_Shelf.set(new GT_MetaTileEntity_Shelf(870, "gtplusplus.shelf.wooden", "Wood encased Shelf").getStackForm(1L)); - GregtechItemList.GT4_Shelf_Iron.set(new GT_MetaTileEntity_Shelf_Iron(871, "gtplusplus.shelf.iron", "Metal encased Shelf").getStackForm(1L)); - GregtechItemList.GT4_Shelf_FileCabinet.set(new GT_MetaTileEntity_Shelf_FileCabinet(872, "gtplusplus.shelf.filecabinet", "File Cabinet").getStackForm(1L)); - GregtechItemList.GT4_Shelf_Desk.set(new GT_MetaTileEntity_Shelf_Desk8(873, "gtplusplus.shelf.desk", "Metal encased Desk").getStackForm(1L)); - GregtechItemList.GT4_Shelf_Compartment.set(new GT_MetaTileEntity_Shelf_Compartment(874, "gtplusplus.shelf.compartment", "Compartment").getStackForm(1L)); + GregtechItemList.GT4_Shelf.set(new GT4Entity_Shelf(870, "gtplusplus.shelf.wooden", "Wood encased Shelf").getStackForm(1L)); + GregtechItemList.GT4_Shelf_Iron.set(new GT4Entity_Shelf_Iron(871, "gtplusplus.shelf.iron", "Metal encased Shelf").getStackForm(1L)); + GregtechItemList.GT4_Shelf_FileCabinet.set(new GT4Entity_Shelf_FileCabinet(872, "gtplusplus.shelf.filecabinet", "File Cabinet").getStackForm(1L)); + GregtechItemList.GT4_Shelf_Desk.set(new GT4Entity_Shelf_Desk(873, "gtplusplus.shelf.desk", "Metal encased Desk").getStackForm(1L)); + GregtechItemList.GT4_Shelf_Compartment.set(new GT4Entity_Shelf_Compartment(874, "gtplusplus.shelf.compartment", "Compartment").getStackForm(1L)); } } |