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 TypMethodeBeschreibungnet.minecraft.world.inventory.AbstractContainerMenucreateMenu(int containerId, net.minecraft.world.entity.player.Inventory playerInventory, net.minecraft.world.entity.player.Player player) Used to create a menu on the server sidevoidhandleInitialMenuDataFromServer(net.minecraft.network.FriendlyByteBuf byteBuf) The collected data for the initial menu opening is received here on the client side.voidsendInitialMenuDataToClient(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
shouldCloseCurrentScreenVon 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 ifEntityBlockProvider.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 ifUBlockEntityContainerMenuis 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:
createMenuin Schnittstellenet.minecraft.world.inventory.MenuConstructor
-