From f6f1654a7669a8e9d377aface2ca08f7797a2e98 Mon Sep 17 00:00:00 2001 From: AViewFromTheTop <87103914+AViewFromTheTop@users.noreply.github.com> Date: Wed, 18 Oct 2023 16:07:27 -0400 Subject: [PATCH] fix potential crash with modded entity poses --- src/main/java/net/frozenblock/wilderwild/entity/Crab.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/frozenblock/wilderwild/entity/Crab.java b/src/main/java/net/frozenblock/wilderwild/entity/Crab.java index 3688cf3dc2..4105a9d63c 100644 --- a/src/main/java/net/frozenblock/wilderwild/entity/Crab.java +++ b/src/main/java/net/frozenblock/wilderwild/entity/Crab.java @@ -1,6 +1,7 @@ package net.frozenblock.wilderwild.entity; import com.mojang.serialization.Dynamic; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -645,7 +646,9 @@ public void readAdditionalSaveData(CompoundTag compound) { VibrationSystem.Data.CODEC.parse(new Dynamic<>(NbtOps.INSTANCE, compound.getCompound("listener"))).resultOrPartial(WilderSharedConstants.LOGGER::error).ifPresent(data -> this.vibrationData = data); } if (compound.contains("EntityPose")) { - this.setPose(Pose.valueOf(compound.getString("EntityPose"))); + if (Arrays.stream(Pose.values()).anyMatch(pose -> pose.name().equals(compound.getString("EntityPose")))) { + this.setPose(Pose.valueOf(compound.getString("EntityPose"))); + } } }