gigaherz / Enderthing

Ender-chests evolved
https://www.curseforge.com/minecraft/mc-mods/enderthing
BSD 3-Clause "New" or "Revised" License
6 stars 4 forks source link

Hard crash when linked to any storage mod #23

Closed joacmc closed 3 years ago

joacmc commented 3 years ago

The ender chests from this mod are incompatible with any of the storage mods I've tried (Simple Storage Network, Pretty Pipes). Linking the chest to the system causes the game to crash. On server removing the storage mod allows the map to work again. On single player I have not found a way to recover a map once it crashes.

To reproduce:

  1. Launch game with Enderthings, any required files and either Simple Storage or Prettypipes.
  2. Set up the storage mod
  3. Connect with cable to an Enderthings locked enderchest.

2020-10-23-2.log.gz

gigaherz commented 3 years ago

The log doesn't show any indication that it's my mod doing the crashing. It seems to error inside forge code:

Caused by: java.lang.NoSuchMethodError: net.minecraft.util.ResourceLocation.compareNamespaced(Lnet/minecraft/util/ResourceLocation;)I
    at net.minecraftforge.event.RegistryEvent$MissingMappings$Mapping.compareTo(RegistryEvent.java:238) ~[?:?]
    at net.minecraftforge.event.RegistryEvent$MissingMappings$Mapping.compareTo(RegistryEvent.java:167) ~[?:?]
    at java.util.Comparators$NaturalOrderComparator.compare(Comparators.java:52) ~[?:1.8.0_51]
    at java.util.Comparators$NaturalOrderComparator.compare(Comparators.java:47) ~[?:1.8.0_51]
    at java.util.TimSort.countRunAndMakeAscending(TimSort.java:351) ~[?:1.8.0_51]
    at java.util.TimSort.sort(TimSort.java:216) ~[?:1.8.0_51]

This strongly sounds like an Optifine compatibility problem. Optifine is well known to overwrite entire classes with their own patched implementation, meaning it can easily overwrite forge patches with versions that don't contain that patch. I would assume it will work just fine without optifine installed.

I'll reopen the issue if this is not the case.

joacmc commented 3 years ago

Tried again with just simple storage and enderthings installed, error still happens.

latest.log

gigaherz commented 3 years ago

Aha! THAT's an Enderthing error. The other mod is trying to access the enderthing chest contents client-side, but this is not supported, I probably should return a fake empty inventory instead of crashing. :P

gigaherz commented 3 years ago

I'll release a workaround shortly. That said, the true issue is in Storage Network:

This piece of code: https://github.com/Lothrazar/Storage-Network/blob/trunk/1.16/src/main/java/com/lothrazar/storagenetwork/block/TileCableWithFacing.java#L47

Should read like

    if (neighbor != null && neighbor.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite()).isPresent()) {

You should report this problem to them: They should NOT be resolving the actual value of a capability, just to check for presence, that's why it's a Lazy Optional. To avoid doing that.

gigaherz commented 3 years ago

v1.0.4 is up on curseforge, and it should avoid the crash.