Skip to content

Conversation

ANRAR4
Copy link
Contributor

@ANRAR4 ANRAR4 commented Mar 14, 2025

The changes replace the switch case statements for determining items smeltable and cookable inside a furnace as well as fuels for furnaces, which are used to check if an item can be put inside a furnace, with comparisons to lists of the available smelting/cooking/blastsmelting recipes or rather a check of the Material.isFuel method for fuels, as the hardcoded lists tend to be outdated (e. g. missing resin_clump in 1.21.4 and the upcoming recipe for leaves (to leaf_litter)).

These changes also add further tests to check the exclusion of items that should not be allowed into the specific type of furnace, although testing seems to be currently disabled.

* Precompute lists of all recipes available for furnace, blast_furnace and smoker/campfire
*
*/
public static void setupSmeltableItemLists() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We used to do this, but it caused some very major issues. Servers stalling on startup, various versions of Spigot where large numbers of recipes were missing (and therefore things worked very unreliably), etc.

My understanding is the stability of the recipe API has only gotten worse over time, so these issues are likely more of a problem than ever. I'm not sure this is something worth doing due to this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my limited testing (on paper and spigot with versions 1.21.3 and 1.21.4) it worked, but i of course don't know if it will work in all cases.
When was a dynamic solution last used?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't recall specifically the last time, but it's been tried many times in the past. it works in some instances, but significantly reduces the stability of the plugin, making it really a non-starter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is there further testing I could do to check the reliability? (i. e. do you remember configurations that caused problems?)
Or if not has my other pr (#1345) a chance of beeing merged? (which would require it to be rewritten)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, 1.21.5 has taken priority from reviewing any existing stuff

I'd be much more comfortable if this PR didn't contain the dynamic stuff via the recipe iterator, and then if you wanted to put that through as its own separate PR we could discuss it there

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pr refering to #1344 and the isFuel check, fixing of isFurnacable spelling and seperation of furnaceable and blastable recipes?
Should this also include the addition of resin_clumb and leaves -> leaf_litter?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that one- although the spelling change is probably worth skipping. Both are technically valid (unsure if that’s a english variant thing or not), and it’s not really worth the API break for a small change like spelling

isFuel, blastable separation, and those additions all sound like changes that should be pretty easily mergeable- thanks :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the pr
Although compiling/merging would require the dependencies in build.gradle to be updated as well which i was unable to do

if (recipe instanceof FurnaceRecipe) {
smeltableItems.put(((FurnaceRecipe)recipe).getInput().getType(), ((FurnaceRecipe)recipe).getResult());
}
else if (recipe instanceof BlastingRecipe) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure to follow the style standards

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refering to the line wrapping?
Does the second commit fix this issue?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was referring to the

if {

}
else

rather than

if {

} else {

we follow the Oracle Java Conventions, https://www.oracle.com/docs/tech/java/codeconventions.pdf

@ANRAR4
Copy link
Contributor Author

ANRAR4 commented Mar 15, 2025

I forgot to add all choices of smelting recipes with a taglist as input (e. g. #minecraft:logs_that_burn -> charcoal).
Now the lists of accepted items are identical, exept i noticed the switch case was also missing deepslate_coal_ore -> coal.
I also added line wrapping for lines around 120 characters.

@ANRAR4 ANRAR4 changed the title Determine smeltable items and fuels dynamically (for pipes inputting items into furnaces) Seperate furnace recipes by furnace type, dynamically determine isAFuel for furnaces Mar 30, 2025
@me4502 me4502 merged commit e2a7b40 into EngineHub:master Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants