Skip to content

Modifying Output Stacks

Skye Prince edited this page Apr 23, 2024 · 1 revision

By default, The Printer block entities attempt to clear item stacks' internal inventories (under the Items NBT key). However, if further customization is desired, there are two options:

  1. Use the theprinter:loses_data tag
    Any items within this tag will have their NBT completely removed in the output stack. This is useful for clearing other mods' storage containers with unconventional internal inventory formats.
  2. Use the PrinterOutputCreated event
    This is a simple callback that provides the block entity along with the input stack and returns the output stack. For example, if you wanted to apply sharpness to every input diamond sword:
PrinterOutputCreated.EVENT.register((blockEntity, stack) -> {
	if (stack.isOf(Items.DIAMOND_SWORD)) {
		stack.addEnchantment(Enchantments.SHARPNESS, 1);
	}
	return stack;
});

Clone this wiki locally