aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/tileentities/machines/basic
diff options
context:
space:
mode:
authorJohn <Techlone@users.noreply.github.com>2016-04-02 16:07:59 +0500
committerJohn <Techlone@users.noreply.github.com>2016-04-02 16:07:59 +0500
commit0aad2f76890c0490b3a277609fa48cce0a97ce1f (patch)
tree4c3d81b018e860597811036b57289e31954995db /src/main/java/gregtech/common/tileentities/machines/basic
parent792cca0af612ff35bd36e5408e538a386f5d02db (diff)
parentb71fa8f0429cf58b7e16aa94c9361d33e85dbe5f (diff)
downloadGT5-Unofficial-0aad2f76890c0490b3a277609fa48cce0a97ce1f.tar.gz
GT5-Unofficial-0aad2f76890c0490b3a277609fa48cce0a97ce1f.tar.bz2
GT5-Unofficial-0aad2f76890c0490b3a277609fa48cce0a97ce1f.zip
Merge pull request #1 from Blood-Asp/experimental
Update from orig
Diffstat (limited to 'src/main/java/gregtech/common/tileentities/machines/basic')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java85
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java5
2 files changed, 89 insertions, 1 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java
new file mode 100644
index 0000000000..7d0de3fcc2
--- /dev/null
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java
@@ -0,0 +1,85 @@
+package gregtech.common.tileentities.machines.basic;
+
+
+import java.util.Iterator;
+
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Textures;
+import gregtech.api.gui.GT_Container_1by1;
+import gregtech.api.gui.GT_GUIContainer_1by1;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GT_MetaTileEntity_CuringOven
+ extends GT_MetaTileEntity_BasicMachine {
+
+ public GT_MetaTileEntity_CuringOven(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 1, "Heats tools for hardening", 1, 1, "E_Oven.png", "", new ITexture[]{new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_SIDE_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_SIDE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_FRONT_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_FRONT")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_TOP_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_TOP")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_BOTTOM_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_BOTTOM"))});
+ }
+
+ public GT_MetaTileEntity_CuringOven(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
+ }
+
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_CuringOven(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
+ }
+
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (ItemList.Cell_Empty.isStackEqual(aStack));
+ }
+
+ public boolean isFluidInputAllowed(FluidStack aFluid) {
+ return false;
+ }
+
+ @Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_1by1(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_1by1(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aBaseMetaTileEntity.isServerSide()) {
+ for (ItemStack tStack : mInventory)
+ if (tStack!=null&&tStack.getItem() instanceof GT_MetaGenerated_Tool &&getBaseMetaTileEntity().getStoredEU()>0) {
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits(24, true);
+ NBTTagCompound aNBT = tStack.getTagCompound();
+ if (aNBT != null) {
+ int tHeat = 300;
+ long tWorldTime = getBaseMetaTileEntity().getWorld().getTotalWorldTime();
+ aNBT = aNBT.getCompoundTag("GT.ToolStats");
+ if (aNBT != null&&aNBT.hasKey("Heat")) {
+ tHeat = aNBT.getInteger("Heat");
+ if(aNBT.hasKey("HeatTime")){
+ long tHeatTime = aNBT.getLong("HeatTime");
+ if(tWorldTime>(tHeatTime+10)){
+ tHeat = (int) (tHeat - ((tWorldTime-tHeatTime)/10));
+ if(tHeat<300)tHeat=300;
+ }
+ }
+ }
+ tHeat++;
+ if(aNBT!=null){
+ aNBT.setInteger("Heat", tHeat);
+ aNBT.setLong("HeatTime", tWorldTime);}
+ if(tHeat>GT_MetaGenerated_Tool.getPrimaryMaterial(tStack).mMeltingPoint){mInventory[0]=null;}
+ }
+
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java
index a9c4299edd..6835e6415a 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java
@@ -30,7 +30,6 @@ public class GT_MetaTileEntity_Disassembler
if (tNBT != null) {
tNBT = tNBT.getCompoundTag("GT.CraftingComponents");
if (tNBT != null) {
- getInputAt(0).stackSize -= 1;
this.mEUt = (16 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
this.mMaxProgresstime = 80;
for (int i = 0; i < this.mOutputItems.length; i++) {
@@ -41,6 +40,10 @@ public class GT_MetaTileEntity_Disassembler
}
}
}
+ if(mMaxProgresstime==80){
+ return 0;
+ }
+ getInputAt(0).stackSize -= 1;
return 2;
}
}