mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Fixed crash when throwing a horseshoe, muffin, or rock at an entity. Closes #511
This commit is contained in:
parent
8ef56c4890
commit
7698de7226
1 changed files with 5 additions and 3 deletions
|
@ -163,9 +163,11 @@ public class PhysicsBodyProjectileEntity extends PersistentProjectileEntity impl
|
||||||
} else {
|
} else {
|
||||||
ItemStack stack = asItemStack();
|
ItemStack stack = asItemStack();
|
||||||
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()) {
|
||||||
dropStack(stack);
|
dropStack(stack);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue