Interface PocketComputer
- All Known Subinterfaces:
IPocketAccess
@NonExtendable
public interface PocketComputer
A pocket computer.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionintGet the colour of this pocket computer as an RGB number.@Nullable net.minecraft.world.entity.EntityGets the entity holding this item.net.minecraft.server.level.ServerLevelgetLevel()Get the level in which the pocket computer exists.net.minecraft.world.phys.Vec3Get the position of the pocket computer.booleanisActive()Check whether this pocket computer is currently being held by a player, lectern, or other valid entity.voidsetColour(int colour) Set the colour of the pocket computer to an RGB number.
-
Method Details
-
getLevel
net.minecraft.server.level.ServerLevel getLevel()Get the level in which the pocket computer exists.- Returns:
- The pocket computer's level.
-
getPosition
net.minecraft.world.phys.Vec3 getPosition()Get the position of the pocket computer.- Returns:
- The pocket computer's position.
-
getEntity
@Nullable net.minecraft.world.entity.Entity getEntity()Gets the entity holding this item.This must be called on the server thread.
- Returns:
- The holding entity, or
nullif none exists.
-
isActive
boolean isActive()Check whether this pocket computer is currently being held by a player, lectern, or other valid entity.As pocket computers are backed by item stacks, you must check for validity before updating the computer.
This must be called on the server thread.
- Returns:
- Whether this computer is active.
-
getColour
int getColour()Get the colour of this pocket computer as an RGB number.This method can only be called from the main server thread, when this computer is is active.
- Returns:
- The colour this pocket computer is. This will be a RGB colour between
0x000000and0xFFFFFFor -1 if it has no colour. - See Also:
-
setColour
void setColour(int colour) Set the colour of the pocket computer to an RGB number.This method can only be called from the main server thread, when this computer is is active.
- Parameters:
colour- The colour this pocket computer should be changed to. This should be a RGB colour between0x000000and0xFFFFFFor -1 to reset to the default colour.- See Also:
-