diff options
author | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-04-12 17:32:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-12 17:32:11 +0200 |
commit | 3ac6ce92d641fdaec86a1aa39a17250944931bcc (patch) | |
tree | 9859aad3fce4ced498edd23474c71b8d4cbb4aaa | |
parent | 1dd78e6403655ded500589890a20b1b65a15c28f (diff) | |
parent | c74b1a862d9935995f1a56e3a9061e2eb2a5aec6 (diff) | |
download | GT5-Unofficial-3ac6ce92d641fdaec86a1aa39a17250944931bcc.tar.gz GT5-Unofficial-3ac6ce92d641fdaec86a1aa39a17250944931bcc.tar.bz2 GT5-Unofficial-3ac6ce92d641fdaec86a1aa39a17250944931bcc.zip |
Merge pull request #19 from bartimaeusnek/0.4.X
Fixed Heated Water Pump
Former-commit-id: d5ba4e1dda23999abe0045d5683f2905fdeba22c
9 files changed, 139 insertions, 23 deletions
diff --git a/build.properties b/build.properties index 3d69f35b15..22690fd078 100644 --- a/build.properties +++ b/build.properties @@ -23,8 +23,8 @@ mc_version=1.7.10 majorUpdate=0 minorUpdate=4 -buildNumber=6 -APIVersion=5 +buildNumber=7 +APIVersion=6 ic2.version=2.2.828-experimental gregtech.version=5.09.32.36 gregtech.jenkinsbuild=143 diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/API/ITileDropsContent.java b/src/main/java/com/github/bartimaeusnek/bartworks/API/ITileDropsContent.java new file mode 100644 index 0000000000..a84f254d8a --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/API/ITileDropsContent.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.bartworks.API; + +import net.minecraft.inventory.ISidedInventory; + +public interface ITileDropsContent extends ISidedInventory { + default int[] getDropSlots(){ + return new int[] {0}; + }; + +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/blocks/BW_TileEntityContainer.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/blocks/BW_TileEntityContainer.java index fc546fc980..4cc851df67 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/blocks/BW_TileEntityContainer.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/blocks/BW_TileEntityContainer.java @@ -23,6 +23,7 @@ package com.github.bartimaeusnek.bartworks.common.blocks; import com.github.bartimaeusnek.bartworks.API.ITileAddsInformation; +import com.github.bartimaeusnek.bartworks.API.ITileDropsContent; import com.github.bartimaeusnek.bartworks.API.ITileHasDifferentTextureSides; import com.github.bartimaeusnek.bartworks.API.ITileWithGUI; import com.github.bartimaeusnek.bartworks.MainMod; @@ -32,14 +33,17 @@ import cpw.mods.fml.relauncher.SideOnly; import ic2.api.tile.IWrenchable; import ic2.core.IC2; import ic2.core.IHasGui; +import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EnumCreatureType; +import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; +import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; @@ -116,6 +120,19 @@ public class BW_TileEntityContainer extends BlockContainer implements ITileAddsI } @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + TileEntity t = world.getTileEntity(x,y,z); + if (t instanceof ITileDropsContent){ + int[] dropSlots = ((ITileDropsContent)t).getDropSlots(); + for (int i = 0; i < dropSlots.length; i++) { + if (((ITileDropsContent)t).getStackInSlot(dropSlots[i]) != null) + world.spawnEntityInWorld(new EntityItem(world,x,y,z,((BW_TileEntity_HeatedWaterPump)t).getStackInSlot(dropSlots[i]))); + } + } + super.breakBlock(world, x, y, z, block, meta); + } + + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { if (ITileHasDifferentTextureSides.class.isAssignableFrom(this.tileEntity)) { diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_HeatedWaterPump.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_HeatedWaterPump.java index 4c86a8e9b8..416e4fb56e 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_HeatedWaterPump.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_HeatedWaterPump.java @@ -23,6 +23,7 @@ package com.github.bartimaeusnek.bartworks.common.tileentities.classic; import com.github.bartimaeusnek.bartworks.API.ITileAddsInformation; +import com.github.bartimaeusnek.bartworks.API.ITileDropsContent; import com.github.bartimaeusnek.bartworks.API.ITileHasDifferentTextureSides; import com.github.bartimaeusnek.bartworks.API.ITileWithGUI; import com.github.bartimaeusnek.bartworks.MainMod; @@ -39,7 +40,7 @@ import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.*; -public class BW_TileEntity_HeatedWaterPump extends TileEntity implements ISidedInventory, IFluidHandler, IFluidTank, ITileWithGUI, ITileAddsInformation, ITileHasDifferentTextureSides { +public class BW_TileEntity_HeatedWaterPump extends TileEntity implements ITileDropsContent, IFluidHandler, IFluidTank, ITileWithGUI, ITileAddsInformation, ITileHasDifferentTextureSides { public static final int FUELSLOT = 0; public static final Fluid WATER = FluidRegistry.WATER; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/server/container/BW_Container_HeatedWaterPump.java b/src/main/java/com/github/bartimaeusnek/bartworks/server/container/BW_Container_HeatedWaterPump.java index a3b951b34e..121f628df8 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/server/container/BW_Container_HeatedWaterPump.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/server/container/BW_Container_HeatedWaterPump.java @@ -23,6 +23,7 @@ package com.github.bartimaeusnek.bartworks.server.container; import com.github.bartimaeusnek.bartworks.common.tileentities.classic.BW_TileEntity_HeatedWaterPump; +import com.github.bartimaeusnek.bartworks.server.container.Slots.BW_FuelSlot; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.gui.GT_Slot_Render; @@ -48,7 +49,7 @@ public class BW_Container_HeatedWaterPump extends Container { this.TILE = TILE; this.INVENTORY = INVENTORY.inventory; - this.addSlotToContainer(new Slot(TILE, 0, 56, 53)); + this.addSlotToContainer(new BW_FuelSlot(TILE, 0, 56, 53)); this.addSlotToContainer(new GT_Slot_Render(TILE, 1, 86, 33)); int i; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/server/container/GT_Container_Item_Destructopack.java b/src/main/java/com/github/bartimaeusnek/bartworks/server/container/GT_Container_Item_Destructopack.java index edfc722bbd..b983ea27d7 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/server/container/GT_Container_Item_Destructopack.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/server/container/GT_Container_Item_Destructopack.java @@ -22,6 +22,7 @@ package com.github.bartimaeusnek.bartworks.server.container; +import com.github.bartimaeusnek.bartworks.server.container.Slots.BW_DelSlot; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -33,7 +34,7 @@ public class GT_Container_Item_Destructopack extends Container { public GT_Container_Item_Destructopack(InventoryPlayer inventory) { - addSlotToContainer(new delslot()); + addSlotToContainer(new BW_DelSlot()); for (int i = 0; i < 3; i++) { for (int j = 0; j < 9; j++) { @@ -62,18 +63,4 @@ public class GT_Container_Item_Destructopack extends Container { final Slot slotObject = (Slot) this.inventorySlots.get(0); slotObject.decrStackSize(0); } - - - class delslot extends Slot { - public delslot() { - super(new InventoryPlayer(null), 0, 80, 17); - } - - public void putStack(ItemStack p_75215_1_) { - p_75215_1_ = null; - this.onSlotChanged(); - } - - - } }
\ No newline at end of file diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/server/container/Slots/BW_DelSlot.java b/src/main/java/com/github/bartimaeusnek/bartworks/server/container/Slots/BW_DelSlot.java new file mode 100644 index 0000000000..133bc2dfbb --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/server/container/Slots/BW_DelSlot.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.bartworks.server.container.Slots; + +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class BW_DelSlot extends Slot { + public BW_DelSlot() { + super(new InventoryPlayer(null), 0, 80, 17); + } + + public void putStack(ItemStack p_75215_1_) { + p_75215_1_ = null; + this.onSlotChanged(); + } + + +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/server/container/Slots/BW_FuelSlot.java b/src/main/java/com/github/bartimaeusnek/bartworks/server/container/Slots/BW_FuelSlot.java new file mode 100644 index 0000000000..71ed548559 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/server/container/Slots/BW_FuelSlot.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.bartworks.server.container.Slots; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntityFurnace; + +public class BW_FuelSlot extends Slot { + public BW_FuelSlot(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) { + super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_); + } + + @Override + public boolean isItemValid(ItemStack itemStack) { + return TileEntityFurnace.getItemBurnTime(itemStack) > 0; + } +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java index 7b7d33fa3d..fd8e39ebcb 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java @@ -128,13 +128,12 @@ public class BW_MetaGenerated_Ores extends BW_TileEntityContainer { return 0; } - public void breakBlock(World aWorld, int aX, int aY, int aZ, Block par5, int par6) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + TileEntity tTileEntity = world.getTileEntity(x, y, z); if ((tTileEntity instanceof BW_MetaGeneratedOreTE)) { mTemporaryTileEntity.set((BW_MetaGeneratedOreTE) tTileEntity); } - super.breakBlock(aWorld, aX, aY, aZ, par5, par6); - aWorld.removeTileEntity(aX, aY, aZ); + super.breakBlock(world, x, y, z, block, meta); } public ArrayList<ItemStack> getDrops(World aWorld, int aX, int aY, int aZ, int aMeta, int aFortune) { |