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
47657366cc
commit
f8e6a60d0f
@ -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));
|
||||
}
|
||||
@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
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.muffled = nbt.getBoolean("muffled");
|
||||
|
||||
@ -6,6 +6,7 @@ import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@ -44,13 +45,8 @@ public class TileEntityDeuteriumExtractor extends TileEntityMachineBase implemen
|
||||
|
||||
this.subscribeToAllAround(tanks[0].getTankType(), 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");
|
||||
}
|
||||
|
||||
@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() {
|
||||
return power >= this.getMaxPower() / 20;
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ import com.hbm.util.RTGUtil;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -72,24 +73,28 @@ public class TileEntityDiFurnaceRTG extends TileEntityMachineBase implements IGU
|
||||
|
||||
MachineDiFurnaceRTG.updateBlockState(isProcessing() || (canProcess() && hasPower()), getWorldObj(), xCoord, yCoord, zCoord);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setShort("progress", progress);
|
||||
data.setShort("speed", processSpeed);
|
||||
data.setByteArray("modes", new byte[] {(byte) sideUpper, (byte) sideLower});
|
||||
networkPack(data, 10);
|
||||
networkPackNT(10);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
progress = nbt.getShort("progress");
|
||||
processSpeed = nbt.getShort("speed");
|
||||
byte[] modes = nbt.getByteArray("modes");
|
||||
this.sideUpper = modes[0];
|
||||
this.sideLower = modes[1];
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeShort(progress);
|
||||
buf.writeShort(processSpeed);
|
||||
buf.writeBytes(new byte[] {sideUpper, sideLower});
|
||||
}
|
||||
|
||||
|
||||
@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() {
|
||||
|
||||
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.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -208,24 +209,7 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
this.networkPackNT(50);
|
||||
}
|
||||
}
|
||||
|
||||
@ -244,21 +228,47 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
public void serialize(ByteBuf buf) {
|
||||
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");
|
||||
this.progressFluid = nbt.getInteger("progressFluid");
|
||||
this.progressOre = nbt.getInteger("progressOre");
|
||||
this.usageOre = nbt.getInteger("usageOre");
|
||||
this.usageFluid = nbt.getInteger("usageFluid");
|
||||
this.processFluidTime = nbt.getInteger("processFluidTime");
|
||||
this.processOreTime = nbt.getInteger("processOreTime");
|
||||
if(nbt.hasKey("leftType")) this.leftStack = new MaterialStack(Mats.matById.get(nbt.getInteger("leftType")), nbt.getInteger("leftAmount"));
|
||||
else this.leftStack = null;
|
||||
if(nbt.hasKey("rightType")) this.rightStack = new MaterialStack(Mats.matById.get(nbt.getInteger("rightType")), nbt.getInteger("rightAmount"));
|
||||
else this.rightStack = null;
|
||||
for(int i = 0; i < 4; i++) tanks[i].readFromNBT(nbt, "t" + i);
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
this.power = buf.readLong();
|
||||
this.progressFluid = buf.readInt();
|
||||
this.progressOre = buf.readInt();
|
||||
this.usageOre = buf.readInt();
|
||||
this.usageFluid = buf.readInt();
|
||||
this.processFluidTime = buf.readInt();
|
||||
this.processOreTime = buf.readInt();
|
||||
for(int i = 0; i < 4; i++) tanks[i].deserialize(buf);
|
||||
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() {
|
||||
|
||||
@ -17,6 +17,7 @@ import com.hbm.util.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -115,14 +116,8 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI
|
||||
} else {
|
||||
this.progress = 0;
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
|
||||
this.networkPackNT(50);
|
||||
} else {
|
||||
|
||||
if(this.progress > 0) {
|
||||
@ -141,16 +136,25 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.maxBurnTime = nbt.getInteger("maxBurnTime");
|
||||
this.burnTime = nbt.getInteger("burnTime");
|
||||
this.progress = nbt.getInteger("progress");
|
||||
this.processingTime = nbt.getInteger("processingTime");
|
||||
this.wasOn = nbt.getBoolean("wasOn");
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeInt(this.maxBurnTime);
|
||||
buf.writeInt(this.burnTime);
|
||||
buf.writeInt(this.progress);
|
||||
buf.writeInt(this.processingTime);
|
||||
buf.writeBoolean(this.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() {
|
||||
|
||||
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.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import com.hbm.util.ItemStackUtil;
|
||||
|
||||
import api.hbm.tile.IHeatSource;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -96,13 +98,9 @@ public class TileEntityFurnaceSteel extends TileEntityMachineBase implements IGU
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setIntArray("progress", progress);
|
||||
data.setIntArray("bonus", bonus);
|
||||
data.setInteger("heat", heat);
|
||||
data.setBoolean("wasOn", wasOn);
|
||||
this.networkPack(data, 50);
|
||||
|
||||
this.networkPackNT(50);
|
||||
|
||||
} else {
|
||||
|
||||
if(this.wasOn) {
|
||||
@ -122,13 +120,21 @@ public class TileEntityFurnaceSteel extends TileEntityMachineBase implements IGU
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.progress = nbt.getIntArray("progress");
|
||||
this.bonus = nbt.getIntArray("bonus");
|
||||
this.heat = nbt.getInteger("heat");
|
||||
this.wasOn = nbt.getBoolean("wasOn");
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
BufferUtil.writeIntArray(buf, this.progress);
|
||||
BufferUtil.writeIntArray(buf, this.bonus);
|
||||
buf.writeInt(this.heat);
|
||||
buf.writeBoolean(this.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
|
||||
|
||||
@ -25,6 +25,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
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_y", stat_y);
|
||||
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);
|
||||
}
|
||||
|
||||
@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
|
||||
public void networkUnpack(NBTTagCompound 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
|
||||
|
||||
@ -26,6 +26,7 @@ import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.sound.AudioWrapper;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
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.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
@ -158,27 +160,7 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyRece
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
this.networkPackNT(250);
|
||||
/// END Notif packets ///
|
||||
|
||||
} else {
|
||||
@ -378,16 +360,37 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyRece
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
super.networkUnpack(data);
|
||||
|
||||
this.isOn = data.getBoolean("isOn");
|
||||
this.power = data.getLong("power");
|
||||
this.blanket = data.getInteger("blanket");
|
||||
this.progress = data.getInteger("progress"); //
|
||||
tanks[0].readFromNBT(data, "t0");
|
||||
tanks[1].readFromNBT(data, "t1");
|
||||
plasma.readFromNBT(data, "t2");
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeBoolean(this.isOn);
|
||||
buf.writeLong(this.power);
|
||||
buf.writeInt(this.progress);
|
||||
tanks[0].serialize(buf);
|
||||
tanks[1].serialize(buf);
|
||||
plasma.serialize(buf);
|
||||
if(slots[3] == null) {
|
||||
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
|
||||
|
||||
@ -23,6 +23,7 @@ import api.hbm.energymk2.IEnergyProviderMK2;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -111,13 +112,8 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin
|
||||
|
||||
if(power > maxPower)
|
||||
power = maxPower;
|
||||
|
||||
data.setInteger("playersUsing", playersUsing);
|
||||
data.setInteger("setting", setting);
|
||||
data.setBoolean("isOn", isOn);
|
||||
data.setBoolean("wasOn", wasOn);
|
||||
tank.writeToNBT(data, "tank");
|
||||
this.networkPack(data, 50);
|
||||
|
||||
this.networkPackNT(50);
|
||||
|
||||
} else {
|
||||
this.prevDoorAngle = this.doorAngle;
|
||||
@ -200,14 +196,23 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
this.playersUsing = nbt.getInteger("playersUsing");
|
||||
this.setting = nbt.getInteger("setting");
|
||||
this.power = nbt.getLong("power");
|
||||
this.isOn = nbt.getBoolean("isOn");
|
||||
this.wasOn = nbt.getBoolean("wasOn");
|
||||
this.tank.readFromNBT(nbt, "tank");
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeInt(this.playersUsing);
|
||||
buf.writeInt(this.setting);
|
||||
buf.writeBoolean(this.isOn);
|
||||
buf.writeBoolean(this.wasOn);
|
||||
tank.serialize(buf);
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
@ -27,6 +27,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -119,16 +120,8 @@ public class TileEntityMachineCompressor extends TileEntityMachineBase implement
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
|
||||
this.networkPackNT(100);
|
||||
|
||||
} else {
|
||||
|
||||
@ -163,17 +156,29 @@ public class TileEntityMachineCompressor extends TileEntityMachineBase implement
|
||||
}
|
||||
|
||||
private float randSpeed = 0.1F;
|
||||
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.progress = nbt.getInteger("progress");
|
||||
this.processTime = nbt.getInteger("processTime");
|
||||
this.powerRequirement = nbt.getInteger("powerRequirement");
|
||||
this.power = nbt.getLong("power");
|
||||
tanks[0].readFromNBT(nbt, "0");
|
||||
tanks[1].readFromNBT(nbt, "1");
|
||||
this.isOn = nbt.getBoolean("isOn");
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeInt(this.progress);
|
||||
buf.writeInt(this.processTime);
|
||||
buf.writeInt(this.powerRequirement);
|
||||
buf.writeLong(this.power);
|
||||
tanks[0].serialize(buf);
|
||||
tanks[1].serialize(buf);
|
||||
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() {
|
||||
|
||||
@ -28,6 +28,7 @@ import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -151,22 +152,26 @@ public class TileEntityMachineDiesel extends TileEntityMachinePolluting implemen
|
||||
|
||||
generate();
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("power", (int) power);
|
||||
data.setInteger("powerCap", (int) powerCap);
|
||||
tank.writeToNBT(data, "t");
|
||||
this.networkPack(data, 50);
|
||||
this.networkPackNT(50);
|
||||
}
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
super.networkUnpack(data);
|
||||
|
||||
power = data.getInteger("power");
|
||||
powerCap = data.getInteger("powerCap");
|
||||
tank.readFromNBT(data, "t");
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
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() {
|
||||
return getHEFromFuel() > 0;
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.IUpgradeInfoProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
@ -20,6 +21,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -117,16 +119,7 @@ public class TileEntityMachineEPress extends TileEntityMachineBase implements IE
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
this.networkPackNT(50);
|
||||
|
||||
} else {
|
||||
|
||||
@ -141,21 +134,27 @@ public class TileEntityMachineEPress extends TileEntityMachineBase implements IE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.syncPress = nbt.getInteger("press");
|
||||
|
||||
if(nbt.hasKey("stack")) {
|
||||
NBTTagCompound stack = nbt.getCompoundTag("stack");
|
||||
this.syncStack = ItemStack.loadItemStackFromNBT(stack);
|
||||
} else {
|
||||
this.syncStack = null;
|
||||
}
|
||||
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(power);
|
||||
buf.writeInt(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.power = buf.readLong();
|
||||
this.syncPress = buf.readInt();
|
||||
|
||||
NBTTagCompound stack = BufferUtil.readNBT(buf);
|
||||
this.syncStack = ItemStack.loadItemStackFromNBT(stack);
|
||||
|
||||
this.turnProgress = 2;
|
||||
}
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
@ -102,6 +103,8 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
|
||||
return "container.machineLargeTurbine";
|
||||
}
|
||||
|
||||
private boolean operational;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
@ -117,9 +120,7 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
|
||||
tanks[0].setType(0, 1, slots);
|
||||
tanks[0].loadTank(2, 3, slots);
|
||||
power = Library.chargeItemsFromTE(slots, 4, power, maxPower);
|
||||
|
||||
boolean operational = false;
|
||||
|
||||
|
||||
FluidType in = tanks[0].getTankType();
|
||||
boolean valid = false;
|
||||
if(in.hasTrait(FT_Coolable.class)) {
|
||||
@ -145,13 +146,9 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
|
||||
if(power > maxPower) power = maxPower;
|
||||
|
||||
tanks[1].unloadTank(5, 6, slots);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
data.setBoolean("operational", operational);
|
||||
tanks[0].writeToNBT(data, "t0");
|
||||
tanks[1].writeToNBT(data, "t1");
|
||||
this.networkPack(data, 50);
|
||||
|
||||
this.networkPackNT(50);
|
||||
|
||||
} else {
|
||||
this.lastRotor = this.rotor;
|
||||
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)
|
||||
};
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
super.networkUnpack(data);
|
||||
|
||||
this.power = data.getLong("power");
|
||||
this.shouldTurn = data.getBoolean("operational");
|
||||
tanks[0].readFromNBT(data, "t0");
|
||||
tanks[1].readFromNBT(data, "t1");
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(this.power);
|
||||
buf.writeBoolean(operational);
|
||||
tanks[0].serialize(buf);
|
||||
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) {
|
||||
|
||||
@ -31,6 +31,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import api.hbm.fluid.IFluidStandardSender;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@ -83,6 +84,8 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen
|
||||
return "container.miningLaser";
|
||||
}
|
||||
|
||||
private double clientBreakProgress;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
@ -108,8 +111,6 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen
|
||||
lastTargetY = targetY;
|
||||
lastTargetZ = targetZ;
|
||||
|
||||
double clientBreakProgress = 0;
|
||||
|
||||
if(isOn) {
|
||||
|
||||
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);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
this.networkPackNT(250);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
this.trySubscribe(worldObj, xCoord, yCoord + 2, zCoord, ForgeDirection.UP);
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
super.networkUnpack(data);
|
||||
|
||||
this.power = data.getLong("power");
|
||||
this.lastTargetX = data.getInteger("lastX");
|
||||
this.lastTargetY = data.getInteger("lastY");
|
||||
this.lastTargetZ = data.getInteger("lastZ");
|
||||
this.targetX = data.getInteger("x");
|
||||
this.targetY = data.getInteger("y");
|
||||
this.targetZ = data.getInteger("z");
|
||||
this.beam = data.getBoolean("beam");
|
||||
this.isOn = data.getBoolean("isOn");
|
||||
this.breakProgress = data.getDouble("progress");
|
||||
tank.readFromNBT(data, "t");
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeLong(this.power);
|
||||
buf.writeInt(this.lastTargetX);
|
||||
buf.writeInt(this.lastTargetY);
|
||||
buf.writeInt(this.lastTargetZ);
|
||||
buf.writeInt(this.targetX);
|
||||
buf.writeInt(this.targetY);
|
||||
buf.writeInt(this.targetZ);
|
||||
buf.writeBoolean(this.beam);
|
||||
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() {
|
||||
|
||||
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 cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -122,13 +123,7 @@ public class TileEntityMachinePlasmaHeater extends TileEntityMachineBase impleme
|
||||
/// END Loading plasma into the ITER ///
|
||||
|
||||
/// START Notif packets ///
|
||||
|
||||
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);
|
||||
this.networkPackNT(50);
|
||||
/// END Notif packets ///
|
||||
}
|
||||
}
|
||||
@ -148,14 +143,23 @@ public class TileEntityMachinePlasmaHeater extends TileEntityMachineBase impleme
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
tanks[0].readFromNBT(nbt, "t0");
|
||||
tanks[1].readFromNBT(nbt, "t1");
|
||||
plasma.readFromNBT(nbt, "t2");
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(power);
|
||||
tanks[0].serialize(buf);
|
||||
tanks[1].serialize(buf);
|
||||
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() {
|
||||
|
||||
@ -8,8 +8,10 @@ import com.hbm.items.machine.ItemStamp;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import com.hbm.util.BufferUtil;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -133,17 +135,7 @@ public class TileEntityMachinePress extends TileEntityMachineBase implements IGU
|
||||
this.markChanged();
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
this.networkPackNT(50);
|
||||
|
||||
} 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
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
|
||||
@ -11,6 +11,7 @@ import com.hbm.items.special.ItemWasteLong;
|
||||
import com.hbm.items.special.ItemWasteShort;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
import com.hbm.util.Tuple.Triplet;
|
||||
|
||||
@ -18,6 +19,7 @@ import api.hbm.energymk2.IEnergyProviderMK2;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
@ -111,26 +113,29 @@ public class TileEntityMachineRadGen extends TileEntityMachineBase implements IE
|
||||
|
||||
if(this.power > maxPower)
|
||||
this.power = maxPower;
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
|
||||
this.networkPackNT(50);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.progress = nbt.getIntArray("progress");
|
||||
this.maxProgress = nbt.getIntArray("maxProgress");
|
||||
this.production = nbt.getIntArray("production");
|
||||
this.power = nbt.getLong("power");
|
||||
this.isOn = nbt.getBoolean("isOn");
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
BufferUtil.writeIntArray(buf, this.progress);
|
||||
BufferUtil.writeIntArray(buf, this.maxProgress);
|
||||
BufferUtil.writeIntArray(buf, this.production);
|
||||
buf.writeLong(this.power);
|
||||
buf.writeBoolean(this.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
|
||||
|
||||
@ -23,6 +23,7 @@ import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -98,16 +99,6 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement
|
||||
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
|
||||
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[2].getFill() > 0) this.sendFluid(tanks[2], worldObj, pos.getX(), pos.getY(),pos.getZ(), pos.getDir());
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
|
||||
this.networkPackNT(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() {
|
||||
return new DirPos[] {
|
||||
|
||||
@ -15,6 +15,7 @@ import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
@ -66,19 +67,23 @@ public class TileEntityMachineReactorBreeding extends TileEntityMachineBase impl
|
||||
} else {
|
||||
progress = 0.0F;
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("flux", flux);
|
||||
data.setFloat("progress", progress);
|
||||
this.networkPack(data, 20);
|
||||
|
||||
this.networkPackNT(20);
|
||||
}
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
super.networkUnpack(data);
|
||||
|
||||
flux = data.getInteger("flux");
|
||||
progress = data.getFloat("progress");
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeInt(flux);
|
||||
buf.writeFloat(progress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
this.flux = buf.readInt();
|
||||
this.progress = buf.readFloat();
|
||||
}
|
||||
|
||||
public void getInteractions() {
|
||||
|
||||
@ -16,6 +16,7 @@ import api.hbm.energymk2.IBatteryItem;
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -167,11 +168,8 @@ public class TileEntityMachineSchrabidiumTransmutator extends TileEntityMachineB
|
||||
} else {
|
||||
process = 0;
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
data.setInteger("progress", process);
|
||||
this.networkPack(data, 50);
|
||||
|
||||
this.networkPackNT(50);
|
||||
|
||||
} 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
|
||||
public AudioWrapper createAudioLoop() {
|
||||
@ -224,14 +236,6 @@ public class TileEntityMachineSchrabidiumTransmutator extends TileEntityMachineB
|
||||
audio = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
super.networkUnpack(data);
|
||||
|
||||
this.power = data.getLong("power");
|
||||
this.process = data.getInteger("progress");
|
||||
}
|
||||
|
||||
@Override
|
||||
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.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -69,6 +70,8 @@ public class TileEntityMachineSolderingStation extends TileEntityMachineBase imp
|
||||
}
|
||||
}
|
||||
|
||||
private SolderingRecipe recipe;
|
||||
|
||||
@Override
|
||||
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;
|
||||
|
||||
UpgradeManager.eval(slots, 9, 10);
|
||||
@ -133,19 +136,8 @@ public class TileEntityMachineSolderingStation extends TileEntityMachineBase imp
|
||||
}
|
||||
|
||||
this.maxPower = Math.max(intendedMaxPower, power);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
|
||||
this.networkPackNT(25);
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,22 +232,38 @@ public class TileEntityMachineSolderingStation extends TileEntityMachineBase imp
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.maxPower = nbt.getLong("maxPower");
|
||||
this.consumption = nbt.getLong("consumption");
|
||||
this.progress = nbt.getInteger("progress");
|
||||
this.processTime = nbt.getInteger("processTime");
|
||||
|
||||
if(nbt.hasKey("display")) {
|
||||
this.display = new ItemStack(Item.getItemById(nbt.getInteger("display")), 1, nbt.getInteger("displayMeta"));
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(this.power);
|
||||
buf.writeLong(this.maxPower);
|
||||
buf.writeLong(this.consumption);
|
||||
buf.writeInt(this.progress);
|
||||
buf.writeInt(this.processTime);
|
||||
buf.writeBoolean(recipe != null);
|
||||
if(recipe != null) {
|
||||
buf.writeInt(Item.getIdFromItem(recipe.output.getItem()));
|
||||
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 {
|
||||
this.display = null;
|
||||
}
|
||||
|
||||
this.tank.readFromNBT(nbt, "t");
|
||||
|
||||
this.tank.deserialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -28,6 +28,7 @@ import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
@ -85,7 +86,9 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
||||
tanks[2] = new FluidTank(Fluids.WATER, 16000);
|
||||
tanks[3] = new FluidTank(Fluids.HOTSTEAM, 160000);
|
||||
}
|
||||
|
||||
|
||||
private long powerBeforeNet;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
@ -131,10 +134,9 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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
|
||||
|
||||
|
||||
powerBeforeNet = Math.min(this.power, maxPower);
|
||||
|
||||
//do net/battery deductions first...
|
||||
power = Library.chargeItemsFromTE(slots, 0, power, maxPower);
|
||||
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);
|
||||
//steam
|
||||
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
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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
|
||||
public void readFromNBT(NBTTagCompound 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.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@ -284,15 +285,8 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem
|
||||
if(this.power > this.maxPower) {
|
||||
this.power = this.maxPower;
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
|
||||
this.networkPackNT(150);
|
||||
|
||||
} else {
|
||||
|
||||
@ -385,16 +379,27 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.afterburner = nbt.getByte("after");
|
||||
this.wasOn = nbt.getBoolean("wasOn");
|
||||
this.showBlood = nbt.getBoolean("showBlood");
|
||||
tank.readFromNBT(nbt, "tank");
|
||||
blood.readFromNBT(nbt, "blood");
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(power);
|
||||
buf.writeByte((byte) afterburner);
|
||||
buf.writeBoolean(wasOn);
|
||||
buf.writeBoolean(showBlood);
|
||||
tank.serialize(buf);
|
||||
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() {
|
||||
|
||||
@ -11,6 +11,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
@ -75,21 +76,25 @@ public class TileEntityMicrowave extends TileEntityMachineBase implements IEnerg
|
||||
time += speed * 2;
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
data.setInteger("time", time);
|
||||
data.setInteger("speed", speed);
|
||||
networkPack(data, 50);
|
||||
|
||||
networkPackNT(50);
|
||||
}
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
super.networkUnpack(data);
|
||||
|
||||
power = data.getLong("power");
|
||||
time = data.getInteger("time");
|
||||
speed = data.getInteger("speed");
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(power);
|
||||
buf.writeInt(time);
|
||||
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) {
|
||||
|
||||
@ -29,6 +29,7 @@ import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
@ -270,22 +271,8 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG
|
||||
this.coreHeat = 0;
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
|
||||
this.networkPackNT(150);
|
||||
} else {
|
||||
|
||||
if(amountLoaded > 0) {
|
||||
@ -383,23 +370,41 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG
|
||||
protected int getRodCountForCoolant() {
|
||||
return this.rodCount + (int) Math.ceil(this.heatsinkCount / 4D);
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
tanks[0].readFromNBT(nbt, "t0");
|
||||
tanks[1].readFromNBT(nbt, "t1");
|
||||
rodCount = nbt.getInteger("rodCount");
|
||||
coreHeat = nbt.getInteger("coreHeat");
|
||||
hullHeat = nbt.getInteger("hullHeat");
|
||||
flux = nbt.getDouble("flux");
|
||||
processTime = nbt.getDouble("processTime");
|
||||
progress = nbt.getDouble("progress");
|
||||
typeLoaded = nbt.getInteger("typeLoaded");
|
||||
amountLoaded = nbt.getInteger("amountLoaded");
|
||||
rodLevel = nbt.getDouble("rodLevel");
|
||||
rodTarget = nbt.getInteger("rodTarget");
|
||||
coreHeatCapacity = nbt.getInteger("coreHeatCapacity");
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeInt(this.rodCount);
|
||||
buf.writeInt(this.coreHeat);
|
||||
buf.writeInt(this.hullHeat);
|
||||
buf.writeDouble(this.flux);
|
||||
buf.writeDouble(this.processTime);
|
||||
buf.writeDouble(this.progress);
|
||||
buf.writeInt(this.typeLoaded);
|
||||
buf.writeInt(this.amountLoaded);
|
||||
buf.writeDouble(this.rodLevel);
|
||||
buf.writeDouble(this.rodTarget);
|
||||
buf.writeInt(this.coreHeatCapacity);
|
||||
tanks[0].serialize(buf);
|
||||
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() {
|
||||
|
||||
@ -13,6 +13,7 @@ import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
@ -136,33 +137,37 @@ public class TileEntityReactorControl extends TileEntityMachineBase implements I
|
||||
reactor.setTarget(level);
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
|
||||
this.networkPackNT(150);
|
||||
}
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
super.networkUnpack(data);
|
||||
|
||||
this.heat = data.getInteger("heat");
|
||||
this.level = data.getDouble("level");
|
||||
this.flux = data.getInteger("flux");
|
||||
isLinked = data.getBoolean("isLinked");
|
||||
levelLower = data.getDouble("levelLower");
|
||||
levelUpper = data.getDouble("levelUpper");
|
||||
heatLower = data.getDouble("heatLower");
|
||||
heatUpper = data.getDouble("heatUpper");
|
||||
function = RodFunction.values()[data.getInteger("function")];
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeInt(heat);
|
||||
buf.writeDouble(level);
|
||||
buf.writeInt(flux);
|
||||
buf.writeBoolean(isLinked);
|
||||
buf.writeDouble(levelLower);
|
||||
buf.writeDouble(levelUpper);
|
||||
buf.writeDouble(heatLower);
|
||||
buf.writeDouble(heatUpper);
|
||||
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() {
|
||||
|
||||
@ -15,12 +15,14 @@ import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemPlateFuel;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
@ -151,27 +153,31 @@ public class TileEntityReactorResearch extends TileEntityMachineBase implements
|
||||
float rad = (float) heat / (float) maxHeat * 50F;
|
||||
ChunkRadiationManager.proxy.incrementRad(worldObj, xCoord, yCoord, zCoord, rad);
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
|
||||
this.networkPackNT(150);
|
||||
}
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
super.networkUnpack(data);
|
||||
|
||||
this.heat = data.getInteger("heat");
|
||||
this.water = data.getByte("water");
|
||||
this.level = data.getDouble("level");
|
||||
this.targetLevel = data.getDouble("targetLevel");
|
||||
this.slotFlux = data.getIntArray("slotFlux");
|
||||
this.totalFlux = data.getInteger("totalFlux");
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeInt(this.heat);
|
||||
buf.writeByte(this.water);
|
||||
buf.writeDouble(this.level);
|
||||
buf.writeDouble(this.targetLevel);
|
||||
BufferUtil.writeIntArray(buf, this.slotFlux);
|
||||
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() {
|
||||
|
||||
@ -33,6 +33,7 @@ import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
@ -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) {
|
||||
switch (type) {
|
||||
case 0: return (steam.getFill() * i) / steam.getMaxFill();
|
||||
@ -227,18 +217,33 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IC
|
||||
}
|
||||
|
||||
checkIfMeltdown();
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
|
||||
this.networkPackNT(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() {
|
||||
|
||||
// function of SHS produced per tick
|
||||
|
||||
@ -23,6 +23,7 @@ import api.hbm.fluid.IFluidStandardReceiver;
|
||||
import api.hbm.item.IDesignatorItem;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -94,15 +95,8 @@ public class TileEntitySoyuzLauncher extends TileEntityMachineBase implements IS
|
||||
} else {
|
||||
liftOff();
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
|
||||
networkPackNT(250);
|
||||
}
|
||||
|
||||
if(worldObj.isRemote) {
|
||||
@ -189,18 +183,29 @@ public class TileEntitySoyuzLauncher extends TileEntityMachineBase implements IS
|
||||
audio = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
super.networkUnpack(data);
|
||||
|
||||
power = data.getLong("power");
|
||||
mode = data.getByte("mode");
|
||||
starting = data.getBoolean("starting");
|
||||
rocketType = data.getByte("type");
|
||||
tanks[0].readFromNBT(data, "t0");
|
||||
tanks[1].readFromNBT(data, "t1");
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(power);
|
||||
buf.writeByte(mode);
|
||||
buf.writeBoolean(starting);
|
||||
buf.writeByte(this.getType());
|
||||
tanks[0].serialize(buf);
|
||||
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() {
|
||||
|
||||
if(canLaunch())
|
||||
|
||||
@ -15,6 +15,7 @@ import com.hbm.util.ArmorUtil;
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
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);
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
this.networkPackNT(100);
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,19 +136,30 @@ public class TileEntityTesla extends TileEntityMachineBase implements IEnergyRec
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
super.networkUnpack(data);
|
||||
|
||||
int s = data.getShort("length");
|
||||
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
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();
|
||||
|
||||
|
||||
for(int i = 0; i < s; i++)
|
||||
this.targets.add(new double[] {
|
||||
data.getDouble("x" + i),
|
||||
data.getDouble("y" + i),
|
||||
data.getDouble("z" + i)
|
||||
buf.readDouble(), // X
|
||||
buf.readDouble(), // Y
|
||||
buf.readDouble() // Z
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@ import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -120,7 +121,7 @@ public class TileEntityWatz extends TileEntityMachineBase implements IFluidStand
|
||||
/* send sync packets (order doesn't matter) */
|
||||
for(TileEntityWatz segment : segments) {
|
||||
segment.isOn = turnedOn;
|
||||
segment.sendPacket(sharedTanks);
|
||||
this.networkPackNT(25);
|
||||
segment.heat *= 0.99; //cool 1% per tick
|
||||
}
|
||||
|
||||
@ -277,30 +278,28 @@ public class TileEntityWatz extends TileEntityMachineBase implements IFluidStand
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void sendPacket(FluidTank[] tanks) {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("heat", this.heat);
|
||||
data.setBoolean("isOn", isOn);
|
||||
data.setBoolean("lock", isLocked);
|
||||
data.setDouble("flux", this.fluxLastReaction + this.fluxLastBase);
|
||||
for(int i = 0; i < tanks.length; i++) {
|
||||
tanks[i].writeToNBT(data, "t" + i);
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeInt(this.heat);
|
||||
buf.writeBoolean(isOn);
|
||||
buf.writeBoolean(isLocked);
|
||||
buf.writeDouble(this.fluxLastReaction + this.fluxLastBase);
|
||||
for (FluidTank tank : tanks) {
|
||||
tank.serialize(buf);
|
||||
}
|
||||
this.networkPack(data, 25);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.heat = nbt.getInteger("heat");
|
||||
this.isOn = nbt.getBoolean("isOn");
|
||||
this.isLocked = nbt.getBoolean("lock");
|
||||
this.fluxDisplay = nbt.getDouble("flux");
|
||||
for(int i = 0; i < tanks.length; i++) {
|
||||
tanks[i].readFromNBT(nbt, "t" + i);
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
this.heat = buf.readInt();
|
||||
this.isOn = buf.readBoolean();
|
||||
this.isLocked = buf.readBoolean();
|
||||
this.fluxDisplay = buf.readDouble();
|
||||
for (FluidTank tank : tanks) {
|
||||
tank.deserialize(buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -20,6 +20,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -73,13 +74,24 @@ public class TileEntityMachineCatalyticReformer extends TileEntityMachineBase im
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", this.power);
|
||||
for(int i = 0; i < 4; i++) tanks[i].writeToNBT(data, "" + i);
|
||||
this.networkPack(data, 150);
|
||||
|
||||
this.networkPackNT(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
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
|
||||
@ -12,6 +12,7 @@ import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import com.hbm.util.Tuple.Triplet;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
@ -19,6 +20,7 @@ import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import api.hbm.tile.IHeatSource;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -107,14 +109,8 @@ public class TileEntityMachineCoker extends TileEntityMachineBase implements IFl
|
||||
for(DirPos pos : getConPos()) {
|
||||
if(this.tanks[1].getFill() > 0) this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
|
||||
this.networkPackNT(25);
|
||||
} else {
|
||||
|
||||
if(this.wasOn) {
|
||||
@ -135,6 +131,8 @@ public class TileEntityMachineCoker extends TileEntityMachineBase implements IFl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public DirPos[] getConPos() {
|
||||
|
||||
@ -172,16 +170,25 @@ public class TileEntityMachineCoker extends TileEntityMachineBase implements IFl
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.wasOn = nbt.getBoolean("wasOn");
|
||||
this.heat = nbt.getInteger("heat");
|
||||
this.progress = nbt.getInteger("progress");
|
||||
tanks[0].readFromNBT(nbt, "t0");
|
||||
tanks[1].readFromNBT(nbt, "t1");
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeBoolean(this.wasOn);
|
||||
buf.writeInt(this.heat);
|
||||
buf.writeInt(this.progress);
|
||||
tanks[0].serialize(buf);
|
||||
tanks[1].serialize(buf);
|
||||
}
|
||||
|
||||
@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() {
|
||||
|
||||
@ -30,6 +30,7 @@ import api.hbm.fluid.IFluidStandardReceiver;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -178,13 +179,8 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements
|
||||
}
|
||||
|
||||
power = Library.chargeItemsFromTE(slots, 0, power, maxPower);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", this.power);
|
||||
data.setBoolean("isOn", isOn);
|
||||
data.setBoolean("doesBurn", doesBurn);
|
||||
tank.writeToNBT(data, "t");
|
||||
this.networkPack(data, 50);
|
||||
|
||||
this.networkPackNT(50);
|
||||
|
||||
} else {
|
||||
|
||||
@ -240,15 +236,23 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements
|
||||
new DirPos(xCoord, yCoord, zCoord - 2, Library.NEG_Z)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.isOn = nbt.getBoolean("isOn");
|
||||
this.doesBurn = nbt.getBoolean("doesBurn");
|
||||
tank.readFromNBT(nbt, "t");
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(this.power);
|
||||
buf.writeBoolean(this.isOn);
|
||||
buf.writeBoolean(this.doesBurn);
|
||||
tank.serialize(buf);
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
@ -24,6 +24,7 @@ import api.hbm.fluid.IFluidStandardSender;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -76,14 +77,8 @@ public class TileEntityMachineLiquefactor extends TileEntityMachineBase implemen
|
||||
this.progress = 0;
|
||||
|
||||
this.sendFluid();
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
|
||||
this.networkPackNT(50);
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,14 +149,23 @@ public class TileEntityMachineLiquefactor extends TileEntityMachineBase implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.progress = nbt.getInteger("progress");
|
||||
this.usage = nbt.getInteger("usage");
|
||||
this.processTime = nbt.getInteger("processTime");
|
||||
tank.readFromNBT(nbt, "t");
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(this.power);
|
||||
buf.writeInt(this.progress);
|
||||
buf.writeInt(this.usage);
|
||||
buf.writeInt(this.processTime);
|
||||
tank.serialize(buf);
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
@ -37,6 +37,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -193,14 +194,9 @@ public class TileEntityMachineRefinery extends TileEntityMachineBase implements
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
|
||||
this.networkPackNT(150);
|
||||
|
||||
} else {
|
||||
|
||||
if(this.isOn) audioTime = 20;
|
||||
@ -253,16 +249,25 @@ public class TileEntityMachineRefinery extends TileEntityMachineBase implements
|
||||
audio = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
for(int i = 0; i < 5; i++) tanks[i].readFromNBT(nbt, "" + i);
|
||||
this.hasExploded = nbt.getBoolean("exploded");
|
||||
this.onFire = nbt.getBoolean("onFire");
|
||||
this.isOn = nbt.getBoolean("isOn");
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(this.power);
|
||||
for(int i = 0; i < 5; i++) tanks[i].serialize(buf);
|
||||
buf.writeBoolean(this.hasExploded);
|
||||
buf.writeBoolean(this.onFire);
|
||||
buf.writeBoolean(this.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() {
|
||||
|
||||
@ -24,6 +24,7 @@ import api.hbm.fluid.IFluidStandardReceiver;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -75,14 +76,8 @@ public class TileEntityMachineSolidifier extends TileEntityMachineBase implement
|
||||
this.process();
|
||||
else
|
||||
this.progress = 0;
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
|
||||
this.networkPackNT(50);
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,14 +166,23 @@ public class TileEntityMachineSolidifier extends TileEntityMachineBase implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.progress = nbt.getInteger("progress");
|
||||
this.usage = nbt.getInteger("usage");
|
||||
this.processTime = nbt.getInteger("processTime");
|
||||
tank.readFromNBT(nbt, "t");
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(this.power);
|
||||
buf.writeInt(this.progress);
|
||||
buf.writeInt(this.usage);
|
||||
buf.writeInt(this.processTime);
|
||||
tank.serialize(buf);
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
@ -20,6 +20,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -81,12 +82,9 @@ public class TileEntityMachineVacuumDistill extends TileEntityMachineBase implem
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
|
||||
this.networkPackNT(150);
|
||||
|
||||
} else {
|
||||
|
||||
if(this.isOn) audioTime = 20;
|
||||
@ -139,14 +137,21 @@ public class TileEntityMachineVacuumDistill extends TileEntityMachineBase implem
|
||||
audio = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.isOn = nbt.getBoolean("isOn");
|
||||
for(int i = 0; i < 5; i++) tanks[i].readFromNBT(nbt, "" + i);
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(this.power);
|
||||
buf.writeBoolean(this.isOn);
|
||||
for(int i = 0; i < 5; i++) tanks[i].serialize(buf);
|
||||
}
|
||||
|
||||
@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() {
|
||||
|
||||
@ -14,6 +14,7 @@ import com.hbm.inventory.gui.GUIRBMKConsole;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKControlManual.RBMKColor;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import com.hbm.util.Compat;
|
||||
import com.hbm.util.EnumUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
@ -21,6 +22,7 @@ import com.hbm.util.I18nUtil;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -77,8 +79,8 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon
|
||||
this.worldObj.theProfiler.endSection();
|
||||
prepareScreenInfo();
|
||||
}
|
||||
|
||||
prepareNetworkPack();
|
||||
|
||||
this.networkPackNT(50);
|
||||
}
|
||||
}
|
||||
|
||||
@ -185,66 +187,65 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon
|
||||
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
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
|
||||
if(data.getBoolean("full")) {
|
||||
this.columns = new RBMKColumn[15 * 15];
|
||||
|
||||
for(int i = 0; i < columns.length; i++) {
|
||||
|
||||
if(data.hasKey("type_" + i)) {
|
||||
this.columns[i] = new RBMKColumn(ColumnType.values()[data.getShort("type_" + i)], (NBTTagCompound)data.getTag("column_" + i));
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
|
||||
if (this.worldObj.getTotalWorldTime() % 10 == 0) {
|
||||
buf.writeBoolean(true);
|
||||
|
||||
for (RBMKColumn column : this.columns) {
|
||||
if (column == null || column.type == null)
|
||||
buf.writeByte(-1);
|
||||
else {
|
||||
buf.writeByte((byte) column.type.ordinal());
|
||||
BufferUtil.writeNBT(buf, column.data);
|
||||
}
|
||||
}
|
||||
|
||||
this.fluxBuffer = data.getIntArray("flux");
|
||||
|
||||
for(int i = 0; i < this.screens.length; i++) {
|
||||
RBMKScreen screen = screens[i];
|
||||
screen.display = data.getString("t" + i);
|
||||
|
||||
BufferUtil.writeIntArray(buf, fluxBuffer);
|
||||
|
||||
for (RBMKScreen screen : this.screens) {
|
||||
BufferUtil.writeString(buf, screen.display);
|
||||
}
|
||||
|
||||
} 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];
|
||||
screen.type = ScreenType.values()[data.getByte("s" + i)];
|
||||
}
|
||||
|
||||
@Override
|
||||
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 cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -143,17 +144,21 @@ public class TileEntityCraneBoxer extends TileEntityCraneBase implements IGUIPro
|
||||
worldObj.spawnEntityInWorld(moving);
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setByte("mode", mode);
|
||||
this.networkPack(data, 15);
|
||||
|
||||
this.networkPackNT(15);
|
||||
}
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.mode = nbt.getByte("mode");
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeByte(this.mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
this.mode = buf.readByte();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -13,6 +13,7 @@ import com.hbm.util.InventoryUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -130,21 +131,23 @@ public class TileEntityCraneGrabber extends TileEntityCraneBase implements IGUIP
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("isWhitelist", isWhitelist);
|
||||
this.matcher.writeToNBT(data);
|
||||
this.networkPack(data, 15);
|
||||
|
||||
this.networkPackNT(15);
|
||||
}
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.isWhitelist = nbt.getBoolean("isWhitelist");
|
||||
this.matcher.modes = new String[this.matcher.modes.length];
|
||||
this.matcher.readFromNBT(nbt);
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeBoolean(this.isWhitelist);
|
||||
this.matcher.serialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
this.isWhitelist = buf.readBoolean();
|
||||
this.matcher.deserialize(buf);
|
||||
}
|
||||
|
||||
public boolean matchesFilter(ItemStack stack) {
|
||||
|
||||
@ -7,8 +7,10 @@ import com.hbm.tileentity.IControlReceiverFilter;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import com.hbm.util.BufferUtil;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -44,26 +46,28 @@ public class TileEntityCraneRouter extends TileEntityMachineBase implements IGUI
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
this.networkPackNT(15);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
super.networkUnpack(data);
|
||||
|
||||
for(int i = 0; i < patterns.length; i++) {
|
||||
NBTTagCompound compound = data.getCompoundTag("pattern" + i);
|
||||
patterns[i].readFromNBT(compound);
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
for (ModulePatternMatcher pattern : patterns) {
|
||||
pattern.serialize(buf);
|
||||
}
|
||||
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
|
||||
|
||||
@ -3,8 +3,10 @@ package com.hbm.tileentity.network;
|
||||
import com.hbm.module.ModulePatternMatcher;
|
||||
import com.hbm.tileentity.IControlReceiverFilter;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import com.hbm.util.Compat;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -68,24 +70,27 @@ public class TileEntityRadioTorchCounter extends TileEntityMachineBase implement
|
||||
this.lastCount[i] = count;
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
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);
|
||||
|
||||
this.networkPackNT(15);
|
||||
}
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.polling = nbt.getBoolean("polling");
|
||||
this.lastCount = nbt.getIntArray("last");
|
||||
this.matcher.modes = new String[this.matcher.modes.length];
|
||||
this.matcher.readFromNBT(nbt);
|
||||
for(int i = 0; i < 3; i++) this.channel[i] = nbt.getString("c" + i);
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeBoolean(this.polling);
|
||||
BufferUtil.writeIntArray(buf, this.lastCount);
|
||||
this.matcher.serialize(buf);
|
||||
for(int i = 0; i < 3; i++) BufferUtil.writeString(buf, this.channel[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
|
||||
|
||||
@ -19,6 +19,7 @@ import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
@ -317,9 +318,8 @@ public class TileEntityTurretArty extends TileEntityTurretBaseArtillery implemen
|
||||
}
|
||||
|
||||
this.power = Library.chargeTEFromItems(slots, 10, this.power, this.getMaxPower());
|
||||
|
||||
NBTTagCompound data = this.writePacket();
|
||||
this.networkPack(data, 250);
|
||||
|
||||
this.networkPackNT(250);
|
||||
|
||||
this.didJustShoot = false;
|
||||
|
||||
@ -409,20 +409,17 @@ public class TileEntityTurretArty extends TileEntityTurretBaseArtillery implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NBTTagCompound writePacket() {
|
||||
NBTTagCompound data = super.writePacket();
|
||||
data.setShort("mode", mode);
|
||||
if(didJustShoot)
|
||||
data.setBoolean("didJustShoot", didJustShoot);
|
||||
return data;
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeShort(this.mode);
|
||||
buf.writeBoolean(this.didJustShoot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
this.mode = nbt.getShort("mode");
|
||||
if(nbt.getBoolean("didJustShoot"))
|
||||
this.retracting = true;
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
this.mode = buf.readShort();
|
||||
this.retracting = buf.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -34,6 +34,7 @@ import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
@ -228,9 +229,8 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
|
||||
}
|
||||
|
||||
this.power = Library.chargeTEFromItems(slots, 10, this.power, this.getMaxPower());
|
||||
|
||||
NBTTagCompound data = this.writePacket();
|
||||
this.networkPack(data, 250);
|
||||
|
||||
this.networkPackNT(250);
|
||||
|
||||
if(usesCasings() && this.casingDelay() > 0) {
|
||||
if(casingDelay > 0) {
|
||||
@ -252,26 +252,45 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected NBTTagCompound writePacket() {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeBoolean(this.tPos != null);
|
||||
if(this.tPos != null) {
|
||||
data.setDouble("tX", this.tPos.xCoord);
|
||||
data.setDouble("tY", this.tPos.yCoord);
|
||||
data.setDouble("tZ", this.tPos.zCoord);
|
||||
buf.writeDouble(this.tPos.xCoord);
|
||||
buf.writeDouble(this.tPos.yCoord);
|
||||
buf.writeDouble(this.tPos.zCoord);
|
||||
}
|
||||
data.setDouble("pitch", this.rotationPitch);
|
||||
data.setDouble("yaw", this.rotationYaw);
|
||||
data.setLong("power", this.power);
|
||||
data.setBoolean("isOn", this.isOn);
|
||||
data.setBoolean("targetPlayers", this.targetPlayers);
|
||||
data.setBoolean("targetAnimals", this.targetAnimals);
|
||||
data.setBoolean("targetMobs", this.targetMobs);
|
||||
data.setBoolean("targetMachines", this.targetMachines);
|
||||
data.setInteger("stattrak", this.stattrak);
|
||||
|
||||
return data;
|
||||
buf.writeDouble(this.rotationPitch);
|
||||
buf.writeDouble(this.rotationYaw);
|
||||
buf.writeLong(this.power);
|
||||
buf.writeBoolean(this.isOn);
|
||||
buf.writeBoolean(this.targetPlayers);
|
||||
buf.writeBoolean(this.targetAnimals);
|
||||
buf.writeBoolean(this.targetMobs);
|
||||
buf.writeBoolean(this.targetMachines);
|
||||
buf.writeInt(this.stattrak);
|
||||
}
|
||||
|
||||
@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() {
|
||||
|
||||
@ -22,6 +22,7 @@ import api.hbm.fluid.IFluidStandardReceiver;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -153,18 +154,17 @@ public class TileEntityTurretFritz extends TileEntityTurretBaseNT implements IFl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected NBTTagCompound writePacket() {
|
||||
NBTTagCompound data = super.writePacket();
|
||||
tank.writeToNBT(data, "t");
|
||||
return data;
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
tank.serialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
tank.readFromNBT(nbt, "t");
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
tank.deserialize(buf);
|
||||
}
|
||||
|
||||
@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.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
@ -249,9 +250,8 @@ public class TileEntityTurretHIMARS extends TileEntityTurretBaseArtillery implem
|
||||
}
|
||||
|
||||
this.power = Library.chargeTEFromItems(slots, 10, this.power, this.getMaxPower());
|
||||
|
||||
NBTTagCompound data = this.writePacket();
|
||||
this.networkPack(data, 250);
|
||||
|
||||
this.networkPackNT(250);
|
||||
|
||||
} else {
|
||||
|
||||
@ -267,22 +267,21 @@ public class TileEntityTurretHIMARS extends TileEntityTurretBaseArtillery implem
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NBTTagCompound writePacket() {
|
||||
NBTTagCompound data = super.writePacket();
|
||||
data.setShort("mode", this.mode);
|
||||
data.setInteger("type", this.typeLoaded);
|
||||
data.setInteger("ammo", this.ammo);
|
||||
data.setFloat("crane", crane);
|
||||
return data;
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeShort(this.mode);
|
||||
buf.writeShort(this.typeLoaded);
|
||||
buf.writeInt(this.ammo);
|
||||
buf.writeFloat(this.crane);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
this.mode = nbt.getShort("mode");
|
||||
this.typeLoaded = nbt.getShort("type");
|
||||
this.ammo = nbt.getInteger("ammo");
|
||||
this.crane = nbt.getFloat("crane");
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
this.mode = buf.readShort();
|
||||
this.typeLoaded = buf.readShort();
|
||||
this.ammo = buf.readInt();
|
||||
this.crane = buf.readFloat();
|
||||
}
|
||||
|
||||
public boolean hasAmmo() {
|
||||
|
||||
@ -19,6 +19,7 @@ import com.hbm.util.I18nUtil;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -261,20 +262,21 @@ public class TileEntityTurretMaxwell extends TileEntityTurretBaseNT implements I
|
||||
}
|
||||
|
||||
this.power -= demand;
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("shot", true);
|
||||
this.networkPack(data, 250);
|
||||
|
||||
this.networkPackNT(250);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
|
||||
if(nbt.hasKey("shot"))
|
||||
beam = 5;
|
||||
else
|
||||
super.networkUnpack(nbt);
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeBoolean(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
this.beam = buf.readBoolean() ? 5 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -15,6 +15,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import com.hbm.items.ModItems;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@ -104,20 +105,21 @@ public class TileEntityTurretRichard extends TileEntityTurretBaseNT {
|
||||
if(this.getFirstConfigLoaded() == null) {
|
||||
this.loaded = 0;
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("loaded", this.loaded);
|
||||
this.networkPack(data, 250);
|
||||
|
||||
this.networkPackNT(250);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
|
||||
if(nbt.hasKey("loaded"))
|
||||
this.loaded = nbt.getInteger("loaded");
|
||||
else
|
||||
super.networkUnpack(nbt);
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeInt(this.loaded);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
this.loaded = buf.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -15,6 +15,7 @@ import com.hbm.tileentity.IGUIProvider;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -229,20 +230,19 @@ public class TileEntityTurretSentry extends TileEntityTurretBaseNT implements IG
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NBTTagCompound writePacket() {
|
||||
NBTTagCompound data = super.writePacket();
|
||||
if(didJustShootLeft) data.setBoolean("justShotLeft", didJustShootLeft);
|
||||
if(didJustShootRight) data.setBoolean("justShotRight", didJustShootRight);
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
if(didJustShootLeft) buf.writeBoolean(didJustShootLeft);
|
||||
if(didJustShootRight) buf.writeBoolean(didJustShootRight);
|
||||
didJustShootLeft = false;
|
||||
didJustShootRight = false;
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
if(nbt.getBoolean("justShotLeft")) this.retractingLeft = true;
|
||||
if(nbt.getBoolean("justShotRight")) this.retractingRight = true;
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
if(buf.readBoolean()) this.retractingLeft = true;
|
||||
if(buf.readBoolean()) this.retractingRight = true;
|
||||
}
|
||||
|
||||
protected void updateConnections() {
|
||||
|
||||
@ -13,6 +13,7 @@ import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
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.conusmeAmmo(conf.ammo);
|
||||
this.worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:weapon.tauShoot", 4.0F, 0.9F + worldObj.rand.nextFloat() * 0.3F);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("shot", true);
|
||||
this.networkPack(data, 250);
|
||||
|
||||
this.networkPackNT(250);
|
||||
|
||||
Vec3 pos = this.getTurretPos();
|
||||
Vec3 vec = Vec3.createVectorHelper(this.getBarrelLength(), 0, 0);
|
||||
@ -149,12 +148,15 @@ public class TileEntityTurretTauon extends TileEntityTurretBaseNT {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
|
||||
if(nbt.hasKey("shot"))
|
||||
beam = 3;
|
||||
else
|
||||
super.networkUnpack(nbt);
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeBoolean(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
this.beam = buf.readBoolean() ? 3 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -14,7 +14,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
public class BufferUtil {
|
||||
|
||||
private static final Charset CHARSET = StandardCharsets.UTF_8;
|
||||
|
||||
|
||||
// Writes a string to a byte buffer by encoding the length and raw bytes
|
||||
public static void writeString(ByteBuf buf, String value) {
|
||||
if(value == null) {
|
||||
@ -22,7 +22,7 @@ public class BufferUtil {
|
||||
return;
|
||||
}
|
||||
|
||||
buf.writeInt(value.length());
|
||||
buf.writeInt(value.getBytes(CHARSET).length);
|
||||
buf.writeBytes(value.getBytes(CHARSET));
|
||||
}
|
||||
|
||||
@ -37,6 +37,66 @@ public class BufferUtil {
|
||||
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.
|
||||
*/
|
||||
@ -52,23 +112,12 @@ public class BufferUtil {
|
||||
if (item.getItem().isDamageable() || item.getItem().getShareTag())
|
||||
nbtTagCompound = item.stackTagCompound;
|
||||
|
||||
if(nbtTagCompound != null) {
|
||||
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);
|
||||
}
|
||||
writeNBT(buf, nbtTagCompound);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads an ItemStack from a buffer
|
||||
* Reads an ItemStack from a buffer.
|
||||
*/
|
||||
public static ItemStack readItemStack(ByteBuf buf) {
|
||||
ItemStack item = null;
|
||||
@ -78,16 +127,7 @@ public class BufferUtil {
|
||||
byte quantity = buf.readByte();
|
||||
short meta = buf.readShort();
|
||||
item = new ItemStack(Item.getItemById(id), quantity, meta);
|
||||
|
||||
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();
|
||||
}
|
||||
item.stackTagCompound = readNBT(buf);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user