Posted February 27, 20205 yr Hi, I am trying to add a recipe that use two of my mod items and return a new Item with a property on a nbt tag increased. My problem is that the recipe is not loaded : Spoiler [17:56:45] [Server thread/ERROR] [minecraft/RecipeManager]: Parsing error loading recipe thelastofcraft:modtool_crafting com.google.gson.JsonSyntaxException: Invalid or unsupported recipe type 'thelastofcraft:modtool_crafting' at net.minecraft.item.crafting.RecipeManager.lambda$deserializeRecipe$8(RecipeManager.java:136) ~[?:?] {re:classloading} at java.util.Optional.orElseThrow(Optional.java:290) ~[?:1.8.0_151] {} at net.minecraft.item.crafting.RecipeManager.deserializeRecipe(RecipeManager.java:135) ~[?:?] {re:classloading} at net.minecraft.item.crafting.RecipeManager.apply(RecipeManager.java:60) ~[?:?] {re:classloading} at net.minecraft.item.crafting.RecipeManager.apply(RecipeManager.java:37) ~[?:?] {re:classloading} at net.minecraft.client.resources.ReloadListener.lambda$reload$1(ReloadListener.java:14) ~[?:?] {re:classloading} at java.util.concurrent.CompletableFuture.uniAccept(CompletableFuture.java:656) ~[?:1.8.0_151] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:632) ~[?:1.8.0_151] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:442) ~[?:1.8.0_151] {} at net.minecraft.resources.AsyncReloader.lambda$null$3(AsyncReloader.java:66) ~[?:?] {re:classloading} at net.minecraft.util.concurrent.TickDelayedTask.run(TickDelayedTask.java:20) [?:?] {re:classloading} at net.minecraft.util.concurrent.ThreadTaskExecutor.run(ThreadTaskExecutor.java:140) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.concurrent.RecursiveEventLoop.run(RecursiveEventLoop.java:22) [?:?] {re:classloading} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:757) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:141) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.concurrent.ThreadTaskExecutor.driveOne(ThreadTaskExecutor.java:110) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.driveOneInternal(MinecraftServer.java:740) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.driveOne(MinecraftServer.java:734) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.concurrent.ThreadTaskExecutor.driveUntil(ThreadTaskExecutor.java:123) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.loadDataPacks(MinecraftServer.java:1577) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.loadDataPacks(MinecraftServer.java:455) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:77) [?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.server.integrated.IntegratedServer.init(IntegratedServer.java:99) [?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:636) [?:?] {re:classloading,pl:accesstransformer:B} at java.lang.Thread.run(Thread.java:748) [?:1.8.0_151] {} Where I register my recipe : Spoiler @Mod.EventBusSubscriber(modid = ThelastofcraftMod.MODID, bus = Mod.EventBusSubscriber.Bus.FORGE) public class ModSetup { public static final IRecipeSerializer<ModToolRecipe> MODTOOL_CRAFTING = null; public static final ItemGroup ITEM_GROUP = new ItemGroup("thelastofcraft") { @Override public ItemStack createIcon() { return new ItemStack(Registration.MOLOTOV_ITEM.get()); } }; public static void init(final FMLCommonSetupEvent event) { Networking.registerMessages(); for (Biome biome : ForgeRegistries.BIOMES) { biome.getSpawns(EntityClassification.MONSTER).add(new Biome.SpawnListEntry(Registration.RUNNER.get(), 60, 3, 5)); } } @SubscribeEvent public static void registerRecipes(final RegistryEvent.Register<IRecipeSerializer<?>> event) { event.getRegistry().register(new SpecialRecipeSerializer<>(ModToolRecipe::new).setRegistryName(ThelastofcraftMod.MODID, "modtool_crafting")); } @SubscribeEvent public static void onPlayerLoggin(PlayerEvent.PlayerLoggedInEvent event) { CompoundNBT nbt = event.getEntity().getPersistentData(); if(!nbt.contains("TLOC_pistol")) { nbt.putBoolean("TLOC_pistol", true); ((PlayerEntity) event.getEntity()).inventory.addItemStackToInventory(new ItemStack(Registration.PISTOL.get())); ((PlayerEntity) event.getEntity()).inventory.addItemStackToInventory(new ItemStack(Registration.BULLET_ITEM.get(), 6)); } } @SubscribeEvent public static void onPlayerRespawn(PlayerEvent.PlayerRespawnEvent event) { ((PlayerEntity) event.getEntity()).inventory.addItemStackToInventory(new ItemStack(Registration.PISTOL.get())); ((PlayerEntity) event.getEntity()).inventory.addItemStackToInventory(new ItemStack(Registration.BULLET_ITEM.get(), 6)); } } My recipe : Spoiler public class ModToolRecipe extends SpecialRecipe { public ModToolRecipe(ResourceLocation res) { super(res); } @Override public boolean matches(CraftingInventory inv, World worldIn) { ArrayList<ItemStack> modtool = new ArrayList<ItemStack>(); for (int i = 0; i < inv.getSizeInventory(); i++) { ItemStack stack = inv.getStackInSlot(i); if (stack.getItem() == Registration.MODTOOL.get()) { modtool.add(stack); } else if(!stack.isEmpty()) { return false; } } return ModTool.readUpgradeAcquired(modtool.get(0)) == ModTool.readUpgradeAcquired(modtool.get(1)) && modtool.size() == 2; } @Override public ItemStack getCraftingResult(CraftingInventory inv) { ArrayList<ItemStack> modtool = Lists.newArrayList(); for (int i = 0; i < inv.getSizeInventory(); i++) { ItemStack stack = inv.getStackInSlot(i); if (stack.getItem() == Registration.MODTOOL.get()) { modtool.add(stack); }else if(!stack.isEmpty()) { return ItemStack.EMPTY; } } if(modtool.size() != 2) return ItemStack.EMPTY; if(ModTool.readUpgradeAcquired(modtool.get(0)) != ModTool.readUpgradeAcquired(modtool.get(1))) return ItemStack.EMPTY; else { ItemStack itemout = new ItemStack(Registration.MODTOOL.get()); ModTool.writeUpgradeAcquired(itemout, ModTool.readUpgradeAcquired(modtool.get(0))+1); return itemout; } } @Override public boolean canFit(int width, int height) { return width*height>=2; } @Override public IRecipeSerializer<?> getSerializer() { return ModSetup.MODTOOL_CRAFTING; } } and I have a json file in the recipes folder with my vanilla recipes : { "type": "thelastofcraft:modtool_crafting" } Edited February 27, 20205 yr by marcowflash
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.