2021-03-16 09:00:00 +11:00
|
|
|
--- a/net/minecraft/world/item/ItemSnowball.java
|
|
|
|
+++ b/net/minecraft/world/item/ItemSnowball.java
|
2025-03-26 03:05:00 +11:00
|
|
|
@@ -26,13 +26,21 @@
|
2024-10-23 02:15:00 +11:00
|
|
|
public EnumInteractionResult use(World world, EntityHuman entityhuman, EnumHand enumhand) {
|
2021-11-22 09:00:00 +11:00
|
|
|
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
2016-03-19 11:13:15 +11:00
|
|
|
|
2025-03-26 03:05:00 +11:00
|
|
|
- world.playSound((Entity) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
2024-10-23 02:15:00 +11:00
|
|
|
+ // CraftBukkit start - moved down
|
2025-03-26 03:05:00 +11:00
|
|
|
+ // world.playSound((Entity) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
2024-10-23 02:15:00 +11:00
|
|
|
if (world instanceof WorldServer worldserver) {
|
2024-12-04 03:20:00 +11:00
|
|
|
- IProjectile.spawnProjectileFromRotation(EntitySnowball::new, worldserver, itemstack, entityhuman, 0.0F, ItemSnowball.PROJECTILE_SHOOT_POWER, 1.0F);
|
|
|
|
+ if (IProjectile.spawnProjectileFromRotation(EntitySnowball::new, worldserver, itemstack, entityhuman, 0.0F, ItemSnowball.PROJECTILE_SHOOT_POWER, 1.0F).isAlive()) {
|
2024-04-24 01:15:00 +10:00
|
|
|
+ itemstack.consume(1, entityhuman);
|
2016-03-19 11:13:15 +11:00
|
|
|
+
|
2025-03-26 03:05:00 +11:00
|
|
|
+ world.playSound((Entity) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
2021-03-16 09:00:00 +11:00
|
|
|
+ } else if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) {
|
|
|
|
+ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
2016-03-19 11:13:15 +11:00
|
|
|
+ }
|
2024-10-23 02:15:00 +11:00
|
|
|
+ // CraftBukkit end
|
2016-03-19 11:13:15 +11:00
|
|
|
}
|
|
|
|
|
2021-11-22 09:00:00 +11:00
|
|
|
entityhuman.awardStat(StatisticList.ITEM_USED.get(this));
|
2024-04-24 01:15:00 +10:00
|
|
|
- itemstack.consume(1, entityhuman);
|
|
|
|
+ // itemstack.consume(1, entityhuman); // CraftBukkit - moved up
|
2024-10-23 02:15:00 +11:00
|
|
|
return EnumInteractionResult.SUCCESS;
|
2019-12-11 09:00:00 +11:00
|
|
|
}
|
2024-04-24 01:15:00 +10:00
|
|
|
|