Player
Link to player
Importing the class
Link to importing-the-class
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
ZenScript Copyimport crafttweaker.api.entity.type.player.Player;
Extending LivingEntity
Link to extending-livingentity
Player extends LivingEntity. That means all methods available in LivingEntity are also available in Player
Methods
Link to methods
Name: addItem
Return Type: boolean
ZenScript CopyPlayer.addItem(stack as ItemStack) as boolean
Parameter | Type |
---|---|
Parameter stack | Type format@@0 ItemStack |
Name: awardStat
ZenScript CopyPlayer.awardStat(stat as ResourceLocation)
Parameter | Type |
---|---|
Parameter stat | Type ResourceLocation |
Name: awardStat
ZenScript CopyPlayer.awardStat(stat as ResourceLocation, amount as int)
Parameter | Type |
---|---|
Parameter stat | Type ResourceLocation |
Parameter amount | Type int |
Name: canEat
Return Type: boolean
ZenScript CopyPlayer.canEat(ignoreHunger as boolean) as boolean
Parameter | Type |
---|---|
Parameter ignoreHunger | Type boolean |
Name: canHarmPlayer
Return Type: boolean
ZenScript CopyPlayer.canHarmPlayer(player as Player) as boolean
Parameter | Type |
---|---|
Parameter player | Type Player |
Name: canUseGameMasterBlocks
Return Type: boolean
ZenScript Copy// Player.canUseGameMasterBlocks() as boolean
myPlayer.canUseGameMasterBlocks();
Name: causeFoodExhaustion
ZenScript CopyPlayer.causeFoodExhaustion(exhaustion as float)
Parameter | Type |
---|---|
Parameter exhaustion | Type float |
Name: disableShield
ZenScript CopyPlayer.disableShield(usingAxe as boolean)
Parameter | Type |
---|---|
Parameter usingAxe | Type boolean |
Name: displayClientMessage
ZenScript CopyPlayer.displayClientMessage(component as Component, actionBar as boolean)
Parameter | Type |
---|---|
Parameter component | Type Component |
Parameter actionBar | Type boolean |
Name: drop
Return Type: ItemEntity?
ZenScript CopyPlayer.drop(stack as ItemStack, traceItem as boolean) as ItemEntity?
Parameter | Type |
---|---|
Parameter stack | Type format@@0 ItemStack |
Parameter traceItem | Type boolean |
Name: getAbilities
Return Type: Abilities
ZenScript Copy// Player.getAbilities() as Abilities
myPlayer.getAbilities();
Name: getCooldowns
Return Type: ItemCooldowns
ZenScript Copy// Player.getCooldowns() as ItemCooldowns
myPlayer.getCooldowns();
Name: getCurrentItemAttackStrengthDelay
Return Type: float
ZenScript Copy// Player.getCurrentItemAttackStrengthDelay() as float
myPlayer.getCurrentItemAttackStrengthDelay();
Name: getDestroySpeed
Return Type: float
ZenScript CopyPlayer.getDestroySpeed(state as BlockState) as float
Parameter | Type |
---|---|
Parameter state | Type BlockState |
Name: getEnchantmentSeed
Return Type: int
ZenScript Copy// Player.getEnchantmentSeed() as int
myPlayer.getEnchantmentSeed();
Name: getExperienceLevel
Return Type: int
ZenScript Copy// Player.getExperienceLevel() as int
myPlayer.getExperienceLevel();
Name: getFoodData
Return Type: FoodData
ZenScript Copy// Player.getFoodData() as FoodData
myPlayer.getFoodData();
Name: getInventory
Return Type: Inventory
ZenScript Copy// Player.getInventory() as Inventory
myPlayer.getInventory();
Name: getLuck
Return Type: float
ZenScript Copy// Player.getLuck() as float
myPlayer.getLuck();
Name: getMainArm
Return Type: HumanoidArm
ZenScript Copy// Player.getMainArm() as HumanoidArm
myPlayer.getMainArm();
Name: getScore
Return Type: int
ZenScript Copy// Player.getScore() as int
myPlayer.getScore();
Name: getShoulderEntityLeft
Return Type: MapData
ZenScript Copy// Player.getShoulderEntityLeft() as MapData
myPlayer.getShoulderEntityLeft();
Name: getShoulderEntityRight
Return Type: MapData
ZenScript Copy// Player.getShoulderEntityRight() as MapData
myPlayer.getShoulderEntityRight();
Name: getSleepTimer
Return Type: int
ZenScript Copy// Player.getSleepTimer() as int
myPlayer.getSleepTimer();
Name: getXpNeededForNextLevel
Return Type: int
ZenScript Copy// Player.getXpNeededForNextLevel() as int
myPlayer.getXpNeededForNextLevel();
Name: give
ZenScript CopyPlayer.give(stack as IItemStack, slot as int)
Parameter | Type | Optional | Default Value |
---|---|---|---|
Parameter stack | Type IItemStack | Optional false | Default Value ​ |
Parameter slot | Type int | Optional true | Default Value -1 |
Name: giveExperienceLevels
ZenScript CopyPlayer.giveExperienceLevels(levels as int)
Parameter | Type |
---|---|
Parameter levels | Type int |
Name: giveExperiencePoints
ZenScript CopyPlayer.giveExperiencePoints(amount as int)
Parameter | Type |
---|---|
Parameter amount | Type int |
Name: hasCorrectToolForDrops
Return Type: boolean
ZenScript CopyPlayer.hasCorrectToolForDrops(state as BlockState) as boolean
Parameter | Type |
---|---|
Parameter state | Type BlockState |
Name: increaseScore
ZenScript CopyPlayer.increaseScore(score as int)
Parameter | Type |
---|---|
Parameter score | Type int |
Name: isCreative
Return Type: boolean
ZenScript Copy// Player.isCreative() as boolean
myPlayer.isCreative();
Name: isHurt
Return Type: boolean
ZenScript Copy// Player.isHurt() as boolean
myPlayer.isHurt();
Name: isLocalPlayer
Return Type: boolean
ZenScript Copy// Player.isLocalPlayer() as boolean
myPlayer.isLocalPlayer();
Name: isReducedDebugInfo
Return Type: boolean
ZenScript Copy// Player.isReducedDebugInfo() as boolean
myPlayer.isReducedDebugInfo();
Name: isScoping
Return Type: boolean
ZenScript Copy// Player.isScoping() as boolean
myPlayer.isScoping();
Name: isSecondaryUseActive
Return Type: boolean
ZenScript Copy// Player.isSecondaryUseActive() as boolean
myPlayer.isSecondaryUseActive();
Name: isSleepingLongEnough
Return Type: boolean
ZenScript Copy// Player.isSleepingLongEnough() as boolean
myPlayer.isSleepingLongEnough();
Name: jumpFromGround
ZenScript Copy// Player.jumpFromGround()
myPlayer.jumpFromGround();
Name: magicCrit
ZenScript CopyPlayer.magicCrit(entity as Entity)
Parameter | Type |
---|---|
Parameter entity | Type Entity |
Name: mayBuild
Return Type: boolean
ZenScript Copy// Player.mayBuild() as boolean
myPlayer.mayBuild();
Name: playNotifySound
ZenScript CopyPlayer.playNotifySound(event as SoundEvent, source as SoundSource, volume as float, pitch as float)
Parameter | Type |
---|---|
Parameter event | Type SoundEvent |
Parameter source | Type SoundSource |
Parameter volume | Type float |
Parameter pitch | Type float |
Name: respawn
ZenScript Copy// Player.respawn()
myPlayer.respawn();
Name: sendMessage
ZenScript CopyPlayer.sendMessage(text as Component)
Parameter | Type |
---|---|
Parameter texte | Type Component |
Name: setEntityOnShoulder
Return Type: boolean
ZenScript CopyPlayer.setEntityOnShoulder(entityData as MapData) as boolean
Parameter | Type |
---|---|
Parameter entityData | Type MapData |
Name: setExperienceLevel
ZenScript CopyPlayer.setExperienceLevel(level as int)
Parameter | Type |
---|---|
Parameter level | Type int |
Name: setMainArm
ZenScript CopyPlayer.setMainArm(arm as HumanoidArm)
Parameter | Type |
---|---|
Parameter arm | Type HumanoidArm |
Name: setReducedDebugInfo
ZenScript CopyPlayer.setReducedDebugInfo(reducedDebugInfo as boolean)
Parameter | Type |
---|---|
Parameter reducedDebugInfo | Type boolean |
Name: setScore
ZenScript CopyPlayer.setScore(score as int)
Parameter | Type |
---|---|
Parameter score | Type int |
Name: stopSleeping
ZenScript Copy// Player.stopSleeping()
myPlayer.stopSleeping();
Name: sweepAttack
ZenScript Copy// Player.sweepAttack()
myPlayer.sweepAttack();
Properties
Link to properties
Name | Type | Has Getter | Has Setter |
---|---|---|---|
Name abilities | Type Abilities | Has Getter true | Has Setter false |
Name canUseGameMasterBlocks | Type boolean | Has Getter true | Has Setter false |
Name cooldowns | Type ItemCooldowns | Has Getter true | Has Setter false |
Name currentItemAttackStrengthDelay | Type float | Has Getter true | Has Setter false |
Name enchantmentSeed | Type int | Has Getter true | Has Setter false |
Name experienceLevel | Type int | Has Getter true | Has Setter true |
Name foodData | Type FoodData | Has Getter true | Has Setter false |
Name inventory | Type Inventory | Has Getter true | Has Setter false |
Name isCreative | Type boolean | Has Getter true | Has Setter false |
Name isHurt | Type boolean | Has Getter true | Has Setter false |
Name isLocalPlayer | Type boolean | Has Getter true | Has Setter false |
Name isReducedDebugInfo | Type boolean | Has Getter true | Has Setter false |
Name isScoping | Type boolean | Has Getter true | Has Setter false |
Name isSecondaryUseActive | Type boolean | Has Getter true | Has Setter false |
Name isSleepingLongEnough | Type boolean | Has Getter true | Has Setter false |
Name luck | Type float | Has Getter true | Has Setter false |
Name mainArm | Type HumanoidArm | Has Getter true | Has Setter false |
Name mayBuild | Type boolean | Has Getter true | Has Setter false |
Name score | Type int | Has Getter true | Has Setter false |
Name shoulderEntityLeft | Type MapData | Has Getter true | Has Setter false |
Name shoulderEntityRight | Type MapData | Has Getter true | Has Setter false |
Name sleepTimer | Type int | Has Getter true | Has Setter false |
Name xpNeededForNextLevel | Type int | Has Getter true | Has Setter false |