Schnittstelle MenuSyncedBlockEntity

Alle Superschnittstellen:
net.fabricmc.fabric.api.screenhandler.v1.FabricScreenHandlerFactory, net.minecraft.world.inventory.MenuConstructor, net.minecraft.world.MenuProvider

public interface MenuSyncedBlockEntity extends net.minecraft.world.MenuProvider
Implement this in you block entity when it should synchronize initial values when a player opens the container
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    net.minecraft.world.inventory.AbstractContainerMenu
    createMenu(int containerId, net.minecraft.world.entity.player.Inventory playerInventory, net.minecraft.world.entity.player.Player player)
    Used to create a menu on the server side
    void
    handleInitialMenuDataFromServer(net.minecraft.network.FriendlyByteBuf byteBuf)
    The collected data for the initial menu opening is received here on the client side.
    void
    sendInitialMenuDataToClient(net.minecraft.network.FriendlyByteBuf byteBuf)
    Collect data here that should be sent to the client side when the menu will be opened.

    Von Schnittstelle geerbte Methoden net.fabricmc.fabric.api.screenhandler.v1.FabricScreenHandlerFactory

    shouldCloseCurrentScreen

    Von Schnittstelle geerbte Methoden net.minecraft.world.MenuProvider

    getDisplayName
  • Methodendetails

    • sendInitialMenuDataToClient

      void sendInitialMenuDataToClient(net.minecraft.network.FriendlyByteBuf byteBuf)
      Collect data here that should be sent to the client side when the menu will be opened. The method will only be called automatically if EntityBlockProvider.openMenu(net.minecraft.world.level.Level, net.minecraft.core.BlockPos, Player, boolean) is used for opening the menu.
      The data will be received on the client side in this method: handleInitialMenuDataFromServer(FriendlyByteBuf)
      Parameter:
      byteBuf - Data to be send to the client
    • handleInitialMenuDataFromServer

      void handleInitialMenuDataFromServer(net.minecraft.network.FriendlyByteBuf byteBuf)
      The collected data for the initial menu opening is received here on the client side. The method will only be called if UBlockEntityContainerMenu is used as a base class for the menu or an equivalent implementation is used.
      The data is sent from the server side here: sendInitialMenuDataToClient(FriendlyByteBuf)
      Parameter:
      byteBuf - Received data from the server
    • createMenu

      net.minecraft.world.inventory.AbstractContainerMenu createMenu(int containerId, net.minecraft.world.entity.player.Inventory playerInventory, net.minecraft.world.entity.player.Player player)
      Used to create a menu on the server side
      Angegeben von:
      createMenu in Schnittstelle net.minecraft.world.inventory.MenuConstructor