Class MultiPlayerGameMode

java.lang.Object
net.minecraft.client.multiplayer.MultiPlayerGameMode

public class MultiPlayerGameMode extends Object
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • minecraft

      private final Minecraft minecraft
    • connection

      private final ClientPacketListener connection
    • destroyBlockPos

      private BlockPos destroyBlockPos
    • destroyingItem

      private ItemStack destroyingItem
    • destroyProgress

      private float destroyProgress
    • destroyTicks

      private float destroyTicks
    • destroyDelay

      private int destroyDelay
    • isDestroying

      private boolean isDestroying
    • localPlayerMode

      private GameType localPlayerMode
    • previousLocalPlayerMode

      private @Nullable GameType previousLocalPlayerMode
    • carriedIndex

      private int carriedIndex
  • Constructor Details

  • Method Details

    • adjustPlayer

      public void adjustPlayer(Player player)
      Sets player capabilities depending on current gametype.
    • setLocalMode

      public void setLocalMode(GameType mode, @Nullable GameType previousMode)
    • setLocalMode

      public void setLocalMode(GameType mode)
      Sets the game type for the player.
    • canHurtPlayer

      public boolean canHurtPlayer()
    • destroyBlock

      public boolean destroyBlock(BlockPos pos)
    • startDestroyBlock

      public boolean startDestroyBlock(BlockPos pos, Direction direction)
      Called when the player is hitting a block with an item.
    • stopDestroyBlock

      public void stopDestroyBlock()
    • continueDestroyBlock

      public boolean continueDestroyBlock(BlockPos pos, Direction direction)
    • startPrediction

      private void startPrediction(ClientLevel level, PredictiveAction predictiveAction)
    • tick

      public void tick()
    • sameDestroyTarget

      private boolean sameDestroyTarget(BlockPos pos)
    • ensureHasSentCarriedItem

      private void ensureHasSentCarriedItem()
    • useItemOn

      public InteractionResult useItemOn(LocalPlayer player, InteractionHand hand, BlockHitResult blockHit)
    • performUseItemOn

      private InteractionResult performUseItemOn(LocalPlayer player, InteractionHand hand, BlockHitResult blockHit)
    • useItem

      public InteractionResult useItem(Player player, InteractionHand hand)
    • createPlayer

      public LocalPlayer createPlayer(ClientLevel level, StatsCounter stats, ClientRecipeBook recipeBook)
    • createPlayer

      public LocalPlayer createPlayer(ClientLevel level, StatsCounter stats, ClientRecipeBook recipeBook, Input lastSentInput, boolean wasSprinting)
    • attack

      public void attack(Player player, Entity entity)
      Attacks an entity
    • spectate

      public void spectate(Entity entity)
    • interact

      public InteractionResult interact(Player player, Entity entity, EntityHitResult hitResult, InteractionHand hand)
    • handleContainerInput

      public void handleContainerInput(int containerId, int slotNum, int buttonNum, ContainerInput containerInput, Player player)
    • handlePlaceRecipe

      public void handlePlaceRecipe(int containerId, RecipeDisplayId recipe, boolean useMaxItems)
    • handleInventoryButtonClick

      public void handleInventoryButtonClick(int containerId, int buttonId)
      GuiEnchantment uses this during multiplayer to tell PlayerControllerMP to send a packet indicating the enchantment action the player has taken.
    • handleCreativeModeItemAdd

      public void handleCreativeModeItemAdd(ItemStack clicked, int slot)
      Used in PlayerControllerMP to update the server with an ItemStack in a slot.
    • handleCreativeModeItemDrop

      public void handleCreativeModeItemDrop(ItemStack clicked)
      Sends a Packet107 to the server to drop the item on the ground
    • releaseUsingItem

      public void releaseUsingItem(Player player)
    • piercingAttack

      public void piercingAttack(PiercingWeapon weapon)
    • hasExperience

      public boolean hasExperience()
    • hasMissTime

      public boolean hasMissTime()
    • isServerControlledInventory

      public boolean isServerControlledInventory()
    • isSpectator

      public boolean isSpectator()
    • getPreviousPlayerMode

      public @Nullable GameType getPreviousPlayerMode()
    • getPlayerMode

      public GameType getPlayerMode()
    • isDestroying

      public boolean isDestroying()
    • getDestroyStage

      public int getDestroyStage()
    • handlePickItemFromBlock

      public void handlePickItemFromBlock(BlockPos pos, boolean includeData)
    • handlePickItemFromEntity

      public void handlePickItemFromEntity(Entity entity, boolean includeData)
    • handleSlotStateChanged

      public void handleSlotStateChanged(int slotId, int containerId, boolean newState)