Fixed crash when throwing horseshoes

This commit is contained in:
Sollace 2024-10-20 22:04:40 +01:00
parent c5f33d0abd
commit 0603ebf281
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB

View file

@ -268,9 +268,11 @@ public class PhysicsBodyProjectileEntity extends PersistentProjectileEntity impl
if (!isBouncy()) { if (!isBouncy()) {
if (stack.isIn(UTags.Items.HORSE_SHOES)) { if (stack.isIn(UTags.Items.HORSE_SHOES)) {
stack.damage(1 + random.nextInt(10), (ServerWorld)getWorld(), null, i -> { if (getWorld() instanceof ServerWorld sw) {
stack.damage(1 + random.nextInt(10), sw, null, i -> {
playSound(USounds.Vanilla.ENTITY_ITEM_BREAK, 1, 1); playSound(USounds.Vanilla.ENTITY_ITEM_BREAK, 1, 1);
}); });
}
if (stack.isEmpty()) { if (stack.isEmpty()) {
discard(); discard();
return; return;