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.

import crafttweaker.api.player.MCPlayerEntity;

Extending MCLivingEntity

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

方法

addExhaustion #增加饥饿值

Return Type: void

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

canUseCommandBlock #是否可以使用命令方块

Return Type: boolean

MCPlayerEntity.canUseCommandBlock() as boolean
myMCPlayerEntity.canUseCommandBlock();

drop

Return Type: boolean

MCPlayerEntity.drop(p_225609_1_ as boolean) as boolean
参数类型描述
p_225609_1_booleanNo Description Provided

getCurrentItem

Return Type: IItemStack

MCPlayerEntity.getCurrentItem() as IItemStack
myMCPlayerEntity.getCurrentItem();

getFoodLevel

Return Type: int

MCPlayerEntity.getFoodLevel() as int
myMCPlayerEntity.getFoodLevel();

getInventoryItemStack

Return Type: IItemStack

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

getLuck

Return Type: float

MCPlayerEntity.getLuck() as float
myMCPlayerEntity.getLuck();

getMaxInPortalTime

Return Type: int

MCPlayerEntity.getMaxInPortalTime() as int
myMCPlayerEntity.getMaxInPortalTime();

getName

Return Type: MCTextComponent

MCPlayerEntity.getName() as MCTextComponent
myMCPlayerEntity.getName();

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

MCPlayerEntity.getPersistentData() as MapData
myMCPlayerEntity.getPersistentData();

getPortalCooldown

Return Type: int

MCPlayerEntity.getPortalCooldown() as int
myMCPlayerEntity.getPortalCooldown();

getSaturationLevel

Return Type: float

MCPlayerEntity.getSaturationLevel() as float
myMCPlayerEntity.getSaturationLevel();

getSleepTimer

Return Type: int

MCPlayerEntity.getSleepTimer() as int
myMCPlayerEntity.getSleepTimer();

give

Return Type: void

MCPlayerEntity.give(stack as IItemStack) as void
参数类型描述
stackIItemStackNo Description Provided

isCreative

Return Type: boolean

MCPlayerEntity.isCreative() as boolean
myMCPlayerEntity.isCreative();

isFake

Return Type: boolean

MCPlayerEntity.isFake() as boolean
myMCPlayerEntity.isFake();

isPushedByWater

Return Type: boolean

MCPlayerEntity.isPushedByWater() as boolean
myMCPlayerEntity.isPushedByWater();

isSecondaryUseActive

Return Type: boolean

MCPlayerEntity.isSecondaryUseActive() as boolean
myMCPlayerEntity.isSecondaryUseActive();

isSpectator

Return Type: boolean

MCPlayerEntity.isSpectator() as boolean
myMCPlayerEntity.isSpectator();

isSwimming

Return Type: boolean

MCPlayerEntity.isSwimming() as boolean
myMCPlayerEntity.isSwimming();

isUser

Return Type: boolean

MCPlayerEntity.isUser() as boolean
myMCPlayerEntity.isUser();

needFood

Return Type: boolean

MCPlayerEntity.needFood() as boolean
myMCPlayerEntity.needFood();

sendMessage

Return Type: void

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

sendStatusMessage

Return Type: void

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

setFoodLevel

Return Type: void

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

unlockRecipes

Return Type: void

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

updatePersistentData

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

Return Type: void

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

wakeUp

Return Type: void

MCPlayerEntity.wakeUp() as void
myMCPlayerEntity.wakeUp();

参数

名称类型可获得可设置
fakebooleantruefalse
foodLevelinttruetrue
nameMCText组件truefalse
saturationLevelfloattruefalse