Skip to content

Commit

Permalink
chore: make the snapshot runnable
Browse files Browse the repository at this point in the history
- fix some imports
- Ingredients use a stream of items now
  • Loading branch information
gabizou committed Nov 16, 2024
1 parent 7f50cec commit 87d0ae6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,19 @@
import org.spongepowered.common.item.util.ItemStackUtil;

import java.util.List;
import java.util.stream.Stream;

@Mixin(Ingredient.class)
@Implements(@Interface(iface = org.spongepowered.api.item.recipe.crafting.Ingredient.class, prefix = "ingredient$", remap = Remap.NONE))
public abstract class IngredientMixin_API {

// @formatter:off
@Shadow public abstract boolean shadow$test(@Nullable ItemStack p_test_1_);
@Shadow public abstract List<Holder<Item>> shadow$items();
@Shadow public abstract Stream<Holder<Item>> shadow$items();
// @formatter:on

public List<ItemType> ingredient$displayedItems() {
return this.shadow$items().stream().map((holder) -> (ItemType) holder.value()).toList();
return this.shadow$items().map((holder) -> (ItemType) holder.value()).toList();
}

public boolean ingredient$test(final ItemStackLike itemStack) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import net.minecraft.server.packs.AbstractPackResources;
import net.minecraft.server.packs.PackLocationInfo;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.metadata.MetadataSectionSerializer;
import net.minecraft.server.packs.metadata.MetadataSectionType;
import net.minecraft.server.packs.metadata.pack.PackMetadataSection;
import net.minecraft.server.packs.resources.IoSupplier;
import org.checkerframework.checker.nullness.qual.Nullable;
Expand Down Expand Up @@ -109,8 +109,8 @@ private ResourceLocation convertResourcePath(final String namespace, final Path

@Nullable
@Override
public <T> T getMetadataSection(final MetadataSectionSerializer<T> deserializer) throws IOException {
if (deserializer.getMetadataSectionName().equals("pack")) {
public <T> T getMetadataSection(final MetadataSectionType<T> deserializer) throws IOException {
if (deserializer.name().equals("pack")) {
return (T) this.metadata;
}
return null;
Expand Down

0 comments on commit 87d0ae6

Please sign in to comment.