Jump to content

[1.12] Nbt Crafting


_Bedrockbreaker_

Recommended Posts

I want an item, that when crafted with different dyes, changes its nbt to reflect the average color, like dyeing leather armor/ sort-of like fireworks. The only thing I can assume I need is two textures, one for static colors, and another for one that is dynamically changed with the color, which would be overlayed onto the first. And how could I take that item and craft it into a block (for example) and still have that block retain its color? or armor crafted with the same item?

Professional Hot Garbage Programmer.

https://github.com/Bedrockbreaker/

Link to comment
Share on other sites

26 minutes ago, _Bedrockbreaker_ said:

I want an item, that when crafted with different dyes, changes its nbt to reflect the average color, like dyeing leather armor/ sort-of like fireworks. The only thing I can assume I need is two textures, one for static colors, and another for one that is dynamically changed with the color, which would be overlayed onto the first. And how could I take that item and craft it into a block (for example) and still have that block retain its color? or armor crafted with the same item?

You will need to make a custom IRecipe implementation. You should look at the ItemArmor for how the LeatherArmor texture works.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

  • 2 weeks later...

Okay, so I think I managed to copy create a class that behaves like RecipesArmorDyes, but how would I register that? GameRegistry.addRecipe give me a resource location, but that would be for an external file. And I can't seem to find any other registry method to do this anymore that isn't deprecated in 1.12.

Professional Hot Garbage Programmer.

https://github.com/Bedrockbreaker/

Link to comment
Share on other sites

Recipes now use the Forge registry system, so subscribe to RegistryEvent.Register<IRecipe> and register an instance of the recipe using IForgeRegistry#register.

 

When possible, you should register recipes through JSON files rather than in code. To allow your IRecipe class to be used by JSON files, create an IRecipeFactory class for it and specify it in _factories.json.

 

You can see some examples of IRecipe and IRecipeFactory implementations here, the _factories.json file here and the recipe files here.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

6 hours ago, _Bedrockbreaker_ said:

Yes, most of my recipes are registered through json, but I don't think that json allows you to do advanced recipes that give nbt-specific items based on certain inputs. (armor dying)

 

It does if you create your own recipe class and factory, as I explained in my previous post.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

8 hours ago, Choonster said:

 

It does if you create your own recipe class and factory, as I explained in my previous post.

Okay... It just seems the vanilla classes to register the armor dying (or it seems anything that uses dying/cloning items/tipped arrows) don't use jsons... Will try to move my class to json though...

Professional Hot Garbage Programmer.

https://github.com/Bedrockbreaker/

Link to comment
Share on other sites

(This is just to check to see if I have the right idea) Okay, So when looking at the files, you have gold_helmet_from_iron_helmet.json that actually specifies the recipe. The type tag on the json specifies the class that _factories.json uses to modify that recipe. (What does the data tag do on the iron helmet?) Then, the ShapedArmorUpgradeRecipe which iterates over the crafting slots until it finds an armor piece. Then, it takes the damage of the iron helmet, and copies it onto the golden helmet. (doesn't the iron helmet have more durability, which wouldn't effect the golden helmet until the iron helmet's durability got low enough? Or does it take any damage on the iron helmet on apply it to the golden helmet, meaning that a barely broken iron helmet could result in a completely broken golden helmet? Or is it a ratio, which I see none of in the class, that as the iron helmet takes more damage, the golden takes less, but both meet at 0.)

Professional Hot Garbage Programmer.

https://github.com/Bedrockbreaker/

Link to comment
Share on other sites

3 minutes ago, _Bedrockbreaker_ said:

(What does the data tag do on the iron helmet?)

 

32767 is the value of OreDictionary.WILDCARD_VALUE, which tells the Ingredient to accept any metadata value of the item. This allow an Iron Helmet with any amount of damage to be used in the recipe.

 

4 minutes ago, _Bedrockbreaker_ said:

Then, it takes the damage of the iron helmet, and copies it onto the golden helmet. (doesn't the iron helmet have more durability, which wouldn't effect the golden helmet until the iron helmet's durability got low enough? Or does it take any damage on the iron helmet on apply it to the golden helmet, meaning that a barely broken iron helmet could result in a completely broken golden helmet? Or is it a ratio, which I see none of in the class, that as the iron helmet takes more damage, the golden takes less, but both meet at 0.)

 

Minecraft uses the metadata as the amount of damage the item has taken, so 0 is no damage and X (where X is the maximum damage) is just about to break.

 

ShapedArmourUpgradeRecipe clamps the output item's damage between 0 and its max damage, so if the Iron Helmet has more than 77 damage (the max damage of a Gold Helmet), the damage on the Gold Helmet will be clamped to 77. This means that an Iron Helmet with anywhere from 0 to 88 durability will be converted to a Gold Helmet with 0 durability.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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 Terms of Use.