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) {
//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) {
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.
// I think it might be fixable by doing something with getDescriptionPacket() and onDataPacket(),
// 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;
}
this.lastPackedBuf = buf;

View File

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

View File

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

View File

@ -19,7 +19,6 @@ 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;
import net.minecraft.nbt.NBTTagCompound;
@ -68,6 +67,7 @@ public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHe
@Override
public void serialize(ByteBuf buf) {
tanks[0].serialize(buf);
this.tryConvert();
tanks[1].serialize(buf);
buf.writeInt(this.heatEnergy);
buf.writeInt(this.amountToCool);

View File

@ -156,10 +156,7 @@ public class TileEntityMachinePress extends TileEntityMachineBase implements IGU
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);
BufferUtil.writeItemStack(buf, slots[2]);
}
@Override
@ -167,9 +164,8 @@ public class TileEntityMachinePress extends TileEntityMachineBase implements IGU
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.syncPress = buf.readInt();
this.syncStack = BufferUtil.readItemStack(buf);
this.turnProgress = 2;
}