From e4b2a8d9c2de57ab8bdcd556b195b2410c0e79a3 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Thu, 29 Feb 2024 18:33:28 +0000 Subject: [PATCH] Rename --- .../ingredient/DefaultCustomIngredients.java | 4 +-- .../ingredient/CustomIngredientInit.java | 4 +-- ...redient.java => ComponentsIngredient.java} | 34 +++++++++---------- 3 files changed, 21 insertions(+), 21 deletions(-) rename fabric-recipe-api-v1/src/main/java/net/fabricmc/fabric/impl/recipe/ingredient/builtin/{ComponentIngredient.java => ComponentsIngredient.java} (74%) diff --git a/fabric-recipe-api-v1/src/main/java/net/fabricmc/fabric/api/recipe/v1/ingredient/DefaultCustomIngredients.java b/fabric-recipe-api-v1/src/main/java/net/fabricmc/fabric/api/recipe/v1/ingredient/DefaultCustomIngredients.java index 60d02f53f6..792b07d565 100644 --- a/fabric-recipe-api-v1/src/main/java/net/fabricmc/fabric/api/recipe/v1/ingredient/DefaultCustomIngredients.java +++ b/fabric-recipe-api-v1/src/main/java/net/fabricmc/fabric/api/recipe/v1/ingredient/DefaultCustomIngredients.java @@ -26,7 +26,7 @@ import net.fabricmc.fabric.impl.recipe.ingredient.builtin.AllIngredient; import net.fabricmc.fabric.impl.recipe.ingredient.builtin.AnyIngredient; -import net.fabricmc.fabric.impl.recipe.ingredient.builtin.ComponentIngredient; +import net.fabricmc.fabric.impl.recipe.ingredient.builtin.ComponentsIngredient; import net.fabricmc.fabric.impl.recipe.ingredient.builtin.DifferenceIngredient; /** @@ -111,7 +111,7 @@ public static Ingredient components(Ingredient base, ComponentChanges components Objects.requireNonNull(base, "Base ingredient cannot be null"); Objects.requireNonNull(components, "Component changes cannot be null"); - return new ComponentIngredient(base, components).toVanilla(); + return new ComponentsIngredient(base, components).toVanilla(); } /** diff --git a/fabric-recipe-api-v1/src/main/java/net/fabricmc/fabric/impl/recipe/ingredient/CustomIngredientInit.java b/fabric-recipe-api-v1/src/main/java/net/fabricmc/fabric/impl/recipe/ingredient/CustomIngredientInit.java index 01c4ca214b..56230ed1c5 100644 --- a/fabric-recipe-api-v1/src/main/java/net/fabricmc/fabric/impl/recipe/ingredient/CustomIngredientInit.java +++ b/fabric-recipe-api-v1/src/main/java/net/fabricmc/fabric/impl/recipe/ingredient/CustomIngredientInit.java @@ -20,7 +20,7 @@ import net.fabricmc.fabric.api.recipe.v1.ingredient.CustomIngredientSerializer; import net.fabricmc.fabric.impl.recipe.ingredient.builtin.AllIngredient; import net.fabricmc.fabric.impl.recipe.ingredient.builtin.AnyIngredient; -import net.fabricmc.fabric.impl.recipe.ingredient.builtin.ComponentIngredient; +import net.fabricmc.fabric.impl.recipe.ingredient.builtin.ComponentsIngredient; import net.fabricmc.fabric.impl.recipe.ingredient.builtin.DifferenceIngredient; /** @@ -32,6 +32,6 @@ public void onInitialize() { CustomIngredientSerializer.register(AllIngredient.SERIALIZER); CustomIngredientSerializer.register(AnyIngredient.SERIALIZER); CustomIngredientSerializer.register(DifferenceIngredient.SERIALIZER); - CustomIngredientSerializer.register(ComponentIngredient.SERIALIZER); + CustomIngredientSerializer.register(ComponentsIngredient.SERIALIZER); } } diff --git a/fabric-recipe-api-v1/src/main/java/net/fabricmc/fabric/impl/recipe/ingredient/builtin/ComponentIngredient.java b/fabric-recipe-api-v1/src/main/java/net/fabricmc/fabric/impl/recipe/ingredient/builtin/ComponentsIngredient.java similarity index 74% rename from fabric-recipe-api-v1/src/main/java/net/fabricmc/fabric/impl/recipe/ingredient/builtin/ComponentIngredient.java rename to fabric-recipe-api-v1/src/main/java/net/fabricmc/fabric/impl/recipe/ingredient/builtin/ComponentsIngredient.java index 327d1555e7..ef5bcfc9b3 100644 --- a/fabric-recipe-api-v1/src/main/java/net/fabricmc/fabric/impl/recipe/ingredient/builtin/ComponentIngredient.java +++ b/fabric-recipe-api-v1/src/main/java/net/fabricmc/fabric/impl/recipe/ingredient/builtin/ComponentsIngredient.java @@ -37,13 +37,13 @@ import net.fabricmc.fabric.api.recipe.v1.ingredient.CustomIngredient; import net.fabricmc.fabric.api.recipe.v1.ingredient.CustomIngredientSerializer; -public class ComponentIngredient implements CustomIngredient { - public static final CustomIngredientSerializer SERIALIZER = new Serializer(); +public class ComponentsIngredient implements CustomIngredient { + public static final CustomIngredientSerializer SERIALIZER = new Serializer(); private final Ingredient base; private final ComponentChanges components; - public ComponentIngredient(Ingredient base, ComponentChanges components) { + public ComponentsIngredient(Ingredient base, ComponentChanges components) { if (components.isEmpty()) { throw new IllegalArgumentException("ComponentIngredient must have at least one defined component"); } @@ -114,22 +114,22 @@ private ComponentChanges getComponents() { return components; } - private static class Serializer implements CustomIngredientSerializer { - private static final Identifier ID = new Identifier("fabric", "component"); - private static final Codec ALLOW_EMPTY_CODEC = createCodec(Ingredient.ALLOW_EMPTY_CODEC); - private static final Codec DISALLOW_EMPTY_CODEC = createCodec(Ingredient.DISALLOW_EMPTY_CODEC); - private static final PacketCodec PACKET_CODEC = PacketCodec.tuple( - Ingredient.PACKET_CODEC, ComponentIngredient::getBase, - ComponentChanges.PACKET_CODEC, ComponentIngredient::getComponents, - ComponentIngredient::new + private static class Serializer implements CustomIngredientSerializer { + private static final Identifier ID = new Identifier("fabric", "components"); + private static final Codec ALLOW_EMPTY_CODEC = createCodec(Ingredient.ALLOW_EMPTY_CODEC); + private static final Codec DISALLOW_EMPTY_CODEC = createCodec(Ingredient.DISALLOW_EMPTY_CODEC); + private static final PacketCodec PACKET_CODEC = PacketCodec.tuple( + Ingredient.PACKET_CODEC, ComponentsIngredient::getBase, + ComponentChanges.PACKET_CODEC, ComponentsIngredient::getComponents, + ComponentsIngredient::new ); - private static Codec createCodec(Codec ingredientCodec) { + private static Codec createCodec(Codec ingredientCodec) { return RecordCodecBuilder.create(instance -> instance.group( - ingredientCodec.fieldOf("base").forGetter(ComponentIngredient::getBase), - ComponentChanges.CODEC.fieldOf("components").forGetter(ComponentIngredient::getComponents) - ).apply(instance, ComponentIngredient::new) + ingredientCodec.fieldOf("base").forGetter(ComponentsIngredient::getBase), + ComponentChanges.CODEC.fieldOf("components").forGetter(ComponentsIngredient::getComponents) + ).apply(instance, ComponentsIngredient::new) ); } @@ -139,12 +139,12 @@ public Identifier getIdentifier() { } @Override - public Codec getCodec(boolean allowEmpty) { + public Codec getCodec(boolean allowEmpty) { return allowEmpty ? ALLOW_EMPTY_CODEC : DISALLOW_EMPTY_CODEC; } @Override - public PacketCodec getPacketCodec() { + public PacketCodec getPacketCodec() { return PACKET_CODEC; } }