From 036bb4e24ace544830726189cb43611ef0a3220d Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Wed, 25 Nov 2020 23:49:06 +0000
Subject: [PATCH] Updated Upstream (Bukkit/CraftBukkit)

Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Actually rebuild patches this time...

Bukkit Changes:
19b7b7bd #561: Add clear weather World API
5929c808 #552: Add the ability to retrieve hit, step, fall, and other sounds from blocks.

CraftBukkit Changes:
e1ebdd92 #771: Add clear weather World API
424598d2 #752: Add the ability to retrieve hit, step, fall, and other sounds from blocks.
---
 .../Implement-CraftBlockSoundGroup.patch      | 18 ++++++------
 .../Improve-death-events.patch                | 29 +------------------
 .../Optimize-CraftBlockData-Creation.patch    |  2 +-
 3 files changed, 11 insertions(+), 38 deletions(-)

diff --git a/Spigot-Server-Patches/Implement-CraftBlockSoundGroup.patch b/Spigot-Server-Patches/Implement-CraftBlockSoundGroup.patch
index 1f2a54c4bf..244c332f1e 100644
--- a/Spigot-Server-Patches/Implement-CraftBlockSoundGroup.patch
+++ b/Spigot-Server-Patches/Implement-CraftBlockSoundGroup.patch
@@ -25,27 +25,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +
 +    @Override
 +    public Sound getBreakSound() {
-+        return CraftSound.getSoundByEffect(soundEffectType.getBreakSound());
++        return CraftSound.getBukkit(soundEffectType.getBreakSound());
 +    }
 +
 +    @Override
 +    public Sound getStepSound() {
-+        return CraftSound.getSoundByEffect(soundEffectType.getStepSound());
++        return CraftSound.getBukkit(soundEffectType.getStepSound());
 +    }
 +
 +    @Override
 +    public Sound getPlaceSound() {
-+        return CraftSound.getSoundByEffect(soundEffectType.getPlaceSound());
++        return CraftSound.getBukkit(soundEffectType.getPlaceSound());
 +    }
 +
 +    @Override
 +    public Sound getHitSound() {
-+        return CraftSound.getSoundByEffect(soundEffectType.getHitSound());
++        return CraftSound.getBukkit(soundEffectType.getHitSound());
 +    }
 +
 +    @Override
 +    public Sound getFallSound() {
-+        return CraftSound.getSoundByEffect(soundEffectType.getFallSound());
++        return CraftSound.getBukkit(soundEffectType.getFallSound());
 +    }
 +}
 diff --git a/src/main/java/net/minecraft/server/SoundEffectType.java b/src/main/java/net/minecraft/server/SoundEffectType.java
@@ -56,12 +56,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
      public static final SoundEffectType U = new SoundEffectType(1.0F, 1.0F, SoundEffects.BLOCK_GILDED_BLACKSTONE_BREAK, SoundEffects.BLOCK_GILDED_BLACKSTONE_STEP, SoundEffects.BLOCK_GILDED_BLACKSTONE_PLACE, SoundEffects.BLOCK_GILDED_BLACKSTONE_HIT, SoundEffects.BLOCK_GILDED_BLACKSTONE_FALL);
      public final float V;
      public final float W;
--    private final SoundEffect X;
-+    private final SoundEffect X; public final SoundEffect getBreakSound() { return this.X; } // Paper - OBFHELPER
+-    public final SoundEffect X; // PAIL private -> public, rename breakSound
++    public final SoundEffect X; public final SoundEffect getBreakSound() { return this.X; } // Paper - OBFHELPER // PAIL private -> public, rename breakSound
      private final SoundEffect Y;
      private final SoundEffect Z;
--    private final SoundEffect aa;
-+    private final SoundEffect aa; public final SoundEffect getHitSound() { return this.aa; } // Paper - OBFHELPER
+-    public final SoundEffect aa; // PAIL private -> public, rename hitSound
++    public final SoundEffect aa; public final SoundEffect getHitSound() { return this.aa; } // Paper - OBFHELPER // PAIL private -> public, rename hitSound
      private final SoundEffect ab;
  
      public SoundEffectType(float f, float f1, SoundEffect soundeffect, SoundEffect soundeffect1, SoundEffect soundeffect2, SoundEffect soundeffect3, SoundEffect soundeffect4) {
diff --git a/Spigot-Server-Patches/Improve-death-events.patch b/Spigot-Server-Patches/Improve-death-events.patch
index 7c3760e077..ff67e01844 100644
--- a/Spigot-Server-Patches/Improve-death-events.patch
+++ b/Spigot-Server-Patches/Improve-death-events.patch
@@ -324,33 +324,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
              }
          }
      }
-diff --git a/src/main/java/org/bukkit/craftbukkit/CraftSound.java b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
-index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
---- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java
-+++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
-@@ -0,0 +0,0 @@ public enum CraftSound {
-     WEATHER_RAIN_ABOVE("weather.rain.above");
-     private final String minecraftKey;
- 
-+    // Paper start - cancellable death event
-+    public static CraftSound getBySoundEffect(final SoundEffect effect) {
-+        MinecraftKey key = IRegistry.SOUND_EVENT.getKey(effect);
-+        Preconditions.checkArgument(key != null, "Key for sound effect %s not found?", effect.toString());
-+
-+        return valueOf(key.getKey().replace('.', '_').toUpperCase(java.util.Locale.ENGLISH));
-+    }
-+
-+    public static Sound getSoundByEffect(final SoundEffect effect) {
-+        return Sound.valueOf(getBySoundEffect(effect).name());
-+    }
-+
-+    public static SoundEffect getSoundEffect(final Sound sound) {
-+        return getSoundEffect(getSound(sound));
-+    }
-+    // Paper end
-     CraftSound(String minecraftKey) {
-         this.minecraftKey = minecraftKey;
-     }
 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -419,7 +392,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +        event.setReviveHealth(event.getEntity().getAttribute(org.bukkit.attribute.Attribute.GENERIC_MAX_HEALTH).getValue());
 +        event.setShouldPlayDeathSound(!victim.silentDeath && !victim.isSilent());
 +        net.minecraft.server.SoundEffect soundEffect = victim.getDeathSoundEffect();
-+        event.setDeathSound(soundEffect != null ? org.bukkit.craftbukkit.CraftSound.getSoundByEffect(soundEffect) : null);
++        event.setDeathSound(soundEffect != null ? org.bukkit.craftbukkit.CraftSound.getBukkit(soundEffect) : null);
 +        event.setDeathSoundCategory(org.bukkit.SoundCategory.valueOf(victim.getSoundCategory().name()));
 +        event.setDeathSoundVolume(victim.getDeathSoundVolume());
 +        event.setDeathSoundPitch(victim.getSoundPitch());
diff --git a/Spigot-Server-Patches/Optimize-CraftBlockData-Creation.patch b/Spigot-Server-Patches/Optimize-CraftBlockData-Creation.patch
index d8e1cc58b6..05d6212fdc 100644
--- a/Spigot-Server-Patches/Optimize-CraftBlockData-Creation.patch
+++ b/Spigot-Server-Patches/Optimize-CraftBlockData-Creation.patch
@@ -46,4 +46,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +        // Paper end
          return MAP.getOrDefault(data.getBlock().getClass(), CraftBlockData::new).apply(data);
      }
- }
+