From 4f8b7caddb10d72008652e6dc1b84da4f3f253e0 Mon Sep 17 00:00:00 2001 From: Samsuik Date: Tue, 11 Jun 2024 13:42:37 +0100 Subject: [PATCH] Add old sounds and particle effects --- .../0003-Sakura-Configuration-Files.patch | 5 ++-- ...d-combat-sounds-and-particle-effects.patch | 27 +++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 patches/server/0076-Old-combat-sounds-and-particle-effects.patch diff --git a/patches/server/0003-Sakura-Configuration-Files.patch b/patches/server/0003-Sakura-Configuration-Files.patch index b1567cc..da7ff32 100644 --- a/patches/server/0003-Sakura-Configuration-Files.patch +++ b/patches/server/0003-Sakura-Configuration-Files.patch @@ -606,10 +606,10 @@ index 0000000000000000000000000000000000000000..a22139d6f6775b7b8d635e126d2ea2bf +} diff --git a/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java new file mode 100644 -index 0000000000000000000000000000000000000000..c52187c77d1012e8be494c5171915af4d7c202e4 +index 0000000000000000000000000000000000000000..0a165ed0fcadfcb862474c8f0094a7a4339e355a --- /dev/null +++ b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java -@@ -0,0 +1,217 @@ +@@ -0,0 +1,218 @@ +package me.samsuik.sakura.configuration; + +import com.mojang.logging.LogUtils; @@ -738,6 +738,7 @@ index 0000000000000000000000000000000000000000..c52187c77d1012e8be494c5171915af4 + public boolean allowSweepAttacks = true; + public boolean shieldDamageReduction = false; + public boolean oldEnchantedGoldenApple = false; ++ public boolean oldSoundsAndParticleEffects = false; + public boolean fastHealthRegen = true; + } + diff --git a/patches/server/0076-Old-combat-sounds-and-particle-effects.patch b/patches/server/0076-Old-combat-sounds-and-particle-effects.patch new file mode 100644 index 0000000..e2d4e27 --- /dev/null +++ b/patches/server/0076-Old-combat-sounds-and-particle-effects.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Samsuik +Date: Tue, 11 Jun 2024 13:37:51 +0100 +Subject: [PATCH] Old combat sounds and particle effects + + +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 4546df07cdf1d73fcb9c03794efc47c629842e31..a76491cf9bf598ad7e0cbb40cecbeda68c1d822f 100644 +--- a/src/main/java/net/minecraft/world/entity/player/Player.java ++++ b/src/main/java/net/minecraft/world/entity/player/Player.java +@@ -1473,7 +1473,7 @@ public abstract class Player extends LivingEntity { + // CraftBukkit end + } + +- if (this.level() instanceof ServerLevel && f5 > 2.0F) { ++ if (this.level() instanceof ServerLevel && f5 > 2.0F && !this.level().sakuraConfig().players.combat.oldSoundsAndParticleEffects) { // Sakura - old combat sounds and particles + int k = (int) ((double) f5 * 0.5D); + + ((ServerLevel) this.level()).sendParticles(ParticleTypes.DAMAGE_INDICATOR, target.getX(), target.getY(0.5D), target.getZ(), k, 0.1D, 0.0D, 0.1D, 0.2D); +@@ -1903,6 +1903,7 @@ public abstract class Player extends LivingEntity { + } + // Paper start - send while respecting visibility + private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) { ++ if (fromEntity.level().sakuraConfig().players.combat.oldSoundsAndParticleEffects) return; // Sakura - old combat sounds and particles + 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(net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.wrapAsHolder(soundEffect), soundCategory, x, y, z, volume, pitch, fromEntity.random.nextLong()));