Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,13 @@ public void updateSize(boolean forceSync) {
* @see ExtendedInventory#refreshPlayerInventoryMenuServer(Player) Refresh the Inventory Menu with the Slots in unknown positions (possible on the server side)
*/
public static void refreshPlayerInventoryMenu(Player player, int columns, int invX, int invY, int leftHotbarSlots, int leftHotbarX, int leftHotbarY, int rightHotbarX, int rightHotbarY) {
player.inventoryMenu = new InventoryMenu(player.getInventory(), !player.level().isClientSide(), player); // Usually this field would be final; don't tell anybody I did this
InventoryMenu oldMenu = player.inventoryMenu;
InventoryMenu newMenu = new InventoryMenu(player.getInventory(), !player.level().isClientSide(), player); // Usually this field would be final; don't tell anybody I did this
player.inventoryMenu = newMenu;
get(player).ifPresent(inv -> inv.addExtraInventorySlotsToMenu(player.inventoryMenu, columns, invX, invY, leftHotbarSlots, leftHotbarX, leftHotbarY, rightHotbarX, rightHotbarY));
player.containerMenu = player.inventoryMenu;
if (player instanceof ServerPlayer sp && sp.containerSynchronizer != null && sp.containerListener != null) sp.initInventoryMenu();
newMenu.containerListeners.addAll(oldMenu.containerListeners);
};

/**
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ private-f net.minecraft.world.entity.player.Player inventory
public-f net.minecraft.world.entity.player.Player inventoryMenu
public net.minecraft.server.level.ServerPlayer containerSynchronizer
public net.minecraft.server.level.ServerPlayer containerListener
public net.minecraft.world.inventory.AbstractContainerMenu containerListeners
public net.minecraft.world.inventory.AbstractContainerMenu lastSlots
public net.minecraft.world.inventory.AbstractContainerMenu remoteSlots
public net.minecraft.world.inventory.AbstractContainerMenu addSlot(Lnet/minecraft/world/inventory/Slot;)Lnet/minecraft/world/inventory/Slot;
Expand Down