mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-22 05:02:25 +00:00
Issue 19: Cap. banks not getting picked up by turtles.
This commit is contained in:
1 parent
9c66edc235
commit
157fa50c91
1 file changed
+22
-3
@@ -1,6 +1,7 @@
|
||||
package crazypants.enderio.machine.power;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
@@ -167,14 +168,32 @@ public class BlockCapacitorBank extends Block implements ITileEntityProvider, IG
|
||||
te.onNeighborBlockChange(blockId);
|
||||
}
|
||||
|
||||
public void breakBlock(World world, int x, int y, int z, int par5, int par6) {
|
||||
public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
if(!world.isRemote) {
|
||||
TileEntity te = world.getBlockTileEntity(x, y, z);
|
||||
if (te instanceof TileCapacitorBank) {
|
||||
TileCapacitorBank cb = (TileCapacitorBank) te;
|
||||
cb.onBreakBlock();
|
||||
|
||||
ItemStack itemStack =
|
||||
BlockItemCapacitorBank.createItemStackWithPower(cb.doGetEnergyStored());
|
||||
ret.add(itemStack);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeBlockByPlayer(World world, EntityPlayer player, int x, int y, int z) {
|
||||
if (!world.isRemote) {
|
||||
TileEntity te = world.getBlockTileEntity(x, y, z);
|
||||
if (te instanceof TileCapacitorBank) {
|
||||
TileCapacitorBank cb = (TileCapacitorBank) te;
|
||||
cb.onBreakBlock();
|
||||
|
||||
ItemStack itemStack = BlockItemCapacitorBank.createItemStackWithPower(cb.doGetEnergyStored());
|
||||
ItemStack itemStack =
|
||||
BlockItemCapacitorBank.createItemStackWithPower(cb.doGetEnergyStored());
|
||||
float f = 0.7F;
|
||||
double d0 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D;
|
||||
double d1 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D;
|
||||
@@ -184,7 +203,7 @@ public class BlockCapacitorBank extends Block implements ITileEntityProvider, IG
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
world.removeBlockTileEntity(x, y, z);
|
||||
return super.removeBlockByPlayer(world, player, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user