@Override public NBTTagList serializeNBT() { NBTTagList nbt = new NBTTagList(); this.slots.forEach(slot -> nbt.appendTag(slot.serializeNBT())); return nbt; }
public void onBreakBlock() { items.forEach(i -> InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), i)); straw.forEach(i -> InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), i)); logs.forEach(i -> InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), i)); }
public void onBreakBlock() { items.forEach(i -> InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), i)); }
private void complexConsumeSubItems(Item item, String groupName, Consumer<ItemStack> consumer) { final NonNullList<ItemStack> subItems = NonNullList.create(); item.getSubItems(CreativeTabs.SEARCH, subItems); // Fallback if item is not returned in sub items if (subItems.isEmpty()) { final ItemStack itemStack = new ItemStack(item, 1); final String subItemName = itemStack.getTranslationKey(); Log.info("[PluginNatura] Adding '{}' to list of {}", subItemName, groupName); consumer.accept(itemStack); return; } subItems.forEach(itemStack -> { final String subItemName = itemStack.getTranslationKey(); Log.info("[PluginNatura] Adding '{}' to list of {}", subItemName, groupName); consumer.accept(itemStack); }); }
NonNullList<ItemStack> list = NonNullList.create(); BlockHandler.CULTIVATOR_BOTTOM.getSubBlocks(CreativeTabs.SEARCH, list); list.forEach(item -> registry.addRecipeCatalyst(item, CULTIVATEOR));