Hello. I need to remove specific amount of item stack with specific type from a chest.
Given: ItemStack and chest location (already checked for errors).
I wrote that code but now I am stuck:
Chest chest = (Chest) location.getTileEntity().get();
ItemStack stack = ItemStack.builder().itemType(type).quantity(amount).build();
Now I need to remove stack from chest and save the block state with new inventory contents.
I migrated from Bukkit, where I could just do:
inventory.remove(stack);
Seems that there is no such method in Sponge. How should I do? Also, I would really appreciate if someone had given me a tip how to correctly update the block state with new inventory.
Regards,
MrOnlineCoder