mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
holy shit what the fuck am i smoking
This commit is contained in:
parent
05ca9203e9
commit
4b490d56a1
@ -154,12 +154,7 @@ 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));
|
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 processGauge(int val, int id) { }
|
||||||
|
|
||||||
@Deprecated public void networkPack(NBTTagCompound nbt, int range) {
|
|
||||||
nbt.setBoolean("muffled", muffled);
|
|
||||||
if(!worldObj.isRemote) PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(nbt, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void networkUnpack(NBTTagCompound nbt) {
|
||||||
this.muffled = nbt.getBoolean("muffled");
|
this.muffled = nbt.getBoolean("muffled");
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import com.hbm.tileentity.TileEntityMachineBase;
|
|||||||
|
|
||||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
@ -44,13 +45,8 @@ public class TileEntityDeuteriumExtractor extends TileEntityMachineBase implemen
|
|||||||
|
|
||||||
this.subscribeToAllAround(tanks[0].getTankType(), this);
|
this.subscribeToAllAround(tanks[0].getTankType(), this);
|
||||||
this.sendFluidToAll(tanks[1], this);
|
this.sendFluidToAll(tanks[1], this);
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
|
||||||
data.setLong("power", power);
|
|
||||||
tanks[0].writeToNBT(data, "water");
|
|
||||||
tanks[1].writeToNBT(data, "heavyWater");
|
|
||||||
|
|
||||||
this.networkPack(data, 50);
|
this.networkPackNT(50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,6 +64,22 @@ public class TileEntityDeuteriumExtractor extends TileEntityMachineBase implemen
|
|||||||
tanks[1].readFromNBT(data, "heavyWater");
|
tanks[1].readFromNBT(data, "heavyWater");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
|
buf.writeLong(power);
|
||||||
|
tanks[0].serialize(buf);
|
||||||
|
tanks[1].serialize(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.power = buf.readLong();
|
||||||
|
tanks[0].deserialize(buf);
|
||||||
|
tanks[1].deserialize(buf);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasPower() {
|
public boolean hasPower() {
|
||||||
return power >= this.getMaxPower() / 20;
|
return power >= this.getMaxPower() / 20;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import com.hbm.util.RTGUtil;
|
|||||||
import api.hbm.tile.IInfoProviderEC;
|
import api.hbm.tile.IInfoProviderEC;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@ -72,24 +73,28 @@ public class TileEntityDiFurnaceRTG extends TileEntityMachineBase implements IGU
|
|||||||
|
|
||||||
MachineDiFurnaceRTG.updateBlockState(isProcessing() || (canProcess() && hasPower()), getWorldObj(), xCoord, yCoord, zCoord);
|
MachineDiFurnaceRTG.updateBlockState(isProcessing() || (canProcess() && hasPower()), getWorldObj(), xCoord, yCoord, zCoord);
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
networkPackNT(10);
|
||||||
data.setShort("progress", progress);
|
|
||||||
data.setShort("speed", processSpeed);
|
|
||||||
data.setByteArray("modes", new byte[] {(byte) sideUpper, (byte) sideLower});
|
|
||||||
networkPack(data, 10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void serialize(ByteBuf buf) {
|
||||||
super.networkUnpack(nbt);
|
super.serialize(buf);
|
||||||
|
buf.writeShort(progress);
|
||||||
progress = nbt.getShort("progress");
|
buf.writeShort(processSpeed);
|
||||||
processSpeed = nbt.getShort("speed");
|
buf.writeBytes(new byte[] {sideUpper, sideLower});
|
||||||
byte[] modes = nbt.getByteArray("modes");
|
|
||||||
this.sideUpper = modes[0];
|
|
||||||
this.sideLower = modes[1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
progress = buf.readShort();
|
||||||
|
processSpeed = buf.readShort();
|
||||||
|
byte[] bytes = new byte[2];
|
||||||
|
buf.readBytes(bytes);
|
||||||
|
this.sideUpper = bytes[0];
|
||||||
|
this.sideLower = bytes[1];
|
||||||
|
}
|
||||||
|
|
||||||
private void processItem() {
|
private void processItem() {
|
||||||
|
|
||||||
if(canProcess()) {
|
if(canProcess()) {
|
||||||
|
|||||||
@ -39,6 +39,7 @@ import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
|||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@ -208,24 +209,7 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(50);
|
||||||
data.setLong("power", this.power);
|
|
||||||
data.setInteger("progressFluid", this.progressFluid);
|
|
||||||
data.setInteger("progressOre", this.progressOre);
|
|
||||||
data.setInteger("usageOre", this.usageOre);
|
|
||||||
data.setInteger("usageFluid", this.usageFluid);
|
|
||||||
data.setInteger("processFluidTime", this.getDurationFluid());
|
|
||||||
data.setInteger("processOreTime", this.getDurationMetal());
|
|
||||||
if(this.leftStack != null) {
|
|
||||||
data.setInteger("leftType", leftStack.material.id);
|
|
||||||
data.setInteger("leftAmount", leftStack.amount);
|
|
||||||
}
|
|
||||||
if(this.rightStack != null) {
|
|
||||||
data.setInteger("rightType", rightStack.material.id);
|
|
||||||
data.setInteger("rightAmount", rightStack.amount);
|
|
||||||
}
|
|
||||||
for(int i = 0; i < 4; i++) tanks[i].writeToNBT(data, "t" + i);
|
|
||||||
this.networkPack(data, 50);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,21 +228,47 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void serialize(ByteBuf buf) {
|
||||||
super.networkUnpack(nbt);
|
super.serialize(buf);
|
||||||
|
buf.writeLong(this.power);
|
||||||
|
buf.writeInt(this.progressFluid);
|
||||||
|
buf.writeInt(this.progressOre);
|
||||||
|
buf.writeInt(this.usageOre);
|
||||||
|
buf.writeInt(this.usageFluid);
|
||||||
|
buf.writeInt(this.getDurationFluid());
|
||||||
|
buf.writeInt(this.getDurationMetal());
|
||||||
|
for(int i = 0; i < 4; i++) tanks[i].serialize(buf);
|
||||||
|
buf.writeBoolean(this.leftStack != null);
|
||||||
|
buf.writeBoolean(this.rightStack != null);
|
||||||
|
if(this.leftStack != null) {
|
||||||
|
buf.writeInt(leftStack.material.id);
|
||||||
|
buf.writeInt(leftStack.amount);
|
||||||
|
}
|
||||||
|
if(this.rightStack != null) {
|
||||||
|
buf.writeInt(rightStack.material.id);
|
||||||
|
buf.writeInt(rightStack.amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.power = nbt.getLong("power");
|
@Override
|
||||||
this.progressFluid = nbt.getInteger("progressFluid");
|
public void deserialize(ByteBuf buf) {
|
||||||
this.progressOre = nbt.getInteger("progressOre");
|
super.deserialize(buf);
|
||||||
this.usageOre = nbt.getInteger("usageOre");
|
this.power = buf.readLong();
|
||||||
this.usageFluid = nbt.getInteger("usageFluid");
|
this.progressFluid = buf.readInt();
|
||||||
this.processFluidTime = nbt.getInteger("processFluidTime");
|
this.progressOre = buf.readInt();
|
||||||
this.processOreTime = nbt.getInteger("processOreTime");
|
this.usageOre = buf.readInt();
|
||||||
if(nbt.hasKey("leftType")) this.leftStack = new MaterialStack(Mats.matById.get(nbt.getInteger("leftType")), nbt.getInteger("leftAmount"));
|
this.usageFluid = buf.readInt();
|
||||||
else this.leftStack = null;
|
this.processFluidTime = buf.readInt();
|
||||||
if(nbt.hasKey("rightType")) this.rightStack = new MaterialStack(Mats.matById.get(nbt.getInteger("rightType")), nbt.getInteger("rightAmount"));
|
this.processOreTime = buf.readInt();
|
||||||
else this.rightStack = null;
|
for(int i = 0; i < 4; i++) tanks[i].deserialize(buf);
|
||||||
for(int i = 0; i < 4; i++) tanks[i].readFromNBT(nbt, "t" + i);
|
boolean left = buf.readBoolean();
|
||||||
|
boolean right = buf.readBoolean();
|
||||||
|
if(left) {
|
||||||
|
this.leftStack = new MaterialStack(Mats.matById.get(buf.readInt()), buf.readInt());
|
||||||
|
}
|
||||||
|
if(right) {
|
||||||
|
this.rightStack = new MaterialStack(Mats.matById.get(buf.readInt()), buf.readInt());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canProcessFluid() {
|
public boolean canProcessFluid() {
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import com.hbm.util.I18nUtil;
|
|||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@ -115,14 +116,8 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI
|
|||||||
} else {
|
} else {
|
||||||
this.progress = 0;
|
this.progress = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(50);
|
||||||
data.setInteger("maxBurnTime", this.maxBurnTime);
|
|
||||||
data.setInteger("burnTime", this.burnTime);
|
|
||||||
data.setInteger("progress", this.progress);
|
|
||||||
data.setInteger("processingTime", this.processingTime);
|
|
||||||
data.setBoolean("wasOn", this.wasOn);
|
|
||||||
this.networkPack(data, 50);
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if(this.progress > 0) {
|
if(this.progress > 0) {
|
||||||
@ -141,16 +136,25 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void serialize(ByteBuf buf) {
|
||||||
super.networkUnpack(nbt);
|
super.serialize(buf);
|
||||||
|
buf.writeInt(this.maxBurnTime);
|
||||||
this.maxBurnTime = nbt.getInteger("maxBurnTime");
|
buf.writeInt(this.burnTime);
|
||||||
this.burnTime = nbt.getInteger("burnTime");
|
buf.writeInt(this.progress);
|
||||||
this.progress = nbt.getInteger("progress");
|
buf.writeInt(this.processingTime);
|
||||||
this.processingTime = nbt.getInteger("processingTime");
|
buf.writeBoolean(this.wasOn);
|
||||||
this.wasOn = nbt.getBoolean("wasOn");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.maxBurnTime = buf.readInt();
|
||||||
|
this.burnTime = buf.readInt();
|
||||||
|
this.progress = buf.readInt();
|
||||||
|
this.processingTime = buf.readInt();
|
||||||
|
this.wasOn = buf.readBoolean();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean canSmelt() {
|
public boolean canSmelt() {
|
||||||
|
|
||||||
if(this.burnTime <= 0) return false;
|
if(this.burnTime <= 0) return false;
|
||||||
|
|||||||
@ -8,11 +8,13 @@ import com.hbm.inventory.container.ContainerFurnaceSteel;
|
|||||||
import com.hbm.inventory.gui.GUIFurnaceSteel;
|
import com.hbm.inventory.gui.GUIFurnaceSteel;
|
||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
|
import com.hbm.util.BufferUtil;
|
||||||
import com.hbm.util.ItemStackUtil;
|
import com.hbm.util.ItemStackUtil;
|
||||||
|
|
||||||
import api.hbm.tile.IHeatSource;
|
import api.hbm.tile.IHeatSource;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@ -96,13 +98,9 @@ public class TileEntityFurnaceSteel extends TileEntityMachineBase implements IGU
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(50);
|
||||||
data.setIntArray("progress", progress);
|
|
||||||
data.setIntArray("bonus", bonus);
|
|
||||||
data.setInteger("heat", heat);
|
|
||||||
data.setBoolean("wasOn", wasOn);
|
|
||||||
this.networkPack(data, 50);
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if(this.wasOn) {
|
if(this.wasOn) {
|
||||||
@ -122,13 +120,21 @@ public class TileEntityFurnaceSteel extends TileEntityMachineBase implements IGU
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void serialize(ByteBuf buf) {
|
||||||
super.networkUnpack(nbt);
|
super.serialize(buf);
|
||||||
|
BufferUtil.writeIntArray(buf, this.progress);
|
||||||
this.progress = nbt.getIntArray("progress");
|
BufferUtil.writeIntArray(buf, this.bonus);
|
||||||
this.bonus = nbt.getIntArray("bonus");
|
buf.writeInt(this.heat);
|
||||||
this.heat = nbt.getInteger("heat");
|
buf.writeBoolean(this.wasOn);
|
||||||
this.wasOn = nbt.getBoolean("wasOn");
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.progress = BufferUtil.readIntArray(buf);
|
||||||
|
this.bonus = BufferUtil.readIntArray(buf);
|
||||||
|
this.heat = buf.readInt();
|
||||||
|
this.wasOn = buf.readBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2;
|
|||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
@ -170,7 +171,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
|||||||
data.setInteger("stat_x", stat_x);
|
data.setInteger("stat_x", stat_x);
|
||||||
data.setInteger("stat_y", stat_y);
|
data.setInteger("stat_y", stat_y);
|
||||||
data.setInteger("stat_z", stat_z);
|
data.setInteger("stat_z", stat_z);
|
||||||
this.networkPack(data, 50);
|
this.networkPackNT(50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,22 +213,45 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
|||||||
this.setStats(this.state, p.momentum, true);
|
this.setStats(this.state, p.momentum, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
|
buf.writeBoolean(this.isOn);
|
||||||
|
buf.writeLong(this.power);
|
||||||
|
buf.writeBoolean(this.analysisOnly);
|
||||||
|
buf.writeInt(this.ioMode);
|
||||||
|
buf.writeByte((byte) this.state.ordinal());
|
||||||
|
|
||||||
|
buf.writeBoolean(this.stat_success);
|
||||||
|
buf.writeByte((byte) this.stat_state.ordinal());
|
||||||
|
buf.writeInt(this.stat_charge);
|
||||||
|
buf.writeInt(this.stat_x);
|
||||||
|
buf.writeInt(this.stat_y);
|
||||||
|
buf.writeInt(this.stat_z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.isOn = buf.readBoolean();
|
||||||
|
this.power = buf.readLong();
|
||||||
|
this.analysisOnly = buf.readBoolean();
|
||||||
|
this.ioMode = buf.readInt();
|
||||||
|
this.state = EnumHadronState.values()[buf.readByte()];
|
||||||
|
|
||||||
|
this.stat_success = buf.readBoolean();
|
||||||
|
this.stat_state = EnumHadronState.values()[buf.readByte()];
|
||||||
|
this.stat_charge = buf.readInt();
|
||||||
|
this.stat_x = buf.readInt();
|
||||||
|
this.stat_y = buf.readInt();
|
||||||
|
this.stat_z = buf.readInt();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound data) {
|
public void networkUnpack(NBTTagCompound data) {
|
||||||
super.networkUnpack(data);
|
super.networkUnpack(data);
|
||||||
|
|
||||||
this.isOn = data.getBoolean("isOn");
|
|
||||||
this.power = data.getLong("power");
|
|
||||||
this.analysisOnly = data.getBoolean("analysis");
|
|
||||||
this.ioMode = data.getInteger("ioMode");
|
|
||||||
this.state = EnumHadronState.values()[data.getByte("state")];
|
|
||||||
|
|
||||||
this.stat_success = data.getBoolean("stat_success");
|
|
||||||
this.stat_state = EnumHadronState.values()[data.getByte("stat_state")];
|
|
||||||
this.stat_charge = data.getInteger("stat_charge");
|
|
||||||
this.stat_x = data.getInteger("stat_x");
|
|
||||||
this.stat_y = data.getInteger("stat_y");
|
|
||||||
this.stat_z = data.getInteger("stat_z");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import com.hbm.packet.PacketDispatcher;
|
|||||||
import com.hbm.sound.AudioWrapper;
|
import com.hbm.sound.AudioWrapper;
|
||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
|
import com.hbm.util.BufferUtil;
|
||||||
import com.hbm.util.CompatEnergyControl;
|
import com.hbm.util.CompatEnergyControl;
|
||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
@ -36,6 +37,7 @@ import cpw.mods.fml.common.Optional;
|
|||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import li.cil.oc.api.machine.Arguments;
|
import li.cil.oc.api.machine.Arguments;
|
||||||
import li.cil.oc.api.machine.Callback;
|
import li.cil.oc.api.machine.Callback;
|
||||||
import li.cil.oc.api.machine.Context;
|
import li.cil.oc.api.machine.Context;
|
||||||
@ -158,27 +160,7 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyRece
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(250);
|
||||||
data.setBoolean("isOn", isOn);
|
|
||||||
data.setLong("power", power);
|
|
||||||
data.setInteger("progress", progress);
|
|
||||||
tanks[0].writeToNBT(data, "t0");
|
|
||||||
tanks[1].writeToNBT(data, "t1");
|
|
||||||
plasma.writeToNBT(data, "t2");
|
|
||||||
|
|
||||||
if(slots[3] == null) {
|
|
||||||
data.setInteger("blanket", 0);
|
|
||||||
} else if(slots[3].getItem() == ModItems.fusion_shield_tungsten) {
|
|
||||||
data.setInteger("blanket", 1);
|
|
||||||
} else if(slots[3].getItem() == ModItems.fusion_shield_desh) {
|
|
||||||
data.setInteger("blanket", 2);
|
|
||||||
} else if(slots[3].getItem() == ModItems.fusion_shield_chlorophyte) {
|
|
||||||
data.setInteger("blanket", 3);
|
|
||||||
} else if(slots[3].getItem() == ModItems.fusion_shield_vaporwave) {
|
|
||||||
data.setInteger("blanket", 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.networkPack(data, 250);
|
|
||||||
/// END Notif packets ///
|
/// END Notif packets ///
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -378,16 +360,37 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyRece
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound data) {
|
public void serialize(ByteBuf buf) {
|
||||||
super.networkUnpack(data);
|
super.serialize(buf);
|
||||||
|
buf.writeBoolean(this.isOn);
|
||||||
this.isOn = data.getBoolean("isOn");
|
buf.writeLong(this.power);
|
||||||
this.power = data.getLong("power");
|
buf.writeInt(this.progress);
|
||||||
this.blanket = data.getInteger("blanket");
|
tanks[0].serialize(buf);
|
||||||
this.progress = data.getInteger("progress"); //
|
tanks[1].serialize(buf);
|
||||||
tanks[0].readFromNBT(data, "t0");
|
plasma.serialize(buf);
|
||||||
tanks[1].readFromNBT(data, "t1");
|
if(slots[3] == null) {
|
||||||
plasma.readFromNBT(data, "t2");
|
buf.writeInt(0);
|
||||||
|
} else if(slots[3].getItem() == ModItems.fusion_shield_tungsten) {
|
||||||
|
buf.writeInt(1);
|
||||||
|
} else if(slots[3].getItem() == ModItems.fusion_shield_desh) {
|
||||||
|
buf.writeInt(2);
|
||||||
|
} else if(slots[3].getItem() == ModItems.fusion_shield_chlorophyte) {
|
||||||
|
buf.writeInt(3);
|
||||||
|
} else if(slots[3].getItem() == ModItems.fusion_shield_vaporwave) {
|
||||||
|
buf.writeInt(4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.isOn = buf.readBoolean();
|
||||||
|
this.power = buf.readLong();
|
||||||
|
this.progress = buf.readInt();
|
||||||
|
tanks[0].deserialize(buf);
|
||||||
|
tanks[1].deserialize(buf);
|
||||||
|
plasma.deserialize(buf);
|
||||||
|
this.blanket = buf.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import api.hbm.energymk2.IEnergyProviderMK2;
|
|||||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@ -111,13 +112,8 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin
|
|||||||
|
|
||||||
if(power > maxPower)
|
if(power > maxPower)
|
||||||
power = maxPower;
|
power = maxPower;
|
||||||
|
|
||||||
data.setInteger("playersUsing", playersUsing);
|
this.networkPackNT(50);
|
||||||
data.setInteger("setting", setting);
|
|
||||||
data.setBoolean("isOn", isOn);
|
|
||||||
data.setBoolean("wasOn", wasOn);
|
|
||||||
tank.writeToNBT(data, "tank");
|
|
||||||
this.networkPack(data, 50);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.prevDoorAngle = this.doorAngle;
|
this.prevDoorAngle = this.doorAngle;
|
||||||
@ -200,14 +196,23 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void serialize(ByteBuf buf) {
|
||||||
super.networkUnpack(nbt);
|
super.serialize(buf);
|
||||||
this.playersUsing = nbt.getInteger("playersUsing");
|
buf.writeInt(this.playersUsing);
|
||||||
this.setting = nbt.getInteger("setting");
|
buf.writeInt(this.setting);
|
||||||
this.power = nbt.getLong("power");
|
buf.writeBoolean(this.isOn);
|
||||||
this.isOn = nbt.getBoolean("isOn");
|
buf.writeBoolean(this.wasOn);
|
||||||
this.wasOn = nbt.getBoolean("wasOn");
|
tank.serialize(buf);
|
||||||
this.tank.readFromNBT(nbt, "tank");
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.playersUsing = buf.readInt();
|
||||||
|
this.setting = buf.readInt();
|
||||||
|
this.isOn = buf.readBoolean();
|
||||||
|
this.wasOn = buf.readBoolean();
|
||||||
|
tank.deserialize(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -27,6 +27,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2;
|
|||||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@ -119,16 +120,8 @@ public class TileEntityMachineCompressor extends TileEntityMachineBase implement
|
|||||||
for(DirPos pos : getConPos()) {
|
for(DirPos pos : getConPos()) {
|
||||||
this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(100);
|
||||||
data.setInteger("progress", progress);
|
|
||||||
data.setInteger("processTime", processTime);
|
|
||||||
data.setInteger("powerRequirement", powerRequirement);
|
|
||||||
data.setLong("power", power);
|
|
||||||
tanks[0].writeToNBT(data, "0");
|
|
||||||
tanks[1].writeToNBT(data, "1");
|
|
||||||
data.setBoolean("isOn", isOn);
|
|
||||||
this.networkPack(data, 100);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -163,17 +156,29 @@ public class TileEntityMachineCompressor extends TileEntityMachineBase implement
|
|||||||
}
|
}
|
||||||
|
|
||||||
private float randSpeed = 0.1F;
|
private float randSpeed = 0.1F;
|
||||||
|
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
@Override
|
||||||
super.networkUnpack(nbt);
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
this.progress = nbt.getInteger("progress");
|
buf.writeInt(this.progress);
|
||||||
this.processTime = nbt.getInteger("processTime");
|
buf.writeInt(this.processTime);
|
||||||
this.powerRequirement = nbt.getInteger("powerRequirement");
|
buf.writeInt(this.powerRequirement);
|
||||||
this.power = nbt.getLong("power");
|
buf.writeLong(this.power);
|
||||||
tanks[0].readFromNBT(nbt, "0");
|
tanks[0].serialize(buf);
|
||||||
tanks[1].readFromNBT(nbt, "1");
|
tanks[1].serialize(buf);
|
||||||
this.isOn = nbt.getBoolean("isOn");
|
buf.writeBoolean(this.isOn);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.progress = buf.readInt();
|
||||||
|
this.processTime = buf.readInt();
|
||||||
|
this.powerRequirement = buf.readInt();
|
||||||
|
this.power = buf.readLong();
|
||||||
|
tanks[0].deserialize(buf);
|
||||||
|
tanks[1].deserialize(buf);
|
||||||
|
this.isOn = buf.readBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateConnections() {
|
private void updateConnections() {
|
||||||
|
|||||||
@ -28,6 +28,7 @@ import api.hbm.fluid.IFluidStandardTransceiver;
|
|||||||
import api.hbm.tile.IInfoProviderEC;
|
import api.hbm.tile.IInfoProviderEC;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@ -151,22 +152,26 @@ public class TileEntityMachineDiesel extends TileEntityMachinePolluting implemen
|
|||||||
|
|
||||||
generate();
|
generate();
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(50);
|
||||||
data.setInteger("power", (int) power);
|
|
||||||
data.setInteger("powerCap", (int) powerCap);
|
|
||||||
tank.writeToNBT(data, "t");
|
|
||||||
this.networkPack(data, 50);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void networkUnpack(NBTTagCompound data) {
|
|
||||||
super.networkUnpack(data);
|
|
||||||
|
|
||||||
power = data.getInteger("power");
|
@Override
|
||||||
powerCap = data.getInteger("powerCap");
|
public void serialize(ByteBuf buf) {
|
||||||
tank.readFromNBT(data, "t");
|
super.serialize(buf);
|
||||||
|
buf.writeInt((int) power);
|
||||||
|
buf.writeInt((int) powerCap);
|
||||||
|
tank.serialize(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.power = buf.readInt();
|
||||||
|
this.powerCap = buf.readInt();
|
||||||
|
tank.deserialize(buf);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasAcceptableFuel() {
|
public boolean hasAcceptableFuel() {
|
||||||
return getHEFromFuel() > 0;
|
return getHEFromFuel() > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import com.hbm.lib.Library;
|
|||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.IUpgradeInfoProvider;
|
import com.hbm.tileentity.IUpgradeInfoProvider;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
|
import com.hbm.util.BufferUtil;
|
||||||
import com.hbm.util.CompatEnergyControl;
|
import com.hbm.util.CompatEnergyControl;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
@ -20,6 +21,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2;
|
|||||||
import api.hbm.tile.IInfoProviderEC;
|
import api.hbm.tile.IInfoProviderEC;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@ -117,16 +119,7 @@ public class TileEntityMachineEPress extends TileEntityMachineBase implements IE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(50);
|
||||||
data.setLong("power", power);
|
|
||||||
data.setInteger("press", press);
|
|
||||||
if(slots[2] != null) {
|
|
||||||
NBTTagCompound stack = new NBTTagCompound();
|
|
||||||
slots[2].writeToNBT(stack);
|
|
||||||
data.setTag("stack", stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.networkPack(data, 50);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -141,21 +134,27 @@ public class TileEntityMachineEPress extends TileEntityMachineBase implements IE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void serialize(ByteBuf buf) {
|
||||||
super.networkUnpack(nbt);
|
super.serialize(buf);
|
||||||
|
buf.writeLong(power);
|
||||||
this.power = nbt.getLong("power");
|
buf.writeInt(press);
|
||||||
this.syncPress = nbt.getInteger("press");
|
if (slots[2] == null)
|
||||||
|
buf.writeShort(-1); // indicate that the NBT doesn't actually exist to avoid null pointer errors.
|
||||||
if(nbt.hasKey("stack")) {
|
else
|
||||||
NBTTagCompound stack = nbt.getCompoundTag("stack");
|
BufferUtil.writeNBT(buf, slots[2].stackTagCompound);
|
||||||
this.syncStack = ItemStack.loadItemStackFromNBT(stack);
|
}
|
||||||
} else {
|
|
||||||
this.syncStack = null;
|
@Override
|
||||||
}
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.power = buf.readLong();
|
||||||
|
this.syncPress = buf.readInt();
|
||||||
|
|
||||||
|
NBTTagCompound stack = BufferUtil.readNBT(buf);
|
||||||
|
this.syncStack = ItemStack.loadItemStackFromNBT(stack);
|
||||||
|
|
||||||
this.turnProgress = 2;
|
this.turnProgress = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,6 +29,7 @@ import api.hbm.tile.IInfoProviderEC;
|
|||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import li.cil.oc.api.machine.Arguments;
|
import li.cil.oc.api.machine.Arguments;
|
||||||
import li.cil.oc.api.machine.Callback;
|
import li.cil.oc.api.machine.Callback;
|
||||||
import li.cil.oc.api.machine.Context;
|
import li.cil.oc.api.machine.Context;
|
||||||
@ -102,6 +103,8 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
|
|||||||
return "container.machineLargeTurbine";
|
return "container.machineLargeTurbine";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean operational;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
|
|
||||||
@ -117,9 +120,7 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
|
|||||||
tanks[0].setType(0, 1, slots);
|
tanks[0].setType(0, 1, slots);
|
||||||
tanks[0].loadTank(2, 3, slots);
|
tanks[0].loadTank(2, 3, slots);
|
||||||
power = Library.chargeItemsFromTE(slots, 4, power, maxPower);
|
power = Library.chargeItemsFromTE(slots, 4, power, maxPower);
|
||||||
|
|
||||||
boolean operational = false;
|
|
||||||
|
|
||||||
FluidType in = tanks[0].getTankType();
|
FluidType in = tanks[0].getTankType();
|
||||||
boolean valid = false;
|
boolean valid = false;
|
||||||
if(in.hasTrait(FT_Coolable.class)) {
|
if(in.hasTrait(FT_Coolable.class)) {
|
||||||
@ -145,13 +146,9 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
|
|||||||
if(power > maxPower) power = maxPower;
|
if(power > maxPower) power = maxPower;
|
||||||
|
|
||||||
tanks[1].unloadTank(5, 6, slots);
|
tanks[1].unloadTank(5, 6, slots);
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(50);
|
||||||
data.setLong("power", power);
|
|
||||||
data.setBoolean("operational", operational);
|
|
||||||
tanks[0].writeToNBT(data, "t0");
|
|
||||||
tanks[1].writeToNBT(data, "t1");
|
|
||||||
this.networkPack(data, 50);
|
|
||||||
} else {
|
} else {
|
||||||
this.lastRotor = this.rotor;
|
this.lastRotor = this.rotor;
|
||||||
this.rotor += this.fanAcceleration;
|
this.rotor += this.fanAcceleration;
|
||||||
@ -199,14 +196,23 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
|
|||||||
new DirPos(xCoord + dir.offsetX * 2, yCoord, zCoord + dir.offsetZ * 2, dir)
|
new DirPos(xCoord + dir.offsetX * 2, yCoord, zCoord + dir.offsetZ * 2, dir)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void networkUnpack(NBTTagCompound data) {
|
@Override
|
||||||
super.networkUnpack(data);
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
this.power = data.getLong("power");
|
buf.writeLong(this.power);
|
||||||
this.shouldTurn = data.getBoolean("operational");
|
buf.writeBoolean(operational);
|
||||||
tanks[0].readFromNBT(data, "t0");
|
tanks[0].serialize(buf);
|
||||||
tanks[1].readFromNBT(data, "t1");
|
tanks[1].serialize(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.power = buf.readLong();
|
||||||
|
this.shouldTurn = buf.readBoolean();
|
||||||
|
tanks[0].deserialize(buf);
|
||||||
|
tanks[1].deserialize(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getPowerScaled(int i) {
|
public long getPowerScaled(int i) {
|
||||||
|
|||||||
@ -31,6 +31,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2;
|
|||||||
import api.hbm.fluid.IFluidStandardSender;
|
import api.hbm.fluid.IFluidStandardSender;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
@ -83,6 +84,8 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen
|
|||||||
return "container.miningLaser";
|
return "container.miningLaser";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private double clientBreakProgress;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
|
|
||||||
@ -108,8 +111,6 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen
|
|||||||
lastTargetY = targetY;
|
lastTargetY = targetY;
|
||||||
lastTargetZ = targetZ;
|
lastTargetZ = targetZ;
|
||||||
|
|
||||||
double clientBreakProgress = 0;
|
|
||||||
|
|
||||||
if(isOn) {
|
if(isOn) {
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 1, 8);
|
UpgradeManager.eval(slots, 1, 8);
|
||||||
@ -167,43 +168,45 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen
|
|||||||
this.tryFillContainer(xCoord, yCoord, zCoord + 2);
|
this.tryFillContainer(xCoord, yCoord, zCoord + 2);
|
||||||
this.tryFillContainer(xCoord, yCoord, zCoord - 2);
|
this.tryFillContainer(xCoord, yCoord, zCoord - 2);
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(250);
|
||||||
data.setLong("power", power);
|
|
||||||
data.setInteger("lastX", lastTargetX);
|
|
||||||
data.setInteger("lastY", lastTargetY);
|
|
||||||
data.setInteger("lastZ", lastTargetZ);
|
|
||||||
data.setInteger("x", targetX);
|
|
||||||
data.setInteger("y", targetY);
|
|
||||||
data.setInteger("z", targetZ);
|
|
||||||
data.setBoolean("beam", beam);
|
|
||||||
data.setBoolean("isOn", isOn);
|
|
||||||
data.setDouble("progress", clientBreakProgress);
|
|
||||||
tank.writeToNBT(data, "t");
|
|
||||||
|
|
||||||
this.networkPack(data, 250);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateConnections() {
|
private void updateConnections() {
|
||||||
this.trySubscribe(worldObj, xCoord, yCoord + 2, zCoord, ForgeDirection.UP);
|
this.trySubscribe(worldObj, xCoord, yCoord + 2, zCoord, ForgeDirection.UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void networkUnpack(NBTTagCompound data) {
|
|
||||||
super.networkUnpack(data);
|
|
||||||
|
|
||||||
this.power = data.getLong("power");
|
@Override
|
||||||
this.lastTargetX = data.getInteger("lastX");
|
public void serialize(ByteBuf buf) {
|
||||||
this.lastTargetY = data.getInteger("lastY");
|
buf.writeLong(this.power);
|
||||||
this.lastTargetZ = data.getInteger("lastZ");
|
buf.writeInt(this.lastTargetX);
|
||||||
this.targetX = data.getInteger("x");
|
buf.writeInt(this.lastTargetY);
|
||||||
this.targetY = data.getInteger("y");
|
buf.writeInt(this.lastTargetZ);
|
||||||
this.targetZ = data.getInteger("z");
|
buf.writeInt(this.targetX);
|
||||||
this.beam = data.getBoolean("beam");
|
buf.writeInt(this.targetY);
|
||||||
this.isOn = data.getBoolean("isOn");
|
buf.writeInt(this.targetZ);
|
||||||
this.breakProgress = data.getDouble("progress");
|
buf.writeBoolean(this.beam);
|
||||||
tank.readFromNBT(data, "t");
|
buf.writeBoolean(this.isOn);
|
||||||
|
buf.writeDouble(this.clientBreakProgress);
|
||||||
|
tank.serialize(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.power = buf.readLong();
|
||||||
|
this.lastTargetX = buf.readInt();
|
||||||
|
this.lastTargetY = buf.readInt();
|
||||||
|
this.lastTargetZ = buf.readInt();
|
||||||
|
this.targetX = buf.readInt();
|
||||||
|
this.targetY = buf.readInt();
|
||||||
|
this.targetZ = buf.readInt();
|
||||||
|
this.beam = buf.readBoolean();
|
||||||
|
this.isOn = buf.readBoolean();
|
||||||
|
this.breakProgress = buf.readDouble();
|
||||||
|
tank.deserialize(buf);
|
||||||
|
}
|
||||||
|
|
||||||
private void buildDam() {
|
private void buildDam() {
|
||||||
|
|
||||||
if(worldObj.getBlock(targetX + 1, targetY, targetZ).getMaterial().isLiquid()) worldObj.setBlock(targetX + 1, targetY, targetZ, ModBlocks.barricade);
|
if(worldObj.getBlock(targetX + 1, targetY, targetZ).getMaterial().isLiquid()) worldObj.setBlock(targetX + 1, targetY, targetZ, ModBlocks.barricade);
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2;
|
|||||||
import api.hbm.fluid.IFluidStandardReceiver;
|
import api.hbm.fluid.IFluidStandardReceiver;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@ -122,13 +123,7 @@ public class TileEntityMachinePlasmaHeater extends TileEntityMachineBase impleme
|
|||||||
/// END Loading plasma into the ITER ///
|
/// END Loading plasma into the ITER ///
|
||||||
|
|
||||||
/// START Notif packets ///
|
/// START Notif packets ///
|
||||||
|
this.networkPackNT(50);
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
|
||||||
data.setLong("power", power);
|
|
||||||
tanks[0].writeToNBT(data, "t0");
|
|
||||||
tanks[1].writeToNBT(data, "t1");
|
|
||||||
plasma.writeToNBT(data, "t2");
|
|
||||||
this.networkPack(data, 50);
|
|
||||||
/// END Notif packets ///
|
/// END Notif packets ///
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -148,14 +143,23 @@ public class TileEntityMachinePlasmaHeater extends TileEntityMachineBase impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
@Override
|
||||||
super.networkUnpack(nbt);
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
this.power = nbt.getLong("power");
|
buf.writeLong(power);
|
||||||
tanks[0].readFromNBT(nbt, "t0");
|
tanks[0].serialize(buf);
|
||||||
tanks[1].readFromNBT(nbt, "t1");
|
tanks[1].serialize(buf);
|
||||||
plasma.readFromNBT(nbt, "t2");
|
plasma.serialize(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.power = buf.readLong();
|
||||||
|
tanks[0].deserialize(buf);
|
||||||
|
tanks[1].deserialize(buf);
|
||||||
|
plasma.deserialize(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateType() {
|
private void updateType() {
|
||||||
|
|||||||
@ -8,8 +8,10 @@ import com.hbm.items.machine.ItemStamp;
|
|||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
|
|
||||||
|
import com.hbm.util.BufferUtil;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@ -133,17 +135,7 @@ public class TileEntityMachinePress extends TileEntityMachineBase implements IGU
|
|||||||
this.markChanged();
|
this.markChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(50);
|
||||||
data.setInteger("speed", speed);
|
|
||||||
data.setInteger("burnTime", burnTime);
|
|
||||||
data.setInteger("press", press);
|
|
||||||
if(slots[2] != null) {
|
|
||||||
NBTTagCompound stack = new NBTTagCompound();
|
|
||||||
slots[2].writeToNBT(stack);
|
|
||||||
data.setTag("stack", stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.networkPack(data, 50);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -158,6 +150,30 @@ public class TileEntityMachinePress extends TileEntityMachineBase implements IGU
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
|
buf.writeInt(this.speed);
|
||||||
|
buf.writeInt(this.burnTime);
|
||||||
|
buf.writeInt(this.press);
|
||||||
|
if (slots[2] == null)
|
||||||
|
buf.writeShort(-1); // indicate that the NBT doesn't actually exist to avoid null pointer errors.
|
||||||
|
else
|
||||||
|
BufferUtil.writeNBT(buf, slots[2].stackTagCompound);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.speed = buf.readInt();
|
||||||
|
this.burnTime = buf.readInt();
|
||||||
|
this.press = buf.readInt();
|
||||||
|
NBTTagCompound stack = BufferUtil.readNBT(buf);
|
||||||
|
this.syncStack = ItemStack.loadItemStackFromNBT(stack);
|
||||||
|
|
||||||
|
this.turnProgress = 2;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void networkUnpack(NBTTagCompound nbt) {
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import com.hbm.items.special.ItemWasteLong;
|
|||||||
import com.hbm.items.special.ItemWasteShort;
|
import com.hbm.items.special.ItemWasteShort;
|
||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
|
import com.hbm.util.BufferUtil;
|
||||||
import com.hbm.util.CompatEnergyControl;
|
import com.hbm.util.CompatEnergyControl;
|
||||||
import com.hbm.util.Tuple.Triplet;
|
import com.hbm.util.Tuple.Triplet;
|
||||||
|
|
||||||
@ -18,6 +19,7 @@ import api.hbm.energymk2.IEnergyProviderMK2;
|
|||||||
import api.hbm.tile.IInfoProviderEC;
|
import api.hbm.tile.IInfoProviderEC;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
@ -111,26 +113,29 @@ public class TileEntityMachineRadGen extends TileEntityMachineBase implements IE
|
|||||||
|
|
||||||
if(this.power > maxPower)
|
if(this.power > maxPower)
|
||||||
this.power = maxPower;
|
this.power = maxPower;
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(50);
|
||||||
data.setIntArray("progress", this.progress);
|
|
||||||
data.setIntArray("maxProgress", this.maxProgress);
|
|
||||||
data.setIntArray("production", this.production);
|
|
||||||
data.setLong("power", this.power);
|
|
||||||
data.setBoolean("isOn", this.isOn);
|
|
||||||
this.networkPack(data, 50);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void serialize(ByteBuf buf) {
|
||||||
super.networkUnpack(nbt);
|
super.serialize(buf);
|
||||||
|
BufferUtil.writeIntArray(buf, this.progress);
|
||||||
this.progress = nbt.getIntArray("progress");
|
BufferUtil.writeIntArray(buf, this.maxProgress);
|
||||||
this.maxProgress = nbt.getIntArray("maxProgress");
|
BufferUtil.writeIntArray(buf, this.production);
|
||||||
this.production = nbt.getIntArray("production");
|
buf.writeLong(this.power);
|
||||||
this.power = nbt.getLong("power");
|
buf.writeBoolean(this.isOn);
|
||||||
this.isOn = nbt.getBoolean("isOn");
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.progress = BufferUtil.readIntArray(buf);
|
||||||
|
this.maxProgress = BufferUtil.readIntArray(buf);
|
||||||
|
this.production = BufferUtil.readIntArray(buf);
|
||||||
|
this.power = buf.readLong();
|
||||||
|
this.isOn = buf.readBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import api.hbm.fluid.IFluidStandardTransceiver;
|
|||||||
import api.hbm.tile.IInfoProviderEC;
|
import api.hbm.tile.IInfoProviderEC;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@ -98,16 +99,6 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement
|
|||||||
tanks[2].writeToNBT(nbt, "output2");
|
tanks[2].writeToNBT(nbt, "output2");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void networkUnpack(NBTTagCompound data) {
|
|
||||||
super.networkUnpack(data);
|
|
||||||
|
|
||||||
this.power = data.getLong("power");
|
|
||||||
this.heat = data.getInteger("heat");
|
|
||||||
tanks[0].readFromNBT(data, "t0");
|
|
||||||
tanks[1].readFromNBT(data, "t1");
|
|
||||||
tanks[2].readFromNBT(data, "t2");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
|
|
||||||
@ -139,16 +130,30 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement
|
|||||||
if(tanks[1].getFill() > 0) this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(),pos.getZ(), pos.getDir());
|
if(tanks[1].getFill() > 0) this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(),pos.getZ(), pos.getDir());
|
||||||
if(tanks[2].getFill() > 0) this.sendFluid(tanks[2], worldObj, pos.getX(), pos.getY(),pos.getZ(), pos.getDir());
|
if(tanks[2].getFill() > 0) this.sendFluid(tanks[2], worldObj, pos.getX(), pos.getY(),pos.getZ(), pos.getDir());
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(50);
|
||||||
data.setLong("power", power);
|
|
||||||
data.setInteger("heat", heat);
|
|
||||||
tanks[0].writeToNBT(data, "t0");
|
|
||||||
tanks[1].writeToNBT(data, "t1");
|
|
||||||
tanks[2].writeToNBT(data, "t2");
|
|
||||||
this.networkPack(data, 50);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
|
buf.writeLong(this.power);
|
||||||
|
buf.writeInt(this.heat);
|
||||||
|
tanks[0].serialize(buf);
|
||||||
|
tanks[1].serialize(buf);
|
||||||
|
tanks[2].serialize(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.power = buf.readLong();
|
||||||
|
this.heat = buf.readInt();
|
||||||
|
tanks[0].serialize(buf);
|
||||||
|
tanks[1].serialize(buf);
|
||||||
|
tanks[2].serialize(buf);
|
||||||
|
}
|
||||||
|
|
||||||
protected DirPos[] getConPos() {
|
protected DirPos[] getConPos() {
|
||||||
return new DirPos[] {
|
return new DirPos[] {
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import api.hbm.tile.IInfoProviderEC;
|
|||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import li.cil.oc.api.machine.Arguments;
|
import li.cil.oc.api.machine.Arguments;
|
||||||
import li.cil.oc.api.machine.Callback;
|
import li.cil.oc.api.machine.Callback;
|
||||||
import li.cil.oc.api.machine.Context;
|
import li.cil.oc.api.machine.Context;
|
||||||
@ -66,19 +67,23 @@ public class TileEntityMachineReactorBreeding extends TileEntityMachineBase impl
|
|||||||
} else {
|
} else {
|
||||||
progress = 0.0F;
|
progress = 0.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(20);
|
||||||
data.setInteger("flux", flux);
|
|
||||||
data.setFloat("progress", progress);
|
|
||||||
this.networkPack(data, 20);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void networkUnpack(NBTTagCompound data) {
|
@Override
|
||||||
super.networkUnpack(data);
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
flux = data.getInteger("flux");
|
buf.writeInt(flux);
|
||||||
progress = data.getFloat("progress");
|
buf.writeFloat(progress);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.flux = buf.readInt();
|
||||||
|
this.progress = buf.readFloat();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getInteractions() {
|
public void getInteractions() {
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import api.hbm.energymk2.IBatteryItem;
|
|||||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@ -167,11 +168,8 @@ public class TileEntityMachineSchrabidiumTransmutator extends TileEntityMachineB
|
|||||||
} else {
|
} else {
|
||||||
process = 0;
|
process = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(50);
|
||||||
data.setLong("power", power);
|
|
||||||
data.setInteger("progress", process);
|
|
||||||
this.networkPack(data, 50);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -193,6 +191,20 @@ public class TileEntityMachineSchrabidiumTransmutator extends TileEntityMachineB
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
|
buf.writeLong(this.power);
|
||||||
|
buf.writeInt(this.process);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.power = buf.readLong();
|
||||||
|
this.process = buf.readInt();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AudioWrapper createAudioLoop() {
|
public AudioWrapper createAudioLoop() {
|
||||||
@ -224,14 +236,6 @@ public class TileEntityMachineSchrabidiumTransmutator extends TileEntityMachineB
|
|||||||
audio = null;
|
audio = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void networkUnpack(NBTTagCompound data) {
|
|
||||||
super.networkUnpack(data);
|
|
||||||
|
|
||||||
this.power = data.getLong("power");
|
|
||||||
this.process = data.getInteger("progress");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPower(long i) {
|
public void setPower(long i) {
|
||||||
|
|||||||
@ -27,6 +27,7 @@ import api.hbm.fluid.IFluidStandardReceiver;
|
|||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@ -69,6 +70,8 @@ public class TileEntityMachineSolderingStation extends TileEntityMachineBase imp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SolderingRecipe recipe;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
|
|
||||||
@ -84,7 +87,7 @@ public class TileEntityMachineSolderingStation extends TileEntityMachineBase imp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SolderingRecipe recipe = SolderingRecipes.getRecipe(new ItemStack[] {slots[0], slots[1], slots[2], slots[3], slots[4], slots[5]});
|
recipe = SolderingRecipes.getRecipe(new ItemStack[] {slots[0], slots[1], slots[2], slots[3], slots[4], slots[5]});
|
||||||
long intendedMaxPower;
|
long intendedMaxPower;
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 9, 10);
|
UpgradeManager.eval(slots, 9, 10);
|
||||||
@ -133,19 +136,8 @@ public class TileEntityMachineSolderingStation extends TileEntityMachineBase imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.maxPower = Math.max(intendedMaxPower, power);
|
this.maxPower = Math.max(intendedMaxPower, power);
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(25);
|
||||||
data.setLong("power", power);
|
|
||||||
data.setLong("maxPower", maxPower);
|
|
||||||
data.setLong("consumption", consumption);
|
|
||||||
data.setInteger("progress", progress);
|
|
||||||
data.setInteger("processTime", processTime);
|
|
||||||
if(recipe != null) {
|
|
||||||
data.setInteger("display", Item.getIdFromItem(recipe.output.getItem()));
|
|
||||||
data.setInteger("displayMeta", recipe.output.getItemDamage());
|
|
||||||
}
|
|
||||||
this.tank.writeToNBT(data, "t");
|
|
||||||
this.networkPack(data, 25);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,22 +232,38 @@ public class TileEntityMachineSolderingStation extends TileEntityMachineBase imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void serialize(ByteBuf buf) {
|
||||||
super.networkUnpack(nbt);
|
super.serialize(buf);
|
||||||
|
buf.writeLong(this.power);
|
||||||
this.power = nbt.getLong("power");
|
buf.writeLong(this.maxPower);
|
||||||
this.maxPower = nbt.getLong("maxPower");
|
buf.writeLong(this.consumption);
|
||||||
this.consumption = nbt.getLong("consumption");
|
buf.writeInt(this.progress);
|
||||||
this.progress = nbt.getInteger("progress");
|
buf.writeInt(this.processTime);
|
||||||
this.processTime = nbt.getInteger("processTime");
|
buf.writeBoolean(recipe != null);
|
||||||
|
if(recipe != null) {
|
||||||
if(nbt.hasKey("display")) {
|
buf.writeInt(Item.getIdFromItem(recipe.output.getItem()));
|
||||||
this.display = new ItemStack(Item.getItemById(nbt.getInteger("display")), 1, nbt.getInteger("displayMeta"));
|
buf.writeInt(recipe.output.getItemDamage());
|
||||||
|
}
|
||||||
|
this.tank.serialize(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.power = buf.readLong();
|
||||||
|
this.maxPower = buf.readLong();
|
||||||
|
this.consumption = buf.readLong();
|
||||||
|
this.progress = buf.readInt();
|
||||||
|
this.processTime = buf.readInt();
|
||||||
|
|
||||||
|
if(buf.readBoolean()) {
|
||||||
|
int id = buf.readInt();
|
||||||
|
this.display = new ItemStack(Item.getItemById(id), 1, buf.readInt());
|
||||||
} else {
|
} else {
|
||||||
this.display = null;
|
this.display = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tank.readFromNBT(nbt, "t");
|
this.tank.deserialize(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -28,6 +28,7 @@ import api.hbm.tile.IInfoProviderEC;
|
|||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import li.cil.oc.api.machine.Arguments;
|
import li.cil.oc.api.machine.Arguments;
|
||||||
import li.cil.oc.api.machine.Callback;
|
import li.cil.oc.api.machine.Callback;
|
||||||
import li.cil.oc.api.machine.Context;
|
import li.cil.oc.api.machine.Context;
|
||||||
@ -85,7 +86,9 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
|||||||
tanks[2] = new FluidTank(Fluids.WATER, 16000);
|
tanks[2] = new FluidTank(Fluids.WATER, 16000);
|
||||||
tanks[3] = new FluidTank(Fluids.HOTSTEAM, 160000);
|
tanks[3] = new FluidTank(Fluids.HOTSTEAM, 160000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private long powerBeforeNet;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
|
|
||||||
@ -131,10 +134,9 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
|||||||
|
|
||||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
powerBeforeNet = Math.min(this.power, maxPower);
|
||||||
data.setLong("power", Math.min(this.power, this.maxPower)); //set first to get an unmodified view of how much power was generated before deductions from the net
|
|
||||||
|
|
||||||
//do net/battery deductions first...
|
//do net/battery deductions first...
|
||||||
power = Library.chargeItemsFromTE(slots, 0, power, maxPower);
|
power = Library.chargeItemsFromTE(slots, 0, power, maxPower);
|
||||||
this.tryProvide(worldObj, xCoord - dir.offsetZ * 5, yCoord + 1, zCoord + dir.offsetX * 5, rot); //sends out power
|
this.tryProvide(worldObj, xCoord - dir.offsetZ * 5, yCoord + 1, zCoord + dir.offsetX * 5, rot); //sends out power
|
||||||
@ -152,26 +154,8 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
|||||||
this.trySubscribe(tanks[2].getTankType(), worldObj, xCoord + dir.offsetX * 2 + rot.offsetX * -4, yCoord, zCoord + dir.offsetZ * 2 + rot.offsetZ * -4, dir);
|
this.trySubscribe(tanks[2].getTankType(), worldObj, xCoord + dir.offsetX * 2 + rot.offsetX * -4, yCoord, zCoord + dir.offsetZ * 2 + rot.offsetZ * -4, dir);
|
||||||
//steam
|
//steam
|
||||||
this.sendFluid(tanks[3], worldObj, xCoord + dir.offsetZ * 6, yCoord + 1, zCoord - dir.offsetX * 6, rot.getOpposite());
|
this.sendFluid(tanks[3], worldObj, xCoord + dir.offsetZ * 6, yCoord + 1, zCoord - dir.offsetX * 6, rot.getOpposite());
|
||||||
|
|
||||||
data.setInteger("rpm", this.rpm);
|
|
||||||
data.setInteger("temp", this.temp);
|
|
||||||
data.setInteger("state", this.state);
|
|
||||||
data.setBoolean("automode", this.autoMode);
|
|
||||||
data.setInteger("throttle", this.throttle);
|
|
||||||
data.setInteger("slidpos", this.powerSliderPos);
|
|
||||||
|
|
||||||
if(state != 1) {
|
|
||||||
data.setInteger("counter", this.counter); //sent during startup and shutdown
|
|
||||||
} else {
|
|
||||||
data.setInteger("instantPow", this.instantPowerOutput); //sent while running
|
|
||||||
}
|
|
||||||
|
|
||||||
tanks[0].writeToNBT(data, "fuel");
|
|
||||||
tanks[1].writeToNBT(data, "lube");
|
|
||||||
tanks[2].writeToNBT(data, "water");
|
|
||||||
tanks[3].writeToNBT(data, "steam");
|
|
||||||
|
|
||||||
this.networkPack(data, 150);
|
this.networkPackNT(150);
|
||||||
|
|
||||||
} else { //client side, for sounds n shit
|
} else { //client side, for sounds n shit
|
||||||
|
|
||||||
@ -200,6 +184,51 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
|
buf.writeLong(this.powerBeforeNet);
|
||||||
|
buf.writeInt(this.rpm);
|
||||||
|
buf.writeInt(this.temp);
|
||||||
|
buf.writeInt(this.state);
|
||||||
|
buf.writeBoolean(this.autoMode);
|
||||||
|
buf.writeInt(this.throttle);
|
||||||
|
buf.writeInt(this.powerSliderPos);
|
||||||
|
|
||||||
|
if(state != 1) {
|
||||||
|
buf.writeInt(this.counter); //sent during startup and shutdown
|
||||||
|
} else {
|
||||||
|
buf.writeInt(this.instantPowerOutput); //sent while running
|
||||||
|
}
|
||||||
|
|
||||||
|
tanks[0].serialize(buf);
|
||||||
|
tanks[1].serialize(buf);
|
||||||
|
tanks[2].serialize(buf);
|
||||||
|
tanks[3].serialize(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.power = buf.readLong();
|
||||||
|
this.rpm = buf.readInt();
|
||||||
|
this.temp = buf.readInt();
|
||||||
|
this.state = buf.readInt();
|
||||||
|
this.autoMode = buf.readBoolean();
|
||||||
|
this.powerSliderPos = buf.readInt();
|
||||||
|
this.throttle = buf.readInt();
|
||||||
|
|
||||||
|
if(state != 1)
|
||||||
|
this.counter = buf.readInt();
|
||||||
|
else
|
||||||
|
this.instantPowerOutput = buf.readInt(); //state 1
|
||||||
|
|
||||||
|
this.tanks[0].deserialize(buf);
|
||||||
|
this.tanks[1].deserialize(buf);
|
||||||
|
this.tanks[2].deserialize(buf);
|
||||||
|
this.tanks[3].deserialize(buf);
|
||||||
|
}
|
||||||
|
|
||||||
private void stopIfNotReady() {
|
private void stopIfNotReady() {
|
||||||
|
|
||||||
@ -378,30 +407,7 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
|||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
|
||||||
super.networkUnpack(nbt);
|
|
||||||
|
|
||||||
this.power = nbt.getLong("power");
|
|
||||||
this.rpm = nbt.getInteger("rpm");
|
|
||||||
this.temp = nbt.getInteger("temp");
|
|
||||||
this.state = nbt.getInteger("state");
|
|
||||||
this.autoMode = nbt.getBoolean("automode");
|
|
||||||
this.powerSliderPos = nbt.getInteger("slidpos");
|
|
||||||
this.throttle = nbt.getInteger("throttle");
|
|
||||||
|
|
||||||
if(nbt.hasKey("counter"))
|
|
||||||
this.counter = nbt.getInteger("counter"); //state 0 and -1
|
|
||||||
else
|
|
||||||
this.instantPowerOutput = nbt.getInteger("instantPow"); //state 1
|
|
||||||
|
|
||||||
this.tanks[0].readFromNBT(nbt, "fuel");
|
|
||||||
this.tanks[1].readFromNBT(nbt, "lube");
|
|
||||||
this.tanks[2].readFromNBT(nbt, "water");
|
|
||||||
this.tanks[3].readFromNBT(nbt, "steam");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbt) {
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
super.readFromNBT(nbt);
|
super.readFromNBT(nbt);
|
||||||
|
|||||||
@ -34,6 +34,7 @@ import api.hbm.tile.IInfoProviderEC;
|
|||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
@ -284,15 +285,8 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem
|
|||||||
if(this.power > this.maxPower) {
|
if(this.power > this.maxPower) {
|
||||||
this.power = this.maxPower;
|
this.power = this.maxPower;
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(150);
|
||||||
data.setLong("power", power);
|
|
||||||
data.setByte("after", (byte) afterburner);
|
|
||||||
data.setBoolean("wasOn", wasOn);
|
|
||||||
data.setBoolean("showBlood", showBlood);
|
|
||||||
tank.writeToNBT(data, "tank");
|
|
||||||
blood.writeToNBT(data, "blood");
|
|
||||||
this.networkPack(data, 150);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -385,16 +379,27 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
@Override
|
||||||
super.networkUnpack(nbt);
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
this.power = nbt.getLong("power");
|
buf.writeLong(power);
|
||||||
this.afterburner = nbt.getByte("after");
|
buf.writeByte((byte) afterburner);
|
||||||
this.wasOn = nbt.getBoolean("wasOn");
|
buf.writeBoolean(wasOn);
|
||||||
this.showBlood = nbt.getBoolean("showBlood");
|
buf.writeBoolean(showBlood);
|
||||||
tank.readFromNBT(nbt, "tank");
|
tank.serialize(buf);
|
||||||
blood.readFromNBT(nbt, "blood");
|
blood.serialize(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.power = buf.readLong();
|
||||||
|
this.afterburner = buf.readByte();
|
||||||
|
this.wasOn = buf.readBoolean();
|
||||||
|
this.showBlood = buf.readBoolean();
|
||||||
|
tank.deserialize(buf);
|
||||||
|
blood.deserialize(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AudioWrapper createAudioLoop() {
|
public AudioWrapper createAudioLoop() {
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2;
|
|||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import li.cil.oc.api.machine.Arguments;
|
import li.cil.oc.api.machine.Arguments;
|
||||||
import li.cil.oc.api.machine.Callback;
|
import li.cil.oc.api.machine.Callback;
|
||||||
import li.cil.oc.api.machine.Context;
|
import li.cil.oc.api.machine.Context;
|
||||||
@ -75,21 +76,25 @@ public class TileEntityMicrowave extends TileEntityMachineBase implements IEnerg
|
|||||||
time += speed * 2;
|
time += speed * 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
networkPackNT(50);
|
||||||
data.setLong("power", power);
|
|
||||||
data.setInteger("time", time);
|
|
||||||
data.setInteger("speed", speed);
|
|
||||||
networkPack(data, 50);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void networkUnpack(NBTTagCompound data) {
|
@Override
|
||||||
super.networkUnpack(data);
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
power = data.getLong("power");
|
buf.writeLong(power);
|
||||||
time = data.getInteger("time");
|
buf.writeInt(time);
|
||||||
speed = data.getInteger("speed");
|
buf.writeInt(speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
power = buf.readLong();
|
||||||
|
time = buf.readInt();
|
||||||
|
speed = buf.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleButtonPacket(int value, int meta) {
|
public void handleButtonPacket(int value, int meta) {
|
||||||
|
|||||||
@ -29,6 +29,7 @@ import api.hbm.fluid.IFluidStandardTransceiver;
|
|||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import li.cil.oc.api.machine.Arguments;
|
import li.cil.oc.api.machine.Arguments;
|
||||||
import li.cil.oc.api.machine.Callback;
|
import li.cil.oc.api.machine.Callback;
|
||||||
import li.cil.oc.api.machine.Context;
|
import li.cil.oc.api.machine.Context;
|
||||||
@ -270,22 +271,8 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG
|
|||||||
this.coreHeat = 0;
|
this.coreHeat = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(150);
|
||||||
tanks[0].writeToNBT(data, "t0");
|
|
||||||
tanks[1].writeToNBT(data, "t1");
|
|
||||||
data.setInteger("rodCount", rodCount);
|
|
||||||
data.setInteger("coreHeat", coreHeat);
|
|
||||||
data.setInteger("hullHeat", hullHeat);
|
|
||||||
data.setDouble("flux", flux);
|
|
||||||
data.setDouble("processTime", processTime);
|
|
||||||
data.setDouble("progress", progress);
|
|
||||||
data.setInteger("typeLoaded", typeLoaded);
|
|
||||||
data.setInteger("amountLoaded", amountLoaded);
|
|
||||||
data.setDouble("rodLevel", rodLevel);
|
|
||||||
data.setDouble("rodTarget", rodTarget);
|
|
||||||
data.setInteger("coreHeatCapacity", coreHeatCapacity);
|
|
||||||
this.networkPack(data, 150);
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if(amountLoaded > 0) {
|
if(amountLoaded > 0) {
|
||||||
@ -383,23 +370,41 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG
|
|||||||
protected int getRodCountForCoolant() {
|
protected int getRodCountForCoolant() {
|
||||||
return this.rodCount + (int) Math.ceil(this.heatsinkCount / 4D);
|
return this.rodCount + (int) Math.ceil(this.heatsinkCount / 4D);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
@Override
|
||||||
super.networkUnpack(nbt);
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
tanks[0].readFromNBT(nbt, "t0");
|
buf.writeInt(this.rodCount);
|
||||||
tanks[1].readFromNBT(nbt, "t1");
|
buf.writeInt(this.coreHeat);
|
||||||
rodCount = nbt.getInteger("rodCount");
|
buf.writeInt(this.hullHeat);
|
||||||
coreHeat = nbt.getInteger("coreHeat");
|
buf.writeDouble(this.flux);
|
||||||
hullHeat = nbt.getInteger("hullHeat");
|
buf.writeDouble(this.processTime);
|
||||||
flux = nbt.getDouble("flux");
|
buf.writeDouble(this.progress);
|
||||||
processTime = nbt.getDouble("processTime");
|
buf.writeInt(this.typeLoaded);
|
||||||
progress = nbt.getDouble("progress");
|
buf.writeInt(this.amountLoaded);
|
||||||
typeLoaded = nbt.getInteger("typeLoaded");
|
buf.writeDouble(this.rodLevel);
|
||||||
amountLoaded = nbt.getInteger("amountLoaded");
|
buf.writeDouble(this.rodTarget);
|
||||||
rodLevel = nbt.getDouble("rodLevel");
|
buf.writeInt(this.coreHeatCapacity);
|
||||||
rodTarget = nbt.getInteger("rodTarget");
|
tanks[0].serialize(buf);
|
||||||
coreHeatCapacity = nbt.getInteger("coreHeatCapacity");
|
tanks[1].serialize(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.rodCount = buf.readInt();
|
||||||
|
this.coreHeat = buf.readInt();
|
||||||
|
this.hullHeat = buf.readInt();
|
||||||
|
this.flux = buf.readDouble();
|
||||||
|
this.processTime = buf.readDouble();
|
||||||
|
this.progress = buf.readDouble();
|
||||||
|
this.typeLoaded = buf.readInt();
|
||||||
|
this.amountLoaded = buf.readInt();
|
||||||
|
this.rodLevel = buf.readDouble();
|
||||||
|
this.rodTarget = buf.readInt();
|
||||||
|
this.coreHeatCapacity = buf.readInt();
|
||||||
|
tanks[0].deserialize(buf);
|
||||||
|
tanks[1].deserialize(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setupTanks() {
|
protected void setupTanks() {
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import com.hbm.tileentity.TileEntityMachineBase;
|
|||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import li.cil.oc.api.machine.Arguments;
|
import li.cil.oc.api.machine.Arguments;
|
||||||
import li.cil.oc.api.machine.Callback;
|
import li.cil.oc.api.machine.Callback;
|
||||||
import li.cil.oc.api.machine.Context;
|
import li.cil.oc.api.machine.Context;
|
||||||
@ -136,33 +137,37 @@ public class TileEntityReactorControl extends TileEntityMachineBase implements I
|
|||||||
reactor.setTarget(level);
|
reactor.setTarget(level);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(150);
|
||||||
data.setInteger("heat", heat);
|
|
||||||
data.setDouble("level", level);
|
|
||||||
data.setInteger("flux", flux);
|
|
||||||
data.setBoolean("isLinked", isLinked);
|
|
||||||
data.setDouble("levelLower", levelLower);
|
|
||||||
data.setDouble("levelUpper", levelUpper);
|
|
||||||
data.setDouble("heatLower", heatLower);
|
|
||||||
data.setDouble("heatUpper", heatUpper);
|
|
||||||
data.setInteger("function", function.ordinal());
|
|
||||||
this.networkPack(data, 150);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void networkUnpack(NBTTagCompound data) {
|
@Override
|
||||||
super.networkUnpack(data);
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
this.heat = data.getInteger("heat");
|
buf.writeInt(heat);
|
||||||
this.level = data.getDouble("level");
|
buf.writeDouble(level);
|
||||||
this.flux = data.getInteger("flux");
|
buf.writeInt(flux);
|
||||||
isLinked = data.getBoolean("isLinked");
|
buf.writeBoolean(isLinked);
|
||||||
levelLower = data.getDouble("levelLower");
|
buf.writeDouble(levelLower);
|
||||||
levelUpper = data.getDouble("levelUpper");
|
buf.writeDouble(levelUpper);
|
||||||
heatLower = data.getDouble("heatLower");
|
buf.writeDouble(heatLower);
|
||||||
heatUpper = data.getDouble("heatUpper");
|
buf.writeDouble(heatUpper);
|
||||||
function = RodFunction.values()[data.getInteger("function")];
|
buf.writeByte(function.ordinal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.heat = buf.readInt();
|
||||||
|
this.level = buf.readDouble();
|
||||||
|
this.flux = buf.readInt();
|
||||||
|
isLinked = buf.readBoolean();
|
||||||
|
levelLower = buf.readDouble();
|
||||||
|
levelUpper = buf.readDouble();
|
||||||
|
heatLower = buf.readDouble();
|
||||||
|
heatUpper = buf.readDouble();
|
||||||
|
function = RodFunction.values()[buf.readByte()];
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean establishLink() {
|
private boolean establishLink() {
|
||||||
|
|||||||
@ -15,12 +15,14 @@ import com.hbm.items.ModItems;
|
|||||||
import com.hbm.items.machine.ItemPlateFuel;
|
import com.hbm.items.machine.ItemPlateFuel;
|
||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
|
import com.hbm.util.BufferUtil;
|
||||||
import com.hbm.util.CompatEnergyControl;
|
import com.hbm.util.CompatEnergyControl;
|
||||||
|
|
||||||
import api.hbm.tile.IInfoProviderEC;
|
import api.hbm.tile.IInfoProviderEC;
|
||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import li.cil.oc.api.machine.Arguments;
|
import li.cil.oc.api.machine.Arguments;
|
||||||
import li.cil.oc.api.machine.Callback;
|
import li.cil.oc.api.machine.Callback;
|
||||||
import li.cil.oc.api.machine.Context;
|
import li.cil.oc.api.machine.Context;
|
||||||
@ -151,27 +153,31 @@ public class TileEntityReactorResearch extends TileEntityMachineBase implements
|
|||||||
float rad = (float) heat / (float) maxHeat * 50F;
|
float rad = (float) heat / (float) maxHeat * 50F;
|
||||||
ChunkRadiationManager.proxy.incrementRad(worldObj, xCoord, yCoord, zCoord, rad);
|
ChunkRadiationManager.proxy.incrementRad(worldObj, xCoord, yCoord, zCoord, rad);
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(150);
|
||||||
data.setInteger("heat", heat);
|
|
||||||
data.setByte("water", water);
|
|
||||||
data.setDouble("level", level);
|
|
||||||
data.setDouble("targetLevel", targetLevel);
|
|
||||||
data.setIntArray("slotFlux", slotFlux);
|
|
||||||
data.setInteger("totalFlux", totalFlux);
|
|
||||||
this.networkPack(data, 150);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void networkUnpack(NBTTagCompound data) {
|
@Override
|
||||||
super.networkUnpack(data);
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
this.heat = data.getInteger("heat");
|
buf.writeInt(this.heat);
|
||||||
this.water = data.getByte("water");
|
buf.writeByte(this.water);
|
||||||
this.level = data.getDouble("level");
|
buf.writeDouble(this.level);
|
||||||
this.targetLevel = data.getDouble("targetLevel");
|
buf.writeDouble(this.targetLevel);
|
||||||
this.slotFlux = data.getIntArray("slotFlux");
|
BufferUtil.writeIntArray(buf, this.slotFlux);
|
||||||
this.totalFlux = data.getInteger("totalFlux");
|
buf.writeInt(this.totalFlux);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.heat = buf.readInt();
|
||||||
|
this.water = buf.readByte();
|
||||||
|
this.level = buf.readDouble();
|
||||||
|
this.targetLevel = buf.readDouble();
|
||||||
|
this.slotFlux = BufferUtil.readIntArray(buf);
|
||||||
|
this.totalFlux = buf.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte getWater() {
|
public byte getWater() {
|
||||||
|
|||||||
@ -33,6 +33,7 @@ import api.hbm.tile.IInfoProviderEC;
|
|||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import li.cil.oc.api.machine.Arguments;
|
import li.cil.oc.api.machine.Arguments;
|
||||||
import li.cil.oc.api.machine.Callback;
|
import li.cil.oc.api.machine.Callback;
|
||||||
import li.cil.oc.api.machine.Context;
|
import li.cil.oc.api.machine.Context;
|
||||||
@ -128,17 +129,6 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IC
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void networkUnpack(NBTTagCompound data) {
|
|
||||||
super.networkUnpack(data);
|
|
||||||
|
|
||||||
this.heat = data.getInteger("heat");
|
|
||||||
this.pressure = data.getInteger("pressure");
|
|
||||||
this.isOn = data.getBoolean("isOn");
|
|
||||||
steam.readFromNBT(data, "t0");
|
|
||||||
carbonDioxide.readFromNBT(data, "t1");
|
|
||||||
water.readFromNBT(data, "t2");
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getGaugeScaled(int i, int type) {
|
public int getGaugeScaled(int i, int type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 0: return (steam.getFill() * i) / steam.getMaxFill();
|
case 0: return (steam.getFill() * i) / steam.getMaxFill();
|
||||||
@ -227,18 +217,33 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IC
|
|||||||
}
|
}
|
||||||
|
|
||||||
checkIfMeltdown();
|
checkIfMeltdown();
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(150);
|
||||||
data.setInteger("heat", heat);
|
|
||||||
data.setInteger("pressure", pressure);
|
|
||||||
data.setBoolean("isOn", isOn);
|
|
||||||
steam.writeToNBT(data, "t0");
|
|
||||||
carbonDioxide.writeToNBT(data, "t1");
|
|
||||||
water.writeToNBT(data, "t2");
|
|
||||||
this.networkPack(data, 150);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
|
buf.writeInt(this.heat);
|
||||||
|
buf.writeInt(this.pressure);
|
||||||
|
buf.writeBoolean(this.isOn);
|
||||||
|
steam.serialize(buf);
|
||||||
|
carbonDioxide.serialize(buf);
|
||||||
|
water.serialize(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.heat = buf.readInt();
|
||||||
|
this.pressure = buf.readInt();
|
||||||
|
this.isOn = buf.readBoolean();
|
||||||
|
steam.deserialize(buf);
|
||||||
|
carbonDioxide.deserialize(buf);
|
||||||
|
water.deserialize(buf);
|
||||||
|
}
|
||||||
|
|
||||||
private void generateSteam() {
|
private void generateSteam() {
|
||||||
|
|
||||||
// function of SHS produced per tick
|
// function of SHS produced per tick
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import api.hbm.fluid.IFluidStandardReceiver;
|
|||||||
import api.hbm.item.IDesignatorItem;
|
import api.hbm.item.IDesignatorItem;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@ -94,15 +95,8 @@ public class TileEntitySoyuzLauncher extends TileEntityMachineBase implements IS
|
|||||||
} else {
|
} else {
|
||||||
liftOff();
|
liftOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
networkPackNT(250);
|
||||||
data.setLong("power", power);
|
|
||||||
data.setByte("mode", mode);
|
|
||||||
data.setBoolean("starting", starting);
|
|
||||||
data.setByte("type", this.getType());
|
|
||||||
tanks[0].writeToNBT(data, "t0");
|
|
||||||
tanks[1].writeToNBT(data, "t1");
|
|
||||||
networkPack(data, 250);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(worldObj.isRemote) {
|
if(worldObj.isRemote) {
|
||||||
@ -189,18 +183,29 @@ public class TileEntitySoyuzLauncher extends TileEntityMachineBase implements IS
|
|||||||
audio = null;
|
audio = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void networkUnpack(NBTTagCompound data) {
|
@Override
|
||||||
super.networkUnpack(data);
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
power = data.getLong("power");
|
buf.writeLong(power);
|
||||||
mode = data.getByte("mode");
|
buf.writeByte(mode);
|
||||||
starting = data.getBoolean("starting");
|
buf.writeBoolean(starting);
|
||||||
rocketType = data.getByte("type");
|
buf.writeByte(this.getType());
|
||||||
tanks[0].readFromNBT(data, "t0");
|
tanks[0].serialize(buf);
|
||||||
tanks[1].readFromNBT(data, "t1");
|
tanks[1].serialize(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
power = buf.readLong();
|
||||||
|
mode = buf.readByte();
|
||||||
|
starting = buf.readBoolean();
|
||||||
|
rocketType = buf.readByte();
|
||||||
|
tanks[0].deserialize(buf);
|
||||||
|
tanks[1].deserialize(buf);
|
||||||
|
}
|
||||||
|
|
||||||
public void startCountdown() {
|
public void startCountdown() {
|
||||||
|
|
||||||
if(canLaunch())
|
if(canLaunch())
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import com.hbm.util.ArmorUtil;
|
|||||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.monster.EntityCreeper;
|
import net.minecraft.entity.monster.EntityCreeper;
|
||||||
@ -69,17 +70,7 @@ public class TileEntityTesla extends TileEntityMachineBase implements IEnergyRec
|
|||||||
this.targets = zap(worldObj, dx, dy, dz, range, null);
|
this.targets = zap(worldObj, dx, dy, dz, range, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(100);
|
||||||
data.setShort("length", (short)targets.size());
|
|
||||||
int i = 0;
|
|
||||||
for(double[] d : this.targets) {
|
|
||||||
data.setDouble("x" + i, d[0]);
|
|
||||||
data.setDouble("y" + i, d[1]);
|
|
||||||
data.setDouble("z" + i, d[2]);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.networkPack(data, 100);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,19 +136,30 @@ public class TileEntityTesla extends TileEntityMachineBase implements IEnergyRec
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void networkUnpack(NBTTagCompound data) {
|
@Override
|
||||||
super.networkUnpack(data);
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
int s = data.getShort("length");
|
buf.writeShort((short)targets.size());
|
||||||
|
for(double[] d : this.targets) {
|
||||||
|
buf.writeDouble(d[0]);
|
||||||
|
buf.writeDouble(d[1]);
|
||||||
|
buf.writeDouble(d[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
int s = buf.readShort();
|
||||||
|
|
||||||
this.targets.clear();
|
this.targets.clear();
|
||||||
|
|
||||||
for(int i = 0; i < s; i++)
|
for(int i = 0; i < s; i++)
|
||||||
this.targets.add(new double[] {
|
this.targets.add(new double[] {
|
||||||
data.getDouble("x" + i),
|
buf.readDouble(), // X
|
||||||
data.getDouble("y" + i),
|
buf.readDouble(), // Y
|
||||||
data.getDouble("z" + i)
|
buf.readDouble() // Z
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,7 @@ import api.hbm.fluid.IFluidStandardTransceiver;
|
|||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@ -120,7 +121,7 @@ public class TileEntityWatz extends TileEntityMachineBase implements IFluidStand
|
|||||||
/* send sync packets (order doesn't matter) */
|
/* send sync packets (order doesn't matter) */
|
||||||
for(TileEntityWatz segment : segments) {
|
for(TileEntityWatz segment : segments) {
|
||||||
segment.isOn = turnedOn;
|
segment.isOn = turnedOn;
|
||||||
segment.sendPacket(sharedTanks);
|
this.networkPackNT(25);
|
||||||
segment.heat *= 0.99; //cool 1% per tick
|
segment.heat *= 0.99; //cool 1% per tick
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,30 +278,28 @@ public class TileEntityWatz extends TileEntityMachineBase implements IFluidStand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(FluidTank[] tanks) {
|
@Override
|
||||||
|
public void serialize(ByteBuf buf) {
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
super.serialize(buf);
|
||||||
data.setInteger("heat", this.heat);
|
buf.writeInt(this.heat);
|
||||||
data.setBoolean("isOn", isOn);
|
buf.writeBoolean(isOn);
|
||||||
data.setBoolean("lock", isLocked);
|
buf.writeBoolean(isLocked);
|
||||||
data.setDouble("flux", this.fluxLastReaction + this.fluxLastBase);
|
buf.writeDouble(this.fluxLastReaction + this.fluxLastBase);
|
||||||
for(int i = 0; i < tanks.length; i++) {
|
for (FluidTank tank : tanks) {
|
||||||
tanks[i].writeToNBT(data, "t" + i);
|
tank.serialize(buf);
|
||||||
}
|
}
|
||||||
this.networkPack(data, 25);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void deserialize(ByteBuf buf) {
|
||||||
super.networkUnpack(nbt);
|
super.deserialize(buf);
|
||||||
|
this.heat = buf.readInt();
|
||||||
this.heat = nbt.getInteger("heat");
|
this.isOn = buf.readBoolean();
|
||||||
this.isOn = nbt.getBoolean("isOn");
|
this.isLocked = buf.readBoolean();
|
||||||
this.isLocked = nbt.getBoolean("lock");
|
this.fluxDisplay = buf.readDouble();
|
||||||
this.fluxDisplay = nbt.getDouble("flux");
|
for (FluidTank tank : tanks) {
|
||||||
for(int i = 0; i < tanks.length; i++) {
|
tank.deserialize(buf);
|
||||||
tanks[i].readFromNBT(nbt, "t" + i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2;
|
|||||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@ -73,13 +74,24 @@ public class TileEntityMachineCatalyticReformer extends TileEntityMachineBase im
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(150);
|
||||||
data.setLong("power", this.power);
|
|
||||||
for(int i = 0; i < 4; i++) tanks[i].writeToNBT(data, "" + i);
|
|
||||||
this.networkPack(data, 150);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
|
buf.writeLong(this.power);
|
||||||
|
for(int i = 0; i < 4; i++) tanks[i].serialize(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.power = buf.readLong();
|
||||||
|
for(int i = 0; i < 4; i++) tanks[i].deserialize(buf);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void networkUnpack(NBTTagCompound nbt) {
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import com.hbm.lib.Library;
|
|||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
|
import com.hbm.util.BufferUtil;
|
||||||
import com.hbm.util.Tuple.Triplet;
|
import com.hbm.util.Tuple.Triplet;
|
||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
@ -19,6 +20,7 @@ import api.hbm.fluid.IFluidStandardTransceiver;
|
|||||||
import api.hbm.tile.IHeatSource;
|
import api.hbm.tile.IHeatSource;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@ -107,14 +109,8 @@ public class TileEntityMachineCoker extends TileEntityMachineBase implements IFl
|
|||||||
for(DirPos pos : getConPos()) {
|
for(DirPos pos : getConPos()) {
|
||||||
if(this.tanks[1].getFill() > 0) this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
if(this.tanks[1].getFill() > 0) this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(25);
|
||||||
data.setBoolean("wasOn", this.wasOn);
|
|
||||||
data.setInteger("heat", this.heat);
|
|
||||||
data.setInteger("progress", this.progress);
|
|
||||||
tanks[0].writeToNBT(data, "t0");
|
|
||||||
tanks[1].writeToNBT(data, "t1");
|
|
||||||
this.networkPack(data, 25);
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if(this.wasOn) {
|
if(this.wasOn) {
|
||||||
@ -135,6 +131,8 @@ public class TileEntityMachineCoker extends TileEntityMachineBase implements IFl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public DirPos[] getConPos() {
|
public DirPos[] getConPos() {
|
||||||
|
|
||||||
@ -172,16 +170,25 @@ public class TileEntityMachineCoker extends TileEntityMachineBase implements IFl
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void serialize(ByteBuf buf) {
|
||||||
super.networkUnpack(nbt);
|
super.serialize(buf);
|
||||||
|
buf.writeBoolean(this.wasOn);
|
||||||
this.wasOn = nbt.getBoolean("wasOn");
|
buf.writeInt(this.heat);
|
||||||
this.heat = nbt.getInteger("heat");
|
buf.writeInt(this.progress);
|
||||||
this.progress = nbt.getInteger("progress");
|
tanks[0].serialize(buf);
|
||||||
tanks[0].readFromNBT(nbt, "t0");
|
tanks[1].serialize(buf);
|
||||||
tanks[1].readFromNBT(nbt, "t1");
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.wasOn = buf.readBoolean();
|
||||||
|
this.heat = buf.readInt();
|
||||||
|
this.progress = buf.readInt();
|
||||||
|
tanks[0].deserialize(buf);
|
||||||
|
tanks[1].deserialize(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void tryPullHeat() {
|
protected void tryPullHeat() {
|
||||||
|
|||||||
@ -30,6 +30,7 @@ import api.hbm.fluid.IFluidStandardReceiver;
|
|||||||
import api.hbm.tile.IInfoProviderEC;
|
import api.hbm.tile.IInfoProviderEC;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@ -178,13 +179,8 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
power = Library.chargeItemsFromTE(slots, 0, power, maxPower);
|
power = Library.chargeItemsFromTE(slots, 0, power, maxPower);
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(50);
|
||||||
data.setLong("power", this.power);
|
|
||||||
data.setBoolean("isOn", isOn);
|
|
||||||
data.setBoolean("doesBurn", doesBurn);
|
|
||||||
tank.writeToNBT(data, "t");
|
|
||||||
this.networkPack(data, 50);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -240,15 +236,23 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements
|
|||||||
new DirPos(xCoord, yCoord, zCoord - 2, Library.NEG_Z)
|
new DirPos(xCoord, yCoord, zCoord - 2, Library.NEG_Z)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void serialize(ByteBuf buf) {
|
||||||
super.networkUnpack(nbt);
|
super.serialize(buf);
|
||||||
|
buf.writeLong(this.power);
|
||||||
this.power = nbt.getLong("power");
|
buf.writeBoolean(this.isOn);
|
||||||
this.isOn = nbt.getBoolean("isOn");
|
buf.writeBoolean(this.doesBurn);
|
||||||
this.doesBurn = nbt.getBoolean("doesBurn");
|
tank.serialize(buf);
|
||||||
tank.readFromNBT(nbt, "t");
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.power = buf.readLong();
|
||||||
|
this.isOn = buf.readBoolean();
|
||||||
|
this.doesBurn = buf.readBoolean();
|
||||||
|
tank.serialize(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import api.hbm.fluid.IFluidStandardSender;
|
|||||||
import api.hbm.tile.IInfoProviderEC;
|
import api.hbm.tile.IInfoProviderEC;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@ -76,14 +77,8 @@ public class TileEntityMachineLiquefactor extends TileEntityMachineBase implemen
|
|||||||
this.progress = 0;
|
this.progress = 0;
|
||||||
|
|
||||||
this.sendFluid();
|
this.sendFluid();
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(50);
|
||||||
data.setLong("power", this.power);
|
|
||||||
data.setInteger("progress", this.progress);
|
|
||||||
data.setInteger("usage", this.usage);
|
|
||||||
data.setInteger("processTime", this.processTime);
|
|
||||||
tank.writeToNBT(data, "t");
|
|
||||||
this.networkPack(data, 50);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,14 +149,23 @@ public class TileEntityMachineLiquefactor extends TileEntityMachineBase implemen
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void serialize(ByteBuf buf) {
|
||||||
super.networkUnpack(nbt);
|
super.serialize(buf);
|
||||||
|
buf.writeLong(this.power);
|
||||||
this.power = nbt.getLong("power");
|
buf.writeInt(this.progress);
|
||||||
this.progress = nbt.getInteger("progress");
|
buf.writeInt(this.usage);
|
||||||
this.usage = nbt.getInteger("usage");
|
buf.writeInt(this.processTime);
|
||||||
this.processTime = nbt.getInteger("processTime");
|
tank.serialize(buf);
|
||||||
tank.readFromNBT(nbt, "t");
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.power = buf.readLong();
|
||||||
|
this.progress = buf.readInt();
|
||||||
|
this.usage = buf.readInt();
|
||||||
|
this.processTime = buf.readInt();
|
||||||
|
tank.deserialize(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -37,6 +37,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2;
|
|||||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@ -193,14 +194,9 @@ public class TileEntityMachineRefinery extends TileEntityMachineBase implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(150);
|
||||||
data.setLong("power", this.power);
|
|
||||||
for(int i = 0; i < 5; i++) tanks[i].writeToNBT(data, "" + i);
|
|
||||||
data.setBoolean("exploded", hasExploded);
|
|
||||||
data.setBoolean("onFire", onFire);
|
|
||||||
data.setBoolean("isOn", this.isOn);
|
|
||||||
this.networkPack(data, 150);
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if(this.isOn) audioTime = 20;
|
if(this.isOn) audioTime = 20;
|
||||||
@ -253,16 +249,25 @@ public class TileEntityMachineRefinery extends TileEntityMachineBase implements
|
|||||||
audio = null;
|
audio = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void serialize(ByteBuf buf) {
|
||||||
super.networkUnpack(nbt);
|
super.serialize(buf);
|
||||||
|
buf.writeLong(this.power);
|
||||||
this.power = nbt.getLong("power");
|
for(int i = 0; i < 5; i++) tanks[i].serialize(buf);
|
||||||
for(int i = 0; i < 5; i++) tanks[i].readFromNBT(nbt, "" + i);
|
buf.writeBoolean(this.hasExploded);
|
||||||
this.hasExploded = nbt.getBoolean("exploded");
|
buf.writeBoolean(this.onFire);
|
||||||
this.onFire = nbt.getBoolean("onFire");
|
buf.writeBoolean(this.isOn);
|
||||||
this.isOn = nbt.getBoolean("isOn");
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.power = buf.readLong();
|
||||||
|
for(int i = 0; i < 5; i++) tanks[i].deserialize(buf);
|
||||||
|
this.hasExploded = buf.readBoolean();
|
||||||
|
this.onFire = buf.readBoolean();
|
||||||
|
this.isOn = buf.readBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refine() {
|
private void refine() {
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import api.hbm.fluid.IFluidStandardReceiver;
|
|||||||
import api.hbm.tile.IInfoProviderEC;
|
import api.hbm.tile.IInfoProviderEC;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@ -75,14 +76,8 @@ public class TileEntityMachineSolidifier extends TileEntityMachineBase implement
|
|||||||
this.process();
|
this.process();
|
||||||
else
|
else
|
||||||
this.progress = 0;
|
this.progress = 0;
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(50);
|
||||||
data.setLong("power", this.power);
|
|
||||||
data.setInteger("progress", this.progress);
|
|
||||||
data.setInteger("usage", this.usage);
|
|
||||||
data.setInteger("processTime", this.processTime);
|
|
||||||
tank.writeToNBT(data, "t");
|
|
||||||
this.networkPack(data, 50);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,14 +166,23 @@ public class TileEntityMachineSolidifier extends TileEntityMachineBase implement
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void serialize(ByteBuf buf) {
|
||||||
super.networkUnpack(nbt);
|
super.serialize(buf);
|
||||||
|
buf.writeLong(this.power);
|
||||||
this.power = nbt.getLong("power");
|
buf.writeInt(this.progress);
|
||||||
this.progress = nbt.getInteger("progress");
|
buf.writeInt(this.usage);
|
||||||
this.usage = nbt.getInteger("usage");
|
buf.writeInt(this.processTime);
|
||||||
this.processTime = nbt.getInteger("processTime");
|
tank.serialize(buf);
|
||||||
tank.readFromNBT(nbt, "t");
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.power = buf.readLong();
|
||||||
|
this.progress = buf.readInt();
|
||||||
|
this.usage = buf.readInt();
|
||||||
|
this.processTime = buf.readInt();
|
||||||
|
tank.deserialize(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2;
|
|||||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@ -81,12 +82,9 @@ public class TileEntityMachineVacuumDistill extends TileEntityMachineBase implem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(150);
|
||||||
data.setLong("power", this.power);
|
|
||||||
data.setBoolean("isOn", this.isOn);
|
|
||||||
for(int i = 0; i < 5; i++) tanks[i].writeToNBT(data, "" + i);
|
|
||||||
this.networkPack(data, 150);
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if(this.isOn) audioTime = 20;
|
if(this.isOn) audioTime = 20;
|
||||||
@ -139,14 +137,21 @@ public class TileEntityMachineVacuumDistill extends TileEntityMachineBase implem
|
|||||||
audio = null;
|
audio = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void serialize(ByteBuf buf) {
|
||||||
super.networkUnpack(nbt);
|
super.serialize(buf);
|
||||||
|
buf.writeLong(this.power);
|
||||||
this.power = nbt.getLong("power");
|
buf.writeBoolean(this.isOn);
|
||||||
this.isOn = nbt.getBoolean("isOn");
|
for(int i = 0; i < 5; i++) tanks[i].serialize(buf);
|
||||||
for(int i = 0; i < 5; i++) tanks[i].readFromNBT(nbt, "" + i);
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.power = buf.readLong();
|
||||||
|
this.isOn = buf.readBoolean();
|
||||||
|
for(int i = 0; i < 5; i++) tanks[i].deserialize(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refine() {
|
private void refine() {
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import com.hbm.inventory.gui.GUIRBMKConsole;
|
|||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKControlManual.RBMKColor;
|
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKControlManual.RBMKColor;
|
||||||
|
import com.hbm.util.BufferUtil;
|
||||||
import com.hbm.util.Compat;
|
import com.hbm.util.Compat;
|
||||||
import com.hbm.util.EnumUtil;
|
import com.hbm.util.EnumUtil;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
@ -21,6 +22,7 @@ import com.hbm.util.I18nUtil;
|
|||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@ -77,8 +79,8 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon
|
|||||||
this.worldObj.theProfiler.endSection();
|
this.worldObj.theProfiler.endSection();
|
||||||
prepareScreenInfo();
|
prepareScreenInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
prepareNetworkPack();
|
this.networkPackNT(50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,66 +187,65 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon
|
|||||||
screen.display = text;
|
screen.display = text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prepareNetworkPack() {
|
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
|
||||||
|
|
||||||
|
|
||||||
if(this.worldObj.getTotalWorldTime() % 10 == 0) {
|
|
||||||
|
|
||||||
data.setBoolean("full", true);
|
|
||||||
|
|
||||||
for(int i = 0; i < columns.length; i++) {
|
|
||||||
|
|
||||||
if(this.columns[i] != null) {
|
|
||||||
data.setTag("column_" + i, this.columns[i].data);
|
|
||||||
data.setShort("type_" + i, (short)this.columns[i].type.ordinal());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
data.setIntArray("flux", this.fluxBuffer);
|
|
||||||
|
|
||||||
for(int i = 0; i < this.screens.length; i++) {
|
|
||||||
RBMKScreen screen = screens[i];
|
|
||||||
if(screen.display != null) {
|
|
||||||
data.setString("t" + i, screen.display);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i = 0; i < this.screens.length; i++) {
|
|
||||||
RBMKScreen screen = screens[i];
|
|
||||||
data.setByte("s" + i, (byte) screen.type.ordinal());
|
|
||||||
}
|
|
||||||
|
|
||||||
this.networkPack(data, 50);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound data) {
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
if(data.getBoolean("full")) {
|
|
||||||
this.columns = new RBMKColumn[15 * 15];
|
if (this.worldObj.getTotalWorldTime() % 10 == 0) {
|
||||||
|
buf.writeBoolean(true);
|
||||||
for(int i = 0; i < columns.length; i++) {
|
|
||||||
|
for (RBMKColumn column : this.columns) {
|
||||||
if(data.hasKey("type_" + i)) {
|
if (column == null || column.type == null)
|
||||||
this.columns[i] = new RBMKColumn(ColumnType.values()[data.getShort("type_" + i)], (NBTTagCompound)data.getTag("column_" + i));
|
buf.writeByte(-1);
|
||||||
|
else {
|
||||||
|
buf.writeByte((byte) column.type.ordinal());
|
||||||
|
BufferUtil.writeNBT(buf, column.data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fluxBuffer = data.getIntArray("flux");
|
BufferUtil.writeIntArray(buf, fluxBuffer);
|
||||||
|
|
||||||
for(int i = 0; i < this.screens.length; i++) {
|
for (RBMKScreen screen : this.screens) {
|
||||||
RBMKScreen screen = screens[i];
|
BufferUtil.writeString(buf, screen.display);
|
||||||
screen.display = data.getString("t" + i);
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
buf.writeBoolean(false);
|
||||||
|
|
||||||
|
for (RBMKScreen screen : screens) {
|
||||||
|
buf.writeByte((byte) screen.type.ordinal());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
for(int i = 0; i < this.screens.length; i++) {
|
|
||||||
RBMKScreen screen = screens[i];
|
@Override
|
||||||
screen.type = ScreenType.values()[data.getByte("s" + i)];
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
|
||||||
|
if (buf.readBoolean()) { // check if it should be a full packet
|
||||||
|
|
||||||
|
for(int i = 0; i < this.columns.length; i++) {
|
||||||
|
byte ordinal = buf.readByte();
|
||||||
|
if (ordinal == -1)
|
||||||
|
this.columns[i] = null;
|
||||||
|
else
|
||||||
|
this.columns[i] = new RBMKColumn(ColumnType.values()[ordinal], BufferUtil.readNBT(buf));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.fluxBuffer = BufferUtil.readIntArray(buf);
|
||||||
|
|
||||||
|
for (RBMKScreen screen : this.screens) {
|
||||||
|
screen.display = BufferUtil.readString(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
for (RBMKScreen screen : this.screens) {
|
||||||
|
screen.type = ScreenType.values()[buf.readByte()];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import com.hbm.inventory.gui.GUICraneBoxer;
|
|||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@ -143,17 +144,21 @@ public class TileEntityCraneBoxer extends TileEntityCraneBase implements IGUIPro
|
|||||||
worldObj.spawnEntityInWorld(moving);
|
worldObj.spawnEntityInWorld(moving);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(15);
|
||||||
data.setByte("mode", mode);
|
|
||||||
this.networkPack(data, 15);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
@Override
|
||||||
super.networkUnpack(nbt);
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
this.mode = nbt.getByte("mode");
|
buf.writeByte(this.mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.mode = buf.readByte();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import com.hbm.util.InventoryUtil;
|
|||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@ -130,21 +131,23 @@ public class TileEntityCraneGrabber extends TileEntityCraneBase implements IGUIP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.networkPackNT(15);
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
|
||||||
data.setBoolean("isWhitelist", isWhitelist);
|
|
||||||
this.matcher.writeToNBT(data);
|
|
||||||
this.networkPack(data, 15);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
@Override
|
||||||
super.networkUnpack(nbt);
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
this.isWhitelist = nbt.getBoolean("isWhitelist");
|
buf.writeBoolean(this.isWhitelist);
|
||||||
this.matcher.modes = new String[this.matcher.modes.length];
|
this.matcher.serialize(buf);
|
||||||
this.matcher.readFromNBT(nbt);
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.isWhitelist = buf.readBoolean();
|
||||||
|
this.matcher.deserialize(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean matchesFilter(ItemStack stack) {
|
public boolean matchesFilter(ItemStack stack) {
|
||||||
|
|||||||
@ -7,8 +7,10 @@ import com.hbm.tileentity.IControlReceiverFilter;
|
|||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
|
|
||||||
|
import com.hbm.util.BufferUtil;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@ -44,26 +46,28 @@ public class TileEntityCraneRouter extends TileEntityMachineBase implements IGUI
|
|||||||
|
|
||||||
if(!worldObj.isRemote) {
|
if(!worldObj.isRemote) {
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(15);
|
||||||
for(int i = 0; i < patterns.length; i++) {
|
|
||||||
NBTTagCompound compound = new NBTTagCompound();
|
|
||||||
patterns[i].writeToNBT(compound);
|
|
||||||
data.setTag("pattern" + i, compound);
|
|
||||||
}
|
|
||||||
data.setIntArray("modes", this.modes);
|
|
||||||
this.networkPack(data, 15);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound data) {
|
public void serialize(ByteBuf buf) {
|
||||||
super.networkUnpack(data);
|
super.serialize(buf);
|
||||||
|
for (ModulePatternMatcher pattern : patterns) {
|
||||||
for(int i = 0; i < patterns.length; i++) {
|
pattern.serialize(buf);
|
||||||
NBTTagCompound compound = data.getCompoundTag("pattern" + i);
|
|
||||||
patterns[i].readFromNBT(compound);
|
|
||||||
}
|
}
|
||||||
this.modes = data.getIntArray("modes");
|
|
||||||
|
BufferUtil.writeIntArray(buf, this.modes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
for (ModulePatternMatcher pattern : patterns) {
|
||||||
|
pattern.deserialize(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.modes = BufferUtil.readIntArray(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -3,8 +3,10 @@ package com.hbm.tileentity.network;
|
|||||||
import com.hbm.module.ModulePatternMatcher;
|
import com.hbm.module.ModulePatternMatcher;
|
||||||
import com.hbm.tileentity.IControlReceiverFilter;
|
import com.hbm.tileentity.IControlReceiverFilter;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
|
import com.hbm.util.BufferUtil;
|
||||||
import com.hbm.util.Compat;
|
import com.hbm.util.Compat;
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -68,24 +70,27 @@ public class TileEntityRadioTorchCounter extends TileEntityMachineBase implement
|
|||||||
this.lastCount[i] = count;
|
this.lastCount[i] = count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(15);
|
||||||
data.setBoolean("polling", polling);
|
|
||||||
data.setIntArray("last", lastCount);
|
|
||||||
this.matcher.writeToNBT(data);
|
|
||||||
for(int i = 0; i < 3; i++) if(channel[i] != null) data.setString("c" + i, channel[i]);
|
|
||||||
this.networkPack(data, 15);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
@Override
|
||||||
super.networkUnpack(nbt);
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
this.polling = nbt.getBoolean("polling");
|
buf.writeBoolean(this.polling);
|
||||||
this.lastCount = nbt.getIntArray("last");
|
BufferUtil.writeIntArray(buf, this.lastCount);
|
||||||
this.matcher.modes = new String[this.matcher.modes.length];
|
this.matcher.serialize(buf);
|
||||||
this.matcher.readFromNBT(nbt);
|
for(int i = 0; i < 3; i++) BufferUtil.writeString(buf, this.channel[i]);
|
||||||
for(int i = 0; i < 3; i++) this.channel[i] = nbt.getString("c" + i);
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.polling = buf.readBoolean();
|
||||||
|
this.lastCount = BufferUtil.readIntArray(buf);
|
||||||
|
this.matcher.deserialize(buf);
|
||||||
|
for(int i = 0; i < 3; i++) this.channel[i] = BufferUtil.readString(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import cpw.mods.fml.common.Optional;
|
|||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import li.cil.oc.api.machine.Arguments;
|
import li.cil.oc.api.machine.Arguments;
|
||||||
import li.cil.oc.api.machine.Callback;
|
import li.cil.oc.api.machine.Callback;
|
||||||
import li.cil.oc.api.machine.Context;
|
import li.cil.oc.api.machine.Context;
|
||||||
@ -317,9 +318,8 @@ public class TileEntityTurretArty extends TileEntityTurretBaseArtillery implemen
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.power = Library.chargeTEFromItems(slots, 10, this.power, this.getMaxPower());
|
this.power = Library.chargeTEFromItems(slots, 10, this.power, this.getMaxPower());
|
||||||
|
|
||||||
NBTTagCompound data = this.writePacket();
|
this.networkPackNT(250);
|
||||||
this.networkPack(data, 250);
|
|
||||||
|
|
||||||
this.didJustShoot = false;
|
this.didJustShoot = false;
|
||||||
|
|
||||||
@ -409,20 +409,17 @@ public class TileEntityTurretArty extends TileEntityTurretBaseArtillery implemen
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected NBTTagCompound writePacket() {
|
public void serialize(ByteBuf buf) {
|
||||||
NBTTagCompound data = super.writePacket();
|
super.serialize(buf);
|
||||||
data.setShort("mode", mode);
|
buf.writeShort(this.mode);
|
||||||
if(didJustShoot)
|
buf.writeBoolean(this.didJustShoot);
|
||||||
data.setBoolean("didJustShoot", didJustShoot);
|
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void deserialize(ByteBuf buf) {
|
||||||
super.networkUnpack(nbt);
|
super.deserialize(buf);
|
||||||
this.mode = nbt.getShort("mode");
|
this.mode = buf.readShort();
|
||||||
if(nbt.getBoolean("didJustShoot"))
|
this.retracting = buf.readBoolean();
|
||||||
this.retracting = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -34,6 +34,7 @@ import cpw.mods.fml.common.Optional;
|
|||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import li.cil.oc.api.machine.Arguments;
|
import li.cil.oc.api.machine.Arguments;
|
||||||
import li.cil.oc.api.machine.Callback;
|
import li.cil.oc.api.machine.Callback;
|
||||||
import li.cil.oc.api.machine.Context;
|
import li.cil.oc.api.machine.Context;
|
||||||
@ -228,9 +229,8 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.power = Library.chargeTEFromItems(slots, 10, this.power, this.getMaxPower());
|
this.power = Library.chargeTEFromItems(slots, 10, this.power, this.getMaxPower());
|
||||||
|
|
||||||
NBTTagCompound data = this.writePacket();
|
this.networkPackNT(250);
|
||||||
this.networkPack(data, 250);
|
|
||||||
|
|
||||||
if(usesCasings() && this.casingDelay() > 0) {
|
if(usesCasings() && this.casingDelay() > 0) {
|
||||||
if(casingDelay > 0) {
|
if(casingDelay > 0) {
|
||||||
@ -252,26 +252,45 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected NBTTagCompound writePacket() {
|
@Override
|
||||||
|
public void serialize(ByteBuf buf) {
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
super.serialize(buf);
|
||||||
|
buf.writeBoolean(this.tPos != null);
|
||||||
if(this.tPos != null) {
|
if(this.tPos != null) {
|
||||||
data.setDouble("tX", this.tPos.xCoord);
|
buf.writeDouble(this.tPos.xCoord);
|
||||||
data.setDouble("tY", this.tPos.yCoord);
|
buf.writeDouble(this.tPos.yCoord);
|
||||||
data.setDouble("tZ", this.tPos.zCoord);
|
buf.writeDouble(this.tPos.zCoord);
|
||||||
}
|
}
|
||||||
data.setDouble("pitch", this.rotationPitch);
|
buf.writeDouble(this.rotationPitch);
|
||||||
data.setDouble("yaw", this.rotationYaw);
|
buf.writeDouble(this.rotationYaw);
|
||||||
data.setLong("power", this.power);
|
buf.writeLong(this.power);
|
||||||
data.setBoolean("isOn", this.isOn);
|
buf.writeBoolean(this.isOn);
|
||||||
data.setBoolean("targetPlayers", this.targetPlayers);
|
buf.writeBoolean(this.targetPlayers);
|
||||||
data.setBoolean("targetAnimals", this.targetAnimals);
|
buf.writeBoolean(this.targetAnimals);
|
||||||
data.setBoolean("targetMobs", this.targetMobs);
|
buf.writeBoolean(this.targetMobs);
|
||||||
data.setBoolean("targetMachines", this.targetMachines);
|
buf.writeBoolean(this.targetMachines);
|
||||||
data.setInteger("stattrak", this.stattrak);
|
buf.writeInt(this.stattrak);
|
||||||
|
}
|
||||||
return data;
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
boolean hasTPos = buf.readBoolean();
|
||||||
|
if(hasTPos) {
|
||||||
|
this.tPos.xCoord = buf.readDouble();
|
||||||
|
this.tPos.yCoord = buf.readDouble();
|
||||||
|
this.tPos.zCoord = buf.readDouble();
|
||||||
|
}
|
||||||
|
this.rotationPitch = buf.readDouble();
|
||||||
|
this.rotationYaw = buf.readDouble();
|
||||||
|
this.power = buf.readLong();
|
||||||
|
this.isOn = buf.readBoolean();
|
||||||
|
this.targetPlayers = buf.readBoolean();
|
||||||
|
this.targetAnimals = buf.readBoolean();
|
||||||
|
this.targetMobs = buf.readBoolean();
|
||||||
|
this.targetMachines = buf.readBoolean();
|
||||||
|
this.stattrak = buf.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateConnections() {
|
protected void updateConnections() {
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import api.hbm.fluid.IFluidStandardReceiver;
|
|||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -153,18 +154,17 @@ public class TileEntityTurretFritz extends TileEntityTurretBaseNT implements IFl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected NBTTagCompound writePacket() {
|
public void serialize(ByteBuf buf) {
|
||||||
NBTTagCompound data = super.writePacket();
|
super.serialize(buf);
|
||||||
tank.writeToNBT(data, "t");
|
tank.serialize(buf);
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void deserialize(ByteBuf buf) {
|
||||||
super.networkUnpack(nbt);
|
super.deserialize(buf);
|
||||||
tank.readFromNBT(nbt, "t");
|
tank.deserialize(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override //TODO: clean this shit up
|
@Override //TODO: clean this shit up
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import com.hbm.tileentity.IGUIProvider;
|
|||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import li.cil.oc.api.machine.Arguments;
|
import li.cil.oc.api.machine.Arguments;
|
||||||
import li.cil.oc.api.machine.Callback;
|
import li.cil.oc.api.machine.Callback;
|
||||||
import li.cil.oc.api.machine.Context;
|
import li.cil.oc.api.machine.Context;
|
||||||
@ -249,9 +250,8 @@ public class TileEntityTurretHIMARS extends TileEntityTurretBaseArtillery implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.power = Library.chargeTEFromItems(slots, 10, this.power, this.getMaxPower());
|
this.power = Library.chargeTEFromItems(slots, 10, this.power, this.getMaxPower());
|
||||||
|
|
||||||
NBTTagCompound data = this.writePacket();
|
this.networkPackNT(250);
|
||||||
this.networkPack(data, 250);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -267,22 +267,21 @@ public class TileEntityTurretHIMARS extends TileEntityTurretBaseArtillery implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected NBTTagCompound writePacket() {
|
public void serialize(ByteBuf buf) {
|
||||||
NBTTagCompound data = super.writePacket();
|
super.serialize(buf);
|
||||||
data.setShort("mode", this.mode);
|
buf.writeShort(this.mode);
|
||||||
data.setInteger("type", this.typeLoaded);
|
buf.writeShort(this.typeLoaded);
|
||||||
data.setInteger("ammo", this.ammo);
|
buf.writeInt(this.ammo);
|
||||||
data.setFloat("crane", crane);
|
buf.writeFloat(this.crane);
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void deserialize(ByteBuf buf) {
|
||||||
super.networkUnpack(nbt);
|
super.deserialize(buf);
|
||||||
this.mode = nbt.getShort("mode");
|
this.mode = buf.readShort();
|
||||||
this.typeLoaded = nbt.getShort("type");
|
this.typeLoaded = buf.readShort();
|
||||||
this.ammo = nbt.getInteger("ammo");
|
this.ammo = buf.readInt();
|
||||||
this.crane = nbt.getFloat("crane");
|
this.crane = buf.readFloat();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasAmmo() {
|
public boolean hasAmmo() {
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import com.hbm.util.I18nUtil;
|
|||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@ -261,20 +262,21 @@ public class TileEntityTurretMaxwell extends TileEntityTurretBaseNT implements I
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.power -= demand;
|
this.power -= demand;
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(250);
|
||||||
data.setBoolean("shot", true);
|
|
||||||
this.networkPack(data, 250);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
if(nbt.hasKey("shot"))
|
buf.writeBoolean(true);
|
||||||
beam = 5;
|
}
|
||||||
else
|
|
||||||
super.networkUnpack(nbt);
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.beam = buf.readBoolean() ? 5 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||||||
|
|
||||||
import com.hbm.items.ModItems;
|
import com.hbm.items.ModItems;
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
@ -104,20 +105,21 @@ public class TileEntityTurretRichard extends TileEntityTurretBaseNT {
|
|||||||
if(this.getFirstConfigLoaded() == null) {
|
if(this.getFirstConfigLoaded() == null) {
|
||||||
this.loaded = 0;
|
this.loaded = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(250);
|
||||||
data.setInteger("loaded", this.loaded);
|
|
||||||
this.networkPack(data, 250);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
if(nbt.hasKey("loaded"))
|
buf.writeInt(this.loaded);
|
||||||
this.loaded = nbt.getInteger("loaded");
|
}
|
||||||
else
|
|
||||||
super.networkUnpack(nbt);
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.loaded = buf.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import com.hbm.tileentity.IGUIProvider;
|
|||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@ -229,20 +230,19 @@ public class TileEntityTurretSentry extends TileEntityTurretBaseNT implements IG
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected NBTTagCompound writePacket() {
|
public void serialize(ByteBuf buf) {
|
||||||
NBTTagCompound data = super.writePacket();
|
super.serialize(buf);
|
||||||
if(didJustShootLeft) data.setBoolean("justShotLeft", didJustShootLeft);
|
if(didJustShootLeft) buf.writeBoolean(didJustShootLeft);
|
||||||
if(didJustShootRight) data.setBoolean("justShotRight", didJustShootRight);
|
if(didJustShootRight) buf.writeBoolean(didJustShootRight);
|
||||||
didJustShootLeft = false;
|
didJustShootLeft = false;
|
||||||
didJustShootRight = false;
|
didJustShootRight = false;
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void deserialize(ByteBuf buf) {
|
||||||
super.networkUnpack(nbt);
|
super.deserialize(buf);
|
||||||
if(nbt.getBoolean("justShotLeft")) this.retractingLeft = true;
|
if(buf.readBoolean()) this.retractingLeft = true;
|
||||||
if(nbt.getBoolean("justShotRight")) this.retractingRight = true;
|
if(buf.readBoolean()) this.retractingRight = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateConnections() {
|
protected void updateConnections() {
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import com.hbm.packet.PacketDispatcher;
|
|||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
@ -130,10 +131,8 @@ public class TileEntityTurretTauon extends TileEntityTurretBaseNT {
|
|||||||
this.target.attackEntityFrom(ModDamageSource.electricity, 30F + worldObj.rand.nextInt(11));
|
this.target.attackEntityFrom(ModDamageSource.electricity, 30F + worldObj.rand.nextInt(11));
|
||||||
this.conusmeAmmo(conf.ammo);
|
this.conusmeAmmo(conf.ammo);
|
||||||
this.worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:weapon.tauShoot", 4.0F, 0.9F + worldObj.rand.nextFloat() * 0.3F);
|
this.worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:weapon.tauShoot", 4.0F, 0.9F + worldObj.rand.nextFloat() * 0.3F);
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
this.networkPackNT(250);
|
||||||
data.setBoolean("shot", true);
|
|
||||||
this.networkPack(data, 250);
|
|
||||||
|
|
||||||
Vec3 pos = this.getTurretPos();
|
Vec3 pos = this.getTurretPos();
|
||||||
Vec3 vec = Vec3.createVectorHelper(this.getBarrelLength(), 0, 0);
|
Vec3 vec = Vec3.createVectorHelper(this.getBarrelLength(), 0, 0);
|
||||||
@ -149,12 +148,15 @@ public class TileEntityTurretTauon extends TileEntityTurretBaseNT {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
if(nbt.hasKey("shot"))
|
buf.writeBoolean(true);
|
||||||
beam = 3;
|
}
|
||||||
else
|
|
||||||
super.networkUnpack(nbt);
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.beam = buf.readBoolean() ? 3 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
public class BufferUtil {
|
public class BufferUtil {
|
||||||
|
|
||||||
private static final Charset CHARSET = StandardCharsets.UTF_8;
|
private static final Charset CHARSET = StandardCharsets.UTF_8;
|
||||||
|
|
||||||
// Writes a string to a byte buffer by encoding the length and raw bytes
|
// Writes a string to a byte buffer by encoding the length and raw bytes
|
||||||
public static void writeString(ByteBuf buf, String value) {
|
public static void writeString(ByteBuf buf, String value) {
|
||||||
if(value == null) {
|
if(value == null) {
|
||||||
@ -22,7 +22,7 @@ public class BufferUtil {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.writeInt(value.length());
|
buf.writeInt(value.getBytes(CHARSET).length);
|
||||||
buf.writeBytes(value.getBytes(CHARSET));
|
buf.writeBytes(value.getBytes(CHARSET));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,6 +37,66 @@ public class BufferUtil {
|
|||||||
return new String(bytes, CHARSET);
|
return new String(bytes, CHARSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes an integer array to a buffer.
|
||||||
|
*/
|
||||||
|
public static void writeIntArray(ByteBuf buf, int[] array) {
|
||||||
|
buf.writeInt(array.length);
|
||||||
|
for (int value : array) {
|
||||||
|
buf.writeInt(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads an integer array from a buffer.
|
||||||
|
*/
|
||||||
|
public static int[] readIntArray(ByteBuf buf) {
|
||||||
|
int length = buf.readInt();
|
||||||
|
|
||||||
|
int[] array = new int[length];
|
||||||
|
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
array[i] = buf.readInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes a NBTTagCompound to a buffer.
|
||||||
|
*/
|
||||||
|
public static void writeNBT(ByteBuf buf, NBTTagCompound compound) {
|
||||||
|
if(compound != null) {
|
||||||
|
byte[] nbtData = new byte[0];
|
||||||
|
try {
|
||||||
|
nbtData = CompressedStreamTools.compress(compound);
|
||||||
|
} catch(IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
buf.writeShort((short) nbtData.length);
|
||||||
|
buf.writeBytes(nbtData);
|
||||||
|
} else
|
||||||
|
buf.writeShort(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads a NBTTagCompound from a buffer.
|
||||||
|
*/
|
||||||
|
public static NBTTagCompound readNBT(ByteBuf buf) {
|
||||||
|
short nbtLength = buf.readShort();
|
||||||
|
|
||||||
|
if (nbtLength == -1) // check if no compound was even given.
|
||||||
|
return new NBTTagCompound();
|
||||||
|
byte[] tags = new byte[nbtLength];
|
||||||
|
buf.readBytes(tags);
|
||||||
|
try {
|
||||||
|
return CompressedStreamTools.func_152457_a(tags, new NBTSizeTracker(2097152L));
|
||||||
|
} catch(IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return new NBTTagCompound();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes the ItemStack to the buffer.
|
* Writes the ItemStack to the buffer.
|
||||||
*/
|
*/
|
||||||
@ -52,23 +112,12 @@ public class BufferUtil {
|
|||||||
if (item.getItem().isDamageable() || item.getItem().getShareTag())
|
if (item.getItem().isDamageable() || item.getItem().getShareTag())
|
||||||
nbtTagCompound = item.stackTagCompound;
|
nbtTagCompound = item.stackTagCompound;
|
||||||
|
|
||||||
if(nbtTagCompound != null) {
|
writeNBT(buf, nbtTagCompound);
|
||||||
byte[] nbtData = new byte[0];
|
|
||||||
try {
|
|
||||||
nbtData = CompressedStreamTools.compress(nbtTagCompound);
|
|
||||||
} catch(IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
buf.writeShort((short) nbtData.length);
|
|
||||||
buf.writeBytes(nbtData);
|
|
||||||
} else {
|
|
||||||
buf.writeShort(-1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads an ItemStack from a buffer
|
* Reads an ItemStack from a buffer.
|
||||||
*/
|
*/
|
||||||
public static ItemStack readItemStack(ByteBuf buf) {
|
public static ItemStack readItemStack(ByteBuf buf) {
|
||||||
ItemStack item = null;
|
ItemStack item = null;
|
||||||
@ -78,16 +127,7 @@ public class BufferUtil {
|
|||||||
byte quantity = buf.readByte();
|
byte quantity = buf.readByte();
|
||||||
short meta = buf.readShort();
|
short meta = buf.readShort();
|
||||||
item = new ItemStack(Item.getItemById(id), quantity, meta);
|
item = new ItemStack(Item.getItemById(id), quantity, meta);
|
||||||
|
item.stackTagCompound = readNBT(buf);
|
||||||
short nbtLength = buf.readByte();
|
|
||||||
|
|
||||||
byte[] tags = new byte[nbtLength];
|
|
||||||
buf.readBytes(tags);
|
|
||||||
try {
|
|
||||||
item.stackTagCompound = CompressedStreamTools.func_152457_a(tags, new NBTSizeTracker(2097152L));
|
|
||||||
} catch(IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user