Fixed performance of combustion gen, stirling gen and tanks.

This commit is contained in:
CrazyPants committed 2014-05-28 19:43:52 +08:00
1 parent ddba319e6d
commit 7abf8d26f0
19 files changed
+329 -93

No files matched your search

@@ -34,7 +34,6 @@ public class PacketFluidLevel extends AbstractPacketTileEntity<TileEntity> {
public void decode(ChannelHandlerContext ctx, ByteBuf buf) {
super.decode(ctx, buf);
tc = ByteBufUtils.readTag(buf);
}
@Override
@@ -50,46 +49,4 @@ public class PacketFluidLevel extends AbstractPacketTileEntity<TileEntity> {
con.readFromNBT(tc, TileConduitBundle.NBT_VERSION);
}
// public static Packet createFluidConduitLevelPacket(ILiquidConduit liquidConduit) {
// ByteArrayOutputStream bos = new ByteArrayOutputStream();
// DataOutputStream dos = new DataOutputStream(bos);
// IConduitBundle bundle = liquidConduit.getBundle();
// try {
// dos.writeInt(PacketHandler.ID_CONDUIT_FLUID_LEVEL);
// dos.writeInt(bundle.getEntity().xCoord);
// dos.writeInt(bundle.getEntity().yCoord);
// dos.writeInt(bundle.getEntity().zCoord);
// NBTTagCompound tc = new NBTTagCompound();
// liquidConduit.writeToNBT(tc);
// PacketUtil.writeNBTTagCompound(tc, dos);
//
// } catch (IOException e) {
// // never thrown
// }
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = PacketHandler.CHANNEL;
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = true;
// return pkt;
// }
//
// private void processFluidConduitLevelPacket(DataInputStream data, Player player) throws IOException {
// World world = getWorld(player);
// if(world == null) {
// return;
// }
// IConduitBundle conBun = getConduitBundle(data, world);
// if(conBun == null) {
// return;
// }
// ILiquidConduit con = conBun.getConduit(ILiquidConduit.class);
// if(con == null) {
// //Log.warn("processFluidConduitLevelPacket: no fluid conduit exists in bundle when recieving packet.");
// return;
// }
// NBTTagCompound tc = PacketUtil.readNBTTagCompound(data);
// con.readFromNBT(tc, TileConduitBundle.NBT_VERSION);
// }
}
@@ -54,6 +54,7 @@ public abstract class AbstractMachineBlock<T extends AbstractMachineEntity> exte
static {
EnderIO.packetPipeline.registerPacket(PacketIoMode.class);
EnderIO.packetPipeline.registerPacket(PacketPowerStorage.class);
}
protected AbstractMachineBlock(ModObject mo, Class<T> teClass) {
@@ -5,6 +5,8 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
@@ -318,14 +320,13 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements ISi
}
requiresClientSync |= doSideIo();
requiresClientSync |= doSideIo();
requiresClientSync |= prevRedCheck != redstoneCheckPassed;
requiresClientSync |= processTasks(redstoneCheckPassed);
requiresClientSync |= (lastSyncPowerStored != storedEnergy && worldObj.getTotalWorldTime() % 10 == 0);
boolean powerChanged = (lastSyncPowerStored != storedEnergy && worldObj.getTotalWorldTime() % 5 == 0);
if(requiresClientSync) {
lastSyncPowerStored = storedEnergy;
@@ -335,6 +336,9 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements ISi
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
// And this will make sure our current tile entity state is saved
markDirty();
} else if(powerChanged) {
lastSyncPowerStored = storedEnergy;
EnderIO.packetPipeline.sendToAllAround(new PacketPowerStorage(this), this);
}
if(notifyNeighbours) {
@@ -376,9 +380,7 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements ISi
TileEntity te = worldObj.getTileEntity(loc.x, loc.y, loc.z);
if(te == null) {
return false;
}
boolean res = false;
}
for(int i=slotDefinition.minOutputSlot; i<= slotDefinition.maxOutputSlot;i++) {
ItemStack item = inventory[i];
if(item != null) {
@@ -389,12 +391,11 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements ISi
item = null;
}
inventory[i] = item;
markDirty();
res = true;
markDirty();
}
}
}
return res;
return false;
}
protected boolean doPull(ForgeDirection dir) {
@@ -436,7 +437,7 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements ISi
for(int inputSlot=slotDefinition.minInputSlot; inputSlot <= slotDefinition.maxInputSlot;inputSlot++) {
if(doPull(inputSlot, target, targetSlots, dir)) {
return true;
return false;
}
}
return false;
@@ -52,6 +52,7 @@ public class AbstractMachineRenderer implements ISimpleBlockRenderingHandler {
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof AbstractMachineEntity) {
curEnt = (AbstractMachineEntity)te;
System.out.println("AbstractMachineRenderer.renderWorldBlock: ");
} else {
curEnt = null;
}
@@ -45,18 +45,21 @@ public abstract class GuiMachineBase extends GuiContainerBase {
public GuiMachineBase(AbstractMachineEntity machine, Container container) {
super(container);
tileEntity = machine;
addToolTip(new GuiToolTip(new Rectangle(getPowerX(), getPowerY(), getPowerWidth(), getPowerHeight()), "") {
if(renderPowerBar()) {
addToolTip(new GuiToolTip(new Rectangle(getPowerX(), getPowerY(), getPowerWidth(), getPowerHeight()), "") {
@Override
protected void updateText() {
text.clear();
text.add("Max: " + PowerDisplayUtil.formatPower(tileEntity.getPowerUsePerTick()) + " " + PowerDisplayUtil.abrevation() + PowerDisplayUtil.perTickStr());
//text.add()
text.add(PowerDisplayUtil.formatStoredPower(tileEntity.getEnergyStored(), tileEntity.getCapacitor().getMaxEnergyStored()));
@Override
protected void updateText() {
text.clear();
text.add("Max: " + PowerDisplayUtil.formatPower(tileEntity.getPowerUsePerTick()) + " " + PowerDisplayUtil.abrevation()
+ PowerDisplayUtil.perTickStr());
//text.add()
text.add(PowerDisplayUtil.formatStoredPower(tileEntity.getEnergyStored(), tileEntity.getCapacitor().getMaxEnergyStored()));
}
}
});
});
}
int x = xSize - 5 - BUTTON_SIZE;
int y = 5;
redstoneButton = new RedstoneModeButton(this, -1, x, y, tileEntity, new BlockCoord(tileEntity));
@@ -0,0 +1,64 @@
package crazypants.enderio.machine;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import crazypants.enderio.network.IPacketEio;
public class PacketPowerStorage implements IPacketEio {
private int x;
private int y;
private int z;
private float storedEnergy;
public PacketPowerStorage() {
}
public PacketPowerStorage(AbstractMachineEntity ent) {
x = ent.xCoord;
y = ent.yCoord;
z = ent.zCoord;
storedEnergy = ent.storedEnergy;
}
@Override
public void encode(ChannelHandlerContext ctx, ByteBuf buf) {
buf.writeInt(x);
buf.writeInt(y);
buf.writeInt(z);
buf.writeFloat(storedEnergy);
}
@Override
public void decode(ChannelHandlerContext ctx, ByteBuf buf) {
x = buf.readInt();
y = buf.readInt();
z = buf.readInt();
storedEnergy = buf.readFloat();
}
@Override
public void handleClientSide(EntityPlayer player) {
handle(player);
}
@Override
public void handleServerSide(EntityPlayer player) {
handle(player);
}
private void handle(EntityPlayer player) {
TileEntity te = player.worldObj.getTileEntity(x, y, z);
if(te instanceof AbstractMachineEntity) {
AbstractMachineEntity me = (AbstractMachineEntity) te;
me.storedEnergy = storedEnergy;
me.powerHandler.setEnergy(storedEnergy);
}
}
}
@@ -12,6 +12,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import crazypants.enderio.EnderIO;
import crazypants.enderio.GuiHandler;
import crazypants.enderio.ModObject;
import crazypants.enderio.machine.AbstractMachineBlock;
@@ -24,6 +25,8 @@ public class BlockCombustionGenerator extends AbstractMachineBlock<TileCombustio
public static int renderId = -1;
public static BlockCombustionGenerator create() {
EnderIO.packetPipeline.registerPacket(PacketTanks.class);
BlockCombustionGenerator gen = new BlockCombustionGenerator();
gen.init();
return gen;
@@ -2,13 +2,18 @@ package crazypants.enderio.machine.generator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import crazypants.enderio.EnderIO;
import crazypants.enderio.GuiHandler;
import crazypants.enderio.ModObject;
import crazypants.enderio.machine.AbstractMachineBlock;
import crazypants.enderio.machine.PacketPowerStorage;
public class BlockStirlingGenerator extends AbstractMachineBlock<TileEntityStirlingGenerator> {
public static BlockStirlingGenerator create() {
EnderIO.packetPipeline.registerPacket(PacketBurnTime.class);
BlockStirlingGenerator gen = new BlockStirlingGenerator();
gen.init();
return gen;
@@ -43,6 +43,8 @@ public class CombustionGeneratorRenderer extends TileEntitySpecialRenderer imple
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
System.out.println("CombustionGeneratorRenderer.renderWorldBlock: ");
short facing = (short)ForgeDirection.EAST.ordinal();
boolean active = false;
if(world != null) {
@@ -0,0 +1,44 @@
package crazypants.enderio.machine.generator;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import crazypants.enderio.network.AbstractPacketTileEntity;
import crazypants.enderio.network.PacketTileEntityNbt;
public class PacketBurnTime extends AbstractPacketTileEntity<TileEntityStirlingGenerator> {
private int burnTime;
private int totalBurnTime;
public PacketBurnTime() {
}
public PacketBurnTime(TileEntityStirlingGenerator tile) {
super(tile);
burnTime = tile.burnTime;
totalBurnTime = tile.totalBurnTime;
}
@Override
public void encode(ChannelHandlerContext ctx, ByteBuf buf) {
super.encode(ctx, buf);
buf.writeInt(burnTime);
buf.writeInt(totalBurnTime);
}
@Override
public void decode(ChannelHandlerContext ctx, ByteBuf buf) {
super.decode(ctx, buf);
burnTime = buf.readInt();
totalBurnTime = buf.readInt();
}
@Override
protected void handleClientSide(EntityPlayer player, World worldObj, TileEntityStirlingGenerator tile) {
tile.burnTime = burnTime;
tile.totalBurnTime = totalBurnTime;
}
}
@@ -0,0 +1,61 @@
package crazypants.enderio.machine.generator;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import crazypants.enderio.network.AbstractPacketTileEntity;
import crazypants.enderio.network.NetworkUtil;
public class PacketTanks extends AbstractPacketTileEntity<TileCombustionGenerator> {
private NBTTagCompound nbtRoot;
public PacketTanks() {
}
public PacketTanks(TileCombustionGenerator tile) {
super(tile);
nbtRoot = new NBTTagCompound();
if(tile.coolantTank.getFluidAmount() > 0) {
NBTTagCompound tankRoot = new NBTTagCompound();
tile.coolantTank.writeToNBT(tankRoot);
nbtRoot.setTag("coolantTank", tankRoot);
}
if(tile.fuelTank.getFluidAmount() > 0) {
NBTTagCompound tankRoot = new NBTTagCompound();
tile.fuelTank.writeToNBT(tankRoot);
nbtRoot.setTag("fuelTank", tankRoot);
}
}
@Override
public void encode(ChannelHandlerContext ctx, ByteBuf buf) {
super.encode(ctx, buf);
NetworkUtil.writeNBTTagCompound(nbtRoot, buf);
}
@Override
public void decode(ChannelHandlerContext ctx, ByteBuf buf) {
super.decode(ctx, buf);
nbtRoot = NetworkUtil.readNBTTagCompound(buf);
}
@Override
protected void handleClientSide(EntityPlayer player, World worldObj, TileCombustionGenerator tile) {
if(nbtRoot.hasKey("coolantTank")) {
NBTTagCompound tankRoot = nbtRoot.getCompoundTag("coolantTank");
tile.coolantTank.readFromNBT(tankRoot);
} else {
tile.coolantTank.setFluid(null);
}
if(nbtRoot.hasKey("fuelTank")) {
NBTTagCompound tankRoot = nbtRoot.getCompoundTag("fuelTank");
tile.fuelTank.readFromNBT(tankRoot);
} else {
tile.fuelTank.setFluid(null);
}
}
}
@@ -70,7 +70,7 @@ public class PowerDistributor {
BlockCoord checkLoc = bc.getLocation(dir);
TileEntity te = worldObj.getTileEntity(checkLoc.x, checkLoc.y, checkLoc.z);
IPowerInterface pi = PowerHandlerUtil.create(te);
if(pi != null) {
if(pi != null && pi.canConduitConnect(dir.getOpposite())) {
receptors.add(new Receptor(pi, dir));
}
}
@@ -15,6 +15,8 @@ import buildcraft.api.fuels.IronEngineCoolant.Coolant;
import buildcraft.api.fuels.IronEngineFuel;
import buildcraft.api.fuels.IronEngineFuel.Fuel;
import buildcraft.api.power.IPowerEmitter;
import crazypants.enderio.Config;
import crazypants.enderio.EnderIO;
import crazypants.enderio.ModObject;
import crazypants.enderio.machine.AbstractMachineEntity;
import crazypants.enderio.machine.IoMode;
@@ -49,7 +51,7 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IP
@Override
protected boolean doPull(ForgeDirection dir) {
boolean res = super.doPull(dir);
boolean res = super.doPull(dir);
BlockCoord loc = getLocation().getLocation(dir);
IFluidHandler target = FluidUtil.getFluidHandler(worldObj, loc);
if(target != null) {
@@ -65,8 +67,8 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IP
int filled = fill(dir, drained, false);
if(filled > 0) {
drained = target.drain(dir.getOpposite(), filled, true);
fill(dir, drained, true);
return true;
fill(dir, drained, true);
return res;
}
}
}
@@ -143,8 +145,7 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IP
@Override
protected boolean processTasks(boolean redstoneChecksPassed) {
boolean res = tanksDirty;
tanksDirty = false;
boolean res = false;
if(!redstoneChecksPassed) {
if(active) {
@@ -152,19 +153,25 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IP
res = true;
}
return res;
}
} else {
boolean isActive = generateEnergy();
if(isActive != this.active) {
active = isActive;
res = true;
}
boolean isActive = generateEnergy();
if(isActive != this.active) {
active = isActive;
res = true;
}
if(storedEnergy >= capacitorType.capacitor.getMaxEnergyStored()) {
inPause = true;
}
if(storedEnergy >= capacitorType.capacitor.getMaxEnergyStored()) {
inPause = true;
}
transmitEnergy();
transmitEnergy();
}
if(tanksDirty) {
EnderIO.packetPipeline.sendToAllAround(new PacketTanks(this), this);
tanksDirty = false;
}
return res;
}
@@ -8,6 +8,7 @@ import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.power.IPowerEmitter;
import buildcraft.api.power.PowerHandler.Type;
import crazypants.enderio.EnderIO;
import crazypants.enderio.ModObject;
import crazypants.enderio.machine.AbstractMachineEntity;
import crazypants.enderio.machine.IoMode;
@@ -20,8 +21,8 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
public static final float ENERGY_PER_TICK = 2;
/** How many ticks left until the item is burnt. */
private int burnTime = 0;
private int totalBurnTime;
int burnTime = 0;
int totalBurnTime;
private PowerDistributor powerDis;
@@ -139,15 +140,17 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
@Override
protected boolean processTasks(boolean redstoneCheckPassed) {
boolean needsUpdate = false;
boolean sendBurnTimePacket = false;
if(burnTime > 0) {
if(storedEnergy < powerHandler.getMaxEnergyStored()) {
storedEnergy += (ENERGY_PER_TICK * getEnergyMultiplier());
}
burnTime--;
burnTime--;
sendBurnTimePacket = worldObj.getWorldTime() % 20 == 1;
}
needsUpdate |= transmitEnergy();
transmitEnergy();
if(redstoneCheckPassed) {
@@ -167,6 +170,9 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
}
}
}
if(!needsUpdate && sendBurnTimePacket) {
EnderIO.packetPipeline.sendToAllAround(new PacketBurnTime(this), this);
}
return needsUpdate;
}
@@ -39,7 +39,7 @@ import crazypants.util.Util;
public class BlockTank extends AbstractMachineBlock<TileTank> implements IAdvancedTooltipProvider {
public static BlockTank create() {
EnderIO.packetPipeline.registerPacket(PacketTank.class);
BlockTank res = new BlockTank();
res.init();
return res;
@@ -65,6 +65,6 @@ public class GuiTank extends GuiMachineBase {
}
protected boolean renderPowerBar() {
return true;
return false;
}
}
@@ -0,0 +1,50 @@
package crazypants.enderio.machine.tank;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import crazypants.enderio.machine.generator.TileCombustionGenerator;
import crazypants.enderio.network.AbstractPacketTileEntity;
import crazypants.enderio.network.NetworkUtil;
public class PacketTank extends AbstractPacketTileEntity<TileTank> {
private NBTTagCompound nbtRoot;
public PacketTank() {
}
public PacketTank(TileTank tile) {
super(tile);
nbtRoot = new NBTTagCompound();
if(tile.tank.getFluidAmount() > 0) {
NBTTagCompound tankRoot = new NBTTagCompound();
tile.tank.writeToNBT(tankRoot);
nbtRoot.setTag("tank", tankRoot);
}
}
@Override
public void encode(ChannelHandlerContext ctx, ByteBuf buf) {
super.encode(ctx, buf);
NetworkUtil.writeNBTTagCompound(nbtRoot, buf);
}
@Override
public void decode(ChannelHandlerContext ctx, ByteBuf buf) {
super.decode(ctx, buf);
nbtRoot = NetworkUtil.readNBTTagCompound(buf);
}
@Override
protected void handleClientSide(EntityPlayer player, World worldObj, TileTank tile) {
if(nbtRoot.hasKey("tank")) {
NBTTagCompound tankRoot = nbtRoot.getCompoundTag("tank");
tile.tank.readFromNBT(tankRoot);
} else {
tile.tank.setFluid(null);
}
}
}
@@ -14,6 +14,7 @@ import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
import crazypants.enderio.EnderIO;
import crazypants.enderio.TileEntityEio;
import crazypants.enderio.machine.AbstractMachineEntity;
import crazypants.enderio.machine.SlotDefinition;
@@ -27,6 +28,8 @@ public class TileTank extends AbstractMachineEntity implements IFluidHandler {
protected FluidTankEio tank;// = new FluidTankEio(16000);
protected int lastUpdateLevel = -1;
private boolean tankDirty = false;
public TileTank(int meta) {
super(new SlotDefinition(0, 1, 2, 3, -1, -1));
@@ -60,7 +63,8 @@ public class TileTank extends AbstractMachineEntity implements IFluidHandler {
int filled = target.fill(dir.getOpposite(), push, true);
if(filled > 0) {
tank.drain(filled, true);
return true;
tankDirty = true;
return res;
}
}
}
@@ -89,7 +93,8 @@ public class TileTank extends AbstractMachineEntity implements IFluidHandler {
FluidStack drained = target.drain(dir.getOpposite(), canPull, true);
if(drained != null && drained.amount > 0) {
tank.fill(drained, true);
return true;
tankDirty = true;
return res;
}
} else {
@@ -103,7 +108,8 @@ public class TileTank extends AbstractMachineEntity implements IFluidHandler {
FluidStack drained = target.drain(dir.getOpposite(), canPull, true);
if(drained != null && drained.amount > 0) {
tank.fill(drained, true);
return true;
tankDirty = true;
return res;
}
}
}
@@ -118,17 +124,29 @@ public class TileTank extends AbstractMachineEntity implements IFluidHandler {
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
return tank.fill(resource, doFill);
int res = tank.fill(resource, doFill);
if(res > 0 && doFill) {
tankDirty = true;
}
return res;
}
@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
return tank.drain(resource, doDrain);
FluidStack res = tank.drain(resource, doDrain);
if(res != null && res.amount > 0 && doDrain) {
tankDirty = true;
}
return res;
}
@Override
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
return tank.drain(maxDrain, doDrain);
FluidStack res = tank.drain(maxDrain, doDrain);
if(res != null && res.amount > 0 && doDrain) {
tankDirty = true;
}
return res;
}
@Override
@@ -195,8 +213,13 @@ public class TileTank extends AbstractMachineEntity implements IFluidHandler {
int filledLevel = getFilledLevel();
if(lastUpdateLevel != filledLevel) {
lastUpdateLevel = filledLevel;
tankDirty = false;
return true;
}
if(tankDirty && worldObj.getWorldTime() % 10 == 0) {
EnderIO.packetPipeline.sendToAllAround(new PacketTank(this), this);
tankDirty = false;
}
return res;
}
@@ -245,6 +268,7 @@ public class TileTank extends AbstractMachineEntity implements IFluidHandler {
}
tank.drain(filledFluid.amount, true);
tankDirty = true;
toFill = toFill.copy();
toFill.stackSize--;
@@ -261,7 +285,7 @@ public class TileTank extends AbstractMachineEntity implements IFluidHandler {
newStack.stackSize++;
setInventorySlotContents(3, newStack);
}
markDirty();
return false;
}
@@ -305,7 +329,8 @@ public class TileTank extends AbstractMachineEntity implements IFluidHandler {
newStack.stackSize++;
setInventorySlotContents(2, newStack);
}
return true;
markDirty();
return false;
}
public PowerReceiver getPowerReceiver(ForgeDirection side) {
@@ -17,10 +17,12 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.INetHandler;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.tileentity.TileEntity;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.FMLEmbeddedChannel;
import cpw.mods.fml.common.network.FMLOutboundHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -210,6 +212,10 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, IPacke
this.channels.get(Side.SERVER).writeAndFlush(message);
}
public void sendToAllAround(IPacketEio message, TileEntity te) {
sendToAllAround(message, new TargetPoint(te.getWorldObj().provider.dimensionId, te.xCoord, te.yCoord, te.zCoord, 16));
}
/**
* Send this message to everyone within the supplied dimension.
* <p/>