
[1.20.1] Interaction with GTCEu-Modern preventing glass bottle use
loving2 opened this issue ยท 5 comments
Is there an existing issue for this?
- I have searched the existing issues
Description of the Bug
With just GTCEu-Modern installed, there is functionality to brew potions in a Brewery machine. This machine allows inserting potion fluid into the machine input by clicking potion bottles on the input. It also allows for potion extraction by clicking empty glass bottles on the output.
With railcraft also installed, the extraction of the potion from the output fails.
Railcraft Reborn version
1.1.8
NeoForge/Forge version
47.3.11
Minecraft version
1.20.1
Minecraft server
No
To Reproduce
- Install GTCEu-Modern v1.6.2 and Railcraft Reborn 1.1.8
- Place an Ultimate Brewery down
- Place a Creative Energy source down next to it
- Set the Creative Energy to UV and Active
- Insert 3 awkward potions into the Ultimate Brewery
- Insert a golden carrot into the Ultimate Brewery
- Use an empty glass bottle to try to extract the resulting Night Vision potion
Expected behavior
The empty glass bottle should become filled with the Night Vision potion.
Logs & Environment
No response
Screenshots & Video
No response
I suspect this is due to the canFillFluidType call in CreosoteBottleWrapper but I'm not certain. I also spotted where you add a capability to the glass bottle.
I have been able to fix the issue in my local testing by changing the return of canFillFluidType
to always be true
here. I can make a PR of this if you'd like, but I'm not sure what the ramifications are, if any, from doing this.
@loving2 Yeah, but with your changes, you were able to fill the bottle?
Hmm, I just double checked, and kind of yes but also not quite. I must not have looked closely last time, because it turns out when filling the bottle with a potion (after making that change) that it turns into the Creosote Bottle, regardless of potion type.
I've done a little more looking at this, and I wonder - does the glass bottle need the attached fluid handler item capability? I ask because I'm not sure if the capabilities on the Glass Bottle are just overwriting each other depending on mod load order.
The only way to obtain a Creosote Bottle is by putting it through the Coke Oven multiblock UI, right? If so, then perhaps the Coke Oven or the methods it calls could have some special handling to transform an empty Glass Bottle into a Creosote Bottle. I admit, this may be naive of me, but I just tested and the following changes seem to be working.
railcraft/src/main/java/mods/railcraft/Railcraft.java
- Line 264 commented out so no capability is attached
@SubscribeEvent
public void handleAttachItemStackCapabilities(AttachCapabilitiesEvent<ItemStack> event) {
var stack = event.getObject();
if (stack.is(Items.GLASS_BOTTLE)) {
//event.addCapability(RailcraftConstants.rl("bottle_container"), new CreosoteBottleWrapper(stack));
}
}
railcraft/src/main/java/mods/railcraft/world/module/CokeOvenModule.java
- Lines 104, and 110 edited to include Glass Bottles since they'd no longer return true for FluidTools.isFluidHandler()
as well as adding the appropriate import (I don't know if this is necessary or not)
import net.minecraft.world.item.Items;
var topSlot = this.getItem(SLOT_LIQUID_INPUT);
if (!topSlot.isEmpty() && !(FluidTools.isFluidHandler(topSlot) || topSlot.is(Items.GLASS_BOTTLE))) {
this.setItem(SLOT_LIQUID_INPUT, ItemStack.EMPTY);
this.provider.dropItem(topSlot);
}
var bottomSlot = this.getItem(SLOT_LIQUID_OUTPUT);
if (!bottomSlot.isEmpty() && !(FluidTools.isFluidHandler(bottomSlot) || bottomSlot.is(Items.GLASS_BOTTLE))) {
this.setItem(SLOT_LIQUID_OUTPUT, ItemStack.EMPTY);
this.provider.dropItem(bottomSlot);
}
railcraft/src/main/java/mods/railcraft/util/fluids/FluidTools.java
- Lines 143-152 function tryFill
edited to work with the Glass Bottle
private static ProcessState tryFill(Container container, StandardTank tank, ItemStack itemStack) {
if (itemStack.is(Items.GLASS_BOTTLE)) {
tank.drain(FluidBottleItem.QUANTITY, IFluidHandler.FluidAction.EXECUTE);
container.setItem(1, RailcraftItems.CREOSOTE_BOTTLE.get().getDefaultInstance());
return ProcessState.FILLING;
}
var result =
FluidUtil.tryFillContainer(itemStack, tank, FluidType.BUCKET_VOLUME, null, true);
if (!result.isSuccess()) {
sendToOutput(container);
return ProcessState.RESET;
}
container.setItem(1, result.getResult());
return ProcessState.FILLING;
}