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
Copy
import 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

Name: addItem

Return Type: boolean

ZenScript
Copy
Player.addItem(stack as ItemStack) as boolean
ParameterType
Parameter
stack
Type
ItemStack

Name: attack

ZenScript
Copy
Player.attack(entity as Entity)
ParameterType
Parameter
entity
Type
Entity

Name: awardStat

ZenScript
Copy
Player.awardStat(stat as ResourceLocation)
ParameterType
Parameter
stat
Type
ResourceLocation

Name: awardStat

ZenScript
Copy
Player.awardStat(stat as ResourceLocation, amount as int)
ParameterType
Parameter
stat
Type
ResourceLocation
Parameter
amount
Type
int

Name: canEat

Return Type: boolean

ZenScript
Copy
Player.canEat(ignoreHunger as boolean) as boolean
ParameterType
Parameter
ignoreHunger
Type
boolean

Name: canHarmPlayer

Return Type: boolean

ZenScript
Copy
Player.canHarmPlayer(player as Player) as boolean
ParameterType
Parameter
player
Type
Player

Link to canUseGameMasterBlocks

Name: canUseGameMasterBlocks

Return Type: boolean

ZenScript
Copy
// Player.canUseGameMasterBlocks() as boolean

myPlayer.canUseGameMasterBlocks();

Link to causeFoodExhaustion

Name: causeFoodExhaustion

ZenScript
Copy
Player.causeFoodExhaustion(exhaustion as float)
ParameterType
Parameter
exhaustion
Type
float

Name: crit

ZenScript
Copy
Player.crit(entity as Entity)
ParameterType
Parameter
entity
Type
Entity

Name: disableShield

ZenScript
Copy
Player.disableShield(usingAxe as boolean)
ParameterType
Parameter
usingAxe
Type
boolean

Link to displayClientMessage

Name: displayClientMessage

ZenScript
Copy
Player.displayClientMessage(component as Component, actionBar as boolean)
ParameterType
Parameter
component
Type
Component
Parameter
actionBar
Type
boolean

Name: drop

Return Type: ItemEntity?

ZenScript
Copy
Player.drop(stack as ItemStack, traceItem as boolean) as ItemEntity?
ParameterType
Parameter
stack
Type
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();

Link to getCurrentItemAttackStrengthDelay

Name: getCurrentItemAttackStrengthDelay

Return Type: float

ZenScript
Copy
// Player.getCurrentItemAttackStrengthDelay() as float

myPlayer.getCurrentItemAttackStrengthDelay();

Name: getDestroySpeed

Return Type: float

ZenScript
Copy
Player.getDestroySpeed(state as BlockState) as float
ParameterType
Parameter
state
Type
BlockState

Link to getEnchantmentSeed

Name: getEnchantmentSeed

Return Type: int

ZenScript
Copy
// Player.getEnchantmentSeed() as int

myPlayer.getEnchantmentSeed();

Link to getExperienceLevel

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();

Link to getShoulderEntityLeft

Name: getShoulderEntityLeft

Return Type: MapData

ZenScript
Copy
// Player.getShoulderEntityLeft() as MapData

myPlayer.getShoulderEntityLeft();

Link to getShoulderEntityRight

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();

Link to getXpNeededForNextLevel

Name: getXpNeededForNextLevel

Return Type: int

ZenScript
Copy
// Player.getXpNeededForNextLevel() as int

myPlayer.getXpNeededForNextLevel();

Name: give

ZenScript
Copy
Player.give(stack as IItemStack, slot as int)
ParameterTypeOptionalDefault Value
Parameter
stack
Type
IItemStack
Optional
false
Default Value
​
Parameter
slot
Type
int
Optional
true
Default Value
-1

Link to giveExperienceLevels

Name: giveExperienceLevels

ZenScript
Copy
Player.giveExperienceLevels(levels as int)
ParameterType
Parameter
levels
Type
int

Link to giveExperiencePoints

Name: giveExperiencePoints

ZenScript
Copy
Player.giveExperiencePoints(amount as int)
ParameterType
Parameter
amount
Type
int

Link to hasCorrectToolForDrops

Name: hasCorrectToolForDrops

Return Type: boolean

ZenScript
Copy
Player.hasCorrectToolForDrops(state as BlockState) as boolean
ParameterType
Parameter
state
Type
BlockState

Name: increaseScore

ZenScript
Copy
Player.increaseScore(score as int)
ParameterType
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();

Link to isReducedDebugInfo

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();

Link to isSecondaryUseActive

Name: isSecondaryUseActive

Return Type: boolean

ZenScript
Copy
// Player.isSecondaryUseActive() as boolean

myPlayer.isSecondaryUseActive();

Link to isSleepingLongEnough

Name: isSleepingLongEnough

Return Type: boolean

ZenScript
Copy
// Player.isSleepingLongEnough() as boolean

myPlayer.isSleepingLongEnough();

Name: jumpFromGround

ZenScript
Copy
// Player.jumpFromGround()

myPlayer.jumpFromGround();

Name: magicCrit

ZenScript
Copy
Player.magicCrit(entity as Entity)
ParameterType
Parameter
entity
Type
Entity

Name: mayBuild

Return Type: boolean

ZenScript
Copy
// Player.mayBuild() as boolean

myPlayer.mayBuild();

Name: playNotifySound

ZenScript
Copy
Player.playNotifySound(event as SoundEvent, source as SoundSource, volume as float, pitch as float)
ParameterType
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
Copy
Player.sendMessage(text as Component)
ParameterType
Parameter
text
Type
Component

Link to setEntityOnShoulder

Name: setEntityOnShoulder

Return Type: boolean

ZenScript
Copy
Player.setEntityOnShoulder(entityData as MapData) as boolean
ParameterType
Parameter
entityData
Type
MapData

Link to setExperienceLevel

Name: setExperienceLevel

ZenScript
Copy
Player.setExperienceLevel(level as int)
ParameterType
Parameter
level
Type
int

Name: setMainArm

ZenScript
Copy
Player.setMainArm(arm as HumanoidArm)
ParameterType
Parameter
arm
Type
HumanoidArm

Link to setReducedDebugInfo

Name: setReducedDebugInfo

ZenScript
Copy
Player.setReducedDebugInfo(reducedDebugInfo as boolean)
ParameterType
Parameter
reducedDebugInfo
Type
boolean

Name: setScore

ZenScript
Copy
Player.setScore(score as int)
ParameterType
Parameter
score
Type
int

Name: stopSleeping

ZenScript
Copy
// Player.stopSleeping()

myPlayer.stopSleeping();

Name: sweepAttack

ZenScript
Copy
// Player.sweepAttack()

myPlayer.sweepAttack();
NameTypeHas GetterHas 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