mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
commit
95a6fa5a76
@ -30,6 +30,7 @@ import api.hbm.tile.IHeatSource;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@ -220,38 +221,47 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro
|
||||
this.wasteStack.removeIf(x -> x.amount <= 0);
|
||||
|
||||
/* sync */
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
int[] rec = new int[recipeStack.size() * 2];
|
||||
int[] was = new int[wasteStack.size() * 2];
|
||||
for(int i = 0; i < recipeStack.size(); i++) { MaterialStack sta = recipeStack.get(i); rec[i * 2] = sta.material.id; rec[i * 2 + 1] = sta.amount; }
|
||||
for(int i = 0; i < wasteStack.size(); i++) { MaterialStack sta = wasteStack.get(i); was[i * 2] = sta.material.id; was[i * 2 + 1] = sta.amount; }
|
||||
data.setIntArray("rec", rec);
|
||||
data.setIntArray("was", was);
|
||||
data.setInteger("progress", progress);
|
||||
data.setInteger("heat", heat);
|
||||
this.networkPack(data, 25);
|
||||
this.networkPackNT(25);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.recipeStack.clear();
|
||||
this.wasteStack.clear();
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeInt(progress);
|
||||
buf.writeInt(heat);
|
||||
|
||||
int[] rec = nbt.getIntArray("rec");
|
||||
for(int i = 0; i < rec.length / 2; i++) {
|
||||
recipeStack.add(new MaterialStack(Mats.matById.get(rec[i * 2]), rec[i * 2 + 1]));
|
||||
buf.writeShort(recipeStack.size());
|
||||
for(MaterialStack sta : recipeStack) {
|
||||
buf.writeInt(sta.material.id);
|
||||
buf.writeInt(sta.amount);
|
||||
}
|
||||
|
||||
int[] was = nbt.getIntArray("was");
|
||||
for(int i = 0; i < was.length / 2; i++) {
|
||||
wasteStack.add(new MaterialStack(Mats.matById.get(was[i * 2]), was[i * 2 + 1]));
|
||||
buf.writeShort(wasteStack.size());
|
||||
for(MaterialStack sta : wasteStack) {
|
||||
buf.writeInt(sta.material.id);
|
||||
buf.writeInt(sta.amount);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
progress = buf.readInt();
|
||||
heat = buf.readInt();
|
||||
|
||||
recipeStack.clear();
|
||||
wasteStack.clear();
|
||||
|
||||
int mats = buf.readShort();
|
||||
for(int i = 0; i < mats; i++) {
|
||||
recipeStack.add(new MaterialStack(Mats.matById.get(buf.readInt()), buf.readInt()));
|
||||
}
|
||||
|
||||
this.progress = nbt.getInteger("progress");
|
||||
this.heat = nbt.getInteger("heat");
|
||||
mats = buf.readShort();
|
||||
for(int i = 0; i < mats; i++) {
|
||||
wasteStack.add(new MaterialStack(Mats.matById.get(buf.readInt()), buf.readInt()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -16,6 +16,7 @@ import com.hbm.main.MainRegistry;
|
||||
import com.hbm.sound.AudioWrapper;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import com.hbm.util.ContaminationUtil;
|
||||
import com.hbm.util.ContaminationUtil.ContaminationType;
|
||||
import com.hbm.util.ContaminationUtil.HazardType;
|
||||
@ -23,6 +24,7 @@ import com.hbm.util.ContaminationUtil.HazardType;
|
||||
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.block.Block;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@ -176,13 +178,7 @@ public class TileEntityFEL extends TileEntityMachineBase implements IEnergyRecei
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
data.setString("mode", mode.toString());
|
||||
data.setBoolean("isOn", isOn);
|
||||
data.setBoolean("valid", missingValidSilex);
|
||||
data.setInteger("distance", distance);
|
||||
this.networkPack(data, 250);
|
||||
this.networkPackNT(250);
|
||||
} else {
|
||||
|
||||
if(power > powerReq * Math.pow(2, mode.ordinal()) && isOn && !(mode == EnumWavelengths.NULL) && distance - 3 > 0) {
|
||||
@ -224,16 +220,25 @@ public class TileEntityFEL extends TileEntityMachineBase implements IEnergyRecei
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.mode = EnumWavelengths.valueOf(nbt.getString("mode"));
|
||||
this.isOn = nbt.getBoolean("isOn");
|
||||
this.distance = nbt.getInteger("distance");
|
||||
this.missingValidSilex = nbt.getBoolean("valid");
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(power);
|
||||
BufferUtil.writeString(buf, mode.toString());
|
||||
buf.writeBoolean(isOn);
|
||||
buf.writeBoolean(missingValidSilex);
|
||||
buf.writeInt(distance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
power = buf.readLong();
|
||||
mode = EnumWavelengths.valueOf(BufferUtil.readString(buf));
|
||||
isOn = buf.readBoolean();
|
||||
missingValidSilex = buf.readBoolean();
|
||||
distance = buf.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -17,6 +17,7 @@ import api.hbm.fluid.IFluidStandardSender;
|
||||
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.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@ -121,14 +122,7 @@ public abstract class TileEntityFireboxBase extends TileEntityMachinePolluting i
|
||||
this.burnHeat = 0;
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("maxBurnTime", this.maxBurnTime);
|
||||
data.setInteger("burnTime", this.burnTime);
|
||||
data.setInteger("burnHeat", this.burnHeat);
|
||||
data.setInteger("heatEnergy", this.heatEnergy);
|
||||
data.setInteger("playersUsing", this.playersUsing);
|
||||
data.setBoolean("wasOn", this.wasOn);
|
||||
this.networkPack(data, 50);
|
||||
this.networkPackNT(50);
|
||||
} else {
|
||||
this.prevDoorAngle = this.doorAngle;
|
||||
float swingSpeed = (doorAngle / 10F) + 3;
|
||||
@ -151,6 +145,28 @@ public abstract class TileEntityFireboxBase extends TileEntityMachinePolluting i
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeInt(maxBurnTime);
|
||||
buf.writeInt(burnTime);
|
||||
buf.writeInt(burnHeat);
|
||||
buf.writeInt(heatEnergy);
|
||||
buf.writeInt(playersUsing);
|
||||
buf.writeBoolean(wasOn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
maxBurnTime = buf.readInt();
|
||||
burnTime = buf.readInt();
|
||||
burnHeat = buf.readInt();
|
||||
heatEnergy = buf.readInt();
|
||||
playersUsing = buf.readInt();
|
||||
wasOn = buf.readBoolean();
|
||||
}
|
||||
|
||||
public static EnumAshType getAshFromFuel(ItemStack stack) {
|
||||
|
||||
List<String> names = ItemStackUtil.getOreDictNames(stack);
|
||||
@ -181,18 +197,6 @@ public abstract class TileEntityFireboxBase extends TileEntityMachinePolluting i
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
|
||||
return getModule().getBurnTime(itemStack) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.maxBurnTime = nbt.getInteger("maxBurnTime");
|
||||
this.burnTime = nbt.getInteger("burnTime");
|
||||
this.burnHeat = nbt.getInteger("burnHeat");
|
||||
this.heatEnergy = nbt.getInteger("heatEnergy");
|
||||
this.playersUsing = nbt.getInteger("playersUsing");
|
||||
this.wasOn = nbt.getBoolean("wasOn");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
|
||||
@ -18,6 +18,7 @@ import api.hbm.fluid.IFluidStandardSender;
|
||||
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.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -128,12 +129,7 @@ public class TileEntityFurnaceCombination extends TileEntityMachinePolluting imp
|
||||
this.progress = 0;
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("wasOn", this.wasOn);
|
||||
data.setInteger("heat", this.heat);
|
||||
data.setInteger("progress", this.progress);
|
||||
tank.writeToNBT(data, "t");
|
||||
this.networkPack(data, 50);
|
||||
this.networkPackNT(50);
|
||||
} else {
|
||||
|
||||
if(this.wasOn && worldObj.rand.nextInt(15) == 0) {
|
||||
@ -142,6 +138,24 @@ public class TileEntityFurnaceCombination extends TileEntityMachinePolluting imp
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeBoolean(wasOn);
|
||||
buf.writeInt(heat);
|
||||
buf.writeInt(progress);
|
||||
tank.serialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
wasOn = buf.readBoolean();
|
||||
heat = buf.readInt();
|
||||
progress = buf.readInt();
|
||||
tank.deserialize(buf);
|
||||
}
|
||||
|
||||
public boolean canSmelt() {
|
||||
if(slots[0] == null) return false;
|
||||
Pair<ItemStack, FluidStack> pair = CombinationRecipes.getOutput(slots[0]);
|
||||
@ -165,16 +179,6 @@ public class TileEntityFurnaceCombination extends TileEntityMachinePolluting imp
|
||||
|
||||
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");
|
||||
this.tank.readFromNBT(nbt, "t");
|
||||
}
|
||||
|
||||
protected void tryPullHeat() {
|
||||
|
||||
|
||||
@ -16,6 +16,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;
|
||||
@ -94,23 +95,28 @@ public class TileEntityHeaterOilburner extends TileEntityMachinePolluting implem
|
||||
if(shouldCool)
|
||||
this.heatEnergy = Math.max(this.heatEnergy - Math.max(this.heatEnergy / 1000, 1), 0);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
tank.writeToNBT(data, "tank");
|
||||
data.setBoolean("isOn", isOn);
|
||||
data.setInteger("h", heatEnergy);
|
||||
data.setByte("s", (byte) this.setting);
|
||||
this.networkPack(data, 25);
|
||||
this.networkPackNT(25);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
tank.serialize(buf);
|
||||
|
||||
tank.readFromNBT(nbt, "tank");
|
||||
isOn = nbt.getBoolean("isOn");
|
||||
heatEnergy = nbt.getInteger("h");
|
||||
setting = nbt.getByte("s");
|
||||
buf.writeBoolean(isOn);
|
||||
buf.writeInt(heatEnergy);
|
||||
buf.writeByte((byte) this.setting);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
tank.deserialize(buf);
|
||||
|
||||
isOn = buf.readBoolean();
|
||||
heatEnergy = buf.readInt();
|
||||
setting = buf.readByte();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -29,6 +29,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;
|
||||
@ -135,21 +136,48 @@ public class TileEntityMachineArcWelder extends TileEntityMachineBase implements
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(power);
|
||||
buf.writeLong(maxPower);
|
||||
buf.writeLong(consumption);
|
||||
buf.writeInt(progress);
|
||||
buf.writeInt(processTime);
|
||||
|
||||
tank.serialize(buf);
|
||||
|
||||
ArcWelderRecipe recipe = ArcWelderRecipes.getRecipe(slots[0], slots[1], slots[2]);
|
||||
|
||||
if(recipe != null) {
|
||||
buf.writeBoolean(true);
|
||||
buf.writeInt(Item.getIdFromItem(recipe.output.getItem()));
|
||||
buf.writeInt(recipe.output.getItemDamage());
|
||||
} else
|
||||
buf.writeBoolean(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
power = buf.readLong();
|
||||
maxPower = buf.readLong();
|
||||
consumption = buf.readLong();
|
||||
progress = buf.readInt();
|
||||
processTime = buf.readInt();
|
||||
|
||||
tank.deserialize(buf);
|
||||
|
||||
if(buf.readBoolean()) {
|
||||
this.display = new ItemStack(Item.getItemById(buf.readInt()), 1, buf.readInt());
|
||||
} else
|
||||
this.display = null;
|
||||
}
|
||||
|
||||
public boolean canProcess(ArcWelderRecipe recipe) {
|
||||
|
||||
if(this.power < this.consumption) return false;
|
||||
@ -204,25 +232,6 @@ public class TileEntityMachineArcWelder extends TileEntityMachineBase implements
|
||||
new DirPos(xCoord - dir.offsetX - rot.offsetX * 2, yCoord, zCoord - dir.offsetZ - rot.offsetZ * 2, rot.getOpposite())
|
||||
};
|
||||
}
|
||||
|
||||
@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"));
|
||||
} else {
|
||||
this.display = null;
|
||||
}
|
||||
|
||||
this.tank.readFromNBT(nbt, "t");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
|
||||
@ -23,6 +23,7 @@ import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
import api.hbm.energymk2.IBatteryItem;
|
||||
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,7 @@ public class TileEntityMachineAssembler extends TileEntityMachineAssemblerBase i
|
||||
rec = AssemblerRecipes.recipeList.indexOf(comp);
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
data.setIntArray("progress", this.progress);
|
||||
data.setIntArray("maxProgress", this.maxProgress);
|
||||
data.setBoolean("isProgressing", isProgressing);
|
||||
data.setInteger("recipe", rec);
|
||||
this.networkPack(data, 150);
|
||||
this.networkPackNT(150);
|
||||
} else {
|
||||
|
||||
float volume = this.getVolume(2F);
|
||||
@ -142,16 +137,31 @@ public class TileEntityMachineAssembler extends TileEntityMachineAssemblerBase i
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(power);
|
||||
for(int i = 0; i < getRecipeCount(); i++) {
|
||||
buf.writeInt(progress[i]);
|
||||
buf.writeInt(maxProgress[i]);
|
||||
}
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.progress = nbt.getIntArray("progress");
|
||||
this.maxProgress = nbt.getIntArray("maxProgress");
|
||||
this.isProgressing = nbt.getBoolean("isProgressing");
|
||||
this.recipe = nbt.getInteger("recipe");
|
||||
buf.writeBoolean(isProgressing);
|
||||
buf.writeInt(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
power = buf.readLong();
|
||||
for(int i = 0; i < getRecipeCount(); i++) {
|
||||
progress[i] = buf.readInt();
|
||||
maxProgress[i] = buf.readInt();
|
||||
}
|
||||
|
||||
isProgressing = buf.readBoolean();
|
||||
recipe = buf.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -20,6 +20,7 @@ import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -93,16 +94,7 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im
|
||||
this.sendFluid(steam, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", this.power);
|
||||
data.setIntArray("progress", this.progress);
|
||||
data.setIntArray("maxProgress", this.maxProgress);
|
||||
data.setBoolean("isProgressing", isProgressing);
|
||||
|
||||
water.writeToNBT(data, "w");
|
||||
steam.writeToNBT(data, "s");
|
||||
|
||||
this.networkPack(data, 150);
|
||||
this.networkPackNT(150);
|
||||
|
||||
} else {
|
||||
|
||||
@ -114,7 +106,33 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(power);
|
||||
for(int i = 0; i < getRecipeCount(); i++) {
|
||||
buf.writeInt(progress[i]);
|
||||
buf.writeInt(maxProgress[i]);
|
||||
}
|
||||
buf.writeBoolean(isProgressing);
|
||||
water.serialize(buf);
|
||||
steam.serialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
power = buf.readLong();
|
||||
for(int i = 0; i < getRecipeCount(); i++) {
|
||||
progress[i] = buf.readInt();
|
||||
maxProgress[i] = buf.readInt();
|
||||
}
|
||||
isProgressing = buf.readBoolean();
|
||||
water.deserialize(buf);
|
||||
steam.deserialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
@ -8,11 +8,13 @@ import com.hbm.inventory.gui.GUIAutocrafter;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import com.hbm.util.ItemStackUtil;
|
||||
|
||||
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;
|
||||
@ -193,33 +195,38 @@ public class TileEntityMachineAutocrafter extends TileEntityMachineBase implemen
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
for(int i = 0; i < 9; i++) {
|
||||
if(modes[i] != null) {
|
||||
data.setString("mode" + i, modes[i]);
|
||||
}
|
||||
}
|
||||
data.setInteger("count", this.recipeCount);
|
||||
data.setInteger("rec", this.recipeIndex);
|
||||
this.networkPack(data, 15);
|
||||
this.networkPackNT(15);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
super.networkUnpack(data);
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(power);
|
||||
for(int i = 0; i < 9; i++) {
|
||||
if(modes[i] != null) {
|
||||
buf.writeBoolean(true);
|
||||
BufferUtil.writeString(buf, modes[i]);
|
||||
} else
|
||||
buf.writeBoolean(false);
|
||||
}
|
||||
|
||||
this.power = data.getLong("power");
|
||||
buf.writeInt(recipeCount);
|
||||
buf.writeInt(recipeIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
power = buf.readLong();
|
||||
|
||||
modes = new String[9];
|
||||
for(int i = 0; i < 9; i++) {
|
||||
if(data.hasKey("mode" + i)) {
|
||||
modes[i] = data.getString("mode" + i);
|
||||
}
|
||||
if(buf.readBoolean()) modes[i] = BufferUtil.readString(buf);
|
||||
}
|
||||
this.recipeCount = data.getInteger("count");
|
||||
this.recipeIndex = data.getInteger("rec");
|
||||
|
||||
recipeCount = buf.readInt();
|
||||
recipeIndex = buf.readInt();
|
||||
}
|
||||
|
||||
public void updateTemplateGrid() {
|
||||
|
||||
@ -22,6 +22,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;
|
||||
@ -198,11 +199,7 @@ public class TileEntityMachineCentrifuge extends TileEntityMachineBase implement
|
||||
progress = 0;
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
data.setInteger("progress", progress);
|
||||
data.setBoolean("isProgressing", isProgressing);
|
||||
this.networkPack(data, 50);
|
||||
this.networkPackNT(50);
|
||||
} else {
|
||||
|
||||
if(isProgressing) {
|
||||
@ -234,14 +231,21 @@ public class TileEntityMachineCentrifuge extends TileEntityMachineBase implement
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
super.networkUnpack(data);
|
||||
|
||||
this.power = data.getLong("power");
|
||||
this.progress = data.getInteger("progress");
|
||||
this.isProgressing = data.getBoolean("isProgressing");
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(power);
|
||||
buf.writeInt(progress);
|
||||
buf.writeBoolean(isProgressing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
power = buf.readLong();
|
||||
progress = buf.readInt();
|
||||
isProgressing = buf.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -21,6 +21,7 @@ import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
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;
|
||||
@ -101,19 +102,7 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase imp
|
||||
this.speed = 1;
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", this.power);
|
||||
data.setIntArray("progress", this.progress);
|
||||
data.setIntArray("maxProgress", this.maxProgress);
|
||||
data.setBoolean("isProgressing", isProgressing);
|
||||
|
||||
for(int i = 0; i < tanks.length; i++) {
|
||||
tanks[i].writeToNBT(data, "t" + i);
|
||||
}
|
||||
water.writeToNBT(data, "w");
|
||||
steam.writeToNBT(data, "s");
|
||||
|
||||
this.networkPack(data, 150);
|
||||
this.networkPackNT(150);
|
||||
} else {
|
||||
|
||||
float maxSpeed = 30F;
|
||||
@ -156,21 +145,39 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase imp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.progress = nbt.getIntArray("progress");
|
||||
this.maxProgress = nbt.getIntArray("maxProgress");
|
||||
this.isProgressing = nbt.getBoolean("isProgressing");
|
||||
|
||||
for(int i = 0; i < tanks.length; i++) {
|
||||
tanks[i].readFromNBT(nbt, "t" + i);
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(power);
|
||||
for(int i = 0; i < getRecipeCount(); i++) {
|
||||
buf.writeInt(progress[i]);
|
||||
buf.writeInt(maxProgress[i]);
|
||||
}
|
||||
water.readFromNBT(nbt, "w");
|
||||
steam.readFromNBT(nbt, "s");
|
||||
|
||||
buf.writeBoolean(isProgressing);
|
||||
|
||||
for(int i = 0; i < tanks.length; i++) tanks[i].serialize(buf);
|
||||
|
||||
water.serialize(buf);
|
||||
steam.serialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
power = buf.readLong();
|
||||
for(int i = 0; i < getRecipeCount(); i++) {
|
||||
progress[i] = buf.readInt();
|
||||
maxProgress[i] = buf.readInt();
|
||||
}
|
||||
|
||||
isProgressing = buf.readBoolean();
|
||||
|
||||
for(int i = 0; i < tanks.length; i++) tanks[i].deserialize(buf);
|
||||
|
||||
water.deserialize(buf);
|
||||
steam.deserialize(buf);
|
||||
}
|
||||
|
||||
private int getWaterRequired() {
|
||||
|
||||
@ -27,6 +27,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;
|
||||
@ -97,13 +98,7 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setShort("progress", progress);
|
||||
data.setShort("duration", getDuration());
|
||||
data.setLong("power", power);
|
||||
data.setBoolean("isOn", isOn);
|
||||
tank.writeToNBT(data, "t");
|
||||
this.networkPack(data, 25);
|
||||
this.networkPackNT(25);
|
||||
} else {
|
||||
|
||||
prevAngle = angle;
|
||||
@ -154,14 +149,24 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme
|
||||
};
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
super.networkUnpack(data);
|
||||
|
||||
this.power = data.getLong("power");
|
||||
this.progress = data.getShort("progress");
|
||||
this.duration = data.getShort("duration");
|
||||
this.isOn = data.getBoolean("isOn");
|
||||
this.tank.readFromNBT(data, "t");
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeShort(progress);
|
||||
buf.writeShort(getDuration());
|
||||
buf.writeLong(power);
|
||||
buf.writeBoolean(isOn);
|
||||
tank.serialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
progress = buf.readShort();
|
||||
duration = buf.readShort();
|
||||
power = buf.readLong();
|
||||
isOn = buf.readBoolean();
|
||||
tank.deserialize(buf);
|
||||
}
|
||||
|
||||
private void processItem() {
|
||||
|
||||
@ -20,6 +20,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;
|
||||
@ -219,12 +220,8 @@ public class TileEntityMachineElectricFurnace extends TileEntityMachineBase impl
|
||||
markDirty = true;
|
||||
MachineElectricFurnace.updateBlockState(this.progress > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", this.power);
|
||||
data.setInteger("MaxProgress", this.maxProgress);
|
||||
data.setInteger("progress", this.progress);
|
||||
this.networkPack(data, 50);
|
||||
|
||||
this.networkPackNT(50);
|
||||
|
||||
|
||||
if(markDirty) {
|
||||
@ -232,22 +229,29 @@ public class TileEntityMachineElectricFurnace extends TileEntityMachineBase impl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(power);
|
||||
buf.writeInt(maxProgress);
|
||||
buf.writeInt(progress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
power = buf.readLong();
|
||||
maxProgress = buf.readInt();
|
||||
progress = buf.readInt();
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.maxProgress = nbt.getInteger("MaxProgress");
|
||||
this.progress = nbt.getInteger("progress");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
power = i;
|
||||
|
||||
@ -40,6 +40,7 @@ import api.hbm.fluid.IFluidStandardReceiver;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
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.item.EntityItem;
|
||||
@ -150,18 +151,7 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
|
||||
this.targetDepth = 0;
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("d", enableDrill);
|
||||
data.setBoolean("c", enableCrusher);
|
||||
data.setBoolean("w", enableWalling);
|
||||
data.setBoolean("v", enableVeinMiner);
|
||||
data.setBoolean("s", enableSilkTouch);
|
||||
data.setBoolean("o", operational);
|
||||
data.setInteger("t", targetDepth);
|
||||
data.setInteger("g", chuteTimer);
|
||||
data.setLong("p", power);
|
||||
tank.writeToNBT(data, "tank");
|
||||
this.networkPack(data, 150);
|
||||
this.networkPackNT(150);
|
||||
|
||||
} else {
|
||||
|
||||
@ -214,19 +204,34 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
|
||||
};
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.enableDrill = nbt.getBoolean("d");
|
||||
this.enableCrusher = nbt.getBoolean("c");
|
||||
this.enableWalling = nbt.getBoolean("w");
|
||||
this.enableVeinMiner = nbt.getBoolean("v");
|
||||
this.enableSilkTouch = nbt.getBoolean("s");
|
||||
this.operational = nbt.getBoolean("o");
|
||||
this.targetDepth = nbt.getInteger("t");
|
||||
this.chuteTimer = nbt.getInteger("g");
|
||||
this.power = nbt.getLong("p");
|
||||
this.tank.readFromNBT(nbt, "tank");
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeBoolean(enableDrill);
|
||||
buf.writeBoolean(enableCrusher);
|
||||
buf.writeBoolean(enableWalling);
|
||||
buf.writeBoolean(enableVeinMiner);
|
||||
buf.writeBoolean(enableSilkTouch);
|
||||
buf.writeBoolean(operational);
|
||||
buf.writeInt(targetDepth);
|
||||
buf.writeInt(chuteTimer);
|
||||
buf.writeLong(power);
|
||||
tank.serialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
enableDrill = buf.readBoolean();
|
||||
enableCrusher = buf.readBoolean();
|
||||
enableWalling = buf.readBoolean();
|
||||
enableVeinMiner = buf.readBoolean();
|
||||
enableSilkTouch = buf.readBoolean();
|
||||
operational = buf.readBoolean();
|
||||
targetDepth = buf.readInt();
|
||||
chuteTimer = buf.readInt();
|
||||
power = buf.readLong();
|
||||
tank.deserialize(buf);
|
||||
}
|
||||
|
||||
protected int getY() {
|
||||
|
||||
@ -15,6 +15,7 @@ import com.hbm.packet.LoopedSoundPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
@ -25,6 +26,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.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -168,19 +170,6 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
return false;
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
super.networkUnpack(data);
|
||||
|
||||
this.power = data.getLong("power");
|
||||
this.progress = data.getInteger("progress");
|
||||
this.isProgressing = data.getBoolean("isProgressing");
|
||||
this.inputTank.setTankType(PseudoFluidType.types.get(data.getString("inputType")));
|
||||
this.outputTank.setTankType(PseudoFluidType.types.get(data.getString("outputType")));
|
||||
this.inputTank.setFill(data.getInteger("inputFill"));
|
||||
this.outputTank.setFill(data.getInteger("outputFill"));
|
||||
this.tank.readFromNBT(data, "t");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
@ -234,21 +223,42 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
data.setInteger("progress", progress);
|
||||
data.setBoolean("isProgressing", isProgressing);
|
||||
data.setInteger("inputFill", inputTank.getFill());
|
||||
data.setInteger("outputFill", outputTank.getFill());
|
||||
data.setString("inputType", inputTank.getTankType().name);
|
||||
data.setString("outputType", outputTank.getTankType().name);
|
||||
tank.writeToNBT(data, "t");
|
||||
this.networkPack(data, 50);
|
||||
this.networkPackNT(50);
|
||||
|
||||
PacketDispatcher.wrapper.sendToAllAround(new LoopedSoundPacket(xCoord, yCoord, zCoord), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(power);
|
||||
buf.writeInt(progress);
|
||||
buf.writeBoolean(isProgressing);
|
||||
//pseudofluids can be refactored another day
|
||||
buf.writeInt(inputTank.getFill());
|
||||
buf.writeInt(outputTank.getFill());
|
||||
BufferUtil.writeString(buf, inputTank.getTankType().name); //cough cough
|
||||
BufferUtil.writeString(buf, outputTank.getTankType().name);
|
||||
|
||||
tank.serialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
power = buf.readLong();
|
||||
progress = buf.readInt();
|
||||
isProgressing = buf.readBoolean();
|
||||
|
||||
inputTank.setFill(buf.readInt());
|
||||
outputTank.setFill(buf.readInt());
|
||||
inputTank.setTankType(PseudoFluidType.types.get(BufferUtil.readString(buf)));
|
||||
outputTank.setTankType(PseudoFluidType.types.get(BufferUtil.readString(buf)));
|
||||
|
||||
tank.deserialize(buf);
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
|
||||
@ -25,6 +25,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;
|
||||
@ -121,7 +122,7 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB
|
||||
for(int i = 0; i < 3; i++) {
|
||||
tanks[i].writeToNBT(data, i + "");
|
||||
}
|
||||
this.networkPack(data, 50);
|
||||
this.networkPackNT(50);
|
||||
|
||||
} else {
|
||||
|
||||
@ -137,6 +138,30 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(power);
|
||||
buf.writeInt(processTime);
|
||||
buf.writeInt(progress);
|
||||
buf.writeInt(recipeIndex);
|
||||
buf.writeBoolean(wasOn);
|
||||
|
||||
for(int i = 0; i < tanks.length; i++) tanks[i].serialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
power = buf.readLong();
|
||||
processTime = buf.readInt();
|
||||
progress = buf.readInt();
|
||||
recipeIndex = buf.readInt();
|
||||
wasOn = buf.readBoolean();
|
||||
|
||||
for(int i = 0; i < tanks.length; i++) tanks[i].deserialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
|
||||
@ -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;
|
||||
@ -126,15 +127,7 @@ public class TileEntityMachineWoodBurner extends TileEntityMachineBase implement
|
||||
this.power += this.powerGen;
|
||||
if(this.power > this.maxPower) this.power = this.maxPower;
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
data.setInteger("burnTime", burnTime);
|
||||
data.setInteger("powerGen", powerGen);
|
||||
data.setInteger("maxBurnTime", maxBurnTime);
|
||||
data.setBoolean("isOn", isOn);
|
||||
data.setBoolean("liquidBurn", liquidBurn);
|
||||
tank.writeToNBT(data, "t");
|
||||
this.networkPack(data, 25);
|
||||
this.networkPackNT(25);
|
||||
} else {
|
||||
|
||||
if(powerGen > 0) {
|
||||
@ -145,6 +138,32 @@ public class TileEntityMachineWoodBurner extends TileEntityMachineBase implement
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(power);
|
||||
buf.writeInt(burnTime);
|
||||
buf.writeInt(powerGen);
|
||||
buf.writeInt(maxBurnTime);
|
||||
buf.writeBoolean(isOn);
|
||||
buf.writeBoolean(liquidBurn);
|
||||
|
||||
tank.serialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
power = buf.readLong();
|
||||
burnTime = buf.readInt();
|
||||
powerGen = buf.readInt();
|
||||
maxBurnTime = buf.readInt();
|
||||
isOn = buf.readBoolean();
|
||||
liquidBurn = buf.readBoolean();
|
||||
|
||||
tank.deserialize(buf);
|
||||
}
|
||||
|
||||
private DirPos[] getConPos() {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
@ -153,20 +172,7 @@ public class TileEntityMachineWoodBurner extends TileEntityMachineBase implement
|
||||
new DirPos(xCoord - dir.offsetX * 2 + rot.offsetX, yCoord, zCoord - dir.offsetZ * 2 + rot.offsetZ, dir.getOpposite())
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.powerGen = nbt.getInteger("powerGen");
|
||||
this.burnTime = nbt.getInteger("burnTime");
|
||||
this.maxBurnTime = nbt.getInteger("maxBurnTime");
|
||||
this.isOn = nbt.getBoolean("isOn");
|
||||
this.liquidBurn = nbt.getBoolean("liquidBurn");
|
||||
tank.readFromNBT(nbt, "t");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
@ -15,6 +15,7 @@ import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemFELCrystal.EnumWavelengths;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
import com.hbm.util.WeightedRandomObject;
|
||||
@ -23,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;
|
||||
@ -84,38 +86,42 @@ public class TileEntitySILEX extends TileEntityMachineBase implements IFluidAcce
|
||||
if(currentFill <= 0) {
|
||||
current = null;
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("fill", currentFill);
|
||||
data.setInteger("progress", progress);
|
||||
data.setString("mode", mode.toString());
|
||||
|
||||
if(this.current != null) {
|
||||
data.setInteger("item", Item.getIdFromItem(this.current.item));
|
||||
data.setInteger("meta", this.current.meta);
|
||||
}
|
||||
|
||||
tank.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
|
||||
this.networkPack(data, 50);
|
||||
|
||||
this.networkPackNT(50);
|
||||
|
||||
this.mode = EnumWavelengths.NULL;
|
||||
}
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.currentFill = nbt.getInteger("fill");
|
||||
this.progress = nbt.getInteger("progress");
|
||||
this.mode = EnumWavelengths.valueOf(nbt.getString("mode"));
|
||||
|
||||
if(this.currentFill > 0) {
|
||||
this.current = new ComparableStack(Item.getItemById(nbt.getInteger("item")), 1, nbt.getInteger("meta"));
|
||||
|
||||
} else {
|
||||
this.current = null;
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeInt(currentFill);
|
||||
buf.writeInt(progress);
|
||||
BufferUtil.writeString(buf, mode.toString());
|
||||
|
||||
tank.serialize(buf);
|
||||
|
||||
if(this.current != null) {
|
||||
buf.writeInt(Item.getIdFromItem(this.current.item));
|
||||
buf.writeInt(this.current.meta);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
currentFill = buf.readInt();
|
||||
progress = buf.readInt();
|
||||
mode = EnumWavelengths.valueOf(BufferUtil.readString(buf));
|
||||
|
||||
tank.deserialize(buf);
|
||||
|
||||
if(currentFill > 0) {
|
||||
current = new ComparableStack(Item.getItemById(buf.readInt()), 1, buf.readInt());
|
||||
} else
|
||||
current = null;
|
||||
}
|
||||
|
||||
public void handleButtonPacket(int value, int meta) {
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user