mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
holy shit im done (part 2)
This commit is contained in:
parent
f0148a12e9
commit
ec15e85e4e
@ -5,14 +5,15 @@ import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.NBTPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.BlockPistonBase;
|
||||
@ -103,7 +104,7 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class TileEntityEmitter extends TileEntity implements INBTPacketReceiver {
|
||||
public static class TileEntityEmitter extends TileEntityLoadedBase implements IBufPacketReceiver {
|
||||
|
||||
public static final int range = 100;
|
||||
public int color;
|
||||
@ -146,7 +147,7 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP
|
||||
if(color == 0) {
|
||||
color = Color.HSBtoRGB(worldObj.getTotalWorldTime() / 50.0F, 0.5F, 0.25F) & 16777215;
|
||||
}
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "plasmablast");
|
||||
data.setFloat("r", ((float)((color & 0xff0000) >> 16)) / 256F);
|
||||
@ -168,20 +169,16 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP
|
||||
data.setFloat("pitch", -90);
|
||||
data.setFloat("yaw", 90);
|
||||
}
|
||||
|
||||
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z),
|
||||
new TargetPoint(worldObj.provider.dimensionId, x, y, z, 100));
|
||||
|
||||
color = prevColor;
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("beam", this.beam);
|
||||
data.setInteger("color", this.color);
|
||||
data.setFloat("girth", this.girth);
|
||||
data.setInteger("effect", this.effect);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(data, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 150));
|
||||
|
||||
sendStandard(150);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -225,11 +222,19 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.beam = nbt.getInteger("beam");
|
||||
this.color = nbt.getInteger("color");
|
||||
this.girth = nbt.getFloat("girth");
|
||||
this.effect = nbt.getInteger("effect");
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeInt(this.beam);
|
||||
buf.writeInt(this.color);
|
||||
buf.writeFloat(this.girth);
|
||||
buf.writeInt(this.effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.beam = buf.readInt();
|
||||
this.color = buf.readInt();
|
||||
this.girth = buf.readFloat();
|
||||
this.effect = buf.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -199,8 +199,8 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
||||
|
||||
this.trySubscribe(worldObj, xCoord + opp.offsetX, yCoord + opp.offsetY, zCoord + opp.offsetZ, opp);
|
||||
|
||||
PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 15));
|
||||
|
||||
sendStandard(15);
|
||||
|
||||
this.powerSent = 0;
|
||||
this.powerReceived = 0;
|
||||
}
|
||||
|
||||
@ -4,11 +4,14 @@ import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockContainerBase;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
|
||||
import api.hbm.block.IInsertable;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockPistonBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
@ -206,7 +209,7 @@ public class PistonInserter extends BlockContainerBase implements ITooltipProvid
|
||||
// |___..---' _|____`-----..-----'\
|
||||
// |_____________________| @ | )
|
||||
// average coding session involving tile entities
|
||||
public static class TileEntityPistonInserter extends TileEntity implements IInventory, INBTPacketReceiver {
|
||||
public static class TileEntityPistonInserter extends TileEntityLoadedBase implements IInventory, IBufPacketReceiver {
|
||||
|
||||
public ItemStack slot;
|
||||
|
||||
@ -257,15 +260,7 @@ public class PistonInserter extends BlockContainerBase implements ITooltipProvid
|
||||
delay--;
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("extend", extend);
|
||||
if(this.slot != null) {
|
||||
NBTTagCompound stack = new NBTTagCompound();
|
||||
slot.writeToNBT(stack);
|
||||
data.setTag("stack", stack);
|
||||
}
|
||||
|
||||
INBTPacketReceiver.networkPack(this, data, 25);
|
||||
sendStandard(25);
|
||||
|
||||
} else {
|
||||
this.lastExtend = this.renderExtend;
|
||||
@ -279,22 +274,32 @@ public class PistonInserter extends BlockContainerBase implements ITooltipProvid
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.syncExtend = nbt.getInteger("extend");
|
||||
|
||||
if(nbt.hasKey("stack")) {
|
||||
NBTTagCompound stack = nbt.getCompoundTag("stack");
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeInt(extend);
|
||||
|
||||
buf.writeBoolean(this.slot != null);
|
||||
if(this.slot != null) {
|
||||
BufferUtil.writeNBT(buf, slot.stackTagCompound);
|
||||
}
|
||||
|
||||
this.turnProgress = 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.syncExtend = buf.readInt();
|
||||
|
||||
if(buf.readBoolean()) {
|
||||
NBTTagCompound stack = BufferUtil.readNBT(buf);
|
||||
this.slot = ItemStack.loadItemStackFromNBT(stack);
|
||||
} else
|
||||
this.slot = null;
|
||||
|
||||
|
||||
this.turnProgress = 2;
|
||||
}
|
||||
|
||||
/* :3 NBT stuff */
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
@ -8,16 +8,20 @@ import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.BufPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.render.block.RenderBlockMultipass;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.network.TileEntityCableBaseNT;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import api.hbm.energymk2.PowerNetMK2;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
@ -105,7 +109,7 @@ public class BlockCableGauge extends BlockContainer implements IBlockMultiPass,
|
||||
}
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public static class TileEntityCableGauge extends TileEntityCableBaseNT implements INBTPacketReceiver, SimpleComponent, CompatHandler.OCComponent {
|
||||
public static class TileEntityCableGauge extends TileEntityCableBaseNT implements IBufPacketReceiver, SimpleComponent, CompatHandler.OCComponent {
|
||||
|
||||
private long deltaTick = 0;
|
||||
private long deltaSecond = 0;
|
||||
@ -128,18 +132,21 @@ public class BlockCableGauge extends BlockContainer implements IBlockMultiPass,
|
||||
}
|
||||
this.deltaSecond += deltaTick;
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("deltaT", deltaTick);
|
||||
data.setLong("deltaS", deltaLastSecond);
|
||||
INBTPacketReceiver.networkPack(this, data, 25);
|
||||
|
||||
sendStandard(25);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.deltaTick = Math.max(nbt.getLong("deltaT"), 0);
|
||||
this.deltaLastSecond = Math.max(nbt.getLong("deltaS"), 0);
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeLong(deltaTick);
|
||||
buf.writeLong(deltaLastSecond);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.deltaTick = Math.max(buf.readLong(), 0);
|
||||
this.deltaLastSecond = Math.max(buf.readLong(), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -11,15 +11,19 @@ import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.BufPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.render.block.RenderBlockMultipass;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.network.TileEntityPipeBaseNT;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import api.hbm.fluid.IPipeNet;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
@ -30,7 +34,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@ -109,7 +112,7 @@ public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, IL
|
||||
}
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public static class TileEntityPipeGauge extends TileEntityPipeBaseNT implements INBTPacketReceiver, SimpleComponent, CompatHandler.OCComponent {
|
||||
public static class TileEntityPipeGauge extends TileEntityPipeBaseNT implements IBufPacketReceiver, SimpleComponent, CompatHandler.OCComponent {
|
||||
|
||||
private BigInteger lastMeasurement = BigInteger.valueOf(10);
|
||||
private long deltaTick = 0;
|
||||
@ -139,18 +142,21 @@ public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, IL
|
||||
|
||||
} catch(Exception ex) { }
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("deltaT", deltaTick);
|
||||
data.setLong("deltaS", deltaLastSecond);
|
||||
INBTPacketReceiver.networkPack(this, data, 25);
|
||||
|
||||
sendStandard(25);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.deltaTick = Math.max(nbt.getLong("deltaT"), 0);
|
||||
this.deltaLastSecond = Math.max(nbt.getLong("deltaS"), 0);
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeLong(deltaTick);
|
||||
buf.writeLong(deltaLastSecond);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.deltaTick = Math.max(buf.readLong(), 0);
|
||||
this.deltaLastSecond = Math.max(buf.readLong(), 0);
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
|
||||
@ -62,7 +62,7 @@ public class PileNeutronHandler {
|
||||
TileEntityPileBase originTE = (TileEntityPileBase) origin.tile;
|
||||
BlockPos pos = new BlockPos(originTE);
|
||||
|
||||
for(float i = 1; i <= range; i += 1F) {
|
||||
for(float i = 1; i <= range; i += 0.5F) {
|
||||
|
||||
BlockPos node = new BlockPos(
|
||||
(int)Math.floor(pos.getX() + 0.5 + vector.xCoord * i),
|
||||
@ -73,6 +73,8 @@ public class PileNeutronHandler {
|
||||
if(node.equals(pos))
|
||||
continue; // don't interact with itself!
|
||||
|
||||
pos.mutate(node.getX(), node.getY(), node.getZ());
|
||||
|
||||
TileEntity tile;
|
||||
|
||||
if (NeutronNodeWorld.nodeCache.containsKey(node))
|
||||
@ -108,7 +110,7 @@ public class PileNeutronHandler {
|
||||
if(te instanceof IPileNeutronReceiver) {
|
||||
|
||||
IPileNeutronReceiver rec = (IPileNeutronReceiver) te;
|
||||
rec.receiveNeutrons((int) fluxQuantity);
|
||||
rec.receiveNeutrons((int) Math.floor(fluxQuantity));
|
||||
|
||||
if(block != ModBlocks.block_graphite_detector || (meta & 8) == 0)
|
||||
return;
|
||||
|
||||
@ -1,97 +0,0 @@
|
||||
package com.hbm.packet;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
|
||||
@Deprecated // rest in peace sweet little prince
|
||||
public class NBTPacket implements IMessage {
|
||||
|
||||
PacketBuffer buffer;
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
public NBTPacket() { }
|
||||
|
||||
public NBTPacket(NBTTagCompound nbt, int x, int y, int z) {
|
||||
|
||||
this.buffer = new PacketBuffer(Unpooled.buffer());
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
|
||||
try {
|
||||
buffer.writeNBTTagCompoundToBuffer(nbt);
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
|
||||
x = buf.readInt();
|
||||
y = buf.readInt();
|
||||
z = buf.readInt();
|
||||
|
||||
if (buffer == null) {
|
||||
buffer = new PacketBuffer(Unpooled.buffer());
|
||||
}
|
||||
buffer.writeBytes(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
|
||||
buf.writeInt(x);
|
||||
buf.writeInt(y);
|
||||
buf.writeInt(z);
|
||||
|
||||
if (buffer == null) {
|
||||
buffer = new PacketBuffer(Unpooled.buffer());
|
||||
}
|
||||
buf.writeBytes(buffer);
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<NBTPacket, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(NBTPacket m, MessageContext ctx) {
|
||||
|
||||
if(Minecraft.getMinecraft().theWorld == null)
|
||||
return null;
|
||||
|
||||
TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(m.x, m.y, m.z);
|
||||
|
||||
try {
|
||||
|
||||
NBTTagCompound nbt = m.buffer.readNBTTagCompoundFromBuffer();
|
||||
|
||||
if(nbt != null) {
|
||||
|
||||
if(te instanceof INBTPacketReceiver)
|
||||
((INBTPacketReceiver) te).networkUnpack(nbt);
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -80,7 +80,8 @@ public class PacketDispatcher {
|
||||
|
||||
//Tile sync
|
||||
wrapper.registerMessage(AuxGaugePacket.Handler.class, AuxGaugePacket.class, i++, Side.CLIENT); //The horrid one
|
||||
wrapper.registerMessage(NBTPacket.Handler.class, NBTPacket.class, i++, Side.CLIENT); //The convenient but laggy one
|
||||
// fucking DIE
|
||||
//wrapper.registerMessage(NBTPacket.Handler.class, NBTPacket.class, i++, Side.CLIENT); //The convenient but laggy one
|
||||
wrapper.registerMessage(BufPacket.Handler.class, BufPacket.class, i++, Side.CLIENT); //The not-so-convenient but not laggy one
|
||||
}
|
||||
|
||||
|
||||
@ -1,17 +0,0 @@
|
||||
package com.hbm.tileentity;
|
||||
|
||||
import com.hbm.packet.NBTPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public interface INBTPacketReceiver {
|
||||
|
||||
public void networkUnpack(NBTTagCompound nbt);
|
||||
|
||||
public static void networkPack(TileEntity that, NBTTagCompound data, int range) {
|
||||
PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(data, that.xCoord, that.yCoord, that.zCoord), new TargetPoint(that.getWorldObj().provider.dimensionId, that.xCoord, that.yCoord, that.zCoord, range));
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,6 @@ package com.hbm.tileentity;
|
||||
|
||||
import com.hbm.packet.AuxGaugePacket;
|
||||
import com.hbm.packet.BufPacket;
|
||||
import com.hbm.packet.NBTPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
@ -17,7 +16,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
|
||||
public abstract class TileEntityMachineBase extends TileEntityLoadedBase implements ISidedInventory, INBTPacketReceiver, IBufPacketReceiver {
|
||||
public abstract class TileEntityMachineBase extends TileEntityLoadedBase implements ISidedInventory, IBufPacketReceiver {
|
||||
|
||||
public ItemStack slots[];
|
||||
|
||||
@ -154,11 +153,6 @@ public abstract class TileEntityMachineBase extends TileEntityLoadedBase impleme
|
||||
if(!worldObj.isRemote) PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, val, id), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range));
|
||||
}
|
||||
@Deprecated public void processGauge(int val, int id) { }
|
||||
|
||||
@Deprecated
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.muffled = nbt.getBoolean("muffled");
|
||||
}
|
||||
|
||||
/** Sends a sync packet that uses ByteBuf for efficient information-cramming */
|
||||
public void networkPackNT(int range) {
|
||||
|
||||
@ -1,15 +1,9 @@
|
||||
package com.hbm.tileentity;
|
||||
|
||||
import com.hbm.packet.BufPacket;
|
||||
import com.hbm.packet.NBTPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
|
||||
public abstract class TileEntityTickingBase extends TileEntityLoadedBase implements INBTPacketReceiver, IBufPacketReceiver {
|
||||
public abstract class TileEntityTickingBase extends TileEntityLoadedBase implements IBufPacketReceiver {
|
||||
|
||||
public TileEntityTickingBase() { }
|
||||
|
||||
@ -26,19 +20,11 @@ public abstract class TileEntityTickingBase extends TileEntityLoadedBase impleme
|
||||
@Override
|
||||
public abstract void updateEntity();
|
||||
|
||||
@Deprecated public void networkPack(NBTTagCompound nbt, int range) {
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(nbt, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range));
|
||||
}
|
||||
|
||||
@Deprecated public void networkUnpack(NBTTagCompound nbt) { }
|
||||
|
||||
@Deprecated
|
||||
public void handleButtonPacket(int value, int meta) { }
|
||||
|
||||
public void networkPackNT(int range) {
|
||||
if(!worldObj.isRemote) PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range));
|
||||
if(!worldObj.isRemote) sendStandard(range);
|
||||
}
|
||||
|
||||
@Override public void serialize(ByteBuf buf) {
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
package com.hbm.tileentity.bomb;
|
||||
|
||||
import com.hbm.blocks.bomb.BlockChargeBase;
|
||||
import com.hbm.packet.NBTPacket;
|
||||
import com.hbm.packet.BufPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityCharge extends TileEntity implements INBTPacketReceiver {
|
||||
public class TileEntityCharge extends TileEntity implements IBufPacketReceiver {
|
||||
|
||||
public boolean started;
|
||||
public int timer;
|
||||
@ -29,18 +29,21 @@ public class TileEntityCharge extends TileEntity implements INBTPacketReceiver {
|
||||
((BlockChargeBase)this.getBlockType()).explode(worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("timer", timer);
|
||||
data.setBoolean("started", started);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(data, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 100));
|
||||
|
||||
sendStandard(100);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
timer = data.getInteger("timer");
|
||||
started = data.getBoolean("started");
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeLong(this.timer);
|
||||
buf.writeBoolean(this.started);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.timer = buf.readInt();
|
||||
this.started = buf.readBoolean();
|
||||
}
|
||||
|
||||
public String getMinutes() {
|
||||
|
||||
@ -188,9 +188,9 @@ public class TileEntityCompactLauncher extends TileEntityLoadedBase implements I
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0)
|
||||
this.updateConnections();
|
||||
|
||||
PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
|
||||
|
||||
|
||||
sendStandard(50);
|
||||
|
||||
MissileStruct multipart = getStruct(slots[0]);
|
||||
|
||||
if(multipart != null)
|
||||
|
||||
@ -197,9 +197,9 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide
|
||||
this.decrStackSize(4, 1);
|
||||
solid += 250;
|
||||
}
|
||||
|
||||
PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
|
||||
|
||||
|
||||
sendStandard(50);
|
||||
|
||||
MissileStruct multipart = getStruct(slots[0]);
|
||||
|
||||
if(multipart != null)
|
||||
|
||||
@ -13,11 +13,12 @@ import com.hbm.inventory.RecipesCommon.OreDictStack;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemCircuit.EnumCircuitType;
|
||||
import com.hbm.items.special.ItemKitCustom;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.IRepairable;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
@ -27,7 +28,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityLanternBehemoth extends TileEntity implements INBTPacketReceiver, IRepairable {
|
||||
public class TileEntityLanternBehemoth extends TileEntity implements IBufPacketReceiver, IRepairable {
|
||||
|
||||
public boolean isBroken = false;
|
||||
public int comTimer = -1;
|
||||
@ -63,10 +64,8 @@ public class TileEntityLanternBehemoth extends TileEntity implements INBTPacketR
|
||||
if(comTimer >= 0) {
|
||||
comTimer--;
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("isBroken", isBroken);
|
||||
INBTPacketReceiver.networkPack(this, data, 250);
|
||||
|
||||
sendStandard(250);
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,8 +80,13 @@ public class TileEntityLanternBehemoth extends TileEntity implements INBTPacketR
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.isBroken = nbt.getBoolean("isBroken");
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeBoolean(this.isBroken);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.isBroken = buf.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -4,18 +4,17 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
|
||||
import api.hbm.energymk2.IBatteryItem;
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityCharger extends TileEntityLoadedBase implements IEnergyReceiverMK2, INBTPacketReceiver {
|
||||
public class TileEntityCharger extends TileEntityLoadedBase implements IEnergyReceiverMK2, IBufPacketReceiver {
|
||||
|
||||
private List<EntityPlayer> players = new ArrayList();
|
||||
private long charge = 0;
|
||||
@ -62,10 +61,7 @@ public class TileEntityCharger extends TileEntityLoadedBase implements IEnergyRe
|
||||
worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "random.fizz", 0.2F, 0.5F);
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("c", charge);
|
||||
data.setBoolean("p", particles);
|
||||
INBTPacketReceiver.networkPack(this, data, 50);
|
||||
sendStandard(50);
|
||||
}
|
||||
|
||||
lastUsingTicks = usingTicks;
|
||||
@ -94,9 +90,15 @@ public class TileEntityCharger extends TileEntityLoadedBase implements IEnergyRe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.charge = nbt.getLong("c");
|
||||
this.particles = nbt.getBoolean("p");
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeLong(this.charge);
|
||||
buf.writeBoolean(this.particles);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.charge = buf.readLong();
|
||||
this.particles = buf.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -6,15 +6,15 @@ import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
|
||||
import api.hbm.fluid.IFluidUser;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public abstract class TileEntityChimneyBase extends TileEntityLoadedBase implements IFluidUser, INBTPacketReceiver {
|
||||
public abstract class TileEntityChimneyBase extends TileEntityLoadedBase implements IFluidUser, IBufPacketReceiver {
|
||||
|
||||
public long ashTick = 0;
|
||||
public long sootTick = 0;
|
||||
@ -49,9 +49,7 @@ public abstract class TileEntityChimneyBase extends TileEntityLoadedBase impleme
|
||||
this.sootTick = 0;
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("onTicks", onTicks);
|
||||
INBTPacketReceiver.networkPack(this, data, 150);
|
||||
sendStandard(150);
|
||||
|
||||
if(onTicks > 0) onTicks--;
|
||||
|
||||
@ -72,9 +70,15 @@ public abstract class TileEntityChimneyBase extends TileEntityLoadedBase impleme
|
||||
}
|
||||
|
||||
public void spawnParticles() { }
|
||||
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.onTicks = nbt.getInteger("onTicks");
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeInt(this.onTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.onTicks = buf.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -13,11 +13,9 @@ import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.fluid.trait.FT_Coolable;
|
||||
import com.hbm.inventory.fluid.trait.FT_Coolable.CoolingType;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.NBTPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.sound.AudioWrapper;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.IConfigurableMachine;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
@ -27,9 +25,9 @@ import api.hbm.energymk2.IEnergyProviderMK2;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
@ -40,7 +38,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyProviderMK2, INBTPacketReceiver, IFluidStandardTransceiver, SimpleComponent, IInfoProviderEC, CompatHandler.OCComponent, IConfigurableMachine {
|
||||
public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyProviderMK2, IFluidStandardTransceiver, SimpleComponent, IInfoProviderEC, CompatHandler.OCComponent, IConfigurableMachine, IBufPacketReceiver {
|
||||
|
||||
public long power;
|
||||
private int turnTimer;
|
||||
@ -139,12 +137,8 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr
|
||||
turnTimer--;
|
||||
|
||||
if(operational) turnTimer = 25;
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
data.setInteger("type", tanks[0].getTankType().getID());
|
||||
data.setInteger("operational", turnTimer);
|
||||
this.networkPack(data, 150);
|
||||
|
||||
sendStandard(150);
|
||||
|
||||
} else {
|
||||
|
||||
@ -213,16 +207,19 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr
|
||||
new DirPos(xCoord - rot.offsetX * 3, yCoord, zCoord - rot.offsetZ * 3, rot.getOpposite())
|
||||
};
|
||||
}
|
||||
|
||||
public void networkPack(NBTTagCompound nbt, int range) {
|
||||
PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(nbt, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range));
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeLong(this.power);
|
||||
buf.writeInt(this.turnTimer);
|
||||
this.tanks[0].serialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
this.power = data.getLong("power");
|
||||
this.turnTimer = data.getInteger("operational");
|
||||
this.tanks[0].setTankType(Fluids.fromID(data.getInteger("type")));
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.power = buf.readLong();
|
||||
this.turnTimer = buf.readInt();
|
||||
this.tanks[0].deserialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -7,17 +7,16 @@ import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.saveddata.TomSaveData;
|
||||
import com.hbm.tileentity.IConfigurableMachine;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.tileentity.*;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
|
||||
public class TileEntityCondenser extends TileEntityLoadedBase implements IFluidStandardTransceiver, INBTPacketReceiver, IInfoProviderEC, IConfigurableMachine {
|
||||
public class TileEntityCondenser extends TileEntityLoadedBase implements IFluidStandardTransceiver, IInfoProviderEC, IConfigurableMachine, IBufPacketReceiver {
|
||||
|
||||
public int age = 0;
|
||||
public FluidTank[] tanks;
|
||||
@ -52,8 +51,6 @@ public class TileEntityCondenser extends TileEntityLoadedBase implements IFluidS
|
||||
writer.name("I:outputTankSize").value(outputTankSize);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
@ -95,9 +92,7 @@ public class TileEntityCondenser extends TileEntityLoadedBase implements IFluidS
|
||||
this.subscribeToAllAround(tanks[0].getTankType(), this);
|
||||
this.sendFluidToAll(tanks[1], this);
|
||||
|
||||
data.setByte("timer", (byte) this.waterTimer);
|
||||
packExtra(data);
|
||||
INBTPacketReceiver.networkPack(this, data, 150);
|
||||
sendStandard(150);
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,10 +101,17 @@ public class TileEntityCondenser extends TileEntityLoadedBase implements IFluidS
|
||||
public void postConvert(int convert) { }
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.tanks[0].readFromNBT(nbt, "0");
|
||||
this.tanks[1].readFromNBT(nbt, "1");
|
||||
this.waterTimer = nbt.getByte("timer");
|
||||
public void serialize(ByteBuf buf) {
|
||||
this.tanks[0].serialize(buf);
|
||||
this.tanks[1].serialize(buf);
|
||||
buf.writeByte(this.waterTimer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.tanks[0].deserialize(buf);
|
||||
this.tanks[1].deserialize(buf);
|
||||
this.waterTimer = buf.readByte();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -13,6 +13,7 @@ import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
@ -98,11 +99,21 @@ public class TileEntityCondenserPowered extends TileEntityCondenser implements I
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.power = nbt.getLong("power");
|
||||
this.tanks[0].readFromNBT(nbt, "0");
|
||||
this.tanks[1].readFromNBT(nbt, "1");
|
||||
this.waterTimer = nbt.getByte("timer");
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(this.power);
|
||||
this.tanks[0].serialize(buf);
|
||||
this.tanks[1].serialize(buf);
|
||||
buf.writeByte(this.waterTimer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
this.power = buf.readLong();
|
||||
this.tanks[0].deserialize(buf);
|
||||
this.tanks[1].deserialize(buf);
|
||||
this.waterTimer = buf.readByte();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -56,14 +56,6 @@ public class TileEntityDeuteriumExtractor extends TileEntityMachineBase implemen
|
||||
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
super.networkUnpack(data);
|
||||
|
||||
this.power = data.getLong("power");
|
||||
tanks[0].readFromNBT(data, "water");
|
||||
tanks[1].readFromNBT(data, "heavyWater");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
|
||||
@ -10,7 +10,6 @@ import com.hbm.inventory.gui.GUIDiFurnace;
|
||||
import com.hbm.inventory.recipes.BlastFurnaceRecipes;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityMachinePolluting;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
|
||||
@ -18,6 +17,7 @@ import api.hbm.fluid.IFluidStandardSender;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@ -230,11 +230,7 @@ public class TileEntityDiFurnace extends TileEntityMachinePolluting implements I
|
||||
MachineDiFurnace.updateBlockState(this.progress > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setShort("time", (short) this.progress);
|
||||
data.setShort("fuel", (short) this.fuel);
|
||||
data.setByteArray("modes", new byte[] { (byte) sideFuel, (byte) sideUpper, (byte) sideLower });
|
||||
INBTPacketReceiver.networkPack(this, data, 15);
|
||||
networkPackNT(15);
|
||||
|
||||
if(markDirty) {
|
||||
this.markDirty();
|
||||
@ -243,10 +239,21 @@ public class TileEntityDiFurnace extends TileEntityMachinePolluting implements I
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.progress = nbt.getShort("time");
|
||||
this.fuel = nbt.getShort("fuel");
|
||||
byte[] modes = nbt.getByteArray("modes");
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeShort(this.progress);
|
||||
buf.writeShort(this.fuel);
|
||||
buf.writeBytes(new byte[] {
|
||||
this.sideFuel,
|
||||
this.sideUpper,
|
||||
this.sideLower});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.progress = buf.readShort();
|
||||
this.fuel = buf.readShort();
|
||||
byte[] modes = new byte[3];
|
||||
buf.readBytes(modes);
|
||||
this.sideFuel = modes[0];
|
||||
this.sideUpper = modes[1];
|
||||
this.sideLower = modes[2];
|
||||
|
||||
@ -247,13 +247,6 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
this.stat_z = buf.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
super.networkUnpack(data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleButtonPacket(int value, int meta) {
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.tileentity.TileEntityTickingBase;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@ -25,7 +26,7 @@ public class TileEntityHadronDiode extends TileEntityTickingBase {
|
||||
|
||||
if(age >= 20) {
|
||||
age = 0;
|
||||
sendSides();
|
||||
this.networkPackNT(250);
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -35,27 +36,18 @@ public class TileEntityHadronDiode extends TileEntityTickingBase {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void sendSides() {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
|
||||
@Override public void serialize(ByteBuf buf) {
|
||||
for(int i = 0; i < 6; i++) {
|
||||
|
||||
if(sides[i] != null)
|
||||
data.setInteger("" + i, sides[i].ordinal());
|
||||
buf.writeByte(sides[i].ordinal());
|
||||
}
|
||||
|
||||
this.networkPack(data, 250);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
|
||||
@Override public void deserialize(ByteBuf buf) {
|
||||
for(int i = 0; i < 6; i++) {
|
||||
sides[i] = DiodeConfig.values()[nbt.getInteger("" + i)];
|
||||
sides[i] = DiodeConfig.values()[buf.readByte()];
|
||||
}
|
||||
|
||||
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@ -75,7 +67,7 @@ public class TileEntityHadronDiode extends TileEntityTickingBase {
|
||||
public void setConfig(int side, int config) {
|
||||
sides[side] = DiodeConfig.values()[config];
|
||||
this.markDirty();
|
||||
sendSides();
|
||||
this.networkPackNT(250);
|
||||
}
|
||||
|
||||
public static enum DiodeConfig {
|
||||
|
||||
@ -29,8 +29,8 @@ public class TileEntityHadronPower extends TileEntityLoadedBase implements IEner
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
}
|
||||
|
||||
PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 15));
|
||||
|
||||
sendStandard(15);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -18,8 +18,8 @@ import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.saveddata.TomSaveData;
|
||||
import com.hbm.sound.AudioWrapper;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.IConfigurableMachine;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
@ -27,13 +27,16 @@ import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import api.hbm.tile.IHeatSource;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityHeatBoiler extends TileEntityLoadedBase implements INBTPacketReceiver, IFluidStandardTransceiver, IConfigurableMachine {
|
||||
public class TileEntityHeatBoiler extends TileEntityLoadedBase implements IBufPacketReceiver, IFluidStandardTransceiver, IConfigurableMachine {
|
||||
|
||||
public int heat;
|
||||
public FluidTank[] tanks;
|
||||
@ -54,14 +57,14 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements INBTPa
|
||||
this.tanks[0] = new FluidTank(Fluids.WATER, 16_000);
|
||||
this.tanks[1] = new FluidTank(Fluids.STEAM, 16_000 * 100);
|
||||
}
|
||||
|
||||
ByteBuf buf = new PacketBuffer(Unpooled.buffer());
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
if(!this.hasExploded) {
|
||||
this.setupTanks();
|
||||
this.updateConnections();
|
||||
@ -72,23 +75,23 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements INBTPa
|
||||
if(light > 7 && TomSaveData.forWorld(worldObj).fire > 1e-5) {
|
||||
this.heat += ((maxHeat - heat) * 0.000005D); //constantly heat up 0.0005% of the remaining heat buffer for rampant but diminishing heating
|
||||
}
|
||||
|
||||
data.setInteger("heat", lastHeat);
|
||||
|
||||
tanks[0].writeToNBT(data, "0");
|
||||
buf.writeInt(lastHeat);
|
||||
|
||||
tanks[0].serialize(buf);
|
||||
this.isOn = false;
|
||||
this.tryConvert();
|
||||
tanks[1].writeToNBT(data, "1");
|
||||
tanks[1].serialize(buf);
|
||||
|
||||
if(this.tanks[1].getFill() > 0) {
|
||||
this.sendFluid();
|
||||
}
|
||||
}
|
||||
|
||||
data.setBoolean("exploded", this.hasExploded);
|
||||
data.setBoolean("isOn", this.isOn);
|
||||
data.setBoolean("muffled", this.muffled);
|
||||
INBTPacketReceiver.networkPack(this, data, 25);
|
||||
buf.writeBoolean(this.hasExploded);
|
||||
buf.writeBoolean(this.muffled);
|
||||
buf.writeBoolean(this.isOn);
|
||||
sendStandard(25);
|
||||
} else {
|
||||
|
||||
if(this.isOn) audioTime = 20;
|
||||
@ -143,13 +146,19 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements INBTPa
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.hasExploded = nbt.getBoolean("exploded");
|
||||
this.muffled = nbt.getBoolean("muffled");
|
||||
this.heat = nbt.getInteger("heat");
|
||||
this.tanks[0].readFromNBT(nbt, "0");
|
||||
this.tanks[1].readFromNBT(nbt, "1");
|
||||
this.isOn = nbt.getBoolean("isOn");
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeBytes(this.buf);
|
||||
this.buf = new PacketBuffer(Unpooled.buffer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.heat = buf.readInt();
|
||||
this.tanks[0].deserialize(buf);
|
||||
this.tanks[1].deserialize(buf);
|
||||
this.hasExploded = buf.readBoolean();
|
||||
this.muffled = buf.readBoolean();
|
||||
this.isOn = buf.readBoolean();
|
||||
}
|
||||
|
||||
protected void tryPullHeat() {
|
||||
|
||||
@ -13,8 +13,8 @@ import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.saveddata.TomSaveData;
|
||||
import com.hbm.sound.AudioWrapper;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.IConfigurableMachine;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
@ -22,12 +22,15 @@ import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import api.hbm.tile.IHeatSource;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
|
||||
public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase implements INBTPacketReceiver, IFluidStandardTransceiver, IConfigurableMachine {
|
||||
public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase implements IBufPacketReceiver, IFluidStandardTransceiver, IConfigurableMachine {
|
||||
|
||||
public int heat;
|
||||
public FluidTank[] tanks;
|
||||
@ -46,13 +49,14 @@ public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase impleme
|
||||
this.tanks[0] = new FluidTank(Fluids.WATER, 64_000);
|
||||
this.tanks[1] = new FluidTank(Fluids.STEAM, 64_000 * 100);
|
||||
}
|
||||
|
||||
|
||||
ByteBuf buf = new PacketBuffer(Unpooled.buffer());
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
this.setupTanks();
|
||||
this.updateConnections();
|
||||
this.tryPullHeat();
|
||||
@ -62,21 +66,22 @@ public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase impleme
|
||||
if(light > 7 && TomSaveData.forWorld(worldObj).fire > 1e-5) {
|
||||
this.heat += ((maxHeat - heat) * 0.000005D); //constantly heat up 0.0005% of the remaining heat buffer for rampant but diminishing heating
|
||||
}
|
||||
|
||||
data.setInteger("heat", lastHeat);
|
||||
|
||||
tanks[0].writeToNBT(data, "0");
|
||||
buf.writeInt(lastHeat);
|
||||
|
||||
tanks[0].serialize(buf);
|
||||
this.isOn = false;
|
||||
this.tryConvert();
|
||||
tanks[1].writeToNBT(data, "1");
|
||||
tanks[1].serialize(buf);
|
||||
|
||||
if(this.tanks[1].getFill() > 0) {
|
||||
this.sendFluid();
|
||||
}
|
||||
|
||||
data.setBoolean("isOn", this.isOn);
|
||||
data.setBoolean("muffled", this.muffled);
|
||||
INBTPacketReceiver.networkPack(this, data, 25);
|
||||
buf.writeBoolean(this.isOn);
|
||||
buf.writeBoolean(this.muffled);
|
||||
sendStandard(25);
|
||||
|
||||
} else {
|
||||
|
||||
if(this.isOn) audioTime = 20;
|
||||
@ -131,12 +136,18 @@ public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.heat = nbt.getInteger("heat");
|
||||
this.tanks[0].readFromNBT(nbt, "0");
|
||||
this.tanks[1].readFromNBT(nbt, "1");
|
||||
this.isOn = nbt.getBoolean("isOn");
|
||||
this.muffled = nbt.getBoolean("muffled");
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeBytes(this.buf);
|
||||
this.buf = new PacketBuffer(Unpooled.buffer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.heat = buf.readInt();
|
||||
this.tanks[0].deserialize(buf);
|
||||
this.tanks[1].deserialize(buf);
|
||||
this.isOn = buf.readBoolean();
|
||||
this.muffled = buf.readBoolean();
|
||||
}
|
||||
|
||||
protected void tryPullHeat() {
|
||||
|
||||
@ -3,7 +3,7 @@ package com.hbm.tileentity.machine;
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.sound.AudioWrapper;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
|
||||
@ -12,12 +12,13 @@ import api.hbm.tile.IHeatSource;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityHeaterElectric extends TileEntityLoadedBase implements IHeatSource, IEnergyReceiverMK2, INBTPacketReceiver, IInfoProviderEC {
|
||||
public class TileEntityHeaterElectric extends TileEntityLoadedBase implements IHeatSource, IEnergyReceiverMK2, IBufPacketReceiver, IInfoProviderEC {
|
||||
|
||||
public long power;
|
||||
public int heatEnergy;
|
||||
@ -47,12 +48,7 @@ public class TileEntityHeaterElectric extends TileEntityLoadedBase implements IH
|
||||
this.isOn = true;
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setByte("s", (byte) this.setting);
|
||||
data.setInteger("h", this.heatEnergy);
|
||||
data.setBoolean("o", isOn);
|
||||
data.setBoolean("muffled", muffled);
|
||||
INBTPacketReceiver.networkPack(this, data, 25);
|
||||
sendStandard(25);
|
||||
} else {
|
||||
|
||||
if(isOn) {
|
||||
@ -103,11 +99,19 @@ public class TileEntityHeaterElectric extends TileEntityLoadedBase implements IH
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.setting = nbt.getByte("s");
|
||||
this.heatEnergy = nbt.getInteger("h");
|
||||
this.isOn = nbt.getBoolean("o");
|
||||
this.muffled = nbt.getBoolean("muffled");
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeBoolean(this.muffled);
|
||||
buf.writeByte(this.setting);
|
||||
buf.writeInt(this.heatEnergy);
|
||||
buf.writeBoolean(this.isOn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.muffled = buf.readBoolean();
|
||||
this.setting = buf.readByte();
|
||||
this.heatEnergy = buf.readInt();
|
||||
this.isOn = buf.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -10,7 +10,6 @@ import com.hbm.inventory.fluid.trait.FT_Coolable;
|
||||
import com.hbm.inventory.fluid.trait.FT_Coolable.CoolingType;
|
||||
import com.hbm.inventory.gui.GUIHeaterHeatex;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
@ -18,6 +17,7 @@ import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import api.hbm.tile.IHeatSource;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -27,7 +27,7 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHeatSource, INBTPacketReceiver, IFluidStandardTransceiver, IGUIProvider, IControlReceiver {
|
||||
public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHeatSource, IFluidStandardTransceiver, IGUIProvider, IControlReceiver {
|
||||
|
||||
public FluidTank[] tanks;
|
||||
public int amountToCool = 1;
|
||||
@ -56,28 +56,30 @@ public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHe
|
||||
|
||||
this.heatEnergy *= 0.999;
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
tanks[0].writeToNBT(data, "0");
|
||||
this.tryConvert();
|
||||
tanks[1].writeToNBT(data, "1");
|
||||
data.setInteger("heat", heatEnergy);
|
||||
data.setInteger("toCool", amountToCool);
|
||||
data.setInteger("delay", tickDelay);
|
||||
INBTPacketReceiver.networkPack(this, data, 25);
|
||||
networkPackNT(25);
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
if(this.tanks[1].getFill() > 0) this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
tanks[0].readFromNBT(nbt, "0");
|
||||
tanks[1].readFromNBT(nbt, "1");
|
||||
this.heatEnergy = nbt.getInteger("heat");
|
||||
this.amountToCool = nbt.getInteger("toCool");
|
||||
this.tickDelay = nbt.getInteger("delay");
|
||||
public void serialize(ByteBuf buf) {
|
||||
tanks[0].serialize(buf);
|
||||
tanks[1].serialize(buf);
|
||||
buf.writeInt(this.heatEnergy);
|
||||
buf.writeInt(this.amountToCool);
|
||||
buf.writeInt(this.tickDelay);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
tanks[0].deserialize(buf);
|
||||
tanks[1].deserialize(buf);
|
||||
this.heatEnergy = buf.readInt();
|
||||
this.amountToCool = buf.readInt();
|
||||
this.tickDelay = buf.readInt();
|
||||
}
|
||||
|
||||
protected void setupTanks() {
|
||||
|
||||
@ -133,19 +133,6 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im
|
||||
steam.deserialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.progress = nbt.getIntArray("progress");
|
||||
this.maxProgress = nbt.getIntArray("maxProgress");
|
||||
this.isProgressing = nbt.getBoolean("isProgressing");
|
||||
|
||||
water.readFromNBT(nbt, "w");
|
||||
steam.readFromNBT(nbt, "s");
|
||||
}
|
||||
|
||||
private int getWaterRequired() {
|
||||
return 1000 / this.speed;
|
||||
}
|
||||
|
||||
@ -11,13 +11,14 @@ import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardReceiver;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.block.material.Material;
|
||||
@ -29,7 +30,7 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements INBTPacketReceiver, IFluidStandardReceiver {
|
||||
public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IBufPacketReceiver, IFluidStandardReceiver {
|
||||
|
||||
public static final HashSet<FluidType> acceptedFuels = new HashSet();
|
||||
|
||||
@ -174,12 +175,7 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IN
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("isOn", isOn);
|
||||
data.setFloat("yaw", this.rotationYaw);
|
||||
data.setFloat("pitch", this.rotationPitch);
|
||||
tank.writeToNBT(data, "t");
|
||||
INBTPacketReceiver.networkPack(this, data, 100);
|
||||
sendStandard(100);
|
||||
} else {
|
||||
|
||||
this.lastSpin = this.spin;
|
||||
@ -280,12 +276,20 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IN
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.isOn = nbt.getBoolean("isOn");
|
||||
this.syncYaw = nbt.getFloat("yaw");
|
||||
this.syncPitch = nbt.getFloat("pitch");
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeBoolean(this.isOn);
|
||||
buf.writeFloat(this.syncYaw);
|
||||
buf.writeFloat(this.syncPitch);
|
||||
this.tank.serialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.isOn = buf.readBoolean();
|
||||
this.syncYaw = buf.readFloat();
|
||||
this.syncPitch = buf.readFloat();
|
||||
this.turnProgress = 3; //use 3-ply for extra smoothness
|
||||
this.tank.readFromNBT(nbt, "t");
|
||||
this.tank.deserialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -46,9 +46,9 @@ public class TileEntityMachineDrain extends TileEntityLoadedBase implements IFlu
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
||||
for(DirPos pos : getConPos()) this.trySubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
|
||||
PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
|
||||
|
||||
|
||||
sendStandard(50);
|
||||
|
||||
if(tank.getFill() > 0) {
|
||||
if(tank.getTankType().hasTrait(FT_Amat.class)) {
|
||||
worldObj.newExplosion(null, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 10F, true, true);
|
||||
|
||||
@ -10,20 +10,23 @@ import com.hbm.inventory.fluid.trait.FT_Heatable.HeatingType;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.sound.AudioWrapper;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineHephaestus extends TileEntityLoadedBase implements INBTPacketReceiver, IFluidStandardTransceiver {
|
||||
public class TileEntityMachineHephaestus extends TileEntityLoadedBase implements IBufPacketReceiver, IFluidStandardTransceiver {
|
||||
|
||||
public FluidTank input;
|
||||
public FluidTank output;
|
||||
@ -41,7 +44,9 @@ public class TileEntityMachineHephaestus extends TileEntityLoadedBase implements
|
||||
private long fissureScanTime;
|
||||
|
||||
private AudioWrapper audio;
|
||||
|
||||
|
||||
ByteBuf buf = new PacketBuffer(Unpooled.buffer());
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
@ -66,21 +71,20 @@ public class TileEntityMachineHephaestus extends TileEntityLoadedBase implements
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
input.writeToNBT(data, "i");
|
||||
|
||||
input.serialize(buf);
|
||||
|
||||
heatFluid();
|
||||
|
||||
output.writeToNBT(data, "o");
|
||||
output.serialize(buf);
|
||||
|
||||
if(output.getFill() > 0) {
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.sendFluid(output, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
data.setInteger("heat", this.getTotalHeat());
|
||||
INBTPacketReceiver.networkPack(this, data, 150);
|
||||
buf.writeInt(this.getTotalHeat());
|
||||
sendStandard(150);
|
||||
|
||||
} else {
|
||||
|
||||
@ -182,11 +186,17 @@ public class TileEntityMachineHephaestus extends TileEntityLoadedBase implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
input.readFromNBT(nbt, "i");
|
||||
output.readFromNBT(nbt, "o");
|
||||
|
||||
this.bufferedHeat = nbt.getInteger("heat");
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeBytes(this.buf);
|
||||
this.buf = new PacketBuffer(Unpooled.buffer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
input.deserialize(buf);
|
||||
output.deserialize(buf);
|
||||
|
||||
this.bufferedHeat = buf.readInt();
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
@ -222,15 +222,18 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
|
||||
return new int[] { 3, 4, 5, 6 };
|
||||
}
|
||||
|
||||
// o7
|
||||
/*
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.spin = nbt.getInteger("spin");
|
||||
this.burn = nbt.getIntArray("burn");
|
||||
this.hasRTG = nbt.getBoolean("hasRTG");
|
||||
}
|
||||
*/
|
||||
|
||||
public int getPowerFromFuel(boolean con) {
|
||||
FluidType type = tanks[1].getTankType();
|
||||
|
||||
@ -14,7 +14,6 @@ import com.hbm.inventory.recipes.MixerRecipes.MixerRecipe;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.IUpgradeInfoProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
@ -35,7 +34,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityMachineMixer extends TileEntityMachineBase implements INBTPacketReceiver, IControlReceiver, IGUIProvider, IEnergyReceiverMK2, IFluidStandardTransceiver, IUpgradeInfoProvider {
|
||||
public class TileEntityMachineMixer extends TileEntityMachineBase implements IControlReceiver, IGUIProvider, IEnergyReceiverMK2, IFluidStandardTransceiver, IUpgradeInfoProvider {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 10_000;
|
||||
@ -162,20 +161,6 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB
|
||||
|
||||
for(int i = 0; i < tanks.length; i++) tanks[i].deserialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.processTime = nbt.getInteger("processTime");
|
||||
this.progress = nbt.getInteger("progress");
|
||||
this.recipeIndex = nbt.getInteger("recipe");
|
||||
this.wasOn = nbt.getBoolean("wasOn");
|
||||
for(int i = 0; i < 3; i++) {
|
||||
tanks[i].readFromNBT(nbt, i + "");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canProcess() {
|
||||
|
||||
|
||||
@ -175,24 +175,6 @@ public class TileEntityMachinePress extends TileEntityMachineBase implements IGU
|
||||
this.turnProgress = 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.speed = nbt.getInteger("speed");
|
||||
this.burnTime = nbt.getInteger("burnTime");
|
||||
this.syncPress = nbt.getInteger("press");
|
||||
|
||||
if(nbt.hasKey("stack")) {
|
||||
NBTTagCompound stack = nbt.getCompoundTag("stack");
|
||||
this.syncStack = ItemStack.loadItemStackFromNBT(stack);
|
||||
} else {
|
||||
this.syncStack = null;
|
||||
}
|
||||
|
||||
this.turnProgress = 2;
|
||||
}
|
||||
|
||||
public boolean canProcess() {
|
||||
if(burnTime < 200) return false;
|
||||
if(slots[1] == null || slots[2] == null) return false;
|
||||
|
||||
@ -9,20 +9,19 @@ import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.IConfigurableMachine;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.tileentity.*;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public abstract class TileEntityMachinePumpBase extends TileEntityLoadedBase implements IFluidStandardTransceiver, INBTPacketReceiver, IConfigurableMachine {
|
||||
public abstract class TileEntityMachinePumpBase extends TileEntityLoadedBase implements IFluidStandardTransceiver, IBufPacketReceiver, IConfigurableMachine {
|
||||
|
||||
public static final HashSet<Block> validBlocks = new HashSet();
|
||||
|
||||
@ -50,7 +49,7 @@ public abstract class TileEntityMachinePumpBase extends TileEntityLoadedBase imp
|
||||
public static int groundDepth = 4;
|
||||
public static int steamSpeed = 1_000;
|
||||
public static int electricSpeed = 10_000;
|
||||
|
||||
|
||||
@Override
|
||||
public String getConfigName() {
|
||||
return "waterpump";
|
||||
@ -91,9 +90,8 @@ public abstract class TileEntityMachinePumpBase extends TileEntityLoadedBase imp
|
||||
this.isOn = true;
|
||||
this.operate();
|
||||
}
|
||||
|
||||
NBTTagCompound data = this.getSync();
|
||||
INBTPacketReceiver.networkPack(this, data, 150);
|
||||
|
||||
sendStandard(150);
|
||||
|
||||
} else {
|
||||
|
||||
@ -133,20 +131,19 @@ public abstract class TileEntityMachinePumpBase extends TileEntityLoadedBase imp
|
||||
|
||||
return validBlocks >= invalidBlocks; // valid block count has to be at least 50%
|
||||
}
|
||||
|
||||
protected NBTTagCompound getSync() {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("isOn", isOn);
|
||||
data.setBoolean("onGround", onGround);
|
||||
water.writeToNBT(data, "w");
|
||||
return data;
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeBoolean(this.isOn);
|
||||
buf.writeBoolean(this.onGround);
|
||||
water.serialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.isOn = nbt.getBoolean("isOn");
|
||||
this.onGround = nbt.getBoolean("onGround");
|
||||
water.readFromNBT(nbt, "w");
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.isOn = buf.readBoolean();
|
||||
this.onGround = buf.readBoolean();
|
||||
water.deserialize(buf);
|
||||
}
|
||||
|
||||
protected abstract boolean canOperate();
|
||||
|
||||
@ -5,6 +5,7 @@ import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class TileEntityMachinePumpElectric extends TileEntityMachinePumpBase implements IEnergyReceiverMK2 {
|
||||
@ -28,17 +29,17 @@ public class TileEntityMachinePumpElectric extends TileEntityMachinePumpBase imp
|
||||
|
||||
super.updateEntity();
|
||||
}
|
||||
|
||||
protected NBTTagCompound getSync() {
|
||||
NBTTagCompound data = super.getSync();
|
||||
data.setLong("power", power);
|
||||
return data;
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(this.power);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
this.power = nbt.getLong("power");
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
this.power = buf.readLong();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -4,6 +4,7 @@ import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class TileEntityMachinePumpSteam extends TileEntityMachinePumpBase {
|
||||
@ -47,19 +48,19 @@ public class TileEntityMachinePumpSteam extends TileEntityMachinePumpBase {
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {steam};
|
||||
}
|
||||
|
||||
protected NBTTagCompound getSync() {
|
||||
NBTTagCompound data = super.getSync();
|
||||
steam.writeToNBT(data, "s");
|
||||
lps.writeToNBT(data, "l");
|
||||
return data;
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
steam.serialize(buf);
|
||||
lps.serialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
steam.readFromNBT(nbt, "s");
|
||||
lps.readFromNBT(nbt, "l");
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
steam.deserialize(buf);
|
||||
lps.deserialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -215,7 +215,7 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I
|
||||
screen.refZ = zCoord;
|
||||
screen.range = this.getRange();
|
||||
screen.linked = true;
|
||||
PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, pos.getX(), pos.getY(), pos.getZ(), 25));
|
||||
sendStandard(25);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,19 +3,16 @@ package com.hbm.tileentity.machine;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.packet.BufPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
|
||||
import api.hbm.entity.RadarEntry;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityMachineRadarScreen extends TileEntity implements IBufPacketReceiver {
|
||||
public class TileEntityMachineRadarScreen extends TileEntityLoadedBase implements IBufPacketReceiver {
|
||||
|
||||
public List<RadarEntry> entries = new ArrayList();
|
||||
public int refX;
|
||||
@ -28,16 +25,12 @@ public class TileEntityMachineRadarScreen extends TileEntity implements IBufPack
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
this.networkPackNT(100);
|
||||
this.sendStandard(100);
|
||||
entries.clear();
|
||||
this.linked = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void networkPackNT(int range) {
|
||||
if(!worldObj.isRemote) PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeBoolean(linked);
|
||||
|
||||
@ -11,14 +11,12 @@ import com.hbm.inventory.material.Mats;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemMold;
|
||||
import com.hbm.items.machine.ItemScraps;
|
||||
import com.hbm.packet.NBTPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -32,7 +30,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
//god thank you bob for this base class
|
||||
public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase implements IGUIProvider, ICrucibleAcceptor, ISidedInventory, IFluidStandardTransceiver, INBTPacketReceiver, IInventory {
|
||||
public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase implements IGUIProvider, ICrucibleAcceptor, ISidedInventory, IFluidStandardTransceiver, IBufPacketReceiver, IInventory {
|
||||
|
||||
public FluidTank water;
|
||||
public FluidTank steam;
|
||||
@ -110,12 +108,7 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
water.writeToNBT(data, "w");
|
||||
steam.writeToNBT(data, "s");
|
||||
|
||||
this.networkPack(data, 150);
|
||||
sendStandard(150);
|
||||
|
||||
}
|
||||
|
||||
@ -254,16 +247,14 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase
|
||||
return new GUIMachineStrandCaster(player.inventory, this);
|
||||
}
|
||||
|
||||
public void networkPack(NBTTagCompound nbt, int range) {
|
||||
if(!worldObj.isRemote)
|
||||
PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(nbt, xCoord, yCoord, zCoord), new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range));
|
||||
@Override public void serialize(ByteBuf buf) {
|
||||
water.serialize(buf);
|
||||
steam.serialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
water.readFromNBT(nbt, "w");
|
||||
steam.readFromNBT(nbt, "s");
|
||||
|
||||
@Override public void deserialize(ByteBuf buf) {
|
||||
water.deserialize(buf);
|
||||
steam.deserialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -3,12 +3,14 @@ package com.hbm.tileentity.machine;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityTracker;
|
||||
@ -29,7 +31,7 @@ import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineTeleporter extends TileEntityLoadedBase implements IEnergyReceiverMK2, INBTPacketReceiver {
|
||||
public class TileEntityMachineTeleporter extends TileEntityLoadedBase implements IEnergyReceiverMK2, IBufPacketReceiver {
|
||||
|
||||
public long power = 0;
|
||||
public int targetX = -1;
|
||||
@ -55,10 +57,7 @@ public class TileEntityMachineTeleporter extends TileEntityLoadedBase implements
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
data.setIntArray("target", new int[] {targetX, targetY, targetZ, targetDim});
|
||||
INBTPacketReceiver.networkPack(this, data, 15);
|
||||
sendStandard(15);
|
||||
|
||||
} else {
|
||||
|
||||
@ -72,9 +71,15 @@ public class TileEntityMachineTeleporter extends TileEntityLoadedBase implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.power = nbt.getLong("power");
|
||||
int[] target = nbt.getIntArray("target");
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeLong(power);
|
||||
BufferUtil.writeIntArray(buf, new int[] {targetX, targetY, targetZ, targetDim});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.power = buf.readLong();
|
||||
int[] target = BufferUtil.readIntArray(buf);
|
||||
this.targetX = target[0];
|
||||
this.targetY = target[1];
|
||||
this.targetZ = target[2];
|
||||
|
||||
@ -1,20 +1,22 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.network.RTTYSystem;
|
||||
import com.hbm.tileentity.network.RTTYSystem.RTTYChannel;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import com.hbm.util.NoteBuilder;
|
||||
import com.hbm.util.NoteBuilder.Instrument;
|
||||
import com.hbm.util.NoteBuilder.Note;
|
||||
import com.hbm.util.NoteBuilder.Octave;
|
||||
import com.hbm.util.Tuple.Triplet;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityRadioRec extends TileEntity implements INBTPacketReceiver, IControlReceiver {
|
||||
public class TileEntityRadioRec extends TileEntity implements IBufPacketReceiver, IControlReceiver {
|
||||
|
||||
public String channel = "";
|
||||
public boolean isOn = false;
|
||||
@ -49,17 +51,20 @@ public class TileEntityRadioRec extends TileEntity implements INBTPacketReceiver
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("channel", channel);
|
||||
data.setBoolean("isOn", isOn);
|
||||
INBTPacketReceiver.networkPack(this, data, 15);
|
||||
sendStandard(15);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
channel = nbt.getString("channel");
|
||||
isOn = nbt.getBoolean("isOn");
|
||||
public void serialize(ByteBuf buf) {
|
||||
BufferUtil.writeString(buf, this.channel);
|
||||
buf.writeBoolean(this.isOn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.channel = BufferUtil.readString(buf);
|
||||
this.isOn = buf.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -10,15 +10,17 @@ import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineAutocrafter.InventoryCraftingAuto;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import com.hbm.util.ItemStackUtil;
|
||||
|
||||
import api.hbm.tile.IHeatSource;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
@ -27,7 +29,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
@ -144,24 +146,8 @@ public class TileEntitySawmill extends TileEntityMachineBase {
|
||||
this.overspeed = 0;
|
||||
this.warnCooldown = 0;
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("heat", heat);
|
||||
data.setInteger("progress", progress);
|
||||
data.setBoolean("hasBlade", hasBlade);
|
||||
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(int i = 0; i < slots.length; i++) {
|
||||
if(slots[i] != null) {
|
||||
NBTTagCompound nbt1 = new NBTTagCompound();
|
||||
nbt1.setByte("slot", (byte) i);
|
||||
slots[i].writeToNBT(nbt1);
|
||||
list.appendTag(nbt1);
|
||||
}
|
||||
}
|
||||
data.setTag("items", list);
|
||||
|
||||
INBTPacketReceiver.networkPack(this, data, 150);
|
||||
networkPackNT(150);
|
||||
|
||||
this.heat = 0;
|
||||
|
||||
@ -180,20 +166,28 @@ public class TileEntitySawmill extends TileEntityMachineBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.heat = nbt.getInteger("heat");
|
||||
this.progress = nbt.getInteger("progress");
|
||||
this.hasBlade = nbt.getBoolean("hasBlade");
|
||||
|
||||
NBTTagList list = nbt.getTagList("items", 10);
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeInt(heat);
|
||||
buf.writeInt(progress);
|
||||
buf.writeBoolean(hasBlade);
|
||||
|
||||
slots = new ItemStack[3];
|
||||
for(int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
|
||||
byte b0 = nbt1.getByte("slot");
|
||||
if(b0 >= 0 && b0 < slots.length) {
|
||||
slots[b0] = ItemStack.loadItemStackFromNBT(nbt1);
|
||||
}
|
||||
ByteBuf itemBuf = new PacketBuffer(Unpooled.buffer());
|
||||
|
||||
for (ItemStack slot : slots) {
|
||||
BufferUtil.writeItemStack(buf, slot);
|
||||
}
|
||||
|
||||
buf.writeBytes(itemBuf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.heat = buf.readInt();
|
||||
this.progress = buf.readInt();
|
||||
this.hasBlade = buf.readBoolean();
|
||||
|
||||
for(int i = 0; i < slots.length; i++) {
|
||||
slots[i] = BufferUtil.readItemStack(buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,13 +5,10 @@ import java.util.HashSet;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.packet.BufPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
@ -56,7 +53,7 @@ public class TileEntitySolarBoiler extends TileEntityLoadedBase implements IFlui
|
||||
|
||||
heat = 0;
|
||||
|
||||
networkPackNT(15);
|
||||
sendStandard(15);
|
||||
} else {
|
||||
|
||||
//a delayed queue of mirror positions because we can't expect the boiler to always tick first
|
||||
@ -121,10 +118,6 @@ public class TileEntitySolarBoiler extends TileEntityLoadedBase implements IFlui
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { water, steam };
|
||||
}
|
||||
|
||||
public void networkPackNT(int range) {
|
||||
if(!worldObj.isRemote) PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
|
||||
@ -4,6 +4,7 @@ import com.hbm.tileentity.TileEntityTickingBase;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
@ -28,7 +29,7 @@ public class TileEntitySolarMirror extends TileEntityTickingBase {
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0)
|
||||
sendUpdate();
|
||||
this.networkPackNT(200);
|
||||
|
||||
if(tY < yCoord) {
|
||||
isOn = false;
|
||||
@ -64,22 +65,18 @@ public class TileEntitySolarMirror extends TileEntityTickingBase {
|
||||
}
|
||||
}
|
||||
|
||||
public void sendUpdate() {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("posX", tX);
|
||||
data.setInteger("posY", tY);
|
||||
data.setInteger("posZ", tZ);
|
||||
data.setBoolean("isOn", isOn);
|
||||
this.networkPack(data, 200);
|
||||
@Override public void serialize(ByteBuf buf) {
|
||||
buf.writeInt(this.tX);
|
||||
buf.writeInt(this.tY);
|
||||
buf.writeInt(this.tZ);
|
||||
buf.writeBoolean(this.isOn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
tX = nbt.getInteger("posX");
|
||||
tY = nbt.getInteger("posY");
|
||||
tZ = nbt.getInteger("posZ");
|
||||
isOn = nbt.getBoolean("isOn");
|
||||
@Override public void deserialize(ByteBuf buf) {
|
||||
this.tX = buf.readInt();
|
||||
this.tY = buf.readInt();
|
||||
this.tZ = buf.readInt();
|
||||
this.isOn = buf.readBoolean();
|
||||
}
|
||||
|
||||
public void setTarget(int x, int y, int z) {
|
||||
@ -87,7 +84,7 @@ public class TileEntitySolarMirror extends TileEntityTickingBase {
|
||||
tY = y;
|
||||
tZ = z;
|
||||
this.markDirty();
|
||||
this.sendUpdate();
|
||||
this.networkPackNT(200);
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
|
||||
@ -9,8 +9,8 @@ import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.fluid.trait.FT_Coolable;
|
||||
import com.hbm.inventory.fluid.trait.FT_Coolable.CoolingType;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.IConfigurableMachine;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
@ -18,13 +18,16 @@ import api.hbm.energymk2.IEnergyProviderMK2;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntitySteamEngine extends TileEntityLoadedBase implements IEnergyProviderMK2, IFluidStandardTransceiver, INBTPacketReceiver, IConfigurableMachine {
|
||||
public class TileEntitySteamEngine extends TileEntityLoadedBase implements IEnergyProviderMK2, IFluidStandardTransceiver, IBufPacketReceiver, IConfigurableMachine {
|
||||
|
||||
public long powerBuffer;
|
||||
|
||||
@ -66,7 +69,9 @@ public class TileEntitySteamEngine extends TileEntityLoadedBase implements IEner
|
||||
writer.name("I:ldsCap").value(ldsCap);
|
||||
writer.name("D:efficiency").value(efficiency);
|
||||
}
|
||||
|
||||
|
||||
ByteBuf buf = new PacketBuffer(Unpooled.buffer());
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
@ -76,9 +81,8 @@ public class TileEntitySteamEngine extends TileEntityLoadedBase implements IEner
|
||||
|
||||
tanks[0].setTankType(Fluids.STEAM);
|
||||
tanks[1].setTankType(Fluids.SPENTSTEAM);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
tanks[0].writeToNBT(data, "s");
|
||||
|
||||
tanks[0].serialize(buf);
|
||||
|
||||
FT_Coolable trait = tanks[0].getTankType().getTrait(FT_Coolable.class);
|
||||
double eff = trait.getEfficiency(CoolingType.TURBINE) * efficiency;
|
||||
@ -105,9 +109,9 @@ public class TileEntitySteamEngine extends TileEntityLoadedBase implements IEner
|
||||
this.worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:block.steamEngineOperate", getVolume(1.0F), 0.5F + (acceleration / 80F));
|
||||
}
|
||||
|
||||
data.setLong("power", this.powerBuffer);
|
||||
data.setFloat("rotor", this.rotor);
|
||||
tanks[1].writeToNBT(data, "w");
|
||||
buf.writeLong(this.powerBuffer);
|
||||
buf.writeFloat(this.rotor);
|
||||
tanks[1].serialize(buf);
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
if(this.powerBuffer > 0) this.tryProvide(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
@ -115,7 +119,7 @@ public class TileEntitySteamEngine extends TileEntityLoadedBase implements IEner
|
||||
this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
|
||||
INBTPacketReceiver.networkPack(this, data, 150);
|
||||
sendStandard(150);
|
||||
} else {
|
||||
this.lastRotor = this.rotor;
|
||||
|
||||
@ -139,7 +143,7 @@ public class TileEntitySteamEngine extends TileEntityLoadedBase implements IEner
|
||||
new DirPos(xCoord + rot.offsetX * 2 - dir.offsetX, yCoord + 1, zCoord + rot.offsetZ * 2 - dir.offsetZ, rot)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
@ -207,11 +211,17 @@ public class TileEntitySteamEngine extends TileEntityLoadedBase implements IEner
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.powerBuffer = nbt.getLong("power");
|
||||
this.syncRotor = nbt.getFloat("rotor");
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeBytes(this.buf);
|
||||
this.buf = new PacketBuffer(Unpooled.buffer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.powerBuffer = buf.readLong();
|
||||
this.syncRotor = buf.readFloat();
|
||||
this.turnProgress = 3; //use 3-ply for extra smoothness
|
||||
this.tanks[0].readFromNBT(nbt, "s");
|
||||
this.tanks[1].readFromNBT(nbt, "w");
|
||||
this.tanks[0].deserialize(buf);
|
||||
this.tanks[1].deserialize(buf);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,8 +8,8 @@ import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.entity.projectile.EntityCog;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.IConfigurableMachine;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
@ -17,12 +17,13 @@ import api.hbm.energymk2.IEnergyProviderMK2;
|
||||
import api.hbm.tile.IHeatSource;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityStirling extends TileEntityLoadedBase implements INBTPacketReceiver, IEnergyProviderMK2, IConfigurableMachine {
|
||||
public class TileEntityStirling extends TileEntityLoadedBase implements IBufPacketReceiver, IEnergyProviderMK2, IConfigurableMachine {
|
||||
|
||||
public long powerBuffer;
|
||||
public int heat;
|
||||
@ -88,11 +89,7 @@ public class TileEntityStirling extends TileEntityLoadedBase implements INBTPack
|
||||
this.warnCooldown = 0;
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", powerBuffer);
|
||||
data.setInteger("heat", heat);
|
||||
data.setBoolean("hasCog", hasCog);
|
||||
INBTPacketReceiver.networkPack(this, data, 150);
|
||||
sendStandard(150);
|
||||
|
||||
if(hasCog) {
|
||||
for(DirPos pos : getConPos()) {
|
||||
@ -143,10 +140,17 @@ public class TileEntityStirling extends TileEntityLoadedBase implements INBTPack
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.powerBuffer = nbt.getLong("power");
|
||||
this.heat = nbt.getInteger("heat");
|
||||
this.hasCog = nbt.getBoolean("hasCog");
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeLong(this.powerBuffer);
|
||||
buf.writeInt(this.heat);
|
||||
buf.writeBoolean(this.hasCog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.powerBuffer = buf.readLong();
|
||||
this.heat = buf.readInt();
|
||||
this.hasCog = buf.readBoolean();
|
||||
}
|
||||
|
||||
protected void tryPullHeat() {
|
||||
|
||||
@ -5,7 +5,7 @@ import com.hbm.inventory.FluidStack;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.recipes.CrackingRecipes;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.Tuple.Pair;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
@ -13,11 +13,12 @@ import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineCatalyticCracker extends TileEntityLoadedBase implements INBTPacketReceiver, IFluidStandardTransceiver {
|
||||
public class TileEntityMachineCatalyticCracker extends TileEntityLoadedBase implements IBufPacketReceiver, IFluidStandardTransceiver {
|
||||
|
||||
public FluidTank[] tanks;
|
||||
|
||||
@ -52,22 +53,23 @@ public class TileEntityMachineCatalyticCracker extends TileEntityLoadedBase impl
|
||||
if(tanks[i].getFill() > 0) this.sendFluid(tanks[i], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
for(int i = 0; i < 5; i++)
|
||||
tanks[i].writeToNBT(data, "tank" + i);
|
||||
|
||||
INBTPacketReceiver.networkPack(this, data, 50);
|
||||
sendStandard(25);
|
||||
}
|
||||
this.worldObj.theProfiler.endSection();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
public void serialize(ByteBuf buf) {
|
||||
for(int i = 0; i < 5; i++)
|
||||
tanks[i].readFromNBT(nbt, "tank" + i);
|
||||
tanks[i].serialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
for(int i = 0; i < 5; i++)
|
||||
tanks[i].deserialize(buf);
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
@ -93,14 +93,6 @@ public class TileEntityMachineCatalyticReformer extends TileEntityMachineBase im
|
||||
for(int i = 0; i < 4; i++) tanks[i].deserialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
for(int i = 0; i < 4; i++) tanks[i].readFromNBT(nbt, "" + i);
|
||||
}
|
||||
|
||||
private void reform() {
|
||||
|
||||
Triplet<FluidStack, FluidStack, FluidStack> out = ReformingRecipes.getOutput(tanks[0].getTankType());
|
||||
|
||||
@ -69,7 +69,7 @@ public class TileEntityMachineFractionTower extends TileEntityLoadedBase impleme
|
||||
|
||||
this.sendFluid();
|
||||
|
||||
PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
|
||||
sendStandard(50);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -40,9 +40,9 @@ public abstract class TileEntityPileBase extends TileEntity {
|
||||
|
||||
Vec3 neutronVector = Vec3.createVectorHelper(1, 0, 0);
|
||||
|
||||
neutronVector.rotateAroundX((float)(Math.PI * 2D * worldObj.rand.nextDouble()));
|
||||
neutronVector.rotateAroundY((float)(Math.PI * 2D * worldObj.rand.nextDouble()));
|
||||
neutronVector.rotateAroundZ((float)(Math.PI * 2D * worldObj.rand.nextDouble()));
|
||||
neutronVector.rotateAroundY((float)(Math.PI * 2D * worldObj.rand.nextDouble()));
|
||||
neutronVector.rotateAroundX((float)(Math.PI * 2D * worldObj.rand.nextDouble()));
|
||||
|
||||
new PileNeutronStream(node, neutronVector, flux);
|
||||
}
|
||||
|
||||
@ -6,14 +6,11 @@ import com.hbm.extprop.HbmPlayerProps;
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import com.hbm.handler.HbmKeybinds.EnumKeybind;
|
||||
import com.hbm.items.machine.ItemRBMKRod;
|
||||
import com.hbm.packet.NBTPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
@ -30,7 +27,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import java.util.List;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityCraneConsole extends TileEntity implements INBTPacketReceiver, SimpleComponent, CompatHandler.OCComponent {
|
||||
public class TileEntityCraneConsole extends TileEntity implements IBufPacketReceiver, SimpleComponent, CompatHandler.OCComponent {
|
||||
|
||||
public int centerX;
|
||||
public int centerY;
|
||||
@ -165,26 +162,8 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece
|
||||
this.loadedHeat = 0;
|
||||
this.loadedEnrichment = 0;
|
||||
}
|
||||
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setBoolean("crane", setUpCrane);
|
||||
|
||||
if(setUpCrane) { //no need to send any of this if there's NO FUCKING CRANE THERE
|
||||
nbt.setInteger("centerX", centerX);
|
||||
nbt.setInteger("centerY", centerY);
|
||||
nbt.setInteger("centerZ", centerZ);
|
||||
nbt.setInteger("spanF", spanF);
|
||||
nbt.setInteger("spanB", spanB);
|
||||
nbt.setInteger("spanL", spanL);
|
||||
nbt.setInteger("spanR", spanR);
|
||||
nbt.setInteger("height", height);
|
||||
nbt.setDouble("posFront", posFront);
|
||||
nbt.setDouble("posLeft", posLeft);
|
||||
nbt.setBoolean("loaded", this.hasItemLoaded());
|
||||
nbt.setDouble("loadedHeat", loadedHeat);
|
||||
nbt.setDouble("loadedEnrichment", loadedEnrichment);
|
||||
}
|
||||
PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(nbt, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 250));
|
||||
|
||||
sendStandard(250);
|
||||
}
|
||||
}
|
||||
|
||||
@ -244,27 +223,49 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeBoolean(this.setUpCrane);
|
||||
|
||||
if(this.setUpCrane) { //no need to send any of this if there's NO FUCKING CRANE THERE
|
||||
buf.writeInt(this.centerX);
|
||||
buf.writeInt(this.centerY);
|
||||
buf.writeInt(this.centerZ);
|
||||
buf.writeInt(this.spanF);
|
||||
buf.writeInt(this.spanB);
|
||||
buf.writeInt(this.spanL);
|
||||
buf.writeInt(this.spanR);
|
||||
buf.writeInt(this.height);
|
||||
buf.writeDouble(this.posFront);
|
||||
buf.writeDouble(this.posLeft);
|
||||
buf.writeBoolean(this.hasItemLoaded());
|
||||
buf.writeDouble(this.loadedHeat);
|
||||
buf.writeDouble(this.loadedEnrichment);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
lastPosFront = posFront;
|
||||
lastPosLeft = posLeft;
|
||||
lastProgress = progress;
|
||||
|
||||
this.setUpCrane = nbt.getBoolean("crane");
|
||||
this.centerX = nbt.getInteger("centerX");
|
||||
this.centerY = nbt.getInteger("centerY");
|
||||
this.centerZ = nbt.getInteger("centerZ");
|
||||
this.spanF = nbt.getInteger("spanF");
|
||||
this.spanB = nbt.getInteger("spanB");
|
||||
this.spanL = nbt.getInteger("spanL");
|
||||
this.spanR = nbt.getInteger("spanR");
|
||||
this.height = nbt.getInteger("height");
|
||||
this.posFront = nbt.getDouble("posFront");
|
||||
this.posLeft = nbt.getDouble("posLeft");
|
||||
this.hasLoaded = nbt.getBoolean("loaded");
|
||||
this.posLeft = nbt.getDouble("posLeft");
|
||||
this.loadedHeat = nbt.getDouble("loadedHeat");
|
||||
this.loadedEnrichment = nbt.getDouble("loadedEnrichment");
|
||||
|
||||
this.setUpCrane = buf.readBoolean();
|
||||
if (this.setUpCrane) {
|
||||
this.centerX = buf.readInt();
|
||||
this.centerY = buf.readInt();
|
||||
this.centerZ = buf.readInt();
|
||||
this.spanF = buf.readInt();
|
||||
this.spanB = buf.readInt();
|
||||
this.spanL = buf.readInt();
|
||||
this.spanR = buf.readInt();
|
||||
this.height = buf.readInt();
|
||||
this.posFront = buf.readDouble();
|
||||
this.posLeft = buf.readDouble();
|
||||
this.hasLoaded = buf.readBoolean();
|
||||
this.posLeft = buf.readDouble();
|
||||
this.loadedHeat = buf.readDouble();
|
||||
this.loadedEnrichment = buf.readDouble();
|
||||
}
|
||||
}
|
||||
|
||||
public void setTarget(int x, int y, int z) {
|
||||
|
||||
@ -9,11 +9,9 @@ import com.hbm.entity.effect.EntitySpear;
|
||||
import com.hbm.entity.projectile.EntityRBMKDebris;
|
||||
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
||||
import com.hbm.handler.neutron.NeutronNodeWorld;
|
||||
import com.hbm.handler.neutron.RBMKNeutronHandler;
|
||||
import com.hbm.handler.neutron.RBMKNeutronHandler.RBMKType;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.BufPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.saveddata.TomSaveData;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
@ -119,7 +117,7 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements
|
||||
coolPassively();
|
||||
this.worldObj.theProfiler.endSection();
|
||||
|
||||
this.networkPackNT(trackingRange());
|
||||
this.sendStandard(trackingRange());
|
||||
}
|
||||
}
|
||||
|
||||
@ -280,13 +278,8 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements
|
||||
nbt.setInteger("steam", this.steam);
|
||||
}
|
||||
|
||||
public void networkPackNT(int range) {
|
||||
if(!worldObj.isRemote) PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeBoolean(this.muffled);
|
||||
buf.writeDouble(this.heat);
|
||||
buf.writeInt(this.water);
|
||||
buf.writeInt(this.steam);
|
||||
@ -294,7 +287,6 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.muffled = buf.readBoolean();
|
||||
this.heat = buf.readDouble();
|
||||
this.water = buf.readInt();
|
||||
this.steam = buf.readInt();
|
||||
|
||||
@ -1,15 +1,11 @@
|
||||
package com.hbm.tileentity.machine.rbmk;
|
||||
|
||||
import com.hbm.packet.NBTPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
|
||||
/**
|
||||
* Base class for RBMK components that have GUI slots and thus have to handle
|
||||
@ -124,19 +120,6 @@ public abstract class TileEntityRBMKSlottedBase extends TileEntityRBMKActiveBase
|
||||
return new int[] {};
|
||||
}
|
||||
|
||||
public int getGaugeScaled(int i, FluidTank tank) {
|
||||
return tank.getFluidAmount() * i / tank.getCapacity();
|
||||
}
|
||||
|
||||
public void networkPack(NBTTagCompound nbt, int range) {
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(nbt, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range));
|
||||
}
|
||||
|
||||
public void handleButtonPacket(int value, int meta) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
@ -70,7 +70,7 @@ public class TileEntityFileCabinet extends TileEntityCrateBase implements IGUIPr
|
||||
} else
|
||||
timer = 0;
|
||||
|
||||
PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 25));
|
||||
sendStandard(25);
|
||||
} else {
|
||||
this.prevLowerExtent = lowerExtent;
|
||||
this.prevUpperExtent = upperExtent;
|
||||
|
||||
@ -3,11 +3,13 @@ package com.hbm.tileentity.machine.storage;
|
||||
import com.hbm.inventory.container.ContainerMassStorage;
|
||||
import com.hbm.inventory.gui.GUIMassStorage;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.IControlReceiverFilter;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
|
||||
import com.hbm.util.BufferUtil;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -16,7 +18,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityMassStorage extends TileEntityCrateBase implements INBTPacketReceiver, IControlReceiverFilter {
|
||||
public class TileEntityMassStorage extends TileEntityCrateBase implements IBufPacketReceiver, IControlReceiverFilter {
|
||||
|
||||
private int stack = 0;
|
||||
public boolean output = false;
|
||||
@ -79,28 +81,30 @@ public class TileEntityMassStorage extends TileEntityCrateBase implements INBTPa
|
||||
if(slots[2] == null) {
|
||||
slots[2] = slots[1].copy();
|
||||
slots[2].stackSize = amount;
|
||||
this.stack -= amount;
|
||||
} else {
|
||||
amount = Math.min(amount, slots[2].getMaxStackSize() - slots[2].stackSize);
|
||||
slots[2].stackSize += amount;
|
||||
this.stack -= amount;
|
||||
}
|
||||
this.stack -= amount;
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("stack", getStockpile());
|
||||
data.setBoolean("output", output);
|
||||
if(slots[1] != null) slots[1].writeToNBT(data);
|
||||
INBTPacketReceiver.networkPack(this, data, 15);
|
||||
|
||||
sendStandard(15);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.stack = nbt.getInteger("stack");
|
||||
this.output = nbt.getBoolean("output");
|
||||
this.type = ItemStack.loadItemStackFromNBT(nbt);
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeInt(this.stack);
|
||||
buf.writeBoolean(this.output);
|
||||
BufferUtil.writeItemStack(buf, this.type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.stack = buf.readInt();
|
||||
this.output = buf.readBoolean();
|
||||
this.type = BufferUtil.readItemStack(buf);
|
||||
}
|
||||
|
||||
public int getCapacity() {
|
||||
@ -180,12 +184,11 @@ public class TileEntityMassStorage extends TileEntityCrateBase implements INBTPa
|
||||
if(slots[2] == null) {
|
||||
slots[2] = slots[1].copy();
|
||||
slots[2].stackSize = amount;
|
||||
this.stack -= amount;
|
||||
} else {
|
||||
amount = Math.min(amount, slots[2].getMaxStackSize() - slots[2].stackSize);
|
||||
slots[2].stackSize += amount;
|
||||
this.stack -= amount;
|
||||
}
|
||||
this.stack -= amount;
|
||||
}
|
||||
|
||||
if(data.hasKey("toggle")) {
|
||||
|
||||
@ -10,14 +10,15 @@ import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIDroneCrate;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import com.hbm.util.ParticleUtil;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -27,7 +28,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityDroneCrate extends TileEntityMachineBase implements IGUIProvider, INBTPacketReceiver, IControlReceiver, IDroneLinkable, IFluidStandardTransceiver {
|
||||
public class TileEntityDroneCrate extends TileEntityMachineBase implements IGUIProvider, IControlReceiver, IDroneLinkable, IFluidStandardTransceiver {
|
||||
|
||||
public FluidTank tank;
|
||||
|
||||
@ -82,26 +83,31 @@ public class TileEntityDroneCrate extends TileEntityMachineBase implements IGUIP
|
||||
(nextX - pos.getX()), (nextY - pos.getY()), (nextZ - pos.getZ()), 0x00ffff);
|
||||
}
|
||||
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setIntArray("pos", new int[] {nextX, nextY, nextZ});
|
||||
data.setBoolean("mode", sendingMode);
|
||||
data.setBoolean("type", itemType);
|
||||
tank.writeToNBT(data, "t");
|
||||
INBTPacketReceiver.networkPack(this, data, 25);
|
||||
networkPackNT(25);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
int[] pos = nbt.getIntArray("pos");
|
||||
public void serialize(ByteBuf buf) {
|
||||
BufferUtil.writeIntArray(buf, new int[] {
|
||||
this.nextX,
|
||||
this.nextY,
|
||||
this.nextZ
|
||||
});
|
||||
buf.writeBoolean(this.sendingMode);
|
||||
buf.writeBoolean(this.itemType);
|
||||
tank.serialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
int[] pos = BufferUtil.readIntArray(buf);
|
||||
this.nextX = pos[0];
|
||||
this.nextY = pos[1];
|
||||
this.nextZ = pos[2];
|
||||
this.sendingMode = nbt.getBoolean("mode");
|
||||
this.itemType = nbt.getBoolean("type");
|
||||
tank.readFromNBT(nbt, "t");
|
||||
this.sendingMode = buf.readBoolean();
|
||||
this.itemType = buf.readBoolean();
|
||||
tank.deserialize(buf);
|
||||
}
|
||||
|
||||
protected void loadItems(EntityDeliveryDrone drone) {
|
||||
|
||||
@ -9,15 +9,16 @@ import com.hbm.inventory.RecipesCommon.OreDictStack;
|
||||
import com.hbm.inventory.container.ContainerDroneRequester;
|
||||
import com.hbm.inventory.gui.GUIDroneRequester;
|
||||
import com.hbm.module.ModulePatternMatcher;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.IControlReceiverFilter;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.network.RequestNetwork.PathNode;
|
||||
import com.hbm.tileentity.network.RequestNetwork.RequestNode;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -27,7 +28,7 @@ import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class TileEntityDroneRequester extends TileEntityRequestNetworkContainer implements INBTPacketReceiver, IGUIProvider, IControlReceiverFilter {
|
||||
public class TileEntityDroneRequester extends TileEntityRequestNetworkContainer implements IBufPacketReceiver, IGUIProvider, IControlReceiverFilter {
|
||||
|
||||
public ModulePatternMatcher matcher;
|
||||
|
||||
@ -46,16 +47,17 @@ public class TileEntityDroneRequester extends TileEntityRequestNetworkContainer
|
||||
super.updateEntity();
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
this.matcher.writeToNBT(data);
|
||||
INBTPacketReceiver.networkPack(this, data, 15);
|
||||
|
||||
sendStandard(15);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.matcher.readFromNBT(nbt);
|
||||
@Override public void serialize(ByteBuf buf) {
|
||||
this.matcher.serialize(buf);
|
||||
}
|
||||
|
||||
@Override public void deserialize(ByteBuf buf) {
|
||||
this.matcher.deserialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -39,7 +39,7 @@ public class TileEntityDroneWaypoint extends TileEntity implements IBufPacketRec
|
||||
}
|
||||
}
|
||||
|
||||
PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 15));
|
||||
sendStandard(15);
|
||||
} else {
|
||||
BlockPos pos = getCoord(dir);
|
||||
if(nextY != -1 && worldObj.getTotalWorldTime() % 2 == 0) {
|
||||
|
||||
@ -6,14 +6,16 @@ import java.util.List;
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.inventory.gui.GuiScreenRadioTelex;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.network.RTTYSystem.RTTYChannel;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import com.hbm.util.ItemStackUtil;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
@ -30,7 +32,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityRadioTelex extends TileEntity implements INBTPacketReceiver, IControlReceiver, IGUIProvider, SimpleComponent, CompatHandler.OCComponent {
|
||||
public class TileEntityRadioTelex extends TileEntity implements IBufPacketReceiver, IControlReceiver, IGUIProvider, SimpleComponent, CompatHandler.OCComponent {
|
||||
|
||||
public static final int lineWidth = 33;
|
||||
public String txChannel = "";
|
||||
@ -130,28 +132,32 @@ public class TileEntityRadioTelex extends TileEntity implements INBTPacketReceiv
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
for(int i = 0; i < 5; i++) {
|
||||
data.setString("tx" + i, txBuffer[i]);
|
||||
data.setString("rx" + i, rxBuffer[i]);
|
||||
}
|
||||
data.setString("txChan", txChannel);
|
||||
data.setString("rxChan", rxChannel);
|
||||
data.setInteger("sending", sendingChar);
|
||||
INBTPacketReceiver.networkPack(this, data, 16);
|
||||
sendStandard(16);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
|
||||
public void serialize(ByteBuf buf) {
|
||||
for(int i = 0; i < 5; i++) {
|
||||
txBuffer[i] = nbt.getString("tx" + i);
|
||||
rxBuffer[i] = nbt.getString("rx" + i);
|
||||
BufferUtil.writeString(buf, txBuffer[i]);
|
||||
BufferUtil.writeString(buf, rxBuffer[i]);
|
||||
}
|
||||
this.txChannel = nbt.getString("txChan");
|
||||
this.rxChannel = nbt.getString("rxChan");
|
||||
this.sendingChar = (char) nbt.getInteger("sending");
|
||||
|
||||
BufferUtil.writeString(buf, this.txChannel);
|
||||
BufferUtil.writeString(buf, this.rxChannel);
|
||||
buf.writeChar(this.sendingChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
for(int i = 0; i < 5; i++) {
|
||||
txBuffer[i] = BufferUtil.readString(buf);
|
||||
rxBuffer[i] = BufferUtil.readString(buf);
|
||||
}
|
||||
|
||||
this.txChannel = BufferUtil.readString(buf);
|
||||
this.rxChannel = BufferUtil.readString(buf);
|
||||
this.sendingChar = buf.readChar();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
package com.hbm.tileentity.network;
|
||||
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
|
||||
import com.hbm.util.BufferUtil;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
@ -10,7 +12,7 @@ import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityRadioTorchBase extends TileEntity implements INBTPacketReceiver, IControlReceiver {
|
||||
public class TileEntityRadioTorchBase extends TileEntity implements IBufPacketReceiver, IControlReceiver {
|
||||
|
||||
/** channel we're broadcasting on/listening to */
|
||||
public String channel = "";
|
||||
@ -30,12 +32,7 @@ public class TileEntityRadioTorchBase extends TileEntity implements INBTPacketRe
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("p", polling);
|
||||
data.setBoolean("m", customMap);
|
||||
if(channel != null) data.setString("c", channel);
|
||||
for(int i = 0; i < 16; i++) if(mapping[i] != null) data.setString("m" + i, mapping[i]);
|
||||
INBTPacketReceiver.networkPack(this, data, 50);
|
||||
sendStandard(50);
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,11 +59,19 @@ public class TileEntityRadioTorchBase extends TileEntity implements INBTPacketRe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.polling = nbt.getBoolean("p");
|
||||
this.customMap = nbt.getBoolean("m");
|
||||
this.channel = nbt.getString("c");
|
||||
for(int i = 0; i < 16; i++) this.mapping[i] = nbt.getString("m" + i);
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeBoolean(this.polling);
|
||||
buf.writeBoolean(this.customMap);
|
||||
BufferUtil.writeString(buf, this.channel);
|
||||
for(int i = 0; i < 16; i++) BufferUtil.writeString(buf, this.mapping[i]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.polling = buf.readBoolean();
|
||||
this.customMap = buf.readBoolean();
|
||||
this.channel = BufferUtil.readString(buf);
|
||||
for(int i = 0; i < 16; i++) this.mapping[i] = BufferUtil.readString(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
package com.hbm.tileentity.network;
|
||||
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.network.RTTYSystem.RTTYChannel;
|
||||
|
||||
import com.hbm.util.BufferUtil;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
@ -11,7 +13,7 @@ import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityRadioTorchLogic extends TileEntity implements INBTPacketReceiver, IControlReceiver {
|
||||
public class TileEntityRadioTorchLogic extends TileEntity implements IBufPacketReceiver, IControlReceiver {
|
||||
|
||||
/** channel we're broadcasting on/listening to */
|
||||
public String channel = "";
|
||||
@ -80,13 +82,7 @@ public class TileEntityRadioTorchLogic extends TileEntity implements INBTPacketR
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("p", polling);
|
||||
data.setBoolean("d", descending);
|
||||
if(channel != null) data.setString("c", channel);
|
||||
for(int i = 0; i < 16; i++) if(!mapping[i].equals("")) data.setString("m" + i, mapping[i]);
|
||||
for(int i = 0; i < 16; i++) if(conditions[i] > 0) data.setInteger("c" + i, conditions[i]);
|
||||
INBTPacketReceiver.networkPack(this, data, 50);
|
||||
sendStandard(50);
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,12 +146,22 @@ public class TileEntityRadioTorchLogic extends TileEntity implements INBTPacketR
|
||||
for(int i = 0; i < 16; i++) if(conditions[i] > 0) nbt.setInteger("c" + i, conditions[i]);
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.polling = nbt.getBoolean("p");
|
||||
this.channel = nbt.getString("c");
|
||||
this.descending = nbt.getBoolean("d");
|
||||
for(int i = 0; i < 16; i++) this.mapping[i] = nbt.getString("m" + i);
|
||||
for(int i = 0; i < 16; i++) this.conditions[i] = nbt.getInteger("c" + i);
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeBoolean(this.polling);
|
||||
BufferUtil.writeString(buf, this.channel);
|
||||
buf.writeBoolean(this.descending);
|
||||
for(int i = 0; i < 16; i++) BufferUtil.writeString(buf, this.mapping[i]);
|
||||
for(int i = 0; i < 16; i++) buf.writeInt(this.conditions[i]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.polling = buf.readBoolean();
|
||||
this.channel = BufferUtil.readString(buf);
|
||||
this.descending = buf.readBoolean();
|
||||
for(int i = 0; i < 16; i++) this.mapping[i] = BufferUtil.readString(buf);
|
||||
for(int i = 0; i < 16; i++) this.conditions[i] = buf.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
package com.hbm.tileentity.network;
|
||||
|
||||
import com.hbm.packet.NBTPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -107,10 +103,6 @@ public abstract class TileEntityRequestNetworkContainer extends TileEntityReques
|
||||
}
|
||||
}
|
||||
|
||||
public void networkPack(NBTTagCompound nbt, int range) {
|
||||
if(!worldObj.isRemote) PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(nbt, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
@ -311,28 +311,6 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
|
||||
this.trySubscribe(worldObj, xCoord + dir.offsetX * 2 + rot.offsetX * -1, yCoord, zCoord + dir.offsetZ * 2 + rot.offsetZ * -1, dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.turnProgress = 2;
|
||||
this.syncRotationPitch = nbt.getDouble("pitch");
|
||||
this.syncRotationYaw = nbt.getDouble("yaw");
|
||||
this.power = nbt.getLong("power");
|
||||
this.isOn = nbt.getBoolean("isOn");
|
||||
this.targetPlayers = nbt.getBoolean("targetPlayers");
|
||||
this.targetAnimals = nbt.getBoolean("targetAnimals");
|
||||
this.targetMobs = nbt.getBoolean("targetMobs");
|
||||
this.targetMachines = nbt.getBoolean("targetMachines");
|
||||
this.stattrak = nbt.getInteger("stattrak");
|
||||
|
||||
if(nbt.hasKey("tX")) {
|
||||
this.tPos = Vec3.createVectorHelper(nbt.getDouble("tX"), nbt.getDouble("tY"), nbt.getDouble("tZ"));
|
||||
} else {
|
||||
this.tPos = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleButtonPacket(int value, int meta) {
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user