Player
Link to player
导入类
Link to 导入类
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
使用方式
Link to 使用方式
Name: addItem
Return Type: boolean
ZenScript CopyPlayer.addItem(stack as ItemStack) as boolean
参数 | 类型 |
---|---|
参数 堆叠 | 类型 物品应用 |
Name: awardStat
ZenScript CopyPlayer.awardStat(stat as ResourceLocation, amount as int)
参数 | 类型 |
---|---|
参数 stat | 类型 资源位置 |
参数 amount | 类型 int |
Name: canEat
Return Type: boolean
ZenScript CopyPlayer.canEat(ignoreHunger as boolean) as boolean
参数 | 类型 |
---|---|
参数 ignoreHunger | 类型 布尔值 |
Name: canHarmPlayer
Return Type: boolean
ZenScript CopyPlayer.canHarmPlayer(player as Player) as boolean
参数 | 类型 |
---|---|
参数 player | 类型 Player |
Name: canUseGameMasterBlocks
Return Type: boolean
ZenScript Copy// Player.canUseGameMasterBlocks() as boolean
myPlayer.canUseGameMasterBlocks();
Name: causeFoodExhaustion
ZenScript CopyPlayer.causeFoodExhaustion(exhaustion as float)
参数 | 类型 |
---|---|
参数 exhaustion | 类型 float |
Name: disableShield
ZenScript CopyPlayer.disableShield(usingAxe as boolean)
参数 | 类型 |
---|---|
参数 usingAxe | 类型 布尔值 |
Name: displayClientMessage
ZenScript CopyPlayer.displayClientMessage(component as Component, actionBar as boolean)
参数 | 类型 |
---|---|
参数 component | 类型 Component |
参数 actionBar | 类型 布尔值 |
Name: drop
Return Type: ItemEntity?
ZenScript CopyPlayer.drop(stack as ItemStack, traceItem as boolean) as ItemEntity?
参数 | 类型 |
---|---|
参数 堆叠 | 类型 物品应用 |
参数 traceItem | 类型 布尔值 |
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
参数 | 类型 |
---|---|
参数 state | 类型 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)
参数 | 类型 | 可选 | 默认值 |
---|---|---|---|
参数 堆叠 | 类型 IItemstack | 可选 false | 默认值 |
参数 slot | 类型 int | 可选 true | 默认值 -1 |
Name: giveExperienceLevels
ZenScript CopyPlayer.giveExperienceLevels(levels as int)
参数 | 类型 |
---|---|
参数 levels | 类型 int |
Name: giveExperiencePoints
ZenScript CopyPlayer.giveExperiencePoints(amount as int)
参数 | 类型 |
---|---|
参数 amount | 类型 int |
Name: hasCorrectToolForDrops
Return Type: boolean
ZenScript CopyPlayer.hasCorrectToolForDrops(state as BlockState) as boolean
参数 | 类型 |
---|---|
参数 state | 类型 BlockState |
Name: increaseScore
ZenScript CopyPlayer.increaseScore(score as int)
参数 | 类型 |
---|---|
参数 score | 类型 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: 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)
参数 | 类型 |
---|---|
参数 event | 类型 SoundEvent |
参数 来源 | 类型 SoundSource |
参数 volume | 类型 float |
参数 pitch | 类型 float |
Name: respawn
ZenScript Copy// Player.respawn()
myPlayer.respawn();
Name: setEntityOnShoulder
Return Type: boolean
ZenScript CopyPlayer.setEntityOnShoulder(entityData as MapData) as boolean
参数 | 类型 |
---|---|
参数 entityData | 类型 MapData #地图数据 |
Name: setExperienceLevel
ZenScript CopyPlayer.setExperienceLevel(level as int)
参数 | 类型 |
---|---|
参数 level | 类型 int |
Name: setReducedDebugInfo
ZenScript CopyPlayer.setReducedDebugInfo(reducedDebugInfo as boolean)
参数 | 类型 |
---|---|
参数 reducedDebugInfo | 类型 布尔值 |
Name: setScore
ZenScript CopyPlayer.setScore(score as int)
参数 | 类型 |
---|---|
参数 score | 类型 int |
Name: stopSleeping
ZenScript Copy// Player.stopSleeping()
myPlayer.stopSleeping();
Name: sweepAttack
ZenScript Copy// Player.sweepAttack()
myPlayer.sweepAttack();
名称 | 类型 | 可获得 | 可设置 |
---|---|---|---|
名称 abilities | 类型 Abilities | 可获得 true | 可设置 false |
名称 canUseGameMasterBlocks | 类型 布尔值 | 可获得 true | 可设置 false |
名称 cooldowns | 类型 ItemCooldowns | 可获得 true | 可设置 false |
名称 currentItemAttackStrengthDelay | 类型 float | 可获得 true | 可设置 false |
名称 enchantmentSeed | 类型 int | 可获得 true | 可设置 false |
名称 experienceLevel | 类型 int | 可获得 true | 可设置 true |
名称 foodData | 类型 FoodData | 可获得 true | 可设置 false |
名称 inventory | 类型 Inventory | 可获得 true | 可设置 false |
名称 isCreative | 类型 布尔值 | 可获得 true | 可设置 false |
名称 isHurt | 类型 布尔值 | 可获得 true | 可设置 false |
名称 isLocalPlayer | 类型 布尔值 | 可获得 true | 可设置 false |
名称 isReducedDebugInfo | 类型 布尔值 | 可获得 true | 可设置 false |
名称 isScoping | 类型 布尔值 | 可获得 true | 可设置 false |
名称 isSecondaryUseActive | 类型 布尔值 | 可获得 true | 可设置 false |
名称 isSleepingLongEnough | 类型 布尔值 | 可获得 true | 可设置 false |
名称 luck | 类型 float | 可获得 true | 可设置 false |
名称 mainArm | 类型 HumanoidArm | 可获得 true | 可设置 false |
名称 mayBuild | 类型 布尔值 | 可获得 true | 可设置 false |
名称 score | 类型 int | 可获得 true | 可设置 false |
名称 shoulderEntityLeft | 类型 MapData #地图数据 | 可获得 true | 可设置 false |
名称 shoulderEntityRight | 类型 MapData #地图数据 | 可获得 true | 可设置 false |
名称 sleepTimer | 类型 int | 可获得 true | 可设置 false |
名称 xpNeededForNextLevel | 类型 int | 可获得 true | 可设置 false |