use of net.minecraft.network.protocol.game.PacketPlayOutOpenWindow in project WildChests by BG-Software-LLC.
the class NMSInventory_v1_17_R1 method openPage.
@Override
public void openPage(Player player, com.bgsoftware.wildchests.objects.inventory.CraftWildInventory inventory) {
EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
String title = inventory.getTitle();
Container container = createContainer(entityPlayer.nextContainerCounter(), entityPlayer.getInventory(), inventory);
container.setTitle(new ChatComponentText(title));
// Cursor item is not updated, so we need to update it manually
org.bukkit.inventory.ItemStack cursorItem = player.getItemOnCursor();
entityPlayer.b.sendPacket(new PacketPlayOutOpenWindow(container.j, container.getType(), container.getTitle()));
entityPlayer.bV = container;
entityPlayer.initMenu(container);
player.setItemOnCursor(cursorItem);
}
Aggregations