use of net.minecraft.world.inventory.Container in project PublicCrafters by BananaPuncher714.
the class CustomInventoryCrafting method a.
// splitStack
@Override
public ItemStack a(int i, int j) {
ItemStack itemstack = ContainerUtil.a(items, i, j);
if (!itemstack.b()) {
for (Container container : containers) {
container.a(this);
}
}
// Update the armorstand grid
display.update();
return itemstack;
}
use of net.minecraft.world.inventory.Container 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);
}
use of net.minecraft.world.inventory.Container in project PublicCrafters by BananaPuncher714.
the class CustomInventoryCrafting method a.
// splitStack
@Override
public ItemStack a(int i, int j) {
ItemStack itemstack = ContainerUtil.a(items, i, j);
if (!itemstack.b()) {
for (Container container : containers) {
container.a(this);
}
}
// Update the armorstand grid
display.update();
return itemstack;
}
use of net.minecraft.world.inventory.Container in project PublicCrafters by BananaPuncher714.
the class CustomInventoryCrafting method a.
// setItem
@Override
public void a(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);
for (Container container : containers) {
container.a(this);
}
// Update the armorstand grid
display.update();
}
use of net.minecraft.world.inventory.Container in project PublicCrafters by BananaPuncher714.
the class CustomTileEntityContainerWorkbench method createMenu.
/**
* This is an ITileEntityContainer method that returns a new container for whatever tile entity
*/
@Override
public Container createMenu(int id, PlayerInventory inv, EntityHuman ent) {
CustomInventoryCrafting crafting = manager.benches.get(bloc);
if (crafting == null) {
crafting = new CustomInventoryCrafting(bloc, manager, new SelfContainer(id), 3, 3);
manager.put(bloc, crafting);
}
IInventory inventory = crafting.resultInventory;
InventoryCraftResult result;
if (inventory instanceof InventoryCraftResult || inventory == null) {
result = new InventoryCraftResult();
crafting.resultInventory = result;
} else {
result = (InventoryCraftResult) inventory;
}
Container container = new CustomContainerWorkbench(id, ent.getBukkitEntity(), bloc, crafting, result);
crafting.addContainer(container);
return container;
}
Aggregations