Skip to content

Add config option to completely disable any wine#83

Open
FinnSetchell wants to merge 1 commit into
Let-s-Do-Collection:1.20.1from
FinnSetchell:feature/disable-wines
Open

Add config option to completely disable any wine#83
FinnSetchell wants to merge 1 commit into
Let-s-Do-Collection:1.20.1from
FinnSetchell:feature/disable-wines

Conversation

@FinnSetchell

Copy link
Copy Markdown

Heads up on the version: I based this on the v1.4.8-1.20.1 tag (commit 9dedbbfe). I need this feature on 1.20.1 for prominence modpack, and since there isn't an active 1.20.1 branch anymore, I built it on top of the last 1.20.1 release and opened it against the 1.20.1 branch. I'm just putting it out there so it exists for 1.20.1. dD whatever's useful with it, whether that's merging it, adapting it, porting it to 1.21.1, or closing it. I'm happy to rebase onto a different branch if that helps. GitHub will probably show conflicts since the branch has moved on to 1.21.1, which is expected.

What this does

Adds a disabled_wines list to the config that lets you completely disable any wine. Once a wine is disabled you can't craft it (fermentation barrel, apple press, or Create), it won't show up in the creative menu, JEI/REI, or the recipe book, the winemaker villager and wandering trader won't sell it, and any bottles you already have can't be drunk. The wine_collector advancement still works, and the item stays registered so existing worlds don't break.

Why I made it

I wanted to remove a specific wine from a modpack without deleting the item outright, since that would corrupt any world that already had it.

Using it

Add item IDs to the disabled_wines list, either in config/vinery/config.json5 or through the in-game config screen (Cloth / Mod Menu → Disabled Wines):

"disabled_wines": ["vinery:eiswein", "vinery:mead"]

How it works

It's basically one main hook plus a few small guards, all reading the same list:

  • Recipes (RecipeManagerMixin): at the tail of RecipeManager#apply I drop any recipe whose result is a disabled wine, no matter the recipe type. That single hook handles the fermentation barrel, the apple press, and Create. Create's ProcessingRecipe#getResultItem returns its first output, and every Vinery wine recipe only has one output. JEI, REI, and the recipe book all read from the synced RecipeManager, so they hide it automatically.
  • Creative tab (TabRegistry): wines go through an acceptWine helper that skips disabled ones.
  • Drinking (DrinkBlockItem#use): returns fail for a disabled wine, so leftover bottles do nothing.
  • Trades: VillagerUtil.SellItemFactory#getOffer returns null for disabled wines, which covers the winemaker villager on both loaders, and WanderingWinemakerEntity#updateTrades filters its offers.
  • Advancement (VineryServerDataProvider): wine_collector needs you to hold every wine at once, so I rebuild it without the disabled wines (using the Moonlight dynamic data pack that's already there) so it stays completable. get_wine is an OR list, so it's already fine.

Testing

I built and ran it on both Fabric and Forge (1.20.1) with vinery:eiswein disabled:

  • Forge with Create: the log showed Removed 2 recipe(s) (the fermentation one and the Create mixing one), and eiswein was gone from JEI and creative and couldn't be crafted or drunk.
  • Fabric: Removed 1 recipe(s), same behaviour.
  • Adding and removing wines through the in-game config works and takes effect on world reload.

Adds a 'disabled_wines' config list. A disabled wine can't be crafted (fermentation barrel, apple press, or Create), is hidden from the creative menu / JEI / REI / recipe book, isn't sold by the winemaker villager or wandering trader, and existing bottles can't be drunk. The wine_collector advancement is rebuilt to stay completable. Items stay registered to avoid world corruption.
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.

1 participant