diff --git a/common/mekanism/common/TileComponentEjector.java b/common/mekanism/common/TileComponentEjector.java index ec6db4fec..dea1cf55b 100644 --- a/common/mekanism/common/TileComponentEjector.java +++ b/common/mekanism/common/TileComponentEjector.java @@ -32,6 +32,8 @@ public class TileComponentEjector implements ITileComponent, IEjector public EnumColor[] inputColors = new EnumColor[] {null, null, null, null, null, null}; + public int tickDelay = 0; + public SideData sideData; public int[] trackers; @@ -63,6 +65,18 @@ public class TileComponentEjector implements ITileComponent, IEjector return sides; } + @Override + public void tick() + { + if(tickDelay == 0) + { + onOutput(); + } + else { + tickDelay--; + } + } + @Override public void onOutput() { @@ -125,6 +139,8 @@ public class TileComponentEjector implements ITileComponent, IEjector tileEntity.inventory[slotID] = stack; } + + tickDelay = 20; } @Override @@ -179,9 +195,6 @@ public class TileComponentEjector implements ITileComponent, IEjector return inputColors[side.ordinal()]; } - @Override - public void tick() {} - @Override public void read(NBTTagCompound nbtTags) { diff --git a/common/mekanism/common/block/BlockBasic.java b/common/mekanism/common/block/BlockBasic.java index 442110f27..5c4ad405a 100644 --- a/common/mekanism/common/block/BlockBasic.java +++ b/common/mekanism/common/block/BlockBasic.java @@ -2,6 +2,7 @@ package mekanism.common.block; import java.util.ArrayList; import java.util.List; +import java.util.Random; import mekanism.api.Object3D; import mekanism.client.ClientProxy; @@ -572,4 +573,51 @@ public class BlockBasic extends Block return ret; } + + @Override + public int idDropped(int i, Random random, int j) + { + return 0; + } + + @Override + public boolean removeBlockByPlayer(World world, EntityPlayer player, int x, int y, int z) + { + if(!player.capabilities.isCreativeMode && !world.isRemote && canHarvestBlock(player, world.getBlockMetadata(x, y, z))) + { + TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getBlockTileEntity(x, y, z); + + float motion = 0.7F; + double motionX = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + + EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, getPickBlock(null, world, x, y, z)); + + world.spawnEntityInWorld(entityItem); + } + + return world.setBlockToAir(x, y, z); + } + + public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock) + { + ItemStack itemStack = getPickBlock(null, world, x, y, z); + + world.setBlockToAir(x, y, z); + + if(!returnBlock) + { + float motion = 0.7F; + double motionX = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + + EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, itemStack); + + world.spawnEntityInWorld(entityItem); + } + + return itemStack; + } } \ No newline at end of file diff --git a/common/mekanism/common/tileentity/TileEntityBasicBlock.java b/common/mekanism/common/tileentity/TileEntityBasicBlock.java index 9e9c89880..92351fd4b 100644 --- a/common/mekanism/common/tileentity/TileEntityBasicBlock.java +++ b/common/mekanism/common/tileentity/TileEntityBasicBlock.java @@ -33,7 +33,7 @@ public abstract class TileEntityBasicBlock extends TileEntity implements IWrench public Set playersUsing = new HashSet(); /** A timer used to send packets to clients. */ - public int packetTick; + public int ticker; public boolean doAutoSync = true; @@ -59,7 +59,7 @@ public abstract class TileEntityBasicBlock extends TileEntity implements IWrench } } - packetTick++; + ticker++; } } diff --git a/common/mekanism/common/tileentity/TileEntityDynamicTank.java b/common/mekanism/common/tileentity/TileEntityDynamicTank.java index 581a490e8..71c4208fd 100644 --- a/common/mekanism/common/tileentity/TileEntityDynamicTank.java +++ b/common/mekanism/common/tileentity/TileEntityDynamicTank.java @@ -144,12 +144,12 @@ public class TileEntityDynamicTank extends TileEntityContainerBlock MekanismUtils.updateCache(inventoryID, cachedFluid, inventory, this); } - if(structure == null && packetTick == 5) + if(structure == null && ticker == 5) { update(); } - if(structure != null && isRendering && packetTick % 20 == 0) + if(structure != null && isRendering && ticker % 20 == 0) { sendStructure = true; PacketHandler.sendPacket(Transmission.CLIENTS_RANGE, new PacketTileEntity().setParams(Object3D.get(this), getNetworkedData(new ArrayList())), Object3D.get(this), 50D);