From 0603ebf281bba1e9ae4a861b8c30c294e7ed07d1 Mon Sep 17 00:00:00 2001 From: Sollace Date: Sun, 20 Oct 2024 22:04:40 +0100 Subject: [PATCH] Fixed crash when throwing horseshoes --- .../unicopia/projectile/PhysicsBodyProjectileEntity.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/projectile/PhysicsBodyProjectileEntity.java b/src/main/java/com/minelittlepony/unicopia/projectile/PhysicsBodyProjectileEntity.java index 09a40053..8eab023a 100644 --- a/src/main/java/com/minelittlepony/unicopia/projectile/PhysicsBodyProjectileEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/projectile/PhysicsBodyProjectileEntity.java @@ -268,9 +268,11 @@ public class PhysicsBodyProjectileEntity extends PersistentProjectileEntity impl if (!isBouncy()) { if (stack.isIn(UTags.Items.HORSE_SHOES)) { - stack.damage(1 + random.nextInt(10), (ServerWorld)getWorld(), null, i -> { - playSound(USounds.Vanilla.ENTITY_ITEM_BREAK, 1, 1); - }); + if (getWorld() instanceof ServerWorld sw) { + stack.damage(1 + random.nextInt(10), sw, null, i -> { + playSound(USounds.Vanilla.ENTITY_ITEM_BREAK, 1, 1); + }); + } if (stack.isEmpty()) { discard(); return;