2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/item/ItemSnowball.java
|
|
|
|
+++ b/net/minecraft/world/item/ItemSnowball.java
|
|
|
|
@@ -19,19 +19,32 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
public InteractionResultWrapper<ItemStack> use(World world, EntityHuman entityhuman, EnumHand enumhand) {
|
|
|
|
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
2016-03-19 01:13:15 +01:00
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
- world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
2019-12-10 23:00:00 +01:00
|
|
|
+ // CraftBukkit - moved down
|
2021-11-21 23:00:00 +01:00
|
|
|
+ // world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
2016-03-19 01:13:15 +01:00
|
|
|
if (!world.isClientSide) {
|
|
|
|
EntitySnowball entitysnowball = new EntitySnowball(world, entityhuman);
|
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
entitysnowball.setItem(itemstack);
|
2021-11-21 23:00:00 +01:00
|
|
|
entitysnowball.shootFromRotation(entityhuman, entityhuman.getXRot(), entityhuman.getYRot(), 0.0F, 1.5F, 1.0F);
|
|
|
|
- world.addFreshEntity(entitysnowball);
|
|
|
|
+ if (world.addFreshEntity(entitysnowball)) {
|
2021-06-11 07:00:00 +02:00
|
|
|
+ if (!entityhuman.getAbilities().instabuild) {
|
2021-11-21 23:00:00 +01:00
|
|
|
+ itemstack.shrink(1);
|
2016-03-19 01:13:15 +01:00
|
|
|
+ }
|
|
|
|
+
|
2021-11-21 23:00:00 +01:00
|
|
|
+ world.playSound((EntityHuman) 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-15 23:00:00 +01:00
|
|
|
+ } else if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) {
|
|
|
|
+ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
2016-03-19 01:13:15 +01:00
|
|
|
+ }
|
|
|
|
}
|
|
|
|
+ // CraftBukkit end
|
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
entityhuman.awardStat(StatisticList.ITEM_USED.get(this));
|
2019-12-10 23:00:00 +01:00
|
|
|
+ // CraftBukkit start - moved up
|
|
|
|
+ /*
|
2021-06-11 07:00:00 +02:00
|
|
|
if (!entityhuman.getAbilities().instabuild) {
|
2021-11-21 23:00:00 +01:00
|
|
|
itemstack.shrink(1);
|
2019-12-10 23:00:00 +01:00
|
|
|
}
|
|
|
|
+ */
|
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
return InteractionResultWrapper.sidedSuccess(itemstack, world.isClientSide());
|
2019-12-10 23:00:00 +01:00
|
|
|
}
|