net.minecraft.entity.player
Class EntityPlayerMP

java.lang.Object
  extended by net.minecraft.entity.Entity
      extended by net.minecraft.entity.EntityLiving
          extended by net.minecraft.entity.player.EntityPlayer
              extended by net.minecraft.entity.player.EntityPlayerMP
All Implemented Interfaces:
ICommandSender, ICrafting

public class EntityPlayerMP
extends EntityPlayer
implements ICrafting


Field Summary
 int currentWindowId
          The currently in use window ID.
 List destroyedItemsNetCache
          entities added to this list will be packet29'd to the player
 List loadedChunks
          LinkedList that holds the loaded chunks.
 double managedPosX
          player X position as seen by PlayerManager
 double managedPosZ
          player Z position as seen by PlayerManager
 MinecraftServer mcServer
          Reference to the MinecraftServer object.
 int ping
           
 boolean playerConqueredTheEnd
          Set when a player beats the ender dragon, used to respawn the player at the spawn point while retaining inventory and XP
 boolean playerInventoryBeingManipulated
          poor mans concurency flag, lets hope the jvm doesn't re-order the setting of this flag wrt the inventory change on the next line
 NetServerHandler playerNetServerHandler
          The NetServerHandler assigned to this player by the ServerConfigurationManager.
 ItemInWorldManager theItemInWorldManager
          The ItemInWorldManager belonging to this player
 
Fields inherited from class net.minecraft.entity.player.EntityPlayer
cameraYaw, capabilities, experience, experienceLevel, experienceTotal, field_71079_bU, field_71082_cx, field_71085_bR, field_71089_bV, field_71091_bM, field_71094_bP, field_71095_bQ, field_71096_bN, field_71097_bO, field_71098_bD, fishEntity, inventory, inventoryContainer, openContainer, PERSISTED_NBT_TAG, playerCloakUrl, playerLocation, prevCameraYaw, username, xpCooldown
 
Fields inherited from class net.minecraft.entity.EntityLiving
arrowHitTimer, attackedAtYaw, attackTime, cameraPitch, carryoverDamage, deathTime, experienceValue, field_70730_aX, field_70731_aW, field_70769_ao, field_70770_ap, hurtTime, isJumping, isSwingInProgress, jumpMovementFactor, landMovementFactor, legSwing, legYaw, livingSoundTime, maxHurtResistantTime, maxHurtTime, pickUpLootProability, prevCameraPitch, prevHealth, prevLegYaw, prevRenderYawOffset, prevRotationYawHead, prevSwingProgress, renderYawOffset, rotationYawHead, swingProgress, swingProgressInt, tasks
 
Fields inherited from class net.minecraft.entity.Entity
addedToChunk, boundingBox, capturedDrops, captureDrops, chunkCoordX, chunkCoordY, chunkCoordZ, cloakUrl, dimension, distanceWalkedModified, entityCollisionReduction, entityId, fallDistance, field_70135_K, field_82151_R, fireResistance, height, hurtResistantTime, ignoreFrustumCheck, isAirBorne, isCollided, isCollidedHorizontally, isCollidedVertically, isDead, lastTickPosX, lastTickPosY, lastTickPosZ, motionX, motionY, motionZ, myEntitySize, noClip, onGround, posX, posY, posZ, prevDistanceWalkedModified, preventEntitySpawning, prevPosX, prevPosY, prevPosZ, prevRotationPitch, prevRotationYaw, renderDistanceWeight, riddenByEntity, ridingEntity, rotationPitch, rotationYaw, serverPosX, serverPosY, serverPosZ, skinUrl, stepHeight, ticksExisted, timeUntilPortal, velocityChanged, width, worldObj, yOffset, ySize
 
Constructor Summary
EntityPlayerMP(MinecraftServer par1MinecraftServer, World par2World, String par3Str, ItemInWorldManager par4ItemInWorldManager)
           
 
Method Summary
 void addChatMessage(String par1Str)
          Add a chat message to the player
 void addExperienceLevel(int par1)
          Add experience levels to this player.
 void addSelfToInternalCraftingInventory()
           
 void addStat(StatBase par1StatBase, int par2)
          Adds a value to a statistic field.
 boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
          Called when the entity is attacked.
 boolean canCommandSenderUseCommand(int par1, String par2Str)
          Returns true if the command sender is allowed to use the given command.
 void clonePlayer(EntityPlayer par1EntityPlayer, boolean par2)
          Copies the values from the given player into this player if boolean par2 is true.
 void closeInventory()
           
 void closeScreen()
          sets current screen to null (used on escape buttons of GUIs)
 void displayGUIAnvil(int par1, int par2, int par3)
          Displays the GUI for interacting with an anvil.
 void displayGUIBeacon(TileEntityBeacon par1TileEntityBeacon)
          Displays the GUI for interacting with a beacon.
 void displayGUIBrewingStand(TileEntityBrewingStand par1TileEntityBrewingStand)
          Displays the GUI for interacting with a brewing stand.
 void displayGUIChest(IInventory par1IInventory)
          Displays the GUI for interacting with a chest inventory.
 void displayGUIDispenser(TileEntityDispenser par1TileEntityDispenser)
          Displays the dipsenser GUI for the passed in dispenser entity.
 void displayGUIEnchantment(int par1, int par2, int par3)
           
 void displayGUIFurnace(TileEntityFurnace par1TileEntityFurnace)
          Displays the furnace GUI for the passed in furnace entity.
 void displayGUIMerchant(IMerchant par1IMerchant)
           
 void displayGUIWorkbench(int par1, int par2, int par3)
          Displays the crafting GUI for a workbench.
 String func_71114_r()
           
 int getChatVisibility()
           
 float getEyeHeight()
           
 ChunkCoordinates getPlayerCoordinates()
          Return the coordinates for this player as ChunkCoordinates.
 WorldServer getServerForPlayer()
           
 StringTranslate getTranslator()
           
 void incrementWindowID()
           
 void mountEntity(Entity par1Entity)
          Called when a player mounts an entity.
 void mountEntityAndWakeUp()
           
 void onCriticalHit(Entity par1Entity)
          Called when the player performs a critical hit on the Entity.
 void onDeath(DamageSource par1DamageSource)
          Called when the mob's health reaches 0.
 void onEnchantmentCritical(Entity par1Entity)
           
 void onItemPickup(Entity par1Entity, int par2)
          Called whenever an item is picked up from walking over it.
 void onUpdate()
          Called to update the entity's position/logic.
 void onUpdateEntity()
           
 void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
          (abstract) Protected helper method to read subclass entity data from NBT.
 void requestTexturePackLoad(String par1Str, int par2)
          on recieving this message the client (if permission is given) will download the requested textures
 void sendChatToPlayer(String par1Str)
           
 void sendContainerAndContentsToPlayer(Container par1Container, List par2List)
           
 void sendContainerToPlayer(Container par1Container)
           
 void sendPlayerAbilities()
          Sends the player's abilities to the server (if there is one).
 void sendProgressBarUpdate(Container par1Container, int par2, int par3)
          Sends two ints to the client-side Container.
 void sendSlotContents(Container par1Container, int par2, ItemStack par3ItemStack)
          Sends the contents of an inventory slot to the client-side Container.
 void setGameType(EnumGameType par1EnumGameType)
          Sets the player's game mode and sends it to them.
 void setItemInUse(ItemStack par1ItemStack, int par2)
          sets the itemInUse when the use item button is clicked.
 void setPlayerHealthUpdated()
          this function is called when a players inventory is sent to him, lastHealth is updated on any dimension transitions, then reset.
 void setPositionAndUpdate(double par1, double par3, double par5)
          Move the entity to the coordinates informed, but keep yaw/pitch values.
 EnumStatus sleepInBedAt(int par1, int par2, int par3)
          Attempts to have the player sleep in a bed at the specified location.
 void travelToDimension(int par1)
          Teleports the entity to another dimension.
 void updateClientInfo(Packet204ClientInfo par1Packet204ClientInfo)
           
 void updateFlyingState(double par1, boolean par3)
          likeUpdateFallState, but called from updateFlyingState, rather than moveEntity
 void updateHeldItem()
          updates item held by mouse
 void wakeUpPlayer(boolean par1, boolean par2, boolean par3)
          Wake up the player if they're sleeping.
 void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
          (abstract) Protected helper method to write subclass entity data to NBT.
 
Methods inherited from class net.minecraft.entity.player.EntityPlayer
addExhaustion, addExperience, addMovementStat, addScore, addToPlayerScore, attackTargetEntityWithCurrentItem, canCurrentToolHarvestBlock, canEat, canHarvestBlock, canPlayerEdit, clearItemInUse, destroyCurrentEquippedItem, displayGUIBook, displayGUIEditSign, dropOneItem, dropPlayerItem, dropPlayerItemWithRandomChoice, func_71066_bF, func_82243_bO, getBedLocation, getBedOrientationInDegrees, getCommandSenderName, getCurrentArmor, getCurrentEquippedItem, getCurrentItemOrArmor, getCurrentPlayerStrVsBlock, getCurrentPlayerStrVsBlock, getEntityName, getFoodStats, getHeldItem, getHideCape, getInventoryEnderChest, getItemIcon, getItemInUse, getItemInUseCount, getItemInUseDuration, getLastActiveItems, getMaxHealth, getMaxInPortalTime, getPortalCooldown, getScore, getSleepTimer, getTotalArmorValue, getYOffset, handleHealthUpdate, interactWith, isBlocking, isEntityInsideOpaqueBlock, isPlayerFullyAsleep, isPlayerSleeping, isSpawnForced, isUsingItem, joinEntityItemWithWorld, moveEntityWithHeading, onKillEntity, onLivingUpdate, openGui, playSound, preparePlayerToSpawn, respawnPlayer, setCurrentItemOrArmor, setDead, setInWeb, setScore, setSpawnChunk, shouldHeal, stopUsingItem, translateString, triggerAchievement, updateRidden, verifyRespawnCoordinates, xpBarCap
 
Methods inherited from class net.minecraft.entity.EntityLiving
addPotionEffect, attackEntityAsMob, canAttackClass, canBeCollidedWith, canBePushed, canBeSteered, canBreatheUnderwater, canEntityBeSeen, clearActivePotions, curePotionEffects, detachHome, eatGrassBonus, faceEntity, func_82143_as, func_82159_b, getActivePotionEffect, getActivePotionEffects, getAge, getAIMoveSpeed, getAITarget, getArmorItemForSlot, getArrowCountInEntity, getAttackTarget, getCanSpawnHere, getCreatureAttribute, getEntitySenses, getHealth, getHomePosition, getJumpHelper, getLastAttackingEntity, getLook, getLookHelper, getLookVec, getMaximumHomeDistance, getMaxSpawnedInChunk, getMoveHelper, getNavigator, getPosition, getRenderSizeModifier, getRNG, getSpeedModifier, getSwingProgress, getTalkInterval, getTexture, getVerticalFaceSpeed, hasHome, heal, initCreature, isChild, isEntityAlive, isEntityUndead, isOnLadder, isPotionActive, isPotionActive, isPotionApplicable, isWithinHomeDistance, isWithinHomeDistanceCurrentPosition, knockBack, onEntityUpdate, performHurtAnimation, playLivingSound, rayTrace, removePotionEffect, removePotionEffectClient, renderBrokenItemStack, setAIMoveSpeed, setArrowCountInEntity, setAttackTarget, setEntityHealth, setHeadRotationYaw, setHomeArea, setJumping, setLastAttackingEntity, setMoveForward, setPositionAndRotation2, setRevengeTarget, setRotationYawHead, shouldRiderFaceForward, spawnExplosionParticle, swingItem
 
Methods inherited from class net.minecraft.entity.Entity
addEntityID, addVelocity, applyEntityCollision, canAttackWithItem, canRenderOnFire, copyDataFrom, doesEntityNotTriggerPressurePlate, dropItem, dropItemWithOffset, entityDropItem, equals, extinguish, func_82146_a, func_82148_at, func_82149_j, func_85029_a, func_85031_j, generatePersistentID, getAir, getBoundingBox, getBrightness, getBrightnessForRender, getCollisionBorderSize, getCollisionBox, getDataWatcher, getDistance, getDistanceSq, getDistanceSqToEntity, getDistanceToEntity, getEntityData, getHasActivePotion, getMountedYOffset, getParts, getPersistentID, getPickedResult, getShadowSize, handleLavaMovement, handleWaterMovement, hashCode, interact, isBurning, isEating, isEntityEqual, isEntityInvulnerable, isImmuneToFire, isInRangeToRenderDist, isInRangeToRenderVec3D, isInsideOfMaterial, isInWater, isOffsetPositionInLiquid, isRiding, isSneaking, isSprinting, isWet, moveEntity, moveFlying, onCollideWithPlayer, onStruckByLightning, readFromNBT, setAir, setAngles, setEating, setFire, setHasActivePotion, setInPortal, setLocationAndAngles, setPosition, setPositionAndRotation, setSneaking, setSprinting, setVelocity, setWorld, shouldRiderSit, toString, unmountEntity, updateCloak, updateRiderPosition, writeToNBT
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

playerNetServerHandler

public NetServerHandler playerNetServerHandler
The NetServerHandler assigned to this player by the ServerConfigurationManager.


mcServer

public MinecraftServer mcServer
Reference to the MinecraftServer object.


theItemInWorldManager

public ItemInWorldManager theItemInWorldManager
The ItemInWorldManager belonging to this player


managedPosX

public double managedPosX
player X position as seen by PlayerManager


managedPosZ

public double managedPosZ
player Z position as seen by PlayerManager


loadedChunks

public final List loadedChunks
LinkedList that holds the loaded chunks.


destroyedItemsNetCache

public final List destroyedItemsNetCache
entities added to this list will be packet29'd to the player


currentWindowId

public int currentWindowId
The currently in use window ID. Incremented every time a window is opened.


playerInventoryBeingManipulated

public boolean playerInventoryBeingManipulated
poor mans concurency flag, lets hope the jvm doesn't re-order the setting of this flag wrt the inventory change on the next line


ping

public int ping

playerConqueredTheEnd

public boolean playerConqueredTheEnd
Set when a player beats the ender dragon, used to respawn the player at the spawn point while retaining inventory and XP

Constructor Detail

EntityPlayerMP

public EntityPlayerMP(MinecraftServer par1MinecraftServer,
                      World par2World,
                      String par3Str,
                      ItemInWorldManager par4ItemInWorldManager)
Method Detail

readEntityFromNBT

public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
(abstract) Protected helper method to read subclass entity data from NBT.

Overrides:
readEntityFromNBT in class EntityPlayer

writeEntityToNBT

public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
(abstract) Protected helper method to write subclass entity data to NBT.

Overrides:
writeEntityToNBT in class EntityPlayer

addExperienceLevel

public void addExperienceLevel(int par1)
Add experience levels to this player.

Overrides:
addExperienceLevel in class EntityPlayer

addSelfToInternalCraftingInventory

public void addSelfToInternalCraftingInventory()

getEyeHeight

public float getEyeHeight()
Overrides:
getEyeHeight in class EntityPlayer

onUpdate

public void onUpdate()
Called to update the entity's position/logic.

Overrides:
onUpdate in class EntityPlayer

onUpdateEntity

public void onUpdateEntity()

onDeath

public void onDeath(DamageSource par1DamageSource)
Called when the mob's health reaches 0.

Overrides:
onDeath in class EntityPlayer

attackEntityFrom

public boolean attackEntityFrom(DamageSource par1DamageSource,
                                int par2)
Called when the entity is attacked.

Overrides:
attackEntityFrom in class EntityPlayer

travelToDimension

public void travelToDimension(int par1)
Teleports the entity to another dimension. Params: Dimension number to teleport to

Overrides:
travelToDimension in class Entity

onItemPickup

public void onItemPickup(Entity par1Entity,
                         int par2)
Called whenever an item is picked up from walking over it. Args: pickedUpEntity, stackSize

Overrides:
onItemPickup in class EntityLiving

sleepInBedAt

public EnumStatus sleepInBedAt(int par1,
                               int par2,
                               int par3)
Attempts to have the player sleep in a bed at the specified location.

Overrides:
sleepInBedAt in class EntityPlayer

wakeUpPlayer

public void wakeUpPlayer(boolean par1,
                         boolean par2,
                         boolean par3)
Wake up the player if they're sleeping.

Overrides:
wakeUpPlayer in class EntityPlayer

mountEntity

public void mountEntity(Entity par1Entity)
Called when a player mounts an entity. e.g. mounts a pig, mounts a boat.

Overrides:
mountEntity in class Entity

updateFlyingState

public void updateFlyingState(double par1,
                              boolean par3)
likeUpdateFallState, but called from updateFlyingState, rather than moveEntity


incrementWindowID

public void incrementWindowID()

displayGUIWorkbench

public void displayGUIWorkbench(int par1,
                                int par2,
                                int par3)
Displays the crafting GUI for a workbench.

Overrides:
displayGUIWorkbench in class EntityPlayer

displayGUIEnchantment

public void displayGUIEnchantment(int par1,
                                  int par2,
                                  int par3)
Overrides:
displayGUIEnchantment in class EntityPlayer

displayGUIAnvil

public void displayGUIAnvil(int par1,
                            int par2,
                            int par3)
Displays the GUI for interacting with an anvil.

Overrides:
displayGUIAnvil in class EntityPlayer

displayGUIChest

public void displayGUIChest(IInventory par1IInventory)
Displays the GUI for interacting with a chest inventory. Args: chestInventory

Overrides:
displayGUIChest in class EntityPlayer

displayGUIFurnace

public void displayGUIFurnace(TileEntityFurnace par1TileEntityFurnace)
Displays the furnace GUI for the passed in furnace entity. Args: tileEntityFurnace

Overrides:
displayGUIFurnace in class EntityPlayer

displayGUIDispenser

public void displayGUIDispenser(TileEntityDispenser par1TileEntityDispenser)
Displays the dipsenser GUI for the passed in dispenser entity. Args: TileEntityDispenser

Overrides:
displayGUIDispenser in class EntityPlayer

displayGUIBrewingStand

public void displayGUIBrewingStand(TileEntityBrewingStand par1TileEntityBrewingStand)
Displays the GUI for interacting with a brewing stand.

Overrides:
displayGUIBrewingStand in class EntityPlayer

displayGUIBeacon

public void displayGUIBeacon(TileEntityBeacon par1TileEntityBeacon)
Displays the GUI for interacting with a beacon.

Overrides:
displayGUIBeacon in class EntityPlayer

displayGUIMerchant

public void displayGUIMerchant(IMerchant par1IMerchant)
Overrides:
displayGUIMerchant in class EntityPlayer

sendSlotContents

public void sendSlotContents(Container par1Container,
                             int par2,
                             ItemStack par3ItemStack)
Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual contents of that slot. Args: Container, slot number, slot contents

Specified by:
sendSlotContents in interface ICrafting

sendContainerToPlayer

public void sendContainerToPlayer(Container par1Container)

sendContainerAndContentsToPlayer

public void sendContainerAndContentsToPlayer(Container par1Container,
                                             List par2List)
Specified by:
sendContainerAndContentsToPlayer in interface ICrafting

sendProgressBarUpdate

public void sendProgressBarUpdate(Container par1Container,
                                  int par2,
                                  int par3)
Sends two ints to the client-side Container. Used for furnace burning time, smelting progress, brewing progress, and enchanting level. Normally the first int identifies which variable to update, and the second contains the new value. Both are truncated to shorts in non-local SMP.

Specified by:
sendProgressBarUpdate in interface ICrafting

closeScreen

public void closeScreen()
sets current screen to null (used on escape buttons of GUIs)

Overrides:
closeScreen in class EntityPlayer

updateHeldItem

public void updateHeldItem()
updates item held by mouse


closeInventory

public void closeInventory()

addStat

public void addStat(StatBase par1StatBase,
                    int par2)
Adds a value to a statistic field.

Overrides:
addStat in class EntityPlayer

mountEntityAndWakeUp

public void mountEntityAndWakeUp()

setPlayerHealthUpdated

public void setPlayerHealthUpdated()
this function is called when a players inventory is sent to him, lastHealth is updated on any dimension transitions, then reset.


addChatMessage

public void addChatMessage(String par1Str)
Add a chat message to the player

Overrides:
addChatMessage in class EntityPlayer

setItemInUse

public void setItemInUse(ItemStack par1ItemStack,
                         int par2)
sets the itemInUse when the use item button is clicked. Args: itemstack, int maxItemUseDuration

Overrides:
setItemInUse in class EntityPlayer

clonePlayer

public void clonePlayer(EntityPlayer par1EntityPlayer,
                        boolean par2)
Copies the values from the given player into this player if boolean par2 is true. Always clones Ender Chest Inventory.

Overrides:
clonePlayer in class EntityPlayer

setPositionAndUpdate

public void setPositionAndUpdate(double par1,
                                 double par3,
                                 double par5)
Move the entity to the coordinates informed, but keep yaw/pitch values.

Overrides:
setPositionAndUpdate in class EntityLiving

onCriticalHit

public void onCriticalHit(Entity par1Entity)
Called when the player performs a critical hit on the Entity. Args: entity that was hit critically

Overrides:
onCriticalHit in class EntityPlayer

onEnchantmentCritical

public void onEnchantmentCritical(Entity par1Entity)
Overrides:
onEnchantmentCritical in class EntityPlayer

sendPlayerAbilities

public void sendPlayerAbilities()
Sends the player's abilities to the server (if there is one).

Overrides:
sendPlayerAbilities in class EntityPlayer

getServerForPlayer

public WorldServer getServerForPlayer()

setGameType

public void setGameType(EnumGameType par1EnumGameType)
Sets the player's game mode and sends it to them.

Overrides:
setGameType in class EntityPlayer

sendChatToPlayer

public void sendChatToPlayer(String par1Str)
Specified by:
sendChatToPlayer in interface ICommandSender

canCommandSenderUseCommand

public boolean canCommandSenderUseCommand(int par1,
                                          String par2Str)
Returns true if the command sender is allowed to use the given command.

Specified by:
canCommandSenderUseCommand in interface ICommandSender

func_71114_r

public String func_71114_r()

updateClientInfo

public void updateClientInfo(Packet204ClientInfo par1Packet204ClientInfo)

getTranslator

public StringTranslate getTranslator()
Overrides:
getTranslator in class EntityPlayer

getChatVisibility

public int getChatVisibility()

requestTexturePackLoad

public void requestTexturePackLoad(String par1Str,
                                   int par2)
on recieving this message the client (if permission is given) will download the requested textures


getPlayerCoordinates

public ChunkCoordinates getPlayerCoordinates()
Return the coordinates for this player as ChunkCoordinates.

Specified by:
getPlayerCoordinates in interface ICommandSender