1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
--- a/net/minecraft/world/item/SnowballItem.java
+++ b/net/minecraft/world/item/SnowballItem.java
@@ -15,28 +16,24 @@
}
@Override
- public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) {
- ItemStack itemInHand = player.getItemInHand(hand);
- level.playSound(
- null,
- player.getX(),
- player.getY(),
- player.getZ(),
- SoundEvents.SNOWBALL_THROW,
- SoundSource.NEUTRAL,
- 0.5F,
- 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F)
- );
+ public InteractionResultHolder<ItemStack> use(Level level, Player player, EnumHand hand) {
+ ItemStack itemstack = player.getItemInHand(hand);
+
+ // CraftBukkit - moved down
+ // 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));
if (!level.isClientSide) {
Snowball snowball = new Snowball(level, player);
snowball.setItem(itemInHand);
snowball.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, 1.5F, 1.0F);
level.addFreshEntity(snowball);
}
+ // CraftBukkit end
player.awardStat(Stats.ITEM_USED.get(this));
- if (!player.getAbilities().instabuild) {
- itemInHand.shrink(1);
+ // CraftBukkit start - moved up
+ /*
+ if (!entityhuman.getAbilities().instabuild) {
+ itemstack.shrink(1);
}
return InteractionResultHolder.sidedSuccess(itemInHand, level.isClientSide());
|