Importare la Classe

Link to importare-la-classe

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
ParametroTipo
Parametro
stack
Tipo
ItemStack

Name: attack

ZenScript
Copy
Player.attack(entity as Entity)
ParametroTipo
Parametro
entity
Tipo
Entity

Name: awardStat

ZenScript
Copy
Player.awardStat(stat as ResourceLocation)
ParametroTipo
Parametro
stat
Tipo
ResourceLocation

Name: awardStat

ZenScript
Copy
Player.awardStat(stat as ResourceLocation, amount as int)
ParametroTipo
Parametro
stat
Tipo
ResourceLocation
Parametro
amount
Tipo
int

Name: canEat

Return Type: boolean

ZenScript
Copy
Player.canEat(ignoreHunger as boolean) as boolean
ParametroTipo
Parametro
ignoreHunger
Tipo
boolean

Name: canHarmPlayer

Return Type: boolean

ZenScript
Copy
Player.canHarmPlayer(player as Player) as boolean
ParametroTipo
Parametro
player
Tipo
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)
ParametroTipo
Parametro
exhaustion
Tipo
float

Name: crit

ZenScript
Copy
Player.crit(entity as Entity)
ParametroTipo
Parametro
entity
Tipo
Entity

Name: disableShield

ZenScript
Copy
Player.disableShield(usingAxe as boolean)
ParametroTipo
Parametro
usingAxe
Tipo
boolean

Link to displayClientMessage

Name: displayClientMessage

ZenScript
Copy
Player.displayClientMessage(component as Component, actionBar as boolean)
ParametroTipo
Parametro
component
Tipo
Component
Parametro
actionBar
Tipo
boolean

Name: drop

Return Type: ItemEntity?

ZenScript
Copy
Player.drop(stack as ItemStack, traceItem as boolean) as ItemEntity?
ParametroTipo
Parametro
stack
Tipo
ItemStack
Parametro
traceItem
Tipo
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
ParametroTipo
Parametro
state
Tipo
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)
ParametroTipoOptionalDefault Value
Parametro
stack
Tipo
IItemStack
Optional
no
Default Value
Parametro
slot
Tipo
int
Optional
Default Value
-1

Link to giveExperienceLevels

Name: giveExperienceLevels

ZenScript
Copy
Player.giveExperienceLevels(levels as int)
ParametroTipo
Parametro
levels
Tipo
int

Link to giveExperiencePoints

Name: giveExperiencePoints

ZenScript
Copy
Player.giveExperiencePoints(amount as int)
ParametroTipo
Parametro
amount
Tipo
int

Link to hasCorrectToolForDrops

Name: hasCorrectToolForDrops

Return Type: boolean

ZenScript
Copy
Player.hasCorrectToolForDrops(state as BlockState) as boolean
ParametroTipo
Parametro
state
Tipo
BlockState

Name: increaseScore

ZenScript
Copy
Player.increaseScore(score as int)
ParametroTipo
Parametro
score
Tipo
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)
ParametroTipo
Parametro
entity
Tipo
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)
ParametroTipo
Parametro
event
Tipo
SoundEvent
Parametro
sorgente
Tipo
SoundSource
Parametro
volume
Tipo
float
Parametro
pitch
Tipo
float

Name: respawn

ZenScript
Copy
// Player.respawn()

myPlayer.respawn();

Name: sendMessage

ZenScript
Copy
Player.sendMessage(text as Component)
ParametroTipo
Parametro
testo
Tipo
Component

Link to setEntityOnShoulder

Name: setEntityOnShoulder

Return Type: boolean

ZenScript
Copy
Player.setEntityOnShoulder(entityData as MapData) as boolean
ParametroTipo
Parametro
entityData
Tipo
MapData

Link to setExperienceLevel

Name: setExperienceLevel

ZenScript
Copy
Player.setExperienceLevel(level as int)
ParametroTipo
Parametro
level
Tipo
int

Name: setMainArm

ZenScript
Copy
Player.setMainArm(arm as HumanoidArm)
ParametroTipo
Parametro
arm
Tipo
HumanoidArm

Link to setReducedDebugInfo

Name: setReducedDebugInfo

ZenScript
Copy
Player.setReducedDebugInfo(reducedDebugInfo as boolean)
ParametroTipo
Parametro
reducedDebugInfo
Tipo
boolean

Name: setScore

ZenScript
Copy
Player.setScore(score as int)
ParametroTipo
Parametro
score
Tipo
int

Name: stopSleeping

ZenScript
Copy
// Player.stopSleeping()

myPlayer.stopSleeping();

Name: sweepAttack

ZenScript
Copy
// Player.sweepAttack()

myPlayer.sweepAttack();
NomeTipoHa GetterHa Setter
Nome
abilities
Tipo
Abilities
Ha Getter
Ha Setter
no
Nome
canUseGameMasterBlocks
Tipo
boolean
Ha Getter
Ha Setter
no
Nome
cooldowns
Tipo
ItemCooldowns
Ha Getter
Ha Setter
no
Nome
currentItemAttackStrengthDelay
Tipo
float
Ha Getter
Ha Setter
no
Nome
enchantmentSeed
Tipo
int
Ha Getter
Ha Setter
no
Nome
experienceLevel
Tipo
int
Ha Getter
Ha Setter
Nome
foodData
Tipo
FoodData
Ha Getter
Ha Setter
no
Nome
inventory
Tipo
Inventory
Ha Getter
Ha Setter
no
Nome
isCreative
Tipo
boolean
Ha Getter
Ha Setter
no
Nome
isHurt
Tipo
boolean
Ha Getter
Ha Setter
no
Nome
isLocalPlayer
Tipo
boolean
Ha Getter
Ha Setter
no
Nome
isReducedDebugInfo
Tipo
boolean
Ha Getter
Ha Setter
no
Nome
isScoping
Tipo
boolean
Ha Getter
Ha Setter
no
Nome
isSecondaryUseActive
Tipo
boolean
Ha Getter
Ha Setter
no
Nome
isSleepingLongEnough
Tipo
boolean
Ha Getter
Ha Setter
no
Nome
luck
Tipo
float
Ha Getter
Ha Setter
no
Nome
mainArm
Tipo
HumanoidArm
Ha Getter
Ha Setter
no
Nome
mayBuild
Tipo
boolean
Ha Getter
Ha Setter
no
Nome
score
Tipo
int
Ha Getter
Ha Setter
no
Nome
shoulderEntityLeft
Tipo
MapData
Ha Getter
Ha Setter
no
Nome
shoulderEntityRight
Tipo
MapData
Ha Getter
Ha Setter
no
Nome
sleepTimer
Tipo
int
Ha Getter
Ha Setter
no
Nome
xpNeededForNextLevel
Tipo
int
Ha Getter
Ha Setter
no