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 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) booleanbooleanprivate booleanremoveBlock(BlockPos pos, BlockState state, boolean canHarvest) Patched-in method that handles actual removal of blocks fordestroyBlock(BlockPos).protected voidsetGameModeForPlayer(GameType gameModeForPlayer, GameType previousGameModeForPlayer) 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
-
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.
-