Package net.minecraft.server.level
Class ServerPlayerGameMode
java.lang.Object
net.minecraft.server.level.ServerPlayerGameMode
- Direct Known Subclasses:
DemoMode
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BlockPosprivate intprivate BlockPosprivate intprivate static final doubleprivate GameTypeprivate intprivate booleanprivate booleanprivate intprotected ServerLevelprivate static final org.slf4j.Loggerprotected final ServerPlayerprivate GameType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanchangeGameModeForPlayer(GameType gameModeForPlayer) private voiddebugLogging(BlockPos pos, boolean terminate, int sequence, String message) voiddestroyAndAck(BlockPos pos, int sequence, String message) booleandestroyBlock(BlockPos pos) Attempts to harvest a blockvoidhandleBlockBreakAction(BlockPos pos, ServerboundPlayerActionPacket.Action action, Direction face, int maxBuildHeight, int sequence) private floatincrementDestroyProgress(BlockState state, BlockPos pos, int startTick) booleanprivate booleanbooleanprivate booleanremoveBlock(BlockPos pos, BlockState state, boolean canHarvest, ItemStack toolStack) Patched-in method that handles actual removal of blocks fordestroyBlock(BlockPos).protected voidsetGameModeForPlayer(GameType gameMode, GameType previousGameMode) voidsetLevel(ServerLevel serverLevel) Sets the world instance.voidtick()useItem(ServerPlayer player, Level level, ItemStack stack, InteractionHand hand) useItemOn(ServerPlayer player, Level level, ItemStack stack, InteractionHand hand, BlockHitResult hitResult)
-
Field Details
-
FLIGHT_DISABLE_RANGE
private static final double FLIGHT_DISABLE_RANGE- See Also:
-
LOGGER
private static final org.slf4j.Logger LOGGER -
level
-
player
-
gameModeForPlayer
-
previousGameModeForPlayer
-
isDestroyingBlock
private boolean isDestroyingBlock -
destroyProgressStart
private int destroyProgressStart -
destroyPos
-
gameTicks
private int gameTicks -
hasDelayedDestroy
private boolean hasDelayedDestroy -
delayedDestroyPos
-
delayedTickStart
private int delayedTickStart -
lastSentState
private int lastSentState
-
-
Constructor Details
-
ServerPlayerGameMode
-
-
Method Details
-
changeGameModeForPlayer
-
setGameModeForPlayer
-
isInRangeOfGround
private boolean isInRangeOfGround() -
getGameModeForPlayer
-
getPreviousGameModeForPlayer
-
isSurvival
public boolean isSurvival() -
isCreative
public boolean isCreative() -
tick
public void tick() -
incrementDestroyProgress
-
debugLogging
-
handleBlockBreakAction
public void handleBlockBreakAction(BlockPos pos, ServerboundPlayerActionPacket.Action action, Direction face, int maxBuildHeight, int sequence) -
destroyAndAck
-
destroyBlock
Attempts to harvest a block -
removeBlock
private boolean removeBlock(BlockPos pos, BlockState state, boolean canHarvest, ItemStack toolStack) Patched-in method that handles actual removal of blocks fordestroyBlock(BlockPos).- Parameters:
pos- The block pos of the destroyed blockstate- The state of the destroyed blockcanHarvest- If the player breaking the block can harvest the drops of the blocktoolStack- The players main-hand prior to destroying the block and applying damage to the tool.- Returns:
- If the block was removed, as reported by
IBlockStateExtension.onDestroyedByPlayer(net.minecraft.world.level.Level, net.minecraft.core.BlockPos, net.minecraft.world.entity.player.Player, net.minecraft.world.item.ItemStack, boolean, net.minecraft.world.level.material.FluidState).
-
useItem
public InteractionResult useItem(ServerPlayer player, Level level, ItemStack stack, InteractionHand hand) -
useItemOn
public InteractionResult useItemOn(ServerPlayer player, Level level, ItemStack stack, InteractionHand hand, BlockHitResult hitResult) -
setLevel
Sets the world instance.
-