From 3cf87de5b6fea02eb26b747761f8f85ad0b65f51 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Wed, 14 Aug 2024 23:11:28 +0900 Subject: New Optimised Craftable Filter (should remove almost all stutters with the filter) Developers can also use the new TransferHandlerMeta to provide custom info for available ingredients used for quickly determining whether the player can craft it. --- .../plugin/autocrafting/InventoryCraftingTransferHandler.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'default-plugin/src/main') diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/autocrafting/InventoryCraftingTransferHandler.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/autocrafting/InventoryCraftingTransferHandler.java index d377c2add..d57fc1bb6 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/autocrafting/InventoryCraftingTransferHandler.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/autocrafting/InventoryCraftingTransferHandler.java @@ -24,6 +24,7 @@ package me.shedaniel.rei.plugin.autocrafting; import me.shedaniel.rei.api.client.registry.transfer.TransferHandler; +import me.shedaniel.rei.api.client.registry.transfer.TransferHandlerMeta; import me.shedaniel.rei.api.client.registry.transfer.simple.SimpleTransferHandler; import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.entry.InputIngredient; @@ -31,10 +32,11 @@ import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes; import me.shedaniel.rei.api.common.util.CollectionUtils; import me.shedaniel.rei.plugin.common.displays.crafting.DefaultCraftingDisplay; import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; import java.util.List; -public class InventoryCraftingTransferHandler implements TransferHandler { +public class InventoryCraftingTransferHandler implements TransferHandler, TransferHandlerMeta { private final SimpleTransferHandler parent; public InventoryCraftingTransferHandler(SimpleTransferHandler parent) { @@ -61,4 +63,9 @@ public class InventoryCraftingTransferHandler implements TransferHandler { CollectionUtils.map(inputs, entry -> InputIngredient.withType(entry, VanillaEntryTypes.ITEM)), parent.getInputSlots(context), parent.getInventorySlots(context)); } + + @Override + public Iterable getAvailableIngredients(Context context) { + return parent.getAvailableIngredients(context); + } } -- cgit