use of net.minecraft.server.v1_12_R1.Container 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_12_R1.Container in project PublicCrafters by BananaPuncher714.
the class CustomInventoryCrafting method setItem.
@Override
public void setItem(int index, ItemStack item) {
// Instead of updating one container, update all the containers
// That are looking at the table, basically the viewers
items.set(index, item == null ? ItemStack.a : item);
for (Container container : containers) {
container.a(this);
}
// Update the armorstand grid
display.update();
}
use of net.minecraft.server.v1_12_R1.Container in project PublicCrafters by BananaPuncher714.
the class CustomInventoryCrafting method splitStack.
@Override
public ItemStack splitStack(int i, int j) {
ItemStack itemstack = ContainerUtil.a(items, i, j);
if (!itemstack.isEmpty()) {
for (Container container : containers) {
container.a(this);
}
}
// Update the armorstand grid
display.update();
return itemstack;
}
use of net.minecraft.server.v1_12_R1.Container in project PublicCrafters by BananaPuncher714.
the class CustomTileEntityContainerSelector method getWorkbenchContainer.
protected Container getWorkbenchContainer(EntityHuman ent) {
CustomInventoryCrafting crafting = manager.benches.get(bloc);
if (crafting == null) {
crafting = new CustomInventoryCrafting(bloc, manager, new SelfContainer(), 3, 3);
manager.put(bloc, crafting);
}
IInventory result = crafting.resultInventory;
if (result == null) {
result = new InventoryCraftResult();
crafting.resultInventory = result;
}
Container container = new CustomContainerWorkbench(ent.getBukkitEntity(), bloc, crafting, result);
crafting.addContainer(container);
return container;
}
use of net.minecraft.server.v1_12_R1.Container in project PublicCrafters by BananaPuncher714.
the class CustomTileEntityContainerSelector method getAnvilContainer.
protected Container getAnvilContainer(PlayerInventory inventory, EntityHuman human) {
CustomAnvilSubcontainer crafting = manager.anvils.get(bloc);
if (crafting == null) {
crafting = new CustomAnvilSubcontainer("Repair", true, 2);
manager.anvils.put(bloc, crafting);
}
InventoryCraftResult result = crafting.result;
if (result == null) {
result = new InventoryCraftResult();
crafting.result = result;
}
Container anvil = new CustomContainerAnvil(human.getBukkitEntity(), bloc, crafting, result);
return anvil;
}
Aggregations