use of net.minecraft.server.v1_16_R2.ItemStack in project PublicCrafters by BananaPuncher714.
the class CustomInventoryCrafting method remove.
@Override
public void remove() {
display.stop();
for (ItemStack item : items) {
org.bukkit.inventory.ItemStack is = CraftItemStack.asBukkitCopy(item);
if (is.getType() != Material.AIR) {
bloc.getWorld().dropItem(bloc.clone().add(.5, .9, .5), is);
}
}
items.clear();
}
use of net.minecraft.server.v1_16_R2.ItemStack in project PublicCrafters by BananaPuncher714.
the class ContainerManager_v1_16_R2 method load.
@Override
public void load(Location location, List<ItemStack> items) {
// Is 0 really ok as an id?!?
CustomInventoryCrafting crafting = new CustomInventoryCrafting(location, this, new SelfContainer(0), 3, 3);
InventoryCraftResult result = new InventoryCraftResult();
crafting.resultInventory = result;
crafting.setItems(items);
benches.put(location, crafting);
}
use of net.minecraft.server.v1_16_R2.ItemStack 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_16_R2.ItemStack in project PublicCrafters by BananaPuncher714.
the class CustomInventoryCrafting method setDefaults.
private void setDefaults() {
try {
// Set items
Field field = InventoryCrafting.class.getDeclaredField("items");
field.setAccessible(true);
items = (List<ItemStack>) field.get(this);
} catch (Exception e) {
e.printStackTrace();
}
}
use of net.minecraft.server.v1_16_R2.ItemStack 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);
for (Container container : containers) {
container.a(this);
}
// Update the armorstand grid
display.update();
}
Aggregations