public EntityPlayerMP( MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) { super(world); loadedChunks = new LinkedList(); listeningChunks = new HashSet(); lastHealth = 0xfa0a1f01; field_35221_cc = 0xfa0a1f01; field_35222_cd = true; field_35220_ce = 0xfa0a1f01; ticksOfInvuln = 60; currentWindowId = 0; field_41032_j = false; iteminworldmanager.thisPlayer = this; itemInWorldManager = iteminworldmanager; ChunkCoordinates chunkcoordinates = world.getSpawnPoint(); int i = chunkcoordinates.posX; int j = chunkcoordinates.posZ; int k = chunkcoordinates.posY; if (!world.worldProvider.hasNoSky) { i += rand.nextInt(20) - 10; k = world.findTopSolidBlock(i, j); j += rand.nextInt(20) - 10; } setLocationAndAngles((double) i + 0.5D, k, (double) j + 0.5D, 0.0F, 0.0F); mcServer = minecraftserver; stepHeight = 0.0F; username = s; yOffset = 0.0F; }
public void onUpdate() { itemInWorldManager.updateBlockRemoving(); ticksOfInvuln--; currentCraftingInventory.updateCraftingResults(); for (int i = 0; i < 5; i++) { ItemStack itemstack = getEquipmentInSlot(i); if (itemstack != playerInventory[i]) { mcServer .getEntityTracker(dimension) .sendPacketToTrackedPlayers(this, new Packet5PlayerInventory(entityId, i, itemstack)); playerInventory[i] = itemstack; } } }
public void writeEntityToNBT(NBTTagCompound nbttagcompound) { super.writeEntityToNBT(nbttagcompound); nbttagcompound.setInteger("playerGameType", itemInWorldManager.getGameType()); }
public void readEntityFromNBT(NBTTagCompound nbttagcompound) { super.readEntityFromNBT(nbttagcompound); if (nbttagcompound.hasKey("playerGameType")) { itemInWorldManager.toggleGameType(nbttagcompound.getInteger("playerGameType")); } }