Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
Merge pull request #19 from bartimaeusnek/0.4.X
Browse files Browse the repository at this point in the history
Fixed Heated Water Pump
  • Loading branch information
bartimaeusnek authored Apr 12, 2019
2 parents 8ebbdcc + 7574cfe commit 460c371
Show file tree
Hide file tree
Showing 9 changed files with 139 additions and 23 deletions.
4 changes: 2 additions & 2 deletions build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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};
};

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -32,14 +33,17 @@
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;
Expand Down Expand Up @@ -115,6 +119,19 @@ public void onBlockPlacedBy(final World world, final int x, final int y, final i
}
}

@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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -39,7 +40,7 @@
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -48,7 +49,7 @@ public BW_Container_HeatedWaterPump(BW_TileEntity_HeatedWaterPump TILE, EntityPl
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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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++) {
Expand Down Expand Up @@ -62,18 +63,4 @@ public void onCraftMatrixChanged(IInventory p_75130_1_) {
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();
}


}
}
Original file line number Diff line number Diff line change
@@ -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();
}


}
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,12 @@ public int getDamageValue(World aWorld, int aX, int aY, int aZ) {
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) {
Expand Down

0 comments on commit 460c371

Please sign in to comment.