uecasm / colony4cc

MineColonies for ComputerCraft integration addon mod for Minecraft
GNU General Public License v3.0
7 stars 8 forks source link

ColonyPeripheral.protectPut does not protect against java.lang.NoSuchMethodError #23

Closed ParapetCloud closed 1 year ago

ParapetCloud commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

ColonyPeripheral.protectPut does not protect against java.lang.NoSuchMethodError as it does not inherit from Exception. https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/NoSuchMethodError.html

not to be confused with java.lang.NoSuchMethodException, which does, but is not thrown in this case https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/NoSuchMethodException.html

To Reproduce Steps to reproduce the behavior:

  1. Open A lua prompt in a computer
  2. Run colony.getCitizens()
  3. Game crashes

Expected behavior An error should be printed to the log

Versions:

Additional context java.lang.NoSuchMethodError: 'double com.minecolonies.api.entity.citizen.citizenhandlers.ICitizenHappinessHandler.getHappiness(com.minecolonies.api.colony.IColony, com.minecolonies.api.colony.ICitizenData)' at nz.co.mirality.colony4cc.peripheral.ColonyPeripheral.lambda$getCitizens$38(ColonyPeripheral.java:254) ~[Colony4ComputerCraft-1.19.2-2.3.3.jar%23324!/:2.3.3] {re:classloading} at nz.co.mirality.colony4cc.peripheral.ColonyPeripheral.protectPut(ColonyPeripheral.java:782) ~[Colony4ComputerCraft-1.19.2-2.3.3.jar%23324!/:2.3.3] {re:classloading} at nz.co.mirality.colony4cc.peripheral.ColonyPeripheral.getCitizens(ColonyPeripheral.java:254) ~[Colony4ComputerCraft-1.19.2-2.3.3.jar%23324!/:2.3.3] {re:classloading} at nz.co.mirality.colony4cc.peripheral.ColonyPeripheral$cc$getCitizens1.apply(CC generated method) ~[?:?] {re:classloading,re:classloading,re:classloading,re:classloading} at dan200.computercraft.core.asm.PeripheralMethod.lambda$static$0(PeripheralMethod.java:21) ~[cc-tweaked-1.19.2-1.101.2.jar%23317!/:1.101.2] {re:classloading} at dan200.computercraft.core.computer.LuaContext.lambda$issueMainThreadTask$0(LuaContext.java:32) ~[cc-tweaked-1.19.2-1.101.2.jar%23317!/:1.101.2] {re:classloading} at dan200.computercraft.core.computer.mainthread.MainThreadExecutor.execute(MainThreadExecutor.java:146) ~[cc-tweaked-1.19.2-1.101.2.jar%23317!/:1.101.2] {re:classloading} at dan200.computercraft.core.computer.mainthread.MainThread.tick(MainThread.java:144) ~[cc-tweaked-1.19.2-1.101.2.jar%23317!/:1.101.2] {re:classloading} at dan200.computercraft.shared.computer.core.ServerContext.tick(ServerContext.java:148) ~[cc-tweaked-1.19.2-1.101.2.jar%23317!/:1.101.2] {re:classloading} at dan200.computercraft.shared.CommonHooks.onServerTick(CommonHooks.java:56) ~[cc-tweaked-1.19.2-1.101.2.jar%23317!/:1.101.2] {re:classloading} at dan200.computercraft.shared.__CommonHooks_onServerTick_ServerTickEvent.invoke(.dynamic) ~[cc-tweaked-1.19.2-1.101.2.jar%23317!/:1.101.2] {re:classloading,pl:eventbus:B} at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.3.jar%2385!/:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.3.jar%2385!/:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.3.jar%2385!/:?] {} at net.minecraftforge.event.ForgeEventFactory.onPreServerTick(ForgeEventFactory.java:835) ~[forge-1.19.2-43.2.8-universal.jar%23440!/:?] {re:classloading} at net.minecraft.server.MinecraftServer.m5705(MinecraftServer.java:804) ~[client-1.19.2-20220805.130853-srg.jar%23435!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:A} at net.minecraft.client.server.IntegratedServer.m5705(IntegratedServer.java:84) ~[client-1.19.2-20220805.130853-srg.jar%23435!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.server.MinecraftServer.m130011(MinecraftServer.java:654) ~[client-1.19.2-20220805.130853-srg.jar%23435!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:A} at net.minecraft.server.MinecraftServer.m206580(MinecraftServer.java:244) ~[client-1.19.2-20220805.130853-srg.jar%23435!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:A} at java.lang.Thread.run(Thread.java:833) [?:?] {}

uecasm commented 1 year ago

Thanks for the report. It was intended for this sort of thing to also be handled; I'll look into fixing this.

However as noted in your other report, in this case you're using incompatible versions and your problem can be solved by upgrading.

MineColonies' versioning policy is such that BETA is recommended for servers, ALPHA is recommended for single-player, and RELEASE is not recommended for anyone.

uecasm commented 1 year ago

Protection has been improved in the latest releases.