mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-20 20:22:36 +00:00
Fix health display after dimension change #1132
This commit is contained in:
1 parent
dc439705e6
commit
1eb41de35b
4 files changed
+68
No files matched your search
@@ -0,0 +1,44 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.armor.ArmorProxyClient;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
|
||||
public class HealthUpdatePacket extends AbstractPacket {
|
||||
private float health;
|
||||
|
||||
public HealthUpdatePacket() {
|
||||
}
|
||||
|
||||
public HealthUpdatePacket(float health) {
|
||||
this.health = health;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
buffer.writeFloat(health);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
health = buffer.readFloat();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClientSide(EntityPlayer player) {
|
||||
// todo: fix this to use the proper armor extended.. once we sync that stuff...
|
||||
ArmorProxyClient.armorExtended.recalculateHealth(player, TPlayerStats.get(player));
|
||||
player.setHealth(health);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleServerSide(EntityPlayer player) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -122,6 +122,7 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
|
||||
public void registerPackets ()
|
||||
{
|
||||
registerPacket(HealthUpdatePacket.class);
|
||||
registerPacket(DoubleJumpPacket.class);
|
||||
registerPacket(AccessoryInventoryPacket.class);
|
||||
registerPacket(SmelteryPacket.class);
|
||||
|
||||
Reference in new issue
Block a user