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.
|
Location |
getBlockIn()
Get the point of the block that is being stood in.
|
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 |
getBlockTraceFace(int range,
boolean useLastBlock)
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.
|
void |
setPosition(Vector3 pos)
Move the player.
|
void |
setPosition(Vector3 pos,
float pitch,
float yaw)
Move the player.
|
getExtent, getLocation, getState, remove, setLocation
canDestroyBedrock, dispatchCUIEvent, getDisplayName, getName, isPlayer, openFileOpenDialog, openFileSaveDialog, print, printDebug, printError, printRaw
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 inLocation 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 getBlockTraceFace(int range, boolean useLastBlock)
range
- the rangeuseLastBlock
- try to return the last valid air block foundLocation 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 blocksvoid setPosition(Vector3 pos, float pitch, float yaw)
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 degreesvoid setPosition(Vector3 pos)
pos
- where to move them<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