Player
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.
import crafttweaker.api.entity.type.player.Player;
Extending LivingEntity
Player extends LivingEntity. That means all methods available in LivingEntity are also available in Player
Methods
Return Type: boolean
Player.addItem(stack as ItemStack) as boolean
Parameter | Type | Description |
---|---|---|
Parameter stack | Type ItemStack | Description No Description Provided |
Return Type: void
Player.attack(entity as Entity) as void
Parameter | Type | Description |
---|---|---|
Parameter entity | Type Entity | Description No Description Provided |
Return Type: void
Player.awardStat(stat as ResourceLocation) as void
Parameter | Type | Description |
---|---|---|
Parameter stat | Type ResourceLocation | Description No Description Provided |
Return Type: void
Player.awardStat(stat as ResourceLocation, amount as int) as void
Parameter | Type | Description |
---|---|---|
Parameter stat | Type ResourceLocation | Description No Description Provided |
Parameter amount | Type int | Description No Description Provided |
Return Type: boolean
Player.canEat(ignoreHunger as boolean) as boolean
Parameter | Type | Description |
---|---|---|
Parameter ignoreHunger | Type boolean | Description No Description Provided |
Return Type: boolean
Player.canHarmPlayer(player as Player) as boolean
Parameter | Type | Description |
---|---|---|
Parameter player | Type Player | Description No Description Provided |
Return Type: boolean
// Player.canUseGameMasterBlocks() as boolean
myPlayer.canUseGameMasterBlocks();
Return Type: void
Player.causeFoodExhaustion(exhaustion as float) as void
Parameter | Type | Description |
---|---|---|
Parameter exhaustion | Type float | Description No Description Provided |
Return Type: void
Player.crit(entity as Entity) as void
Parameter | Type | Description |
---|---|---|
Parameter entity | Type Entity | Description No Description Provided |
Return Type: void
Player.disableShield(usingAxe as boolean) as void
Parameter | Type | Description |
---|---|---|
Parameter usingAxe | Type boolean | Description No Description Provided |
Return Type: void
Player.displayClientMessage(component as Component, actionBar as boolean) as void
Parameter | Type | Description |
---|---|---|
Parameter component | Type Component | Description No Description Provided |
Parameter actionBar | Type boolean | Description No Description Provided |
Return Type: ItemEntity
Player.drop(stack as ItemStack, traceItem as boolean) as ItemEntity
Parameter | Type | Description |
---|---|---|
Parameter stack | Type ItemStack | Description No Description Provided |
Parameter traceItem | Type boolean | Description No Description Provided |
Return Type: Abilities
// Player.getAbilities() as Abilities
myPlayer.getAbilities();
Return Type: ItemCooldowns
// Player.getCooldowns() as ItemCooldowns
myPlayer.getCooldowns();
Return Type: float
// Player.getCurrentItemAttackStrengthDelay() as float
myPlayer.getCurrentItemAttackStrengthDelay();
Return Type: float
Player.getDestroySpeed(state as BlockState) as float
Parameter | Type | Description |
---|---|---|
Parameter state | Type BlockState | Description No Description Provided |
Return Type: int
// Player.getEnchantmentSeed() as int
myPlayer.getEnchantmentSeed();
Return Type: FoodData
// Player.getFoodData() as FoodData
myPlayer.getFoodData();
Return Type: Inventory
// Player.getInventory() as Inventory
myPlayer.getInventory();
Return Type: float
// Player.getLuck() as float
myPlayer.getLuck();
Return Type: HumanoidArm
// Player.getMainArm() as HumanoidArm
myPlayer.getMainArm();
Return Type: int
// Player.getScore() as int
myPlayer.getScore();
Return Type: MapData
// Player.getShoulderEntityLeft() as MapData
myPlayer.getShoulderEntityLeft();
Return Type: MapData
// Player.getShoulderEntityRight() as MapData
myPlayer.getShoulderEntityRight();
Return Type: int
// Player.getSleepTimer() as int
myPlayer.getSleepTimer();
Return Type: int
// Player.getXpNeededForNextLevel() as int
myPlayer.getXpNeededForNextLevel();
Return Type: void
Player.give(stack as IItemStack, slot as int) as void
Parameter | Type | Description | Optional | DefaultValue |
---|---|---|---|---|
Parameter stack | Type IItemStack | Description No Description Provided | Optional false | DefaultValue |
Parameter slot | Type int | Description No Description Provided | Optional true | DefaultValue -1 |
Return Type: void
Player.giveExperienceLevels(levels as int) as void
Parameter | Type | Description |
---|---|---|
Parameter levels | Type int | Description No Description Provided |
Return Type: void
Player.giveExperiencePoints(amount as int) as void
Parameter | Type | Description |
---|---|---|
Parameter amount | Type int | Description No Description Provided |
Return Type: boolean
Player.hasCorrectToolForDrops(state as BlockState) as boolean
Parameter | Type | Description |
---|---|---|
Parameter state | Type BlockState | Description No Description Provided |
Return Type: void
Player.increaseScore(score as int) as void
Parameter | Type | Description |
---|---|---|
Parameter score | Type int | Description No Description Provided |
Return Type: boolean
// Player.isCreative() as boolean
myPlayer.isCreative();
Return Type: boolean
// Player.isHurt() as boolean
myPlayer.isHurt();
Return Type: boolean
// Player.isLocalPlayer() as boolean
myPlayer.isLocalPlayer();
Return Type: boolean
// Player.isReducedDebugInfo() as boolean
myPlayer.isReducedDebugInfo();
Return Type: boolean
// Player.isScoping() as boolean
myPlayer.isScoping();
Return Type: boolean
// Player.isSecondaryUseActive() as boolean
myPlayer.isSecondaryUseActive();
Return Type: boolean
// Player.isSleepingLongEnough() as boolean
myPlayer.isSleepingLongEnough();
Return Type: void
// Player.jumpFromGround() as void
myPlayer.jumpFromGround();
Return Type: void
Player.magicCrit(entity as Entity) as void
Parameter | Type | Description |
---|---|---|
Parameter entity | Type Entity | Description No Description Provided |
Return Type: boolean
// Player.mayBuild() as boolean
myPlayer.mayBuild();
Return Type: void
Player.playNotifySound(event as SoundEvent, source as SoundSource, volume as float, pitch as float) as void
Parameter | Type | Description |
---|---|---|
Parameter event | Type SoundEvent | Description No Description Provided |
Parameter source | Type SoundSource | Description No Description Provided |
Parameter volume | Type float | Description No Description Provided |
Parameter pitch | Type float | Description No Description Provided |
Return Type: void
// Player.respawn() as void
myPlayer.respawn();
Return Type: void
Player.sendMessage(text as Component) as void
Parameter | Type | Description |
---|---|---|
Parameter text | Type Component | Description No Description Provided |
Return Type: boolean
Player.setEntityOnShoulder(entityData as MapData) as boolean
Parameter | Type | Description |
---|---|---|
Parameter entityData | Type MapData | Description No Description Provided |
Return Type: void
Player.setMainArm(arm as HumanoidArm) as void
Parameter | Type | Description |
---|---|---|
Parameter arm | Type HumanoidArm | Description No Description Provided |
Return Type: void
Player.setReducedDebugInfo(reducedDebugInfo as boolean) as void
Parameter | Type | Description |
---|---|---|
Parameter reducedDebugInfo | Type boolean | Description No Description Provided |
Return Type: void
Player.setScore(score as int) as void
Parameter | Type | Description |
---|---|---|
Parameter score | Type int | Description No Description Provided |
Return Type: void
// Player.stopSleeping() as void
myPlayer.stopSleeping();
Return Type: void
// Player.sweepAttack() as void
myPlayer.sweepAttack();
Properties
Name | Type | Has Getter | Has Setter | Description |
---|---|---|---|---|
Name abilities | Type Abilities | Has Getter true | Has Setter false | Description No Description Provided |
Name canUseGameMasterBlocks | Type boolean | Has Getter true | Has Setter false | Description No Description Provided |
Name cooldowns | Type ItemCooldowns | Has Getter true | Has Setter false | Description No Description Provided |
Name currentItemAttackStrengthDelay | Type float | Has Getter true | Has Setter false | Description No Description Provided |
Name enchantmentSeed | Type int | Has Getter true | Has Setter false | Description No Description Provided |
Name foodData | Type FoodData | Has Getter true | Has Setter false | Description No Description Provided |
Name inventory | Type Inventory | Has Getter true | Has Setter false | Description No Description Provided |
Name isCreative | Type boolean | Has Getter true | Has Setter false | Description No Description Provided |
Name isHurt | Type boolean | Has Getter true | Has Setter false | Description No Description Provided |
Name isLocalPlayer | Type boolean | Has Getter true | Has Setter false | Description No Description Provided |
Name isReducedDebugInfo | Type boolean | Has Getter true | Has Setter false | Description No Description Provided |
Name isScoping | Type boolean | Has Getter true | Has Setter false | Description No Description Provided |
Name isSecondaryUseActive | Type boolean | Has Getter true | Has Setter false | Description No Description Provided |
Name isSleepingLongEnough | Type boolean | Has Getter true | Has Setter false | Description No Description Provided |
Name luck | Type float | Has Getter true | Has Setter false | Description No Description Provided |
Name mainArm | Type HumanoidArm | Has Getter true | Has Setter false | Description No Description Provided |
Name mayBuild | Type boolean | Has Getter true | Has Setter false | Description No Description Provided |
Name score | Type int | Has Getter true | Has Setter false | Description No Description Provided |
Name shoulderEntityLeft | Type MapData | Has Getter true | Has Setter false | Description No Description Provided |
Name shoulderEntityRight | Type MapData | Has Getter true | Has Setter false | Description No Description Provided |
Name sleepTimer | Type int | Has Getter true | Has Setter false | Description No Description Provided |
Name xpNeededForNextLevel | Type int | Has Getter true | Has Setter false | Description No Description Provided |