@Override public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); if (playerName != null) { tag.setString("playerName", playerName); } inventory.writeToNBT(tag); }
public EntityGhost(World world, String playerName, IInventory playerInvent) { this(world); this.playerName = playerName; // use the dead players skin (ew) // if (world.isRemote) { // this.skinUrl = "http://skins.minecraft.net/MinecraftSkins/" // + StringUtils.stripControlCodes(playerName) + ".png"; // } // copy the inventory from the player inventory inventory.copyFrom(playerInvent); }
@Override public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); if (tag.hasKey("playerName")) { playerName = tag.getString("playerName"); // Depreciated // if (worldObj.isRemote) { // skinUrl = "http://skins.minecraft.net/MinecraftSkins/" // + StringUtils.stripControlCodes(playerName) + ".png"; // } } inventory.readFromNBT(tag); }