Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.13.2] Recipe condition


Recommended Posts

So i have a json recipe and it is loading but i want to add a condition to it. So i tried to do like in 1.12. But it gives me this error com.google.gson.JsonSyntaxException: Unknown condition type: recipes_and_more:golden_apple

This is my recipe file:

Spoiler

{
	"type": "minecraft:crafting_shaped",
	"pattern":
	[
		"GGG",
		"GAG",
		"GGG"
	],
	"key":
	{
		"G":
		{
			"item": "minecraft:gold_block"
		},
		"A":
		{
			"item": "minecraft:apple"
		}
	},
	"result":
	{
		"item": "minecraft:golden_apple",
		"data": 1
	},
	"conditions" : [
		{
			"type" : "recipes_and_more:golden_apple"
		}
	]
}

 

 

And my _factories file:

Spoiler

{
	"conditions": {
		"golden_apple": "meldexun.recipesAndMore.recipes.GoldenAppleCondition"
	}
}

 

 

And my condition class:

Spoiler

public class GoldenAppleCondition implements IConditionSerializer {
	
	@Override
	public BooleanSupplier parse(JsonObject json) {
		return () -> true;
	}
	
}

 

 

Link to post
Share on other sites

1.13 doesn't use _factories any more.

 

You need to register a serializer extends net.minecraftforge.registries.ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<R> (where R is your recipe class) within the appropriate registry event.

 

https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/hardlib/api/recipe/RecipeTagOutput.java#L180

https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/hardlib/HardLib.java#L51 (my registry stuff is handled by my Easy Registry system, but its functionally the same as you'd expect).

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to post
Share on other sites

In Forge 1.13.2 the IRecipeSerializer class doesn't extend IForgeRegistryEntry. So can it even work in 1.13.2? It seems like i should just skip Forge 1.13.2 and work in Forge 1.14.4 since 1.13 is not getting updated currently.

Link to post
Share on other sites
1 hour ago, Meldexun said:

In Forge 1.13.2 the IRecipeSerializer class doesn't extend IForgeRegistryEntry. So can it even work in 1.13.2? It seems like i should just skip Forge 1.13.2 and work in Forge 1.14.4 since 1.13 is not getting updated currently.

Check the type hierarchy (that is, the existing vanilla classes that implement it). In 1.14 all the serializers extend IForgeRegistryEntry explicitly, rather than it being attached to the interface, so it probably is the same in 1.13 (which is weird, but whatever).

 

F4 in Eclipse, or you can right click on it.

 

(And if I'm wrong, I'm wrong. I updated to 1.14 pretty fast)

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.