diff options
author | Alkalus <draknyte1@hotmail.com> | 2017-08-07 02:51:38 +0000 |
---|---|---|
committer | Alkalus <draknyte1@hotmail.com> | 2017-08-07 02:51:38 +0000 |
commit | 2c3cf059795ac4f601f8647dac3fb0b2ef1ddd25 (patch) | |
tree | af8e1608333b0e90baa3537e4bb60d16f7ae90c0 /src/Java/gtPlusPlus/xmod | |
parent | 2e3b94c761f4c5c55b99325381f359d755371d9b (diff) | |
download | GT5-Unofficial-2c3cf059795ac4f601f8647dac3fb0b2ef1ddd25.tar.gz GT5-Unofficial-2c3cf059795ac4f601f8647dac3fb0b2ef1ddd25.tar.bz2 GT5-Unofficial-2c3cf059795ac4f601f8647dac3fb0b2ef1ddd25.zip |
+ Added The Thermal Boiler, Multiblock Crafter and Shelving from GT4.
> This code will need a small rewrite to support GT5 functionality.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod')
8 files changed, 725 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java new file mode 100644 index 0000000000..de1b4c1491 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java @@ -0,0 +1,126 @@ +package gregtechmod.common.tileentities.machines.multi; + +import gregtechmod.api.interfaces.IGregTechTileEntity; +import gregtechmod.api.metatileentity.MetaTileEntity; +import gregtechmod.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +public class GT_MetaTileEntity_Multi_AutoCrafter + extends GT_MetaTileEntity_MultiBlockBase +{ + public boolean isFacingValid(byte aFacing) + { + return aFacing > 1; + } + + public void onRightclick(EntityPlayer aPlayer) {} + + public GT_MetaTileEntity_Multi_AutoCrafter(int aID, String aName, String aNameRegional) + { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_Multi_AutoCrafter() {} + + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) + { + return new GT_MetaTileEntity_Multi_AutoCrafter(); + } + + public boolean isCorrectMachinePart(ItemStack aStack) + { + return true; + } + + public int getDamageToComponent(ItemStack aStack) + { + return 0; + } + + public boolean checkRecipe(ItemStack aStack) + { + return false; + } + + public boolean onRunningTick(ItemStack aStack) + { + return true; + } + + public boolean checkMachine(ItemStack aStack) + { + byte tSide = getBaseMetaTileEntity().getBackFacing(); + if (getBaseMetaTileEntity().getAirAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 1)) + { + if (((getBaseMetaTileEntity().getBlockAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 2) != gregtechmod.api.GregTech_API.sBlockList[0]) || (getBaseMetaTileEntity().getMetaIDAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 2) != 15)) && + (!addToMachineList(getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 2)))) { + return false; + } + int tX = getBaseMetaTileEntity().getXCoord();int tY = getBaseMetaTileEntity().getYCoord();int tZ = getBaseMetaTileEntity().getZCoord(); + for (byte i = -1; i < 2; i = (byte)(i + 1)) { + for (byte j = -1; j < 2; j = (byte)(j + 1)) { + if ((i != 0) || (j != 0)) { + for (byte k = 0; k < 5; k = (byte)(k + 1)) { + if (((i == 0) || (j == 0)) && (k > 0) && (k < 4)) + { + if (getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == gregtechmod.api.GregTech_API.sBlockList[0]) + { + if (getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == 15) {} + } + else if (!addToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)))) { + return false; + } + } + else if (getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == gregtechmod.api.GregTech_API.sBlockList[0]) + { + if (getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == 15) {} + } + else { + return false; + } + } + } + } + } + } + else + { + return false; + } + return true; + } + + public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) + { + if (aSide == aFacing) { + return aActive ? 84 : 83; + } + return super.getTextureIndex(aSide, aFacing, aActive, aRedstone); + } + + public boolean explodesOnComponentBreak(ItemStack aStack) + { + return false; + } + + public int getMaxEfficiency(ItemStack aStack) + { + return 10000; + } + + public int getPollutionPerTick(ItemStack aStack) + { + return 0; + } + + public int getAmountOfOutputs() + { + return 1; + } + + public String getDescription() + { + return "Highly Advanced Autocrafter"; + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java new file mode 100644 index 0000000000..5a172f0f43 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java @@ -0,0 +1,163 @@ +package gregtechmod.common.tileentities.machines.multi; + +import gregtechmod.api.GregTech_API; +import gregtechmod.api.enums.GT_Items; +import gregtechmod.api.interfaces.IGregTechTileEntity; +import gregtechmod.api.metatileentity.MetaTileEntity; +import gregtechmod.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtechmod.api.util.GT_ModHandler; +import gregtechmod.api.util.GT_Recipe; +import gregtechmod.api.util.GT_Utility; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +public class GT_MetaTileEntity_Multi_ThermalBoiler + extends GT_MetaTileEntity_MultiBlockBase +{ + public boolean isFacingValid(byte aFacing) + { + return aFacing > 1; + } + + public void onRightclick(EntityPlayer aPlayer) + { + getBaseMetaTileEntity().openGUI(aPlayer, 158, GregTech_API.gregtechmod); + } + + public GT_MetaTileEntity_Multi_ThermalBoiler(int aID, String aName, String aNameRegional) + { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_Multi_ThermalBoiler() {} + + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) + { + return new GT_MetaTileEntity_Multi_ThermalBoiler(); + } + + public boolean isCorrectMachinePart(ItemStack aStack) + { + return true; + } + + public int getDamageToComponent(ItemStack aStack) + { + return GT_Utility.areStacksEqual(aStack, GT_Items.Component_LavaFilter.getWildcard(1L, new Object[0])) ? 1 : 0; + } + + public boolean checkRecipe(ItemStack aStack) + { + for (GT_Recipe tRecipe : GT_Recipe.sHotFuels) { + if (depleteInput(tRecipe.getRepresentativeInput(0))) + { + this.mEUt = 400; + this.mMaxProgresstime = (tRecipe.mStartEU * 2 / 5); + this.mEfficiencyIncrease = (this.mMaxProgresstime * 30); + if (tRecipe.getOutput(0) != null) { + this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(0) }) }; + } + if (GT_Utility.areStacksEqual(aStack, GT_Items.Component_LavaFilter.getWildcard(1L, new Object[0]))) { + if ((tRecipe.getOutput(1) != null) && (getBaseMetaTileEntity().getRandomNumber(1000) < 100)) { + this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(1) }) }; + } else if ((tRecipe.getOutput(2) != null) && (getBaseMetaTileEntity().getRandomNumber(900) < 50)) { + this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(2) }) }; + } else if ((tRecipe.getOutput(3) != null) && (getBaseMetaTileEntity().getRandomNumber(850) < 25)) { + this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(3) }) }; + } + } + return true; + } + } + return false; + } + + public boolean onRunningTick(ItemStack aStack) + { + if (this.mEUt > 0) + { + int tGeneratedEU = (int)(this.mEUt * 2L * this.mEfficiency / 10000L); + if ((tGeneratedEU > 0) && (depleteInput(GT_ModHandler.getWater((tGeneratedEU + 160) / 160)))) { + addOutput(GT_ModHandler.getSteam(tGeneratedEU)); + } + return true; + } + return true; + } + + public boolean checkMachine(ItemStack aStack) + { + byte tSide = getBaseMetaTileEntity().getBackFacing(); + if (getBaseMetaTileEntity().getAirAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 1)) + { + if (((getBaseMetaTileEntity().getBlockAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 2) != GregTech_API.sBlockList[0]) || (getBaseMetaTileEntity().getMetaIDAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 2) != 14)) && + (!addToMachineList(getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 2)))) { + return false; + } + int tX = getBaseMetaTileEntity().getXCoord();int tY = getBaseMetaTileEntity().getYCoord();int tZ = getBaseMetaTileEntity().getZCoord(); + for (byte i = -1; i < 2; i = (byte)(i + 1)) { + for (byte j = -1; j < 2; j = (byte)(j + 1)) { + if ((i != 0) || (j != 0)) { + for (byte k = 0; k < 3; k = (byte)(k + 1)) { + if (((i == 0) || (j == 0)) && (k == 1)) + { + if (getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == GregTech_API.sBlockList[0]) + { + if (getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == 14) {} + } + else if (!addToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)))) { + return false; + } + } + else if (getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == GregTech_API.sBlockList[0]) + { + if (getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == 14) {} + } + else { + return false; + } + } + } + } + } + } + else + { + return false; + } + return true; + } + + public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) + { + if (aSide == aFacing) { + return aActive ? 84 : 83; + } + return super.getTextureIndex(aSide, aFacing, aActive, aRedstone); + } + + public boolean explodesOnComponentBreak(ItemStack aStack) + { + return false; + } + + public int getMaxEfficiency(ItemStack aStack) + { + return 10000; + } + + public int getPollutionPerTick(ItemStack aStack) + { + return 0; + } + + public int getAmountOfOutputs() + { + return 1; + } + + public String getDescription() + { + return "Converts Heat into Steam"; + } +} 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 new file mode 100644 index 0000000000..ca5cf4af98 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf.java @@ -0,0 +1,178 @@ +package gregtechmod.common.tileentities.storage; + +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 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 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; + } +} 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 new file mode 100644 index 0000000000..63a18f854d --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Compartment.java @@ -0,0 +1,108 @@ +package gregtechmod.common.tileentities.storage; + +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 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; + +public class GT_MetaTileEntity_Shelf_Compartment + extends GT_MetaTileEntity_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; + } +} 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 new file mode 100644 index 0000000000..6514022338 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Desk.java @@ -0,0 +1,56 @@ +package gregtechmod.common.tileentities.storage; + +import gregtechmod.api.interfaces.IGregTechTileEntity; +import gregtechmod.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 GT_MetaTileEntity_Shelf_Desk(int aID, String aName, String aNameRegional) + { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_Shelf_Desk() {} + + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) + { + return new GT_MetaTileEntity_Shelf_Desk(); + } + + public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) + { + if (aSide == aFacing) { + return 222; + } + if (aSide == 0) { + return 32; + } + if (aSide == 1) { + return 29; + } + return 40; + } + + 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) + { + aPlayer.field_71071_by.func_70299_a(aPlayer.field_71071_by.field_70461_c, null); + getBaseMetaTileEntity().func_70299_a(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 new file mode 100644 index 0000000000..f888325b09 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_FileCabinet.java @@ -0,0 +1,34 @@ +package gregtechmod.common.tileentities.storage; + +import gregtechmod.api.interfaces.IGregTechTileEntity; +import gregtechmod.api.metatileentity.MetaTileEntity; + +public class GT_MetaTileEntity_Shelf_FileCabinet + extends GT_MetaTileEntity_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; + } +} 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 new file mode 100644 index 0000000000..bad2dc72dd --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Iron.java @@ -0,0 +1,34 @@ +package gregtechmod.common.tileentities.storage; + +import gregtechmod.api.interfaces.IGregTechTileEntity; +import gregtechmod.api.metatileentity.MetaTileEntity; + +public class GT_MetaTileEntity_Shelf_Iron + extends GT_MetaTileEntity_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; + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java index e0d0374493..9139da59df 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java @@ -15,7 +15,10 @@ public class Gregtech4Content { if (LoadedMods.Gregtech){ workbenches(); + thermalBoiler(); + multiCrafter(); tesseracts(); + shelves(); } } @@ -25,6 +28,18 @@ public class Gregtech4Content //Free //GregtechItemList.GT4_Workbench_Bronze.set(new GT_MetaTileEntity_BronzeCraftingTable(828, "workbench.bronze", "Bronze Workbench", 0).getStackForm(1L)); //Free //GregtechItemList.GT4_Workbench_Advanced.set(new GT_MetaTileEntity_AdvancedCraftingTable(829, "workbench.advanced", "Advanced Workbench", 1).getStackForm(1L)); } + + 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)); + } + + 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)); + } private static void tesseracts(){ //Gregtech 4 Workbenches @@ -32,4 +47,15 @@ public class Gregtech4Content GregtechItemList.GT4_Tesseract_Generator.set(new GT_MetaTileEntity_TesseractGenerator(833, "tesseract.generator", "Tesseract Generator", 4).getStackForm(1L)); GregtechItemList.GT4_Tesseract_Terminal.set(new GT_MetaTileEntity_TesseractTerminal(834, "tesseract.terminal", "Tesseract Terminal", 4).getStackForm(1L)); } + + 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)); + } + } |