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 pGameModeForPlayer) private voiddebugLogging(BlockPos pPos, boolean pTerminate, int pSequence, String pMessage) voiddestroyAndAck(BlockPos pPos, int pSequence, String pMessage) booleandestroyBlock(BlockPos pPos) Attempts to harvest a blockvoidhandleBlockBreakAction(BlockPos pPos, ServerboundPlayerActionPacket.Action pAction, Direction pFace, int pMaxBuildHeight, int pSequence) private floatincrementDestroyProgress(BlockState pState, BlockPos pPos, int pStartTick) 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 pGameMode, GameType pPreviousGameMode) voidsetLevel(ServerLevel pServerLevel) Sets the world instance.voidtick()useItem(ServerPlayer pPlayer, Level pLevel, ItemStack pStack, InteractionHand pHand) useItemOn(ServerPlayer pPlayer, Level pLevel, ItemStack pStack, InteractionHand pHand, BlockHitResult pHitResult)
-
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 pPos, ServerboundPlayerActionPacket.Action pAction, Direction pFace, int pMaxBuildHeight, int pSequence) -
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 pPlayer, Level pLevel, ItemStack pStack, InteractionHand pHand) -
useItemOn
public InteractionResult useItemOn(ServerPlayer pPlayer, Level pLevel, ItemStack pStack, InteractionHand pHand, BlockHitResult pHitResult) -
setLevel
Sets the world instance.
-