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 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 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 ソース | 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 テキスト | 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
名称 | Type | Has Getter | Has Setter |
---|---|---|---|
名称 abilities | Type Abilities | Has Getter true | Has Setter false |
名称 canUseGameMasterBlocks | Type boolean型 | Has Getter true | Has Setter false |
名称 cooldowns | Type ItemCooldowns | Has Getter true | Has Setter false |
名称 currentItemAttackStrengthDelay | Type float | Has Getter true | Has Setter false |
名称 enchantmentSeed | Type int | Has Getter true | Has Setter false |
名称 experienceLevel | Type int | Has Getter true | Has Setter true |
名称 foodData | Type FoodData | Has Getter true | Has Setter false |
名称 inventory | Type Inventory | Has Getter true | Has Setter false |
名称 isCreative | Type boolean型 | Has Getter true | Has Setter false |
名称 isHurt | Type boolean型 | Has Getter true | Has Setter false |
名称 isLocalPlayer | Type boolean型 | Has Getter true | Has Setter false |
名称 isReducedDebugInfo | Type boolean型 | Has Getter true | Has Setter false |
名称 isScoping | Type boolean型 | Has Getter true | Has Setter false |
名称 isSecondaryUseActive | Type boolean型 | Has Getter true | Has Setter false |
名称 isSleepingLongEnough | Type boolean型 | Has Getter true | Has Setter false |
名称 luck | Type float | Has Getter true | Has Setter false |
名称 mainArm | Type HumanoidArm | Has Getter true | Has Setter false |
名称 mayBuild | Type boolean型 | Has Getter true | Has Setter false |
名称 score | Type int | Has Getter true | Has Setter false |
名称 shoulderEntityLeft | Type MapData | Has Getter true | Has Setter false |
名称 shoulderEntityRight | Type MapData | Has Getter true | Has Setter false |
名称 sleepTimer | Type int | Has Getter true | Has Setter false |
名称 xpNeededForNextLevel | Type int | Has Getter true | Has Setter false |