A few fixes
This commit is contained in:
parent
be3063def5
commit
8101ee2e26
4 changed files with 68 additions and 7 deletions
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -33,7 +33,7 @@ public abstract class TileEntityBasicBlock extends TileEntity implements IWrench
|
|||
public Set<EntityPlayer> playersUsing = new HashSet<EntityPlayer>();
|
||||
|
||||
/** 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++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue