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 ServerPlayer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanchangeGameModeForPlayer(GameType gameModeForPlayer) private voiddebugLogging(BlockPos pos, boolean allGood, int sequence, String message) voiddestroyAndAck(BlockPos pos, int sequence, String exitId) booleandestroyBlock(BlockPos pos) voidhandleBlockBreakAction(BlockPos pos, ServerboundPlayerActionPacket.Action action, Direction direction, int maxY, int sequence) private floatincrementDestroyProgress(BlockState blockState, BlockPos delayedDestroyPos, int destroyStartTick) 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 gameModeForPlayer, @Nullable GameType previousGameModeForPlayer) voidsetLevel(ServerLevel newLevel) voidtick()useItem(ServerPlayer player, Level level, ItemStack itemStack, InteractionHand hand) useItemOn(ServerPlayer player, Level level, ItemStack itemStack, 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
private float incrementDestroyProgress(BlockState blockState, BlockPos delayedDestroyPos, int destroyStartTick) -
debugLogging
-
handleBlockBreakAction
public void handleBlockBreakAction(BlockPos pos, ServerboundPlayerActionPacket.Action action, Direction direction, int maxY, int sequence) -
destroyAndAck
-
destroyBlock
-
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(Level, BlockPos, Player, ItemStack, boolean, FluidState).
-
useItem
public InteractionResult useItem(ServerPlayer player, Level level, ItemStack itemStack, InteractionHand hand) -
useItemOn
public InteractionResult useItemOn(ServerPlayer player, Level level, ItemStack itemStack, InteractionHand hand, BlockHitResult hitResult) -
setLevel
-