aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/item/SnowballItem.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/item/SnowballItem.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/item/SnowballItem.java.patch63
1 files changed, 63 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/item/SnowballItem.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/item/SnowballItem.java.patch
new file mode 100644
index 0000000000..07f92d46c9
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/item/SnowballItem.java.patch
@@ -0,0 +1,63 @@
+--- a/net/minecraft/world/item/SnowballItem.java
++++ b/net/minecraft/world/item/SnowballItem.java
+@@ -3,7 +3,7 @@
+ import net.minecraft.sounds.SoundEvents;
+ import net.minecraft.sounds.SoundSource;
+ import net.minecraft.stats.Stats;
+-import net.minecraft.world.InteractionHand;
++import net.minecraft.world.EnumHand;
+ import net.minecraft.world.InteractionResultHolder;
+ import net.minecraft.world.entity.player.Player;
+ import net.minecraft.world.entity.projectile.Snowball;
+@@ -11,28 +11,40 @@
+
+ public class SnowballItem extends Item {
+
+- public SnowballItem(Item.Properties item_properties) {
+- super(item_properties);
++ public SnowballItem(Item.Properties properties) {
++ super(properties);
+ }
+
+ @Override
+- @Override
+- public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand interactionhand) {
+- ItemStack itemstack = player.getItemInHand(interactionhand);
++ public InteractionResultHolder<ItemStack> use(Level level, Player player, EnumHand hand) {
++ ItemStack itemstack = player.getItemInHand(hand);
+
+- level.playSound((Player) null, player.getX(), player.getY(), player.getZ(), SoundEvents.SNOWBALL_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F));
++ // 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 entitysnowball = new Snowball(level, player);
+
+- snowball.setItem(itemstack);
+- snowball.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, 1.5F, 1.0F);
+- level.addFreshEntity(snowball);
++ entitysnowball.setItem(itemstack);
++ entitysnowball.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, 1.5F, 1.0F);
++ if (level.addFreshEntity(entitysnowball)) {
++ if (!player.getAbilities().instabuild) {
++ itemstack.shrink(1);
++ }
++
++ level.playSound((Player) null, player.getX(), player.getY(), player.getZ(), SoundEvents.SNOWBALL_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F));
++ } else if (player instanceof net.minecraft.server.level.ServerPlayer) {
++ ((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity().updateInventory();
++ }
+ }
++ // CraftBukkit end
+
+ player.awardStat(Stats.ITEM_USED.get(this));
+- if (!player.getAbilities().instabuild) {
++ // CraftBukkit start - moved up
++ /*
++ if (!entityhuman.getAbilities().instabuild) {
+ itemstack.shrink(1);
+ }
++ */
+
+ return InteractionResultHolder.sidedSuccess(itemstack, level.isClientSide());
+ }