catching action pack errors. Fixes #942

This commit is contained in:
gnembon committed 2021-06-22 12:57:28 -03:00
1 parent 1a068cb22a
commit 47bf776d71
1 file changed
+14 -1
@@ -1,5 +1,6 @@
package carpet.mixins;
import carpet.CarpetSettings;
import carpet.fakes.ServerPlayerEntityInterface;
import carpet.helpers.EntityPlayerActionPack;
import com.mojang.authlib.GameProfile;
@@ -35,7 +36,19 @@ public abstract class ServerPlayerEntityMixin implements ServerPlayerEntityInter
@Inject(method = "tick", at = @At(value = "HEAD"))
private void onTick(CallbackInfo ci)
{
actionPack.onUpdate();
try
{
actionPack.onUpdate();
}
catch (StackOverflowError soe)
{
CarpetSettings.LOG.fatal("Caused stack overflow when performing player action");
}
catch (Throwable exc)
{
CarpetSettings.LOG.fatal("Error executing player tasks "+ exc.getMessage());
exc.printStackTrace();
}
}