GregTechCEu Modern

GregTechCEu Modern

6M Downloads

Crash when breaking empty fluid tank

Fabizocker456 opened this issue · 3 comments

commented

Checked for existing issues

  • I have checked for existing issues, and have found none.

Tested latest version

  • I have checked that this occurs on the latest version.

GregTech CEu Version

7.1.0 snapshot built from source as of now

Minecraft Version

1.21.1 NeoForge

Recipe Viewer Installed

None

Environment

Singleplayer

Cross-Mod Interaction

No

Other Installed Mods

None

Expected Behavior

The tank does not drop (due to creative mode).
Alternative acceptable behaviour: tank drops.

Actual Behavior

Game crash.
java.lang.IllegalStateException: Cannot encode empty FluidStack in the render thread.

Steps to Reproduce

  1. Create new world (or join existing one) in creative mode
  2. Place a fluid tank (either any quantum or the creative tank)
  3. Break it
  4. Watch your minecraft instance crash

Additional Information

The reason for this crash seems to be src/[..]/common/machine/storage/QuantumTankMachine.java:160, tag.put("stored", stored.save(MixinHelpers.getCurrentBERegistries()));

A solution to this problem may look like the commit BluSunrize/ImmersiveEngineering@6b9f997 , which fixes a similar issue for Immersive Engineering.

The lines import net.minecraft.world.level.material.Fluids; and if(stored == FluidStack.EMPTY || stored.getFluid() == Fluids.EMPTY) tag.remove("stored"); else tag.put("stored", stored.save(MixinHelpers.getCurrentBERegistries())); seem to fix the issue for me.

commented

#3715 may be related (although for a different version)

commented

#3715 may be related (although for a different version)

This PR wasn't even merged into the main branch 🤔

commented

It is targeting into 1.20.1 which is the working main branch