public class ServerPlayNetworkHandler extends Object implements ServerPlayPacketListener
Modifier and Type | Field and Description |
---|---|
ClientConnection |
connection |
private int |
creativeItemDropThreshold |
private boolean |
floating |
private int |
floatingTicks |
private long |
keepAliveId |
private long |
lastKeepAliveTime |
private int |
lastTickMovePacketsCount |
private double |
lastTickRiddenX |
private double |
lastTickRiddenY |
private double |
lastTickRiddenZ |
private double |
lastTickX |
private double |
lastTickY |
private double |
lastTickZ |
private static Logger |
LOGGER |
private int |
messageCooldown |
private int |
movePacketsCount |
ServerPlayerEntity |
player |
private int |
requestedTeleportId |
private Vec3d |
requestedTeleportPos |
private boolean |
ridingEntity |
private MinecraftServer |
server |
private int |
teleportRequestTick |
private int |
ticks |
private Entity |
topmostRiddenEntity |
private it.unimi.dsi.fastutil.ints.Int2ShortMap |
transactions |
private double |
updatedRiddenX |
private double |
updatedRiddenY |
private double |
updatedRiddenZ |
private double |
updatedX |
private double |
updatedY |
private double |
updatedZ |
private int |
vehicleFloatingTicks |
private boolean |
waitingForKeepAlive |
Constructor and Description |
---|
ServerPlayNetworkHandler(MinecraftServer server,
ClientConnection connection,
ServerPlayerEntity player) |
private static final Logger LOGGER
public final ClientConnection connection
private final MinecraftServer server
public ServerPlayerEntity player
private int ticks
private long lastKeepAliveTime
private boolean waitingForKeepAlive
private long keepAliveId
private int messageCooldown
private int creativeItemDropThreshold
private final it.unimi.dsi.fastutil.ints.Int2ShortMap transactions
private double lastTickX
private double lastTickY
private double lastTickZ
private double updatedX
private double updatedY
private double updatedZ
private Entity topmostRiddenEntity
private double lastTickRiddenX
private double lastTickRiddenY
private double lastTickRiddenZ
private double updatedRiddenX
private double updatedRiddenY
private double updatedRiddenZ
private Vec3d requestedTeleportPos
private int requestedTeleportId
private int teleportRequestTick
private boolean floating
private int floatingTicks
private boolean ridingEntity
private int vehicleFloatingTicks
private int movePacketsCount
private int lastTickMovePacketsCount
public ServerPlayNetworkHandler(MinecraftServer server, ClientConnection connection, ServerPlayerEntity player)
public void tick()
public void syncWithPlayerPosition()
public ClientConnection getConnection()
getConnection
in interface PacketListener
private boolean isHost()
public void disconnect(Text reason)
private <T> void method_31275(T t, Consumer<T> consumer, BiFunction<class_5513,T,CompletableFuture<Optional<T>>> biFunction)
public void onPlayerInput(PlayerInputC2SPacket packet)
onPlayerInput
in interface ServerPlayPacketListener
private static boolean validatePlayerMove(PlayerMoveC2SPacket packet)
private static boolean validateVehicleMove(VehicleMoveC2SPacket packet)
public void onVehicleMove(VehicleMoveC2SPacket packet)
onVehicleMove
in interface ServerPlayPacketListener
private boolean method_29780(Entity entity)
public void onTeleportConfirm(TeleportConfirmC2SPacket packet)
onTeleportConfirm
in interface ServerPlayPacketListener
public void onRecipeBookData(RecipeBookDataC2SPacket packet)
onRecipeBookData
in interface ServerPlayPacketListener
public void onRecipeCategoryOptions(RecipeCategoryOptionsC2SPacket packet)
onRecipeCategoryOptions
in interface ServerPlayPacketListener
public void onAdvancementTab(AdvancementTabC2SPacket packet)
onAdvancementTab
in interface ServerPlayPacketListener
public void onRequestCommandCompletions(RequestCommandCompletionsC2SPacket packet)
onRequestCommandCompletions
in interface ServerPlayPacketListener
public void onUpdateCommandBlock(UpdateCommandBlockC2SPacket packet)
onUpdateCommandBlock
in interface ServerPlayPacketListener
public void onUpdateCommandBlockMinecart(UpdateCommandBlockMinecartC2SPacket packet)
onUpdateCommandBlockMinecart
in interface ServerPlayPacketListener
public void onPickFromInventory(PickFromInventoryC2SPacket packet)
onPickFromInventory
in interface ServerPlayPacketListener
public void onRenameItem(RenameItemC2SPacket packet)
onRenameItem
in interface ServerPlayPacketListener
public void onUpdateBeacon(UpdateBeaconC2SPacket packet)
onUpdateBeacon
in interface ServerPlayPacketListener
public void onStructureBlockUpdate(UpdateStructureBlockC2SPacket packet)
onStructureBlockUpdate
in interface ServerPlayPacketListener
public void onJigsawUpdate(UpdateJigsawC2SPacket packet)
onJigsawUpdate
in interface ServerPlayPacketListener
public void onJigsawGenerating(JigsawGeneratingC2SPacket packet)
onJigsawGenerating
in interface ServerPlayPacketListener
public void onMerchantTradeSelect(SelectMerchantTradeC2SPacket packet)
onMerchantTradeSelect
in interface ServerPlayPacketListener
public void onBookUpdate(BookUpdateC2SPacket packet)
onBookUpdate
in interface ServerPlayPacketListener
public void onQueryEntityNbt(QueryEntityNbtC2SPacket packet)
onQueryEntityNbt
in interface ServerPlayPacketListener
public void onQueryBlockNbt(QueryBlockNbtC2SPacket packet)
onQueryBlockNbt
in interface ServerPlayPacketListener
public void onPlayerMove(PlayerMoveC2SPacket packet)
onPlayerMove
in interface ServerPlayPacketListener
private boolean isPlayerNotCollidingWithBlocks(WorldView worldView, Box box)
public void requestTeleport(double x, double y, double z, float yaw, float pitch)
public void teleportRequest(double x, double y, double z, float yaw, float pitch, Set<PlayerPositionLookS2CPacket.Flag> set)
public void onPlayerAction(PlayerActionC2SPacket packet)
onPlayerAction
in interface ServerPlayPacketListener
private static boolean canPlace(ServerPlayerEntity player, ItemStack stack)
For this to return true, the player must not be actively cooling down.
public void onPlayerInteractBlock(PlayerInteractBlockC2SPacket packet)
onPlayerInteractBlock
in interface ServerPlayPacketListener
public void onPlayerInteractItem(PlayerInteractItemC2SPacket packet)
onPlayerInteractItem
in interface ServerPlayPacketListener
public void onSpectatorTeleport(SpectatorTeleportC2SPacket packet)
onSpectatorTeleport
in interface ServerPlayPacketListener
public void onResourcePackStatus(ResourcePackStatusC2SPacket packet)
onResourcePackStatus
in interface ServerPlayPacketListener
public void onBoatPaddleState(BoatPaddleStateC2SPacket packet)
onBoatPaddleState
in interface ServerPlayPacketListener
public void onDisconnected(Text reason)
onDisconnected
in interface PacketListener
public void sendPacket(Packet<?> packet)
public void sendPacket(Packet<?> packet, @Nullable io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super Void>> listener)
public void onUpdateSelectedSlot(UpdateSelectedSlotC2SPacket packet)
onUpdateSelectedSlot
in interface ServerPlayPacketListener
public void onGameMessage(ChatMessageC2SPacket packet)
onGameMessage
in interface ServerPlayPacketListener
private void method_31286(String string)
private void executeCommand(String input)
public void onHandSwing(HandSwingC2SPacket packet)
onHandSwing
in interface ServerPlayPacketListener
public void onClientCommand(ClientCommandC2SPacket packet)
onClientCommand
in interface ServerPlayPacketListener
public void onPlayerInteractEntity(PlayerInteractEntityC2SPacket packet)
onPlayerInteractEntity
in interface ServerPlayPacketListener
public void onClientStatus(ClientStatusC2SPacket packet)
onClientStatus
in interface ServerPlayPacketListener
public void onGuiClose(GuiCloseC2SPacket packet)
onGuiClose
in interface ServerPlayPacketListener
public void onClickWindow(ClickWindowC2SPacket packet)
onClickWindow
in interface ServerPlayPacketListener
public void onCraftRequest(CraftRequestC2SPacket packet)
onCraftRequest
in interface ServerPlayPacketListener
public void onButtonClick(ButtonClickC2SPacket packet)
onButtonClick
in interface ServerPlayPacketListener
public void onCreativeInventoryAction(CreativeInventoryActionC2SPacket packet)
onCreativeInventoryAction
in interface ServerPlayPacketListener
public void onConfirmTransaction(ConfirmGuiActionC2SPacket packet)
onConfirmTransaction
in interface ServerPlayPacketListener
public void onSignUpdate(UpdateSignC2SPacket packet)
onSignUpdate
in interface ServerPlayPacketListener
private void method_31282(UpdateSignC2SPacket updateSignC2SPacket, List<String> list)
public void onKeepAlive(KeepAliveC2SPacket packet)
onKeepAlive
in interface ServerPlayPacketListener
public void onPlayerAbilities(UpdatePlayerAbilitiesC2SPacket packet)
onPlayerAbilities
in interface ServerPlayPacketListener
public void onClientSettings(ClientSettingsC2SPacket packet)
onClientSettings
in interface ServerPlayPacketListener
public void onCustomPayload(CustomPayloadC2SPacket packet)
onCustomPayload
in interface ServerPlayPacketListener
public void onUpdateDifficulty(UpdateDifficultyC2SPacket packet)
onUpdateDifficulty
in interface ServerPlayPacketListener
public void onUpdateDifficultyLock(UpdateDifficultyLockC2SPacket packet)
onUpdateDifficultyLock
in interface ServerPlayPacketListener