bug fixes part 1

(thank you radium)
This commit is contained in:
BallOfEnergy 2024-10-13 00:27:55 -05:00
parent 5c909e156f
commit e3cf157501
7 changed files with 214 additions and 215 deletions

View File

@ -511,7 +511,7 @@ public class ModEventHandlerRenderer {
public void onRenderHand(RenderHandEvent event) { public void onRenderHand(RenderHandEvent event) {
//can't use plaxer.getHeldItem() here because the item rendering persists for a few frames after hitting the switch key //can't use plaxer.getHeldItem() here because the item rendering persists for a few frames after hitting the switch key
ItemStack toRender = null; //Minecraft.getMinecraft().entityRenderer.itemRenderer.itemToRender; ItemStack toRender = Minecraft.getMinecraft().entityRenderer.itemRenderer.itemToRender;
if(toRender != null) { if(toRender != null) {
IItemRenderer renderer = MinecraftForgeClient.getItemRenderer(toRender, ItemRenderType.EQUIPPED_FIRST_PERSON); IItemRenderer renderer = MinecraftForgeClient.getItemRenderer(toRender, ItemRenderType.EQUIPPED_FIRST_PERSON);

View File

@ -174,7 +174,7 @@ public abstract class TileEntityMachineBase extends TileEntityLoadedBase impleme
// In my testing, this can be reliably reproduced with a full fluid barrel, for instance. // In my testing, this can be reliably reproduced with a full fluid barrel, for instance.
// I think it might be fixable by doing something with getDescriptionPacket() and onDataPacket(), // I think it might be fixable by doing something with getDescriptionPacket() and onDataPacket(),
// but this sidesteps the problem for the mean time. // but this sidesteps the problem for the mean time.
if (lastPackedBuf != null && buf.equals(lastPackedBuf) && worldObj.getWorldTime() % 20 != 0) { if (buf.equals(lastPackedBuf) && worldObj.getWorldTime() % 20 != 0) {
return; return;
} }
this.lastPackedBuf = buf; this.lastPackedBuf = buf;

View File

@ -175,8 +175,8 @@ public class TileEntityConveyorPress extends TileEntityMachineBase implements IE
super.serialize(buf); super.serialize(buf);
buf.writeLong(this.power); buf.writeLong(this.power);
buf.writeDouble(this.syncPress); buf.writeDouble(this.press);
BufferUtil.writeItemStack(buf, syncStack); BufferUtil.writeItemStack(buf, slots[0]);
} }
@Override @Override

View File

@ -66,6 +66,8 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements IBufPa
if(!worldObj.isRemote) { if(!worldObj.isRemote) {
buf.writeBoolean(this.hasExploded);
if(!this.hasExploded) { if(!this.hasExploded) {
this.setupTanks(); this.setupTanks();
this.updateConnections(); this.updateConnections();
@ -89,7 +91,6 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements IBufPa
} }
} }
buf.writeBoolean(this.hasExploded);
buf.writeBoolean(this.muffled); buf.writeBoolean(this.muffled);
buf.writeBoolean(this.isOn); buf.writeBoolean(this.isOn);
sendStandard(25); sendStandard(25);
@ -154,12 +155,14 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements IBufPa
@Override @Override
public void deserialize(ByteBuf buf) { public void deserialize(ByteBuf buf) {
this.heat = buf.readInt();
this.tanks[0].deserialize(buf);
this.tanks[1].deserialize(buf);
this.hasExploded = buf.readBoolean(); this.hasExploded = buf.readBoolean();
this.muffled = buf.readBoolean(); if (!this.hasExploded) {
this.isOn = buf.readBoolean(); this.heat = buf.readInt();
this.tanks[0].deserialize(buf);
this.tanks[1].deserialize(buf);
this.muffled = buf.readBoolean();
this.isOn = buf.readBoolean();
}
} }
protected void tryPullHeat() { protected void tryPullHeat() {

View File

@ -19,7 +19,6 @@ import api.hbm.tile.IHeatSource;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -68,6 +67,7 @@ public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHe
@Override @Override
public void serialize(ByteBuf buf) { public void serialize(ByteBuf buf) {
tanks[0].serialize(buf); tanks[0].serialize(buf);
this.tryConvert();
tanks[1].serialize(buf); tanks[1].serialize(buf);
buf.writeInt(this.heatEnergy); buf.writeInt(this.heatEnergy);
buf.writeInt(this.amountToCool); buf.writeInt(this.amountToCool);

View File

@ -156,10 +156,7 @@ public class TileEntityMachinePress extends TileEntityMachineBase implements IGU
buf.writeInt(this.speed); buf.writeInt(this.speed);
buf.writeInt(this.burnTime); buf.writeInt(this.burnTime);
buf.writeInt(this.press); buf.writeInt(this.press);
if (slots[2] == null) BufferUtil.writeItemStack(buf, slots[2]);
buf.writeShort(-1); // indicate that the NBT doesn't actually exist to avoid null pointer errors.
else
BufferUtil.writeNBT(buf, slots[2].stackTagCompound);
} }
@Override @Override
@ -167,9 +164,8 @@ public class TileEntityMachinePress extends TileEntityMachineBase implements IGU
super.deserialize(buf); super.deserialize(buf);
this.speed = buf.readInt(); this.speed = buf.readInt();
this.burnTime = buf.readInt(); this.burnTime = buf.readInt();
this.press = buf.readInt(); this.syncPress = buf.readInt();
NBTTagCompound stack = BufferUtil.readNBT(buf); this.syncStack = BufferUtil.readItemStack(buf);
this.syncStack = ItemStack.loadItemStackFromNBT(stack);
this.turnProgress = 2; this.turnProgress = 2;
} }