use of net.minecraft.server.v1_16_R3.PacketPlayOutOpenWindow in project WildChests by BG-Software-LLC.
the class NMSInventory_v1_16_R3 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.inventory, inventory);
container.setTitle(new ChatComponentText(title));
entityPlayer.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, container.getType(), container.getTitle()));
entityPlayer.activeContainer = container;
entityPlayer.activeContainer.addSlotListener(entityPlayer);
}
use of net.minecraft.server.v1_16_R3.PacketPlayOutOpenWindow in project WildChests by BG-Software-LLC.
the class NMSInventory_v1_12_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.inventory, entityPlayer, inventory);
container.windowId = entityPlayer.nextContainerCounter();
TileEntityWildChest tileEntityWildChest = getTileEntity(inventory.getOwner());
entityPlayer.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, tileEntityWildChest.getContainerName(), new ChatComponentText(title), inventory.getSize()));
entityPlayer.activeContainer = container;
entityPlayer.activeContainer.addSlotListener(entityPlayer);
}
use of net.minecraft.server.v1_16_R3.PacketPlayOutOpenWindow in project WildChests by BG-Software-LLC.
the class NMSInventory_v1_8_R3 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.inventory, entityPlayer, inventory);
container.windowId = entityPlayer.nextContainerCounter();
TileEntityWildChest tileEntityWildChest = getTileEntity(inventory.getOwner());
entityPlayer.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, tileEntityWildChest.getContainerName(), new ChatComponentText(title), inventory.getSize()));
entityPlayer.activeContainer = container;
entityPlayer.activeContainer.addSlotListener(entityPlayer);
}
use of net.minecraft.server.v1_16_R3.PacketPlayOutOpenWindow in project PaperDev by Kamillaova.
the class CraftContainer method c.
@Override
public boolean c(EntityHuman entityhuman) {
if (cachedType == view.getType() && cachedSize == getSize() && cachedTitle.equals(view.getTitle())) {
return true;
}
// If the window type has changed for some reason, update the player
// This method will be called every tick or something, so it's
// as good a place as any to put something like this.
boolean typeChanged = (cachedType != view.getType());
cachedType = view.getType();
cachedTitle = view.getTitle();
if (view.getPlayer() instanceof CraftPlayer) {
CraftPlayer player = (CraftPlayer) view.getPlayer();
String type = getNotchInventoryType(cachedType);
IInventory top = ((CraftInventory) view.getTopInventory()).getInventory();
PlayerInventory bottom = (PlayerInventory) ((CraftInventory) view.getBottomInventory()).getInventory();
this.items.clear();
this.slots.clear();
if (typeChanged) {
setupSlots(top, bottom, player.getHandle());
}
int size = getSize();
player.getHandle().playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.windowId, type, new ChatComponentText(cachedTitle), size));
player.updateInventory();
}
return true;
}
Aggregations