DaFuqs / Spectrum

A full-feature minecraft mod about harnessing the powers of color
Other
103 stars 62 forks source link

[BUG] Brewing Stand can turn Pigment Potions into Uncraftable Potions #99

Closed JamminJellyToast closed 2 years ago

JamminJellyToast commented 2 years ago

Describe the bug It is possible to have the Brewing Stand add Gunpowder to a Pigment Potion. This causes the Brewing Stand to consume the Pigment Potions and produce placeholder Splash Uncraftable Potions that have no effect. Other reagents like Glowstone, Redstone, and Dragon's Breath do not initiate the brewing process, indicating that Gunpowder shouldn't either.

To Reproduce Place any Pigment Potion in a Brewing Stand, and place Gunpowder in the ingredient slot.

Expected behavior Based on behavior with other Reagents, the Brewing Stand should do nothing with Pigment Potions inside.

Mod version Version 1.4.0 for MC 1.18.2.

Screenshots 2022-08-09_16 38 27 2022-08-09_16 38 43

JamminJellyToast commented 2 years ago

I've made an error in my initial comment. After testing it some more, it appears that Dragons Breath is also causing this problem. Turning Splash Pigment Potions into Lingering Uncraftable Potions.

Neubulae commented 2 years ago

These are, in fact, custom potions thus ordinary brewing stands would have problem processing these.

DaFuqs commented 2 years ago

Pretty much, yes.

Spectrum uses the "CustomPotionEffects" NBT tag that potions support to add it's dynamic effects. The vanilla brewing stand does not handle those very well, though. But without messing with the vanilla brewing stand, there is nothing I can do, sorry.

SollyW commented 2 years ago

This is easy to fix

SollyW commented 2 years ago

(On mobile, so using old 1.18 sources and cannot test my code) Register a new net.minecraft.potion.Potion into the potion registry for the pigment potion. You can leave its effects empty and use custom potion effects instead. Then, either:

If you want to disallow gunpowder/dragon's breath brewing, mixin to the lambda used for POTION_TYPE_PREDICATE in net.minecraft.recipe.PotionRecipeRegistry and check for your potion type, returning false if it matches.

Otherwise, mixin to net.minecraft.recipe.PotionRecipeRegistry::craft and, if your potion type is being used, copy the custom effects into the ItemStack created at return PotionUtil.setPotion(new ItemStack(recipe.output), potion);

Azzyypaaras commented 2 years ago

Zamn, daf just got blasted

DaFuqs commented 2 years ago

done.