cadaverous-eris / Rustic

A medieval themed Minecraft mod based around decoration, exploration, and agriculture
68 stars 35 forks source link

Brewing Barrel doesn't get correct container item #316

Open JoshieGemFinder opened 2 years ago

JoshieGemFinder commented 2 years ago

The brewing barrel doesn't get the correct container item when draining from input items. An example of this that I've seen brought up before is the 'Syrmorite bucket turns into weedwood bucket' issue when dealing with The Betweenlands (often brought up because of Sevtech Ages)

This is because it uses a faulty way of emptying items, it simply does out = new ItemStack(in.getItem()) which disregards damage values and other things when mods might have multiple fluid containers on the same item (there is an item limit, after all), these preferred ways of getting an item would be the method item.getContainerItem(ItemStack stack) or the (deprecated) method item.getContainerItem()

It should instead do something like: out = in.getItem().hasContainerItem(in) ? in.getItem().getContainerItem(in) : new ItemStack(in.getItem()) which respects other mods' bucket preferences, while still having the fallback if needed