Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix health display after dimension change #1132
- Loading branch information
Showing
4 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/main/java/tconstruct/util/network/HealthUpdatePacket.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters