Fix snowball throwing (#705)

This commit is contained in:
IzzelAliz 2022-09-02 16:27:15 +08:00
parent 9442c1f987
commit 6bb2d703ee
No known key found for this signature in database
GPG Key ID: EE50E123A11D8338

View File

@ -35,12 +35,12 @@ public class SnowballItemMixin extends Item {
if (!worldIn.isClientSide) {
Snowball snowballentity = new Snowball(worldIn, playerIn);
snowballentity.setItem(itemstack);
snowballentity.shootFromRotation(playerIn, playerIn.getXRot(), playerIn.getYRot(), 0.0F, 1.5F, 1.0F);
if (worldIn.addFreshEntity(snowballentity)) {
if (!playerIn.getAbilities().instabuild) {
itemstack.shrink(1);
}
worldIn.playSound(null, playerIn.getX(), playerIn.getY(), playerIn.getZ(), SoundEvents.SNOWBALL_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (worldIn.getRandom().nextFloat() * 0.4F + 0.8F));
snowballentity.shootFromRotation(playerIn, playerIn.getXRot(), playerIn.getYRot(), 0.0F, 1.5F, 1.0F);
} else if (playerIn instanceof ServerPlayer) {
((ServerPlayerEntityBridge) playerIn).bridge$getBukkitEntity().updateInventory();
}