diff options
Diffstat (limited to 'patches/server/0215-PlayerLaunchProjectileEvent.patch')
-rw-r--r-- | patches/server/0215-PlayerLaunchProjectileEvent.patch | 66 |
1 files changed, 50 insertions, 16 deletions
diff --git a/patches/server/0215-PlayerLaunchProjectileEvent.patch b/patches/server/0215-PlayerLaunchProjectileEvent.patch index 5d9bed5608..6e2265c0d2 100644 --- a/patches/server/0215-PlayerLaunchProjectileEvent.patch +++ b/patches/server/0215-PlayerLaunchProjectileEvent.patch @@ -88,15 +88,24 @@ index c7d4745aed77b23562cde7c68b8870fa239428d4..8c8cf8705107c95d9a4eab28b5845ae1 return InteractionResultHolder.sidedSuccess(itemstack, world.isClientSide()); } diff --git a/src/main/java/net/minecraft/world/item/ExperienceBottleItem.java b/src/main/java/net/minecraft/world/item/ExperienceBottleItem.java -index 72dfb7b652f515bf9df201d524a851ab56706544..39fe6734c8dcd34c563e33e717937bbd91882e1e 100644 +index fe03ef2e400b246f7f3a9333506f22b63ae28690..ad147f392e7ef151d971d462431ab67d378cc920 100644 --- a/src/main/java/net/minecraft/world/item/ExperienceBottleItem.java +++ b/src/main/java/net/minecraft/world/item/ExperienceBottleItem.java -@@ -22,18 +22,37 @@ public class ExperienceBottleItem extends Item { +@@ -22,27 +22,46 @@ public class ExperienceBottleItem extends Item { @Override public InteractionResultHolder<ItemStack> use(Level world, Player user, InteractionHand hand) { ItemStack itemStack = user.getItemInHand(hand); -- world.playSound((Player)null, user.getX(), user.getY(), user.getZ(), SoundEvents.EXPERIENCE_BOTTLE_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); -+ // world.playSound((Player)null, user.getX(), user.getY(), user.getZ(), SoundEvents.EXPERIENCE_BOTTLE_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); // Paper - PlayerLaunchProjectileEvent; moved down +- world.playSound( +- null, +- user.getX(), +- user.getY(), +- user.getZ(), +- SoundEvents.EXPERIENCE_BOTTLE_THROW, +- SoundSource.NEUTRAL, +- 0.5F, +- 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F) +- ); ++ // Paper - PlayerLaunchProjectileEvent; moved down if (!world.isClientSide) { ThrownExperienceBottle thrownExperienceBottle = new ThrownExperienceBottle(world, user); thrownExperienceBottle.setItem(itemStack); @@ -111,7 +120,16 @@ index 72dfb7b652f515bf9df201d524a851ab56706544..39fe6734c8dcd34c563e33e717937bbd + ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory(); + } + -+ world.playSound((Player) null, user.getX(), user.getY(), user.getZ(), SoundEvents.EXPERIENCE_BOTTLE_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (net.minecraft.world.entity.Entity.SHARED_RANDOM.nextFloat() * 0.4F + 0.8F)); ++ world.playSound( ++ null, ++ user.getX(), ++ user.getY(), ++ user.getZ(), ++ SoundEvents.EXPERIENCE_BOTTLE_THROW, ++ SoundSource.NEUTRAL, ++ 0.5F, ++ 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F) ++ ); + user.awardStat(Stats.ITEM_USED.get(this)); + } else { + if (user instanceof net.minecraft.server.level.ServerPlayer) { @@ -132,12 +150,12 @@ index 72dfb7b652f515bf9df201d524a851ab56706544..39fe6734c8dcd34c563e33e717937bbd return InteractionResultHolder.sidedSuccess(itemStack, world.isClientSide()); } diff --git a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java -index 6e6c9477b70b0e1ab36bca9fa91806a283ebedd1..0821c06a4c66edc8fcee09fc192335a588d2944b 100644 +index eb655eb01e4841ca163666f21dae00f0632a11e5..8a82b8bec014b70d672cfaae84510ed84fd2ea97 100644 --- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java +++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java -@@ -47,8 +47,12 @@ public class FireworkRocketItem extends Item { - Direction direction = context.getClickedFace(); - FireworkRocketEntity fireworkRocketEntity = new FireworkRocketEntity(level, context.getPlayer(), vec3.x + (double)direction.getStepX() * 0.15D, vec3.y + (double)direction.getStepY() * 0.15D, vec3.z + (double)direction.getStepZ() * 0.15D, itemStack); +@@ -54,8 +54,12 @@ public class FireworkRocketItem extends Item { + itemStack + ); fireworkRocketEntity.spawningEntity = context.getPlayer() == null ? null : context.getPlayer().getUUID(); // Paper - level.addFreshEntity(fireworkRocketEntity); - itemStack.shrink(1); @@ -151,18 +169,26 @@ index 6e6c9477b70b0e1ab36bca9fa91806a283ebedd1..0821c06a4c66edc8fcee09fc192335a5 return InteractionResult.sidedSuccess(level.isClientSide); diff --git a/src/main/java/net/minecraft/world/item/LingeringPotionItem.java b/src/main/java/net/minecraft/world/item/LingeringPotionItem.java -index 04370590e6c8051ad17f937576b4cd88f6afb5d9..8526251e45899499bc4d9b6254fa1b190a3843d8 100644 +index a822d82b577be20b5c8aa9ba1a4a0d6e4a493354..fec53407acc9bb95ae91e02a44ebc0e8d51355cf 100644 --- a/src/main/java/net/minecraft/world/item/LingeringPotionItem.java +++ b/src/main/java/net/minecraft/world/item/LingeringPotionItem.java -@@ -23,7 +23,12 @@ public class LingeringPotionItem extends ThrowablePotionItem { +@@ -23,6 +23,10 @@ public class LingeringPotionItem extends ThrowablePotionItem { @Override public InteractionResultHolder<ItemStack> use(Level world, Player user, InteractionHand hand) { + // Paper start - PlayerLaunchProjectileEvent + InteractionResultHolder<ItemStack> wrapper = super.use(world, user, hand); + if (wrapper.getResult() != net.minecraft.world.InteractionResult.FAIL) { - world.playSound((Player)null, user.getX(), user.getY(), user.getZ(), SoundEvents.LINGERING_POTION_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); ++ // Paper end - PlayerLaunchProjectileEvent + world.playSound( + null, + user.getX(), +@@ -33,6 +37,9 @@ public class LingeringPotionItem extends ThrowablePotionItem { + 0.5F, + 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F) + ); - return super.use(world, user, hand); ++ // Paper start - PlayerLaunchProjectileEvent + } + return wrapper; + // Paper end - PlayerLaunchProjectileEvent @@ -212,18 +238,26 @@ index d60e57e84f7d66e1858ab50ac33777feedf1c54d..bc8186a5bc3a98b35fad570729dd4ba5 return InteractionResultHolder.sidedSuccess(itemstack, world.isClientSide()); } diff --git a/src/main/java/net/minecraft/world/item/SplashPotionItem.java b/src/main/java/net/minecraft/world/item/SplashPotionItem.java -index 317e20052bcac9118e1adeb619bedaacc6fcd690..3bd127780091c6bb9ec17c88f0cf57b0b8f37e11 100644 +index 935c34ba7eb14348becdd3ac0c29766abf7ca614..73bac60b3bf6d20d415a8250d0426251c0c3265b 100644 --- a/src/main/java/net/minecraft/world/item/SplashPotionItem.java +++ b/src/main/java/net/minecraft/world/item/SplashPotionItem.java -@@ -14,7 +14,12 @@ public class SplashPotionItem extends ThrowablePotionItem { +@@ -14,6 +14,10 @@ public class SplashPotionItem extends ThrowablePotionItem { @Override public InteractionResultHolder<ItemStack> use(Level world, Player user, InteractionHand hand) { + // Paper start - PlayerLaunchProjectileEvent + InteractionResultHolder<ItemStack> wrapper = super.use(world, user, hand); + if (wrapper.getResult() != net.minecraft.world.InteractionResult.FAIL) { - world.playSound((Player)null, user.getX(), user.getY(), user.getZ(), SoundEvents.SPLASH_POTION_THROW, SoundSource.PLAYERS, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); ++ // Paper end - PlayerLaunchProjectileEvent + world.playSound( + null, + user.getX(), +@@ -24,6 +28,9 @@ public class SplashPotionItem extends ThrowablePotionItem { + 0.5F, + 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F) + ); - return super.use(world, user, hand); ++ // Paper start - PlayerLaunchProjectileEvent + } + return wrapper; + // Paper end - PlayerLaunchProjectileEvent @@ -267,7 +301,7 @@ index 0673f62f25532955f3552b64f122e644d42027e4..f47f793c62a919fb65c081ddb82d597a return InteractionResultHolder.sidedSuccess(itemStack, world.isClientSide()); } diff --git a/src/main/java/net/minecraft/world/item/TridentItem.java b/src/main/java/net/minecraft/world/item/TridentItem.java -index 2ccbba4775d7550c5c7277aee9cab9ff7d665693..fa876ddf54780728e7f3ecfe02aa8a16b8ef6f8d 100644 +index f46d0015d707e6708b9e19cc8f20fad5d3bd590b..a792c7b7a6179aa88fc473b27ef0ca13bd91a395 100644 --- a/src/main/java/net/minecraft/world/item/TridentItem.java +++ b/src/main/java/net/minecraft/world/item/TridentItem.java @@ -83,21 +83,26 @@ public class TridentItem extends Item implements Vanishable { |