mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-20 04:09:40 +00:00
Fix for #1552
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.
This commit is contained in:
1 parent
dfed1dd9f4
commit
b38cfee5ff
5 files changed
+143
-3
No files matched your search
@@ -38,6 +38,7 @@ import tconstruct.armor.model.HiddenPlayerModel;
|
||||
import tconstruct.armor.model.WingModel;
|
||||
import tconstruct.armor.player.ArmorExtended;
|
||||
import tconstruct.armor.player.KnapsackInventory;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import tconstruct.client.ArmorControls;
|
||||
import tconstruct.client.tabs.InventoryTabArmorExtended;
|
||||
import tconstruct.client.tabs.InventoryTabKnapsack;
|
||||
@@ -58,9 +59,11 @@ public class ArmorProxyClient extends ArmorProxyCommon {
|
||||
public static HiddenPlayerModel glove = new HiddenPlayerModel(0.25F, 4);
|
||||
public static HiddenPlayerModel vest = new HiddenPlayerModel(0.25f, 1);
|
||||
public static BeltModel belt = new BeltModel();
|
||||
|
||||
public static KnapsackInventory knapsack = new KnapsackInventory();
|
||||
public static ArmorExtended armorExtended = new ArmorExtended();
|
||||
|
||||
public static TPlayerStats playerStats = new TPlayerStats();
|
||||
|
||||
public static KnapsackInventory knapsack = playerStats.knapsack;
|
||||
public static ArmorExtended armorExtended = playerStats.armor;
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
@@ -522,5 +525,15 @@ public class ArmorProxyClient extends ArmorProxyCommon {
|
||||
protected float handleRotationFloat(EntityLivingBase par1EntityLivingBase, float par2) {
|
||||
return (float) par1EntityLivingBase.ticksExisted + par2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePlayerStats (TPlayerStats stats)
|
||||
{
|
||||
|
||||
playerStats.copyFrom(stats, false);
|
||||
armorExtended = stats.armor;
|
||||
knapsack = stats.knapsack;
|
||||
//dumpTPlayerStats(stats);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,9 @@ package tconstruct.armor;
|
||||
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.armor.inventory.*;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import tconstruct.common.TProxyCommon;
|
||||
@@ -65,4 +67,47 @@ public class ArmorProxyCommon implements IGuiHandler
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void updatePlayerStats(TPlayerStats stats)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void dumpTPlayerStats(TPlayerStats stats)
|
||||
{
|
||||
TConstruct.logger.debug("~~~~~~~~~~~~~~~~~ STATS ~~~~~~~~~~~~~~~~~");
|
||||
TConstruct.logger.debug("Player: " + stats.player.get().getCommandSenderName());
|
||||
TConstruct.logger.debug("Level: " + stats.level);
|
||||
TConstruct.logger.debug("BonusHealth: " + stats.bonusHealth);
|
||||
TConstruct.logger.debug("Damage: " + stats.damage);
|
||||
TConstruct.logger.debug("Hunger: " + stats.hunger);
|
||||
TConstruct.logger.debug("Prev Dim: " + stats.previousDimension);
|
||||
TConstruct.logger.debug("Climb Walls: " + stats.climbWalls);
|
||||
TConstruct.logger.debug("Activate Goggles: " + stats.activeGoggles);
|
||||
TConstruct.logger.debug("Beginer Manual: " + stats.beginnerManual);
|
||||
TConstruct.logger.debug("Material Manual: " + stats.materialManual);
|
||||
TConstruct.logger.debug("Smeltery Manual: " + stats.smelteryManual);
|
||||
TConstruct.logger.debug("Weponary Manual: " + stats.weaponryManual);
|
||||
TConstruct.logger.debug("BattleSign Bonus: " + stats.battlesignBonus);
|
||||
TConstruct.logger.debug("Derp Level: " + stats.derpLevel);
|
||||
int i = 0;
|
||||
for (ItemStack stack : stats.armor.inventory)
|
||||
{
|
||||
if (stack != null)
|
||||
{
|
||||
TConstruct.logger.debug("Armor Slot: " + i + " Contains: " + stack.getDisplayName());
|
||||
}
|
||||
i++;
|
||||
}
|
||||
i = 0;
|
||||
for (ItemStack stack : stats.knapsack.inventory)
|
||||
{
|
||||
if (stack != null)
|
||||
{
|
||||
TConstruct.logger.debug("Knapsack Slot: " + i + " Contains: " + stack.getDisplayName());
|
||||
}
|
||||
i++;
|
||||
}
|
||||
TConstruct.logger.debug("~~~~~~~~~~~~~~~~~ STATS ~~~~~~~~~~~~~~~~~");
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,10 @@ import net.minecraft.entity.boss.*;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.event.entity.living.*;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
|
||||
import tconstruct.TConstruct;
|
||||
@@ -15,6 +17,7 @@ import tconstruct.armor.items.TravelWings;
|
||||
import tconstruct.armor.player.ArmorExtended;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.util.network.ArmourGuiSyncPacket;
|
||||
import tconstruct.world.entity.BlueSlime;
|
||||
|
||||
public class TinkerArmorEvents
|
||||
@@ -122,4 +125,19 @@ public class TinkerArmorEvents
|
||||
if(dodge > TConstruct.random.nextInt(10))
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void joinWorld(EntityJoinWorldEvent event)
|
||||
{
|
||||
if (event.entity instanceof EntityPlayerMP)
|
||||
{
|
||||
EntityPlayerMP player = (EntityPlayerMP)event.entity;
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
stats.saveNBTData(tag);
|
||||
ArmourGuiSyncPacket syncPacket = new ArmourGuiSyncPacket(tag);
|
||||
TConstruct.packetPipeline.sendTo(syncPacket, player);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user