Skip to content

Commit

Permalink
fix potential crash with modded entity poses
Browse files Browse the repository at this point in the history
  • Loading branch information
AViewFromTheTop committed Oct 18, 2023
1 parent 5665265 commit f6f1654
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/net/frozenblock/wilderwild/entity/Crab.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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")));
}
}
}

Expand Down

0 comments on commit f6f1654

Please sign in to comment.