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 p_143474_) private voiddebugLogging(BlockPos p_215126_, boolean p_215127_, int p_215128_, String p_215129_) voiddestroyAndAck(BlockPos p_215117_, int p_215118_, String p_215119_) booleandestroyBlock(BlockPos p_9281_) voidhandleBlockBreakAction(BlockPos p_215120_, ServerboundPlayerActionPacket.Action p_215121_, Direction p_215122_, int p_215123_, int p_215124_) private floatincrementDestroyProgress(BlockState p_9277_, BlockPos p_9278_, int p_9279_) booleanbooleanprivate booleanremoveBlock(BlockPos pos, BlockState state, boolean canHarvest) Patched-in method that handles actual removal of blocks fordestroyBlock(BlockPos).protected voidsetGameModeForPlayer(GameType p_9274_, GameType p_9275_) voidsetLevel(ServerLevel p_9261_) voidtick()useItem(ServerPlayer p_9262_, Level p_9263_, ItemStack p_9264_, InteractionHand p_9265_) useItemOn(ServerPlayer p_9266_, Level p_9267_, ItemStack p_9268_, InteractionHand p_9269_, BlockHitResult p_9270_)
-
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 p_215120_, ServerboundPlayerActionPacket.Action p_215121_, Direction p_215122_, int p_215123_, int p_215124_) -
destroyAndAck
-
destroyBlock
-
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 p_9262_, Level p_9263_, ItemStack p_9264_, InteractionHand p_9265_) -
useItemOn
public InteractionResult useItemOn(ServerPlayer p_9266_, Level p_9267_, ItemStack p_9268_, InteractionHand p_9269_, BlockHitResult p_9270_) -
setLevel
-