Adding fuel times to items
Juuxel opened this issue ยท 6 comments
Vanilla hardcodes fuel times in AbstractFurnaceBlockEntity.getBurnTimeMap
. Fabric could have a hook to add custom fuel times.
There's also some room for optimization since the map is generated on each call to getBurnTimeMap
.
I'm probably going to work on a PR for this.
If you mean mean data system as in JSON files, this a bit too complicated for fabric-api itself, but a small hook so that mods can add fuels without needing a mixin would be good.
I was thinking of adding a small hook. I'll also need to investigate if a new map is needed on each call, or if it can be cached.
If you mean mean data system as in JSON files, this a bit too complicated for fabric-api itself
In the most basic form, it'd be a very thin "ItemStack -> fuel value" deserializer. I'm pretty sure it'd be no more than 20 lines of code... I wouldn't rule it out.
My idea was to create an empty map fabric's api.
Add a mixin that returns that map if the fabric one isnt empty, if not return the current vanilla one.
Populate the fabric map with the existing values, so all future calls to AbstractFurnaceBlockEntity.getBurnTimeMap
return the one in fabric.
And the mods can add what they want to it, this would also improve the performance of it, while also allowing mojang to add new values in future versions.
A data driven method could be added very easily ontop of this. I can make/help you with a PR if you wish?
@modmuss50 Can't - notice that the method is tied to datapack information by how it adds ItemTags.
What I'll have to do is essentially refresh the cache on every tag reload. Fortunately, IIRC, tags already have a generational counter, so it's pretty easy to add.