aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0160-Send-attack-SoundEffects-only-to-players-who-can-see.patch
diff options
context:
space:
mode:
authorNassim Jahnke <[email protected]>2022-07-27 20:52:03 +0200
committerNassim Jahnke <[email protected]>2022-07-27 20:52:03 +0200
commit734a43657abfbba1cb21b29eea1d47616af6194c (patch)
tree810a7c7783504c8e4e5e158c0b64ad055d1138eb /patches/server/0160-Send-attack-SoundEffects-only-to-players-who-can-see.patch
parent86f87ba40030d719e5fb8840ab18c513588de772 (diff)
downloadPaper-734a43657abfbba1cb21b29eea1d47616af6194c.tar.gz
Paper-734a43657abfbba1cb21b29eea1d47616af6194c.zip
Move patches over, start with first few
Diffstat (limited to 'patches/server/0160-Send-attack-SoundEffects-only-to-players-who-can-see.patch')
-rw-r--r--patches/server/0160-Send-attack-SoundEffects-only-to-players-who-can-see.patch72
1 files changed, 0 insertions, 72 deletions
diff --git a/patches/server/0160-Send-attack-SoundEffects-only-to-players-who-can-see.patch b/patches/server/0160-Send-attack-SoundEffects-only-to-players-who-can-see.patch
deleted file mode 100644
index c8919be744..0000000000
--- a/patches/server/0160-Send-attack-SoundEffects-only-to-players-who-can-see.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Brokkonaut <[email protected]>
-Date: Tue, 31 Oct 2017 03:26:18 +0100
-Subject: [PATCH] Send attack SoundEffects only to players who can see the
- attacker
-
-
-diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
-index 794081610e52b7b8e04403510d1ad05f4f11d320..98d776dc6970c5412cfe54538228c6fda2b0d02e 100644
---- a/src/main/java/net/minecraft/world/entity/player/Player.java
-+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
-@@ -1245,7 +1245,7 @@ public abstract class Player extends LivingEntity {
- int i = b0 + EnchantmentHelper.getKnockbackBonus(this);
-
- if (this.isSprinting() && flag) {
-- this.level.playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F);
-+ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility
- ++i;
- flag1 = true;
- }
-@@ -1320,7 +1320,7 @@ public abstract class Player extends LivingEntity {
- }
- }
-
-- this.level.playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_SWEEP, this.getSoundSource(), 1.0F, 1.0F);
-+ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_SWEEP, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility
- this.sweepAttack();
- }
-
-@@ -1348,15 +1348,15 @@ public abstract class Player extends LivingEntity {
- }
-
- if (flag2) {
-- this.level.playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_CRIT, this.getSoundSource(), 1.0F, 1.0F);
-+ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_CRIT, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility
- this.crit(target);
- }
-
- if (!flag2 && !flag3) {
- if (flag) {
-- this.level.playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_STRONG, this.getSoundSource(), 1.0F, 1.0F);
-+ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_STRONG, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility
- } else {
-- this.level.playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_WEAK, this.getSoundSource(), 1.0F, 1.0F);
-+ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_WEAK, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility
- }
- }
-
-@@ -1408,7 +1408,7 @@ public abstract class Player extends LivingEntity {
-
- this.causeFoodExhaustion(level.spigotConfig.combatExhaustion, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent // Spigot - Change to use configurable value
- } else {
-- this.level.playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F);
-+ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility
- if (flag4) {
- target.clearFire();
- }
-@@ -1861,6 +1861,14 @@ public abstract class Player extends LivingEntity {
- public int getXpNeededForNextLevel() {
- return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
- }
-+ // Paper start - send SoundEffect to everyone who can see fromEntity
-+ private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) {
-+ fromEntity.level.playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity himself
-+ if (fromEntity instanceof ServerPlayer) {
-+ ((ServerPlayer) fromEntity).connection.send(new net.minecraft.network.protocol.game.ClientboundSoundPacket(soundEffect, soundCategory, x, y, z, volume, pitch, fromEntity.random.nextLong()));
-+ }
-+ }
-+ // Paper end
-
- // CraftBukkit start
- public void causeFoodExhaustion(float exhaustion) {