public interface Player extends Entity, Actor
Modifier and Type | Method and Description |
---|---|
boolean |
ascendLevel()
Go up one level to the next free space above.
|
boolean |
ascendToCeiling(int clearance)
Ascend to the ceiling above.
|
boolean |
ascendToCeiling(int clearance,
boolean alwaysGlass)
Ascend to the ceiling above.
|
boolean |
ascendUpwards(int distance)
Just go up.
|
boolean |
ascendUpwards(int distance,
boolean alwaysGlass)
Just go up.
|
boolean |
descendLevel()
Go up one level to the next free space above.
|
void |
findFreePosition()
Find a position for the player to stand that is not inside a block.
|
void |
findFreePosition(Location searchPos)
Find a position for the actor to stand that is not inside a block.
|
void |
floatAt(int x,
int y,
int z,
boolean alwaysGlass)
Make the player float in the given blocks.
|
default Location |
getBlockIn()
Deprecated.
Use Locatable#getBlockLocation
|
BaseBlock |
getBlockInHand(HandSide handSide)
Get the Block that the player is holding.
|
Location |
getBlockOn()
Get the point of the block that is being stood upon.
|
Location |
getBlockTrace(int range)
Get the point of the block being looked at.
|
Location |
getBlockTrace(int range,
boolean useLastBlock)
Get the point of the block being looked at.
|
Location |
getBlockTrace(int range,
boolean useLastBlock,
Mask stopMask)
Get the point of the block being looked at.
|
Location |
getBlockTraceFace(int range,
boolean useLastBlock)
Get the face that the player is looking at.
|
Location |
getBlockTraceFace(int range,
boolean useLastBlock,
Mask stopMask)
Get the face that the player is looking at.
|
Direction |
getCardinalDirection()
Get the player's cardinal direction (N, W, NW, etc.).
|
Direction |
getCardinalDirection(int yawOffset)
Get the player's cardinal direction (N, W, NW, etc.) with an offset.
|
GameMode |
getGameMode()
Return this actor's game mode.
|
BlockBag |
getInventoryBlockBag()
Get this actor's block bag.
|
BaseItemStack |
getItemInHand(HandSide handSide)
Get the item that the player is holding.
|
Location |
getSolidBlockTrace(int range)
Get the point of the block being looked at.
|
World |
getWorld()
Return the world that the player is on.
|
void |
giveItem(BaseItemStack itemStack)
Gives the player an item.
|
boolean |
isHoldingPickAxe()
Returns true if the entity is holding a pick axe.
|
boolean |
passThroughForwardWall(int range)
Pass through the wall that you are looking at.
|
<B extends BlockStateHolder<B>> |
sendFakeBlock(BlockVector3 pos,
B block)
Sends a fake block to the client.
|
void |
setGameMode(GameMode gameMode)
Sets the player to the given game mode.
|
void |
setOnGround(Location searchPos)
Set the actor on the ground.
|
default void |
setPosition(Vector3 pos,
float pitch,
float yaw)
Deprecated.
This method may fail without indication. Use
trySetPosition(Vector3, float, float) instead |
default boolean |
trySetPosition(Vector3 pos,
float pitch,
float yaw)
Attempt to move the player.
|
getBlockLocation, getExtent, getLocation, setLocation, setPosition, trySetPosition
canDestroyBedrock, dispatchCUIEvent, getDisplayName, getLocale, getName, isPlayer, openFileOpenDialog, openFileSaveDialog, print, print, printDebug, printDebug, printError, printError, printInfo, printRaw, sendAnnouncements
getUniqueId
getSessionKey
checkPermission, getGroups, hasPermission
World getWorld()
boolean isHoldingPickAxe()
Direction getCardinalDirection(int yawOffset)
yawOffset
- offset that is added to the player's yaw before determining the cardinal directionBaseItemStack getItemInHand(HandSide handSide)
BaseBlock getBlockInHand(HandSide handSide) throws WorldEditException
WorldEditException
void giveItem(BaseItemStack itemStack)
itemStack
- The item to giveBlockBag getInventoryBlockBag()
GameMode getGameMode()
void setGameMode(GameMode gameMode)
gameMode
- The game modevoid findFreePosition(Location searchPos)
searchPos
- search positionvoid setOnGround(Location searchPos)
searchPos
- The location to start searching fromvoid findFreePosition()
boolean ascendLevel()
boolean descendLevel()
boolean ascendToCeiling(int clearance)
clearance
- How many blocks to leave above the player's headboolean ascendToCeiling(int clearance, boolean alwaysGlass)
clearance
- How many blocks to leave above the player's headalwaysGlass
- Always put glass under the playerboolean ascendUpwards(int distance)
distance
- How far up to teleportboolean ascendUpwards(int distance, boolean alwaysGlass)
distance
- How far up to teleportalwaysGlass
- Always put glass under the playervoid floatAt(int x, int y, int z, boolean alwaysGlass)
x
- The X coordinate of the block to float iny
- The Y coordinate of the block to float inz
- The Z coordinate of the block to float in@Deprecated default Location getBlockIn()
Location getBlockOn()
Location getBlockTrace(int range, boolean useLastBlock)
range
- how far to checks for blocksuseLastBlock
- try to return the last valid air block foundLocation getBlockTrace(int range, boolean useLastBlock, @Nullable Mask stopMask)
range
- how far to checks for blocksuseLastBlock
- try to return the last valid block not matching the stop mask foundstopMask
- the mask used to determine when to stop tracingLocation getBlockTraceFace(int range, boolean useLastBlock)
range
- the rangeuseLastBlock
- try to return the last valid air block foundLocation getBlockTraceFace(int range, boolean useLastBlock, @Nullable Mask stopMask)
range
- the rangeuseLastBlock
- try to return the last valid block not matching the stop mask foundstopMask
- the mask used to determine when to stop tracingLocation getBlockTrace(int range)
range
- How far to checks for blocksLocation getSolidBlockTrace(int range)
range
- How far to checks for blocksDirection getCardinalDirection()
boolean passThroughForwardWall(int range)
range
- How far to checks for blocks@Deprecated default void setPosition(Vector3 pos, float pitch, float yaw)
trySetPosition(Vector3, float, float)
insteadpos
- where to move thempitch
- the pitch (up/down) of the player's view in degreesyaw
- the yaw (left/right) of the player's view in degrees@NonAbstractForCompatibility(delegateName="setPosition", delegateParams={Vector3.class,float.class,float.class}) default boolean trySetPosition(Vector3 pos, float pitch, float yaw)
This action may fail, due to other mods cancelling the move.
If so, this method will return false
.
pos
- where to move thempitch
- the pitch (up/down) of the player's view in degreesyaw
- the yaw (left/right) of the player's view in degreesNonAbstractForCompatibility
for details<B extends BlockStateHolder<B>> void sendFakeBlock(BlockVector3 pos, @Nullable B block)
This block isn't real.
pos
- The position of the blockblock
- The block to send, null to reset