[1.12.2] Crash from Trying to Bucket Fluid Ethanol
KAfable opened this issue ยท 7 comments
https://hastebin.com/ibekiwuzex.sql
Used JEI in creative testing to cheat myself a fluid source block (it didn't give me the bucket variant of the fluid for some reason), I tried placing it in world and then tried to bucket it so I could figure out what it's the forge thought the liquid was (eg liquid:ethanol) and ended up crashing.
I am unable to recreate this bug - it may have something to do with the large modpack you're using or 2.9d being built on an old Forge version. A bug-fixing update's coming soon so we will be able to see if it is the latter.
So something like
FluidRegistry.addBucketForFluid(fluid);
if (!FluidRegistry.isFluidRegistered(fluid)) FluidRegistry.registerFluid(fluid);
would be fine?
From further testing it looks like you create an Ethanol Fluid
and use it, but do not register it with the FluidRegistry for some reason. As there is some Ethanol in the Registry, your Fluid partially works, until it crashes.
ALWAYS register your Fluid
s. The registry's job is to figure out which Fluid implementation will be used.
PS: Don't rely on addBucketForFluid()
to register your fluid. It's buggy.
no.
isFluidRegistered() only checks if there is any fluid with that name registered. What you need is
if (!FluidRegistry.registerFluid(fluid)) {
fluid = FluidRegistry.getFluid(fluid.getName());
} // put an 'else' here if you don't want to force other mod's fluid to have a bucket
FluidRegistry.addBucketForFluid(fluid);
The point is that you create a Fluid object and offer it to the registry. Then you throw it away and never ever under no circumstances access it again. From then on you can get the fluid from the registry by name.