diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 7ef538d53..0e8107775 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -589,6 +589,22 @@ c9fc3f11f3bf5a928ea9f5900c344461d61fe9e5 data/actuallyadditions/recipes/black_qu 7dc02da1ff58eb4ff48e305437d4857c31cbd5c9 data/actuallyadditions/recipes/chiseled_black_quartz_slab.json bf1b5de98f29c2dabe25a143c8e63d2c0cd6ea72 data/actuallyadditions/recipes/chiseled_black_quartz_stair.json 9d779585266046738b4bcf7447b918ec09b65f95 data/actuallyadditions/recipes/chiseled_black_quartz_wall.json +4c0d56c3a6db66bbeb74cb72ecedfbb115448d83 data/actuallyadditions/recipes/colorchange/black_wool.json +5c698c51d21723c8a13e329673a4c8d703da359d data/actuallyadditions/recipes/colorchange/blue_wool.json +818ab2ea65a94fa5ff8db6c5a5d106eec32816fd data/actuallyadditions/recipes/colorchange/brown_wool.json +37168cf7f51bdd26a1cb74d5fc3eccd835f7f566 data/actuallyadditions/recipes/colorchange/cyan_wool.json +e6fa0fd781c0deb18997b92237a097df2bfa14b7 data/actuallyadditions/recipes/colorchange/gray_wool.json +efb6a3385546c7c6b74e45f33d40dcdbfe7ad23a data/actuallyadditions/recipes/colorchange/green_wool.json +915d5ea71aa02d991a194574a085e7e41e733803 data/actuallyadditions/recipes/colorchange/light_blue_wool.json +9f5a91dc8b31444492fc77dcd2405375db1ba378 data/actuallyadditions/recipes/colorchange/light_gray_wool.json +41e623b3c6730f283a17ab9b293c3dbfb6688a4b data/actuallyadditions/recipes/colorchange/lime_wool.json +5754feb7b97b2e5bed1a44d6b6121d0e6b6d411c data/actuallyadditions/recipes/colorchange/magenta_wool.json +5d34d7ba1302af791ca85fd2f023470328e604b6 data/actuallyadditions/recipes/colorchange/orange_wool.json +e3bf0e1777bd2d495162411424fd7aadcb72c96d data/actuallyadditions/recipes/colorchange/pink_wool.json +0ceb76358bfbc1e289e1d076683870978071a929 data/actuallyadditions/recipes/colorchange/purple_wool.json +a7fdacc3fe3040376fec72cb64efb48305044c6d data/actuallyadditions/recipes/colorchange/red_wool.json +48142b653fd55f8cb373541d590d96c94fe182db data/actuallyadditions/recipes/colorchange/white_wool.json +ca4f8d37d115eac5889542b04d1c01cd2e0cde43 data/actuallyadditions/recipes/colorchange/yellow_wool.json 160466dfd10fafc2ae4b4130ca35220d4c2d2342 data/actuallyadditions/recipes/crate_keeper.json b76b843a60a1c456a11d3bb932a93ab3753d6f58 data/actuallyadditions/recipes/crushing/bone_crusher.json 293cecfa94d22e62bd817a3964e82dca4479d44d data/actuallyadditions/recipes/diamond_aiot.json diff --git a/src/generated/resources/data/actuallyadditions/recipes/colorchange/black_wool.json b/src/generated/resources/data/actuallyadditions/recipes/colorchange/black_wool.json new file mode 100644 index 000000000..64a4198fd --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/colorchange/black_wool.json @@ -0,0 +1,9 @@ +{ + "type": "actuallyadditions:color_change", + "ingredient": { + "item": "minecraft:red_wool" + }, + "result": { + "item": "minecraft:black_wool" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/colorchange/blue_wool.json b/src/generated/resources/data/actuallyadditions/recipes/colorchange/blue_wool.json new file mode 100644 index 000000000..bbabdb26b --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/colorchange/blue_wool.json @@ -0,0 +1,9 @@ +{ + "type": "actuallyadditions:color_change", + "ingredient": { + "item": "minecraft:purple_wool" + }, + "result": { + "item": "minecraft:blue_wool" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/colorchange/brown_wool.json b/src/generated/resources/data/actuallyadditions/recipes/colorchange/brown_wool.json new file mode 100644 index 000000000..a2c52e08f --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/colorchange/brown_wool.json @@ -0,0 +1,9 @@ +{ + "type": "actuallyadditions:color_change", + "ingredient": { + "item": "minecraft:blue_wool" + }, + "result": { + "item": "minecraft:brown_wool" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/colorchange/cyan_wool.json b/src/generated/resources/data/actuallyadditions/recipes/colorchange/cyan_wool.json new file mode 100644 index 000000000..4d7a1335a --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/colorchange/cyan_wool.json @@ -0,0 +1,9 @@ +{ + "type": "actuallyadditions:color_change", + "ingredient": { + "item": "minecraft:light_gray_wool" + }, + "result": { + "item": "minecraft:cyan_wool" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/colorchange/gray_wool.json b/src/generated/resources/data/actuallyadditions/recipes/colorchange/gray_wool.json new file mode 100644 index 000000000..87a343f71 --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/colorchange/gray_wool.json @@ -0,0 +1,9 @@ +{ + "type": "actuallyadditions:color_change", + "ingredient": { + "item": "minecraft:pink_wool" + }, + "result": { + "item": "minecraft:gray_wool" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/colorchange/green_wool.json b/src/generated/resources/data/actuallyadditions/recipes/colorchange/green_wool.json new file mode 100644 index 000000000..48c8f0512 --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/colorchange/green_wool.json @@ -0,0 +1,9 @@ +{ + "type": "actuallyadditions:color_change", + "ingredient": { + "item": "minecraft:brown_wool" + }, + "result": { + "item": "minecraft:green_wool" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/colorchange/light_blue_wool.json b/src/generated/resources/data/actuallyadditions/recipes/colorchange/light_blue_wool.json new file mode 100644 index 000000000..c1faba0ab --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/colorchange/light_blue_wool.json @@ -0,0 +1,9 @@ +{ + "type": "actuallyadditions:color_change", + "ingredient": { + "item": "minecraft:magenta_wool" + }, + "result": { + "item": "minecraft:light_blue_wool" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/colorchange/light_gray_wool.json b/src/generated/resources/data/actuallyadditions/recipes/colorchange/light_gray_wool.json new file mode 100644 index 000000000..4de2dd114 --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/colorchange/light_gray_wool.json @@ -0,0 +1,9 @@ +{ + "type": "actuallyadditions:color_change", + "ingredient": { + "item": "minecraft:gray_wool" + }, + "result": { + "item": "minecraft:light_gray_wool" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/colorchange/lime_wool.json b/src/generated/resources/data/actuallyadditions/recipes/colorchange/lime_wool.json new file mode 100644 index 000000000..c86e7f6ff --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/colorchange/lime_wool.json @@ -0,0 +1,9 @@ +{ + "type": "actuallyadditions:color_change", + "ingredient": { + "item": "minecraft:yellow_wool" + }, + "result": { + "item": "minecraft:lime_wool" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/colorchange/magenta_wool.json b/src/generated/resources/data/actuallyadditions/recipes/colorchange/magenta_wool.json new file mode 100644 index 000000000..9cc15b1cf --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/colorchange/magenta_wool.json @@ -0,0 +1,9 @@ +{ + "type": "actuallyadditions:color_change", + "ingredient": { + "item": "minecraft:orange_wool" + }, + "result": { + "item": "minecraft:magenta_wool" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/colorchange/orange_wool.json b/src/generated/resources/data/actuallyadditions/recipes/colorchange/orange_wool.json new file mode 100644 index 000000000..0024f2cf9 --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/colorchange/orange_wool.json @@ -0,0 +1,9 @@ +{ + "type": "actuallyadditions:color_change", + "ingredient": { + "item": "minecraft:white_wool" + }, + "result": { + "item": "minecraft:orange_wool" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/colorchange/pink_wool.json b/src/generated/resources/data/actuallyadditions/recipes/colorchange/pink_wool.json new file mode 100644 index 000000000..ab7b500fd --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/colorchange/pink_wool.json @@ -0,0 +1,9 @@ +{ + "type": "actuallyadditions:color_change", + "ingredient": { + "item": "minecraft:lime_wool" + }, + "result": { + "item": "minecraft:pink_wool" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/colorchange/purple_wool.json b/src/generated/resources/data/actuallyadditions/recipes/colorchange/purple_wool.json new file mode 100644 index 000000000..93f0eda1b --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/colorchange/purple_wool.json @@ -0,0 +1,9 @@ +{ + "type": "actuallyadditions:color_change", + "ingredient": { + "item": "minecraft:cyan_wool" + }, + "result": { + "item": "minecraft:purple_wool" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/colorchange/red_wool.json b/src/generated/resources/data/actuallyadditions/recipes/colorchange/red_wool.json new file mode 100644 index 000000000..b972816b2 --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/colorchange/red_wool.json @@ -0,0 +1,9 @@ +{ + "type": "actuallyadditions:color_change", + "ingredient": { + "item": "minecraft:green_wool" + }, + "result": { + "item": "minecraft:red_wool" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/colorchange/white_wool.json b/src/generated/resources/data/actuallyadditions/recipes/colorchange/white_wool.json new file mode 100644 index 000000000..f4796b40d --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/colorchange/white_wool.json @@ -0,0 +1,9 @@ +{ + "type": "actuallyadditions:color_change", + "ingredient": { + "item": "minecraft:black_wool" + }, + "result": { + "item": "minecraft:white_wool" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/colorchange/yellow_wool.json b/src/generated/resources/data/actuallyadditions/recipes/colorchange/yellow_wool.json new file mode 100644 index 000000000..203eb71a3 --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/colorchange/yellow_wool.json @@ -0,0 +1,9 @@ +{ + "type": "actuallyadditions:color_change", + "ingredient": { + "item": "minecraft:light_blue_wool" + }, + "result": { + "item": "minecraft:yellow_wool" + } +} \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java index 6723a1775..08c993a2e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java @@ -46,6 +46,7 @@ public final class ActuallyAdditionsAPI { public static final List EMPOWERER_RECIPES = new ArrayList<>(); public static final Map RECONSTRUCTOR_LENS_COLOR_CHANGERS = new HashMap<>(); + public static final List COLOR_CHANGE_RECIPES = new ArrayList<>(); public static final List SOLID_FUEL_RECIPES = new ArrayList<>(); public static final List LIQUID_FUEL_RECIPES = new ArrayList<>(); public static final List PRESSING_RECIPES = new ArrayList<>(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/ActuallyAdditionsData.java b/src/main/java/de/ellpeck/actuallyadditions/data/ActuallyAdditionsData.java index cb4b7ef62..98be4eaae 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/ActuallyAdditionsData.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/ActuallyAdditionsData.java @@ -30,6 +30,7 @@ public class ActuallyAdditionsData { generator.addProvider(new ItemModelGenerator(generator, helper)); generator.addProvider(new LaserRecipeGenerator(generator)); + generator.addProvider(new ColorChangeGenerator(generator)); generator.addProvider(new EmpoweringRecipeGenerator(generator)); generator.addProvider(new CrushingRecipeGenerator(generator)); generator.addProvider(new FuelRecipeGenerator(generator)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/ColorChangeGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/ColorChangeGenerator.java new file mode 100644 index 000000000..7ba2c62c1 --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/data/ColorChangeGenerator.java @@ -0,0 +1,62 @@ +package de.ellpeck.actuallyadditions.data; + +import com.google.gson.JsonObject; +import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; +import de.ellpeck.actuallyadditions.mod.crafting.ColorChangeRecipe; +import de.ellpeck.actuallyadditions.mod.crafting.LaserRecipe; +import net.minecraft.data.DataGenerator; +import net.minecraft.data.DirectoryCache; +import net.minecraft.data.IFinishedRecipe; +import net.minecraft.data.RecipeProvider; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.item.crafting.Ingredient; +import net.minecraft.util.IItemProvider; +import net.minecraft.util.ResourceLocation; + +import javax.annotation.Nonnull; +import java.nio.file.Path; +import java.util.function.Consumer; + +public class ColorChangeGenerator extends RecipeProvider { + public ColorChangeGenerator(DataGenerator p_i48262_1_) { + super(p_i48262_1_); + } + @Override + protected void saveAdvancement(@Nonnull DirectoryCache pCache, @Nonnull JsonObject pAdvancementJson, @Nonnull Path pPath) { + } + + @Override + protected void buildShapelessRecipes(@Nonnull Consumer consumer) { + //Wool + changeColor(consumer, Items.WHITE_WOOL, Items.BLACK_WOOL); + changeColor(consumer, Items.ORANGE_WOOL, Items.WHITE_WOOL); + changeColor(consumer, Items.MAGENTA_WOOL, Items.ORANGE_WOOL); + changeColor(consumer, Items.LIGHT_BLUE_WOOL, Items.MAGENTA_WOOL); + changeColor(consumer, Items.YELLOW_WOOL, Items.LIGHT_BLUE_WOOL); + changeColor(consumer, Items.LIME_WOOL, Items.YELLOW_WOOL); + changeColor(consumer, Items.PINK_WOOL, Items.LIME_WOOL); + changeColor(consumer, Items.GRAY_WOOL, Items.PINK_WOOL); + changeColor(consumer, Items.LIGHT_GRAY_WOOL, Items.GRAY_WOOL); + changeColor(consumer, Items.CYAN_WOOL, Items.LIGHT_GRAY_WOOL); + changeColor(consumer, Items.PURPLE_WOOL, Items.CYAN_WOOL); + changeColor(consumer, Items.BLUE_WOOL, Items.PURPLE_WOOL); + changeColor(consumer, Items.BROWN_WOOL, Items.BLUE_WOOL); + changeColor(consumer, Items.GREEN_WOOL, Items.BROWN_WOOL); + changeColor(consumer, Items.RED_WOOL, Items.GREEN_WOOL); + changeColor(consumer, Items.BLACK_WOOL, Items.RED_WOOL); + } + + private void changeColor(Consumer consumer, IItemProvider output, Ingredient input) { + consumer.accept(new ColorChangeRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + output.asItem().getRegistryName().getPath()), + input, output)); + } + private void changeColor(Consumer consumer, IItemProvider output, IItemProvider input) { + consumer.accept(new ColorChangeRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + output.asItem().getRegistryName().getPath()), + Ingredient.of(input), output)); + } + private void changeColor(Consumer consumer, IItemProvider output, ItemStack input) { + consumer.accept(new ColorChangeRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + output.asItem().getRegistryName().getPath()), + Ingredient.of(input), output)); + } +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ActuallyRecipes.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ActuallyRecipes.java index b94bbcb0d..5df12e36d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ActuallyRecipes.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ActuallyRecipes.java @@ -23,6 +23,7 @@ public class ActuallyRecipes { public static final RegistryObject> LIQUID_FUEL_RECIPE = SERIALIZERS.register(LiquidFuelRecipe.NAME, LiquidFuelRecipe.Serializer::new); public static final RegistryObject> PRESSING_RECIPE = SERIALIZERS.register(PressingRecipe.NAME, PressingRecipe.Serializer::new); public static final RegistryObject> FERMENTING_RECIPE = SERIALIZERS.register(FermentingRecipe.NAME, FermentingRecipe.Serializer::new); + public static final RegistryObject> COLOR_CHANGE_RECIPE = SERIALIZERS.register(ColorChangeRecipe.NAME, ColorChangeRecipe.Serializer::new); @@ -34,5 +35,6 @@ public class ActuallyRecipes { public static final IRecipeType LIQUID_FUEL = IRecipeType.register(ActuallyAdditions.MODID + ":liquid_fuel"); public static final IRecipeType PRESSING = IRecipeType.register(ActuallyAdditions.MODID + ":pressing"); public static final IRecipeType FERMENTING = IRecipeType.register(ActuallyAdditions.MODID + ":fermenting"); + public static final IRecipeType COLOR_CHANGE = IRecipeType.register(ActuallyAdditions.MODID + ":color_change"); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ColorChangeRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ColorChangeRecipe.java new file mode 100644 index 000000000..795a865b8 --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ColorChangeRecipe.java @@ -0,0 +1,146 @@ +package de.ellpeck.actuallyadditions.mod.crafting; + +import com.google.gson.JsonObject; +import net.minecraft.data.IFinishedRecipe; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.item.crafting.IRecipeSerializer; +import net.minecraft.item.crafting.IRecipeType; +import net.minecraft.item.crafting.Ingredient; +import net.minecraft.network.PacketBuffer; +import net.minecraft.util.IItemProvider; +import net.minecraft.util.JSONUtils; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.ForgeRegistryEntry; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class ColorChangeRecipe implements IRecipe { + public static final String NAME = "color_change"; + + private final Ingredient input; + private final ItemStack output; + private final ResourceLocation id; + + public ColorChangeRecipe(ResourceLocation id, ItemStack output, Ingredient input) { + this.input = input; + this.output = output; + this.id = id; + } + + @Override + public boolean matches(@Nonnull IInventory pInv, @Nonnull World pLevel) { + return input.test(pInv.getItem(0)); + } + + public boolean matches(ItemStack stack) { + return input.test(stack); + } + + @Nonnull + @Override + public ItemStack assemble(@Nonnull IInventory pInv) { + return output.copy(); + } + + @Override + public boolean canCraftInDimensions(int pWidth, int pHeight) { + return false; + } + + @Nonnull + @Override + public ItemStack getResultItem() { + return output.copy(); + } + + @Nonnull + @Override + public ResourceLocation getId() { + return id; + } + + @Nonnull + @Override + public IRecipeSerializer getSerializer() { + return ActuallyRecipes.COLOR_CHANGE_RECIPE.get(); + } + + @Override + public IRecipeType getType() { + return ActuallyRecipes.Types.COLOR_CHANGE; + } + + public static class Serializer extends ForgeRegistryEntry> implements IRecipeSerializer { + @Override + public ColorChangeRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) { + Ingredient ingredient = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "ingredient")); + JsonObject resultObject = JSONUtils.getAsJsonObject(pJson, "result"); + ItemStack result = new ItemStack(JSONUtils.getAsItem(resultObject, "item")); + + return new ColorChangeRecipe(pRecipeId, result, ingredient); + } + + @Nullable + @Override + public ColorChangeRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull PacketBuffer pBuffer) { + Ingredient ingredient = Ingredient.fromNetwork(pBuffer); + ItemStack result = pBuffer.readItem(); + return new ColorChangeRecipe(pRecipeId, result, ingredient); + } + + @Override + public void toNetwork(@Nonnull PacketBuffer pBuffer, ColorChangeRecipe pRecipe) { + pRecipe.input.toNetwork(pBuffer); + pBuffer.writeItem(pRecipe.output); + } + } + + public static class FinishedRecipe implements IFinishedRecipe { + private final ResourceLocation id; + private final Ingredient itemIngredient; + private final IItemProvider output; + + public FinishedRecipe(ResourceLocation id, Ingredient itemIngredient, IItemProvider output) { + this.id = id; + this.itemIngredient = itemIngredient; + this.output = output; + } + + @Override + public void serializeRecipeData(JsonObject pJson) { + pJson.add("ingredient", itemIngredient.toJson()); + + JsonObject resultObject = new JsonObject(); + resultObject.addProperty("item", output.asItem().getRegistryName().toString()); + + pJson.add("result", resultObject); + } + + @Override + public ResourceLocation getId() { + return id; + } + + @Override + public IRecipeSerializer getType() { + return ActuallyRecipes.COLOR_CHANGE_RECIPE.get(); + } + + @Nullable + @Override + public JsonObject serializeAdvancement() { + return null; + } + + @Nullable + @Override + public ResourceLocation getAdvancementId() { + return null; + } + } +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/LaserRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/LaserRecipe.java index e2f3f7293..af369ce9f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/LaserRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/LaserRecipe.java @@ -16,6 +16,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.registries.ForgeRegistryEntry; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.Optional; @@ -91,9 +92,8 @@ public class LaserRecipe implements IRecipe { } public static class Serializer extends ForgeRegistryEntry> implements IRecipeSerializer { - @Override - public LaserRecipe fromJson(ResourceLocation pRecipeId, JsonObject pJson) { + public LaserRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) { Ingredient ingredient = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "ingredient")); int energy = JSONUtils.getAsInt(pJson, "energy"); JsonObject resultObject = JSONUtils.getAsJsonObject(pJson, "result"); @@ -104,7 +104,7 @@ public class LaserRecipe implements IRecipe { @Nullable @Override - public LaserRecipe fromNetwork(ResourceLocation pRecipeId, PacketBuffer pBuffer) { + public LaserRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull PacketBuffer pBuffer) { Ingredient ingredient = Ingredient.fromNetwork(pBuffer); int energy = pBuffer.readInt(); ItemStack result = pBuffer.readItem(); @@ -112,7 +112,7 @@ public class LaserRecipe implements IRecipe { } @Override - public void toNetwork(PacketBuffer pBuffer, LaserRecipe pRecipe) { + public void toNetwork(@Nonnull PacketBuffer pBuffer, LaserRecipe pRecipe) { pRecipe.itemIngredient.toNetwork(pBuffer); pBuffer.writeInt(pRecipe.energy); pBuffer.writeItem(pRecipe.result); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ResourceReloader.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ResourceReloader.java index f3150af69..858a02090 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ResourceReloader.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ResourceReloader.java @@ -38,5 +38,8 @@ public class ResourceReloader implements IResourceManagerReloadListener { ActuallyAdditionsAPI.CONVERSION_LASER_RECIPES.clear(); ActuallyAdditionsAPI.CONVERSION_LASER_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.LASER)); + + ActuallyAdditionsAPI.COLOR_CHANGE_RECIPES.clear(); + ActuallyAdditionsAPI.COLOR_CHANGE_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.COLOR_CHANGE)); } }