Patbox / PolyFactory

A server side tech mode with storage, crafting and utility tech™
GNU Lesser General Public License v3.0
33 stars 5 forks source link

Block breaker causes crash when PolyMc on server #8

Closed zigzag1001 closed 8 months ago

zigzag1001 commented 8 months ago

First of all, amazing project! The ability to have such amazing systems while only requiring a client resourcepack is something I never thought id see.

Anyway, here's the issue:

While trying to use the block breaker/miner, at the very end of the block break animation, the server crashes. This only happens when Polymc is present.

Here is the exception:

[02:43:11] [Server thread/ERROR]: Encountered an unexpected exception
net.minecraft.class_148: Ticking block entity
        at net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:901) ~[server-intermediary.jar:?]
        at net.minecraft.class_3176.method_3813(class_3176.java:283) ~[server-intermediary.jar:?]
        at net.minecraft.server.MinecraftServer.method_3748(MinecraftServer.java:820) ~[server-intermediary.jar:?]
        at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:667) ~[server-intermediary.jar:?]
        at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:263) ~[server-intermediary.jar:?]
        at java.lang.Thread.run(Thread.java:1623) ~[?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "io.github.theepicblock.polymc.api.PolyMap.isVanillaLikeMap()" because the return value of "io.github.theepicblock.polymc.impl.Util.tryGetPolyMap(net.minecraft.class_3222)" is null
        at io.github.theepicblock.polymc.impl.Util.isPolyMapVanillaLike(Util.java:252) ~[PolyMc-5.5.0+1.20.2.jar:?]
        at io.github.theepicblock.polymc.impl.mixin.CustomBlockBreakingCheck.needsCustomBreaking(CustomBlockBreakingCheck.java:14) ~[PolyMc-5.5.0+1.20.2.jar:?]
        at net.minecraft.class_2248.redirect$zpm000$polymc$worldEventPoly(class_2248.java:1180) ~[server-intermediary.jar:?]
        at net.minecraft.class_2248.method_33614(class_2248.java:481) ~[server-intermediary.jar:?]
        at net.minecraft.class_2248.method_9576(class_2248.java:486) ~[server-intermediary.jar:?]
        at eu.pb4.polyfactory.block.mechanical.machines.MinerBlockEntity.ticker(MinerBlockEntity.java:185) ~[polyfactory-0.2.1+1.20.2.jar:?]
        at net.minecraft.class_2818$class_5563.method_31703(class_2818.java:662) ~[server-intermediary.jar:?]
        at net.minecraft.class_2818$class_5564.method_31703(class_2818.java:716) ~[server-intermediary.jar:?]
        at net.minecraft.class_1937.method_18471(class_1937.java:470) ~[server-intermediary.jar:?]
        at net.minecraft.class_3218.method_18765(class_3218.java:390) ~[server-intermediary.jar:?]
        at net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:897) ~[server-intermediary.jar:?]
        ... 5 more
Patbox commented 8 months ago

I don't think it's fixable on my part, PolyMc needs to null-check it as likely it will break with other fake player entities (like mine, which is just extension of fapi one)