Create Fabric

Create Fabric

10M Downloads

[Crash] getVersion() may not be called during a transaction | in ThresholdSwitchBlockEntity.updateCurrentLevel

fabien-gigante opened this issue ยท 0 comments

commented

Describe the Bug

My game is crashing at load with the following exception :

getVersion() may not be called during a transaction

In the following stack :

java.lang.IllegalStateException: getVersion() may not be called during a transaction.
	at net.fabricmc.fabric.api.transfer.v1.storage.Storage.getVersion(Storage.java:202)
	at com.simibubi.create.foundation.blockEntity.behaviour.inventory.VersionedInventoryWrapper.getVersion(VersionedInventoryWrapper.java:74)
	at com.simibubi.create.foundation.blockEntity.behaviour.inventory.VersionedInventoryTrackerBehaviour.awaitNewVersion(VersionedInventoryTrackerBehaviour.java:40)
	at com.simibubi.create.content.redstone.thresholdSwitch.ThresholdSwitchBlockEntity.updateCurrentLevel(ThresholdSwitchBlockEntity.java:124)
	at com.simibubi.create.content.redstone.thresholdSwitch.ThresholdSwitchBlockEntity.lazyTick(ThresholdSwitchBlockEntity.java:214)
	at com.simibubi.create.foundation.blockEntity.SmartBlockEntity.tick(SmartBlockEntity.java:77)
	at com.simibubi.create.foundation.blockEntity.SmartBlockEntityTicker.tick(SmartBlockEntityTicker.java:15)

Reproduction Steps

  1. Install create-fabric-0.5.1-f-build.1238+mc1.20.1.jar
  2. Use a Threshold Switch to monitor a Vault level change
  3. Wait for the crash

Expected Result

Shouldn't crash

I was able to work around the crash by removing the first TransferUtil.getTransaction() in ThresholdSwitchBlockEntity.updateCurrentLevel

Screenshots and Videos

No response

Crash Report or Log

crash-2024-02-17_22.16.57-server.txt

Operating System

Windows 10

Mod Version

0.5.1f

Minecraft Version

1.20.1

Other Mods

No response

Additional Context

Similar to #1317