use of net.minecraft.server.v1_13_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_13_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_13_R2.ItemStack in project PublicCrafters by BananaPuncher714.
the class CustomContainerWorkbench method shiftClick.
// Overrides 1.15.1
@Override
public ItemStack shiftClick(EntityHuman entityhuman, int i) {
ItemStack itemstack = ItemStack.b;
Slot slot = (Slot) this.slots.get(i);
if (slot != null && slot.hasItem()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
if (i == 0) {
this.containerAccess.a((world, blockposition) -> {
itemstack1.getItem().b(itemstack1, world, entityhuman);
});
if (!this.a(itemstack1, 10, 46, true)) {
return ItemStack.b;
}
slot.a(itemstack1, itemstack);
} else if (i >= 10 && i < 46 ? !this.a(itemstack1, 1, 10, false) && (i < 37 ? !this.a(itemstack1, 37, 46, false) : !this.a(itemstack1, 10, 37, false)) : !this.a(itemstack1, 10, 46, false)) {
return ItemStack.b;
}
if (itemstack1.isEmpty()) {
slot.set(ItemStack.b);
} else {
slot.d();
}
if (itemstack1.getCount() == itemstack.getCount()) {
return ItemStack.b;
}
ItemStack itemstack2 = slot.a(entityhuman, itemstack1);
if (i == 0) {
entityhuman.drop(itemstack2, false);
}
}
return itemstack;
}
use of net.minecraft.server.v1_13_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_13_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();
}
}
Aggregations