All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.thomasglasser.sherdsapi.impl.Sherd Maven / Gradle / Ivy

The newest version!
package dev.thomasglasser.sherdsapi.impl;

import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.item.crafting.Ingredient;
import org.jetbrains.annotations.ApiStatus;

import java.util.Optional;

@ApiStatus.Internal
public record Sherd(Ingredient ingredient, Optional> pattern)
{
    public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group(
            Ingredient.CODEC_NONEMPTY.fieldOf("ingredient").forGetter(Sherd::ingredient),
            ResourceKey.codec(Registries.DECORATED_POT_PATTERNS).optionalFieldOf("pattern").forGetter(Sherd::pattern)
    ).apply(instance, Sherd::new));
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy