CarrotOfRivia / castle_in_the_sky

Other
7 stars 5 forks source link

Server crash when ran with Etched #1

Closed FemBane closed 3 years ago

FemBane commented 3 years ago

Running the mod on a server alongside Etched causes a crash during startup. Description: Exception in server tick loop

java.lang.UnsupportedOperationException: null
    at java.util.AbstractList.add(AbstractList.java:148) ~[?:1.8.0_292] {}
    at java.util.AbstractList.add(AbstractList.java:108) ~[?:1.8.0_292] {}
    at com.song.castle_in_the_sky.events.ServerEvents.onVillageTradeRegister(ServerEvents.java:62) ~[castle_in_the_sky:1.16.5] {re:classloading}
    at net.minecraftforge.eventbus.ASMEventHandler_71_ServerEvents_onVillageTradeRegister_VillagerTradesEvent.invoke(.dynamic) ~[?:?] {}
    at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-4.0.0.jar:?] {}
    at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-4.0.0.jar:?] {}
    at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-4.0.0.jar:?] {}
    at net.minecraftforge.common.VillagerTradingManager.postVillagerEvents(VillagerTradingManager.java:92) ~[forge:?] {re:classloading}
    at net.minecraftforge.common.VillagerTradingManager.loadTrades(VillagerTradingManager.java:58) ~[forge:?] {re:classloading}
    at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:247) ~[eventbus-4.0.0.jar:?] {}
    at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:239) ~[eventbus-4.0.0.jar:?] {}
    at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-4.0.0.jar:?] {}
    at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-4.0.0.jar:?] {}
    at net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerAboutToStart(ServerLifecycleHooks.java:95) ~[forge:?] {re:mixin,re:classloading}
    at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:166) ~[?:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:621) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:betterendforge.mixins.json:MinecraftServerMixin,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:APP:upstream.mixins.json:MixinMinecraftServer,pl:mixin:APP:blame.mixins.json:MinecraftServerAccessor,pl:mixin:APP:globaldataandresourcepacks.mixins.json:MinecraftServerMixin,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:APP:charm.mixins.json:accessor.MinecraftServerAccessor,pl:mixin:A,pl:runtimedistcleaner:A}
    at net.minecraft.server.MinecraftServer.func_240783_a_(MinecraftServer.java:232) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:betterendforge.mixins.json:MinecraftServerMixin,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:APP:upstream.mixins.json:MixinMinecraftServer,pl:mixin:APP:blame.mixins.json:MinecraftServerAccessor,pl:mixin:APP:globaldataandresourcepacks.mixins.json:MinecraftServerMixin,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:APP:charm.mixins.json:accessor.MinecraftServerAccessor,pl:mixin:A,pl:runtimedistcleaner:A}
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_292] {}

I believe this is caused when adding custom trades from Castle In The Sky to villagers. From the look of it, a try catch for a null object, or just ensuring the trades list being added to isn't null, would prevent this.

SongXia-NYU commented 3 years ago

Hi SSJ3Bane, Thank you for reporting this! The list should not be null. After I looked up the problem it is probably the Arrays.asList() method in the Etched mod that causes the problem. It seems that the Etched Mod overrides the trading list inside the registerVillagerTrades method which causes other mods cannot add new trades. A better solution is creating an issue on their side and let them change Arrays.asList(listing) with new ArrayList<>(Arrays.asList(listing))

If they don't respond I will fix it on my side.

FemBane commented 3 years ago

Gotcha, the stacktrace first pointed to Castle In The Sky, figured it could have been there. I'll go let them know. Thanks!

SongXia-NYU commented 3 years ago

No worries. I will try to fix it on my side later today.

SongXia-NYU commented 3 years ago

Should fix in 0.2.6