mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
yeah these are commits from like a month ago idk what any of this is
This commit is contained in:
parent
88f5ac1cf1
commit
063ab4032f
@ -7,6 +7,7 @@ import com.google.gson.stream.JsonWriter;
|
|||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
import com.hbm.saveddata.TomSaveData;
|
import com.hbm.saveddata.TomSaveData;
|
||||||
|
import com.hbm.tileentity.IBufPacketReceiver;
|
||||||
import com.hbm.tileentity.IFluidCopiable;
|
import com.hbm.tileentity.IFluidCopiable;
|
||||||
import com.hbm.tileentity.IConfigurableMachine;
|
import com.hbm.tileentity.IConfigurableMachine;
|
||||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||||
|
|||||||
@ -234,13 +234,19 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro
|
|||||||
|
|
||||||
buf.writeShort(recipeStack.size());
|
buf.writeShort(recipeStack.size());
|
||||||
for(MaterialStack sta : recipeStack) {
|
for(MaterialStack sta : recipeStack) {
|
||||||
buf.writeInt(sta.material.id);
|
if (sta.material == null)
|
||||||
|
buf.writeInt(-1);
|
||||||
|
else
|
||||||
|
buf.writeInt(sta.material.id);
|
||||||
buf.writeInt(sta.amount);
|
buf.writeInt(sta.amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.writeShort(wasteStack.size());
|
buf.writeShort(wasteStack.size());
|
||||||
for(MaterialStack sta : wasteStack) {
|
for(MaterialStack sta : wasteStack) {
|
||||||
buf.writeInt(sta.material.id);
|
if (sta.material == null)
|
||||||
|
buf.writeInt(-1);
|
||||||
|
else
|
||||||
|
buf.writeInt(sta.material.id);
|
||||||
buf.writeInt(sta.amount);
|
buf.writeInt(sta.amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -256,12 +262,18 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro
|
|||||||
|
|
||||||
int mats = buf.readShort();
|
int mats = buf.readShort();
|
||||||
for(int i = 0; i < mats; i++) {
|
for(int i = 0; i < mats; i++) {
|
||||||
recipeStack.add(new MaterialStack(Mats.matById.get(buf.readInt()), buf.readInt()));
|
int id = buf.readInt();
|
||||||
|
if (id == -1)
|
||||||
|
continue;
|
||||||
|
recipeStack.add(new MaterialStack(Mats.matById.get(id), buf.readInt()));
|
||||||
}
|
}
|
||||||
|
|
||||||
mats = buf.readShort();
|
mats = buf.readShort();
|
||||||
for(int i = 0; i < mats; i++) {
|
for(int i = 0; i < mats; i++) {
|
||||||
wasteStack.add(new MaterialStack(Mats.matById.get(buf.readInt()), buf.readInt()));
|
int id = buf.readInt();
|
||||||
|
if (id == -1)
|
||||||
|
continue;
|
||||||
|
wasteStack.add(new MaterialStack(Mats.matById.get(id), buf.readInt()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -150,9 +150,9 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement
|
|||||||
super.deserialize(buf);
|
super.deserialize(buf);
|
||||||
this.power = buf.readLong();
|
this.power = buf.readLong();
|
||||||
this.heat = buf.readInt();
|
this.heat = buf.readInt();
|
||||||
tanks[0].serialize(buf);
|
tanks[0].deserialize(buf);
|
||||||
tanks[1].serialize(buf);
|
tanks[1].deserialize(buf);
|
||||||
tanks[2].serialize(buf);
|
tanks[2].deserialize(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DirPos[] getConPos() {
|
protected DirPos[] getConPos() {
|
||||||
|
|||||||
@ -116,9 +116,10 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase
|
|||||||
lastCastTick = worldObj.getWorldTime();
|
lastCastTick = worldObj.getWorldTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
sendStandard(150);
|
sendStandard(150);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +191,7 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean standardCheck(World world, int x, int y, int z, ForgeDirection side, Mats.MaterialStack stack) {
|
public boolean standardCheck(World world, int x, int y, int z, ForgeDirection side, Mats.MaterialStack stack) {
|
||||||
@ -257,12 +258,14 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase
|
|||||||
return new GUIMachineStrandCaster(player.inventory, this);
|
return new GUIMachineStrandCaster(player.inventory, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void serialize(ByteBuf buf) {
|
@Override
|
||||||
|
public void serialize(ByteBuf buf) {
|
||||||
water.serialize(buf);
|
water.serialize(buf);
|
||||||
steam.serialize(buf);
|
steam.serialize(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void deserialize(ByteBuf buf) {
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
water.deserialize(buf);
|
water.deserialize(buf);
|
||||||
steam.deserialize(buf);
|
steam.deserialize(buf);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -252,7 +252,7 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements
|
|||||||
this.power = buf.readLong();
|
this.power = buf.readLong();
|
||||||
this.isOn = buf.readBoolean();
|
this.isOn = buf.readBoolean();
|
||||||
this.doesBurn = buf.readBoolean();
|
this.doesBurn = buf.readBoolean();
|
||||||
tank.serialize(buf);
|
tank.deserialize(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -96,7 +96,7 @@ public class TileEntityMassStorage extends TileEntityCrateBase implements IBufPa
|
|||||||
public void serialize(ByteBuf buf) {
|
public void serialize(ByteBuf buf) {
|
||||||
buf.writeInt(this.stack);
|
buf.writeInt(this.stack);
|
||||||
buf.writeBoolean(this.output);
|
buf.writeBoolean(this.output);
|
||||||
BufferUtil.writeItemStack(buf, this.type);
|
BufferUtil.writeItemStack(buf, this.slots[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import com.hbm.packet.toclient.AuxParticlePacketNT;
|
|||||||
import com.hbm.particle.SpentCasing;
|
import com.hbm.particle.SpentCasing;
|
||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
|
import com.hbm.util.BufferUtil;
|
||||||
import com.hbm.util.CompatExternal;
|
import com.hbm.util.CompatExternal;
|
||||||
|
|
||||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||||
@ -256,12 +257,7 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
|
|||||||
@Override
|
@Override
|
||||||
public void serialize(ByteBuf buf) {
|
public void serialize(ByteBuf buf) {
|
||||||
super.serialize(buf);
|
super.serialize(buf);
|
||||||
buf.writeBoolean(this.tPos != null);
|
BufferUtil.writeVec3(buf, this.tPos);
|
||||||
if(this.tPos != null) {
|
|
||||||
buf.writeDouble(this.tPos.xCoord);
|
|
||||||
buf.writeDouble(this.tPos.yCoord);
|
|
||||||
buf.writeDouble(this.tPos.zCoord);
|
|
||||||
}
|
|
||||||
buf.writeDouble(this.rotationPitch);
|
buf.writeDouble(this.rotationPitch);
|
||||||
buf.writeDouble(this.rotationYaw);
|
buf.writeDouble(this.rotationYaw);
|
||||||
buf.writeLong(this.power);
|
buf.writeLong(this.power);
|
||||||
@ -276,12 +272,7 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
|
|||||||
@Override
|
@Override
|
||||||
public void deserialize(ByteBuf buf) {
|
public void deserialize(ByteBuf buf) {
|
||||||
super.deserialize(buf);
|
super.deserialize(buf);
|
||||||
boolean hasTPos = buf.readBoolean();
|
this.tPos = BufferUtil.readVec3(buf);
|
||||||
if(hasTPos) {
|
|
||||||
this.tPos.xCoord = buf.readDouble();
|
|
||||||
this.tPos.yCoord = buf.readDouble();
|
|
||||||
this.tPos.zCoord = buf.readDouble();
|
|
||||||
}
|
|
||||||
this.rotationPitch = buf.readDouble();
|
this.rotationPitch = buf.readDouble();
|
||||||
this.rotationYaw = buf.readDouble();
|
this.rotationYaw = buf.readDouble();
|
||||||
this.power = buf.readLong();
|
this.power = buf.readLong();
|
||||||
|
|||||||
@ -266,16 +266,15 @@ public class TileEntityTurretMaxwell extends TileEntityTurretBaseNT implements I
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serialize(ByteBuf buf) {
|
public void serialize(ByteBuf buf) {
|
||||||
super.serialize(buf);
|
|
||||||
buf.writeBoolean(true);
|
buf.writeBoolean(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deserialize(ByteBuf buf) {
|
public void deserialize(ByteBuf buf) {
|
||||||
super.deserialize(buf);
|
if(buf.readBoolean())
|
||||||
this.beam = buf.readBoolean() ? 5 : 0;
|
this.beam = 5;
|
||||||
|
else
|
||||||
|
this.beam = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -231,8 +231,8 @@ public class TileEntityTurretSentry extends TileEntityTurretBaseNT implements IG
|
|||||||
@Override
|
@Override
|
||||||
public void serialize(ByteBuf buf) {
|
public void serialize(ByteBuf buf) {
|
||||||
super.serialize(buf);
|
super.serialize(buf);
|
||||||
if(didJustShootLeft) buf.writeBoolean(didJustShootLeft);
|
buf.writeBoolean(didJustShootLeft);
|
||||||
if(didJustShootRight) buf.writeBoolean(didJustShootRight);
|
buf.writeBoolean(didJustShootRight);
|
||||||
didJustShootLeft = false;
|
didJustShootLeft = false;
|
||||||
didJustShootRight = false;
|
didJustShootRight = false;
|
||||||
}
|
}
|
||||||
@ -240,8 +240,8 @@ public class TileEntityTurretSentry extends TileEntityTurretBaseNT implements IG
|
|||||||
@Override
|
@Override
|
||||||
public void deserialize(ByteBuf buf) {
|
public void deserialize(ByteBuf buf) {
|
||||||
super.deserialize(buf);
|
super.deserialize(buf);
|
||||||
if(buf.readBoolean()) this.retractingLeft = true;
|
this.retractingLeft = buf.readBoolean();
|
||||||
if(buf.readBoolean()) this.retractingRight = true;
|
this.retractingRight = buf.readBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateConnections() {
|
protected void updateConnections() {
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.nbt.CompressedStreamTools;
|
import net.minecraft.nbt.CompressedStreamTools;
|
||||||
import net.minecraft.nbt.NBTSizeTracker;
|
import net.minecraft.nbt.NBTSizeTracker;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
|
||||||
public class BufferUtil {
|
public class BufferUtil {
|
||||||
|
|
||||||
@ -62,6 +63,32 @@ public class BufferUtil {
|
|||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes a vector to a buffer.
|
||||||
|
*/
|
||||||
|
public static void writeVec3(ByteBuf buf, Vec3 vector) {
|
||||||
|
buf.writeBoolean(vector != null);
|
||||||
|
if(vector == null) return;
|
||||||
|
buf.writeDouble(vector.xCoord);
|
||||||
|
buf.writeDouble(vector.yCoord);
|
||||||
|
buf.writeDouble(vector.zCoord);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads a vector from a buffer.
|
||||||
|
*/
|
||||||
|
public static Vec3 readVec3(ByteBuf buf) {
|
||||||
|
boolean vectorExists = buf.readBoolean();
|
||||||
|
if(!vectorExists) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
double x = buf.readDouble();
|
||||||
|
double y = buf.readDouble();
|
||||||
|
double z = buf.readDouble();
|
||||||
|
|
||||||
|
return Vec3.createVectorHelper(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a NBTTagCompound to a buffer.
|
* Writes a NBTTagCompound to a buffer.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user