MCPlayerEntity #MC玩家实体

Link to mcplayerentity-mc玩家实体

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.player.MCPlayerEntity;

Extending MCLivingEntity

Link to extending-mclivingentity

MCPlayerEntity extends MCLivingEntity. That means all methods available in MCLivingEntity are also available in MCPlayerEntity

Name: addExhaustion

Return Type: void

ZenScript
Copy
MCPlayerEntity.addExhaustion(exhaustion as float) as void
参数类型描述
参数
exhaustion
类型
float
描述
No Description Provided

Link to addExperienceLevels

Name: addExperienceLevels

Return Type: void

ZenScript
Copy
MCPlayerEntity.addExperienceLevels(levels as int) as void
参数类型描述
参数
levels
类型
int
描述
No Description Provided

Link to canUseCommandBlock

Name: canUseCommandBlock

Return Type: boolean

ZenScript
Copy
// MCPlayerEntity.canUseCommandBlock() as boolean

myMCPlayerEntity.canUseCommandBlock();

Name: drop

Return Type: boolean

ZenScript
Copy
MCPlayerEntity.drop(p_225609_1_ as boolean) as boolean
参数类型描述
参数
p_225609_1_
类型
布尔值
描述
No Description Provided

Name: getCurrentItem

Return Type: IItemStack

ZenScript
Copy
// MCPlayerEntity.getCurrentItem() as IItemStack

myMCPlayerEntity.getCurrentItem();

Name: getExperience

Return Type: float

ZenScript
Copy
// MCPlayerEntity.getExperience() as float

myMCPlayerEntity.getExperience();

Link to getExperienceLevel

Name: getExperienceLevel

Return Type: int

ZenScript
Copy
// MCPlayerEntity.getExperienceLevel() as int

myMCPlayerEntity.getExperienceLevel();

Link to getExperienceTotal

Name: getExperienceTotal

Return Type: int

ZenScript
Copy
// MCPlayerEntity.getExperienceTotal() as int

myMCPlayerEntity.getExperienceTotal();

Name: getFoodLevel

Return Type: int

ZenScript
Copy
// MCPlayerEntity.getFoodLevel() as int

myMCPlayerEntity.getFoodLevel();

Name: getHeldItem

Return Type: IItemStack

ZenScript
Copy
MCPlayerEntity.getHeldItem(hand as MCHand) as IItemStack
参数类型描述
参数
hand
类型
MCHand
描述
No Description Provided

Name: getInventory

Return Type: PlayerInventory

ZenScript
Copy
// MCPlayerEntity.getInventory() as PlayerInventory

myMCPlayerEntity.getInventory();

Link to getInventoryItemStack

Name: getInventoryItemStack

Return Type: IItemStack

ZenScript
Copy
MCPlayerEntity.getInventoryItemStack(slotIndex as int) as IItemStack
参数类型描述
参数
slotIndex
类型
int
描述
No Description Provided

Name: getLuck

Return Type: float

ZenScript
Copy
// MCPlayerEntity.getLuck() as float

myMCPlayerEntity.getLuck();

Link to getMaxInPortalTime

Name: getMaxInPortalTime

Return Type: int

ZenScript
Copy
// MCPlayerEntity.getMaxInPortalTime() as int

myMCPlayerEntity.getMaxInPortalTime();

Name: getName

Return Type: MCTextComponent

ZenScript
Copy
// MCPlayerEntity.getName() as MCTextComponent

myMCPlayerEntity.getName();

Link to getPersistentData

Name: getPersistentData

Gets the persisted NBT tag that is saved between deaths. Many mods use this to keep track of if they have given the player an item or not.

Return Type: MapData

ZenScript
Copy
// MCPlayerEntity.getPersistentData() as MapData

myMCPlayerEntity.getPersistentData();

Link to getPortalCooldown

Name: getPortalCooldown

Return Type: int

ZenScript
Copy
// MCPlayerEntity.getPortalCooldown() as int

myMCPlayerEntity.getPortalCooldown();

Link to getSaturationLevel

Name: getSaturationLevel

Return Type: float

ZenScript
Copy
// MCPlayerEntity.getSaturationLevel() as float

myMCPlayerEntity.getSaturationLevel();

Name: getSleepTimer

Return Type: int

ZenScript
Copy
// MCPlayerEntity.getSleepTimer() as int

myMCPlayerEntity.getSleepTimer();

Name: give

Return Type: void

ZenScript
Copy
MCPlayerEntity.give(stack as IItemStack) as void
参数类型描述
参数
堆叠
类型
IItemstack
描述
No Description Provided

Link to giveExperiencePoints

Name: giveExperiencePoints

Return Type: void

ZenScript
Copy
MCPlayerEntity.giveExperiencePoints(experience as int) as void
参数类型描述
参数
experience
类型
int
描述
No Description Provided

Name: isCreative

Return Type: boolean

ZenScript
Copy
// MCPlayerEntity.isCreative() as boolean

myMCPlayerEntity.isCreative();

Name: isFake

Return Type: boolean

ZenScript
Copy
// MCPlayerEntity.isFake() as boolean

myMCPlayerEntity.isFake();

Name: isPushedByWater

Return Type: boolean

ZenScript
Copy
// MCPlayerEntity.isPushedByWater() as boolean

myMCPlayerEntity.isPushedByWater();

Link to isSecondaryUseActive

Name: isSecondaryUseActive

Return Type: boolean

ZenScript
Copy
// MCPlayerEntity.isSecondaryUseActive() as boolean

myMCPlayerEntity.isSecondaryUseActive();

Name: isSpectator

Return Type: boolean

ZenScript
Copy
// MCPlayerEntity.isSpectator() as boolean

myMCPlayerEntity.isSpectator();

Name: isSwimming

Return Type: boolean

ZenScript
Copy
// MCPlayerEntity.isSwimming() as boolean

myMCPlayerEntity.isSwimming();

Name: isUser

Return Type: boolean

ZenScript
Copy
// MCPlayerEntity.isUser() as boolean

myMCPlayerEntity.isUser();

Name: needFood

Return Type: boolean

ZenScript
Copy
// MCPlayerEntity.needFood() as boolean

myMCPlayerEntity.needFood();

Name: sendMessage

Return Type: void

ZenScript
Copy
MCPlayerEntity.sendMessage(text as MCTextComponent) as void
参数类型描述
参数
文本
类型
MCText组件
描述
No Description Provided

Link to sendStatusMessage

Name: sendStatusMessage

Return Type: void

ZenScript
Copy
MCPlayerEntity.sendStatusMessage(text as MCTextComponent, actionBar as boolean) as void
参数类型描述
参数
文本
类型
MCText组件
描述
No Description Provided
参数
actionBar
类型
布尔值
描述
No Description Provided

Name: setFoodLevel

Return Type: void

ZenScript
Copy
MCPlayerEntity.setFoodLevel(value as int) as void
参数类型描述
参数
value
类型
int
描述
No Description Provided

Name: swing

Return Type: void

ZenScript
Copy
MCPlayerEntity.swing(hand as MCHand, updateSelf as boolean) as void
参数类型描述
参数
hand
类型
MCHand
描述
No Description Provided
参数
updateSelf
类型
布尔值
描述
No Description Provided

Name: unlockRecipes

Return Type: void

ZenScript
Copy
MCPlayerEntity.unlockRecipes(p_193102_1_ as MCResourceLocation[]) as void
参数类型描述
参数
p_193102_1_
类型
MCResourceLocation[]
描述
No Description Provided

Link to updatePersistentData

Name: updatePersistentData

Updates the player's persisted data that is saved between deaths.

Return Type: void

ZenScript
Copy
MCPlayerEntity.updatePersistentData(data as MapData) as void
参数类型描述
参数
data
类型
MapData #地图数据
描述
No Description Provided

Name: wakeUp

Return Type: void

ZenScript
Copy
// MCPlayerEntity.wakeUp() as void

myMCPlayerEntity.wakeUp();
名称类型可获得可设置描述
名称
experience
类型
float
可获得
true
可设置
false
描述
No Description Provided
名称
experienceLevel
类型
int
可获得
true
可设置
false
描述
No Description Provided
名称
experienceTotal
类型
int
可获得
true
可设置
false
描述
No Description Provided
名称
fake
类型
布尔值
可获得
true
可设置
false
描述
No Description Provided
名称
foodLevel
类型
int
可获得
true
可设置
true
描述
No Description Provided
名称
inventory
类型
PlayerInventory
可获得
true
可设置
false
描述
No Description Provided
名称
name(名称)
类型
MCText组件
可获得
true
可设置
false
描述
No Description Provided
名称
saturationLevel
类型
float
可获得
true
可设置
false
描述
No Description Provided