Package net.minecraft.server.level
Class ServerPlayerGameMode
java.lang.Object
net.minecraft.server.level.ServerPlayerGameMode
- Direct Known Subclasses:
DemoMode
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BlockPos
private int
private BlockPos
private int
private GameType
private int
private boolean
private boolean
private int
protected ServerLevel
private static final org.slf4j.Logger
protected final ServerPlayer
private GameType
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
changeGameModeForPlayer
(GameType gameModeForPlayer) private void
debugLogging
(BlockPos pos, boolean terminate, int sequence, String message) void
destroyAndAck
(BlockPos pos, int sequence, String message) boolean
destroyBlock
(BlockPos pos) Attempts to harvest a blockvoid
handleBlockBreakAction
(BlockPos pos, ServerboundPlayerActionPacket.Action action, Direction face, int maxBuildHeight, int sequence) private float
incrementDestroyProgress
(BlockState state, BlockPos pos, int startTick) boolean
boolean
private boolean
removeBlock
(BlockPos pos, BlockState state, boolean canHarvest) Patched-in method that handles actual removal of blocks fordestroyBlock(BlockPos)
.protected void
setGameModeForPlayer
(GameType gameModeForPlayer, GameType previousGameModeForPlayer) void
setLevel
(ServerLevel serverLevel) Sets the world instance.void
tick()
useItem
(ServerPlayer player, Level level, ItemStack stack, InteractionHand hand) useItemOn
(ServerPlayer player, Level level, ItemStack stack, InteractionHand hand, BlockHitResult hitResult)
-
Field Details
-
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
-
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
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 block- 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, 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.
-