Skip to content

Commit

Permalink
Generate SlotDisplay for SpongeIngredient
Browse files Browse the repository at this point in the history
  • Loading branch information
aromaa committed Feb 15, 2025
1 parent 61ff771 commit f2274c1
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.display.SlotDisplay;
import org.apache.commons.lang3.NotImplementedException;
import org.spongepowered.api.ResourceKey;
import org.spongepowered.api.item.inventory.ItemStackLike;
Expand Down Expand Up @@ -132,6 +133,11 @@ public boolean test(final ItemStack testStack) {
return this.itemList.test(testStack);
}

@Override
public SlotDisplay display() {
return new SlotDisplay.Composite(this.itemList.getItems().stream().map(SlotDisplay.ItemStackSlotDisplay::new).map(SlotDisplay.class::cast).toList());
}

public static SpongeIngredient spongeFromStacks(net.minecraft.world.item.ItemStack... stacks) {
final SpongeStackItemList itemList = new SpongeStackItemList(stacks);
return new SpongeIngredient(SpongeStackItemList.TYPE_STACK, itemList, null);
Expand Down

0 comments on commit f2274c1

Please sign in to comment.