Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The Server was not syncing the players TPlayerStats to the client until the Armor tab was opened. Added Packet. Send Packet on EntityJoinEvent. Format Derp. Changed to Debug and added Knapsack slot output.
- Loading branch information
1 parent
dfed1dd
commit b38cfee
Showing
5 changed files
with
143 additions
and
3 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
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
62 changes: 62 additions & 0 deletions
62
src/main/java/tconstruct/util/network/ArmourGuiSyncPacket.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,62 @@ | ||
package tconstruct.util.network; | ||
|
||
import tconstruct.TConstruct; | ||
import tconstruct.armor.TinkerArmor; | ||
import tconstruct.armor.player.TPlayerStats; | ||
import cpw.mods.fml.common.network.ByteBufUtils; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
import io.netty.buffer.ByteBuf; | ||
import io.netty.channel.ChannelHandlerContext; | ||
import mantle.common.network.AbstractPacket; | ||
/** | ||
* This Packet is for sending the players TPlayerStats from the server to the client. | ||
* | ||
* @author covers1624 | ||
*/ | ||
|
||
public class ArmourGuiSyncPacket extends AbstractPacket | ||
{ | ||
NBTTagCompound playerStats = new NBTTagCompound(); | ||
|
||
public ArmourGuiSyncPacket() | ||
{ | ||
} | ||
/** | ||
* For sending the players TPlayerStats to the client. | ||
* @param tag, The players TPlayerStats written to NBT. | ||
*/ | ||
public ArmourGuiSyncPacket(NBTTagCompound tag) | ||
{ | ||
playerStats = tag; | ||
} | ||
|
||
@Override | ||
public void encodeInto (ChannelHandlerContext ctx, ByteBuf buffer) | ||
{ | ||
ByteBufUtils.writeTag(buffer, playerStats); | ||
} | ||
|
||
@Override | ||
public void decodeInto (ChannelHandlerContext ctx, ByteBuf buffer) | ||
{ | ||
playerStats = ByteBufUtils.readTag(buffer); | ||
} | ||
|
||
@Override | ||
public void handleClientSide (EntityPlayer player) | ||
{ | ||
TConstruct.logger.info("Packet Arrived!"); | ||
TPlayerStats stats = new TPlayerStats(player); | ||
stats.loadNBTData(playerStats); | ||
TinkerArmor.proxy.updatePlayerStats(stats); | ||
|
||
} | ||
|
||
@Override | ||
public void handleServerSide (EntityPlayer player) | ||
{ | ||
//NO-OP. this is a Server -> client packet. | ||
} | ||
|
||
} |
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