summaryrefslogtreecommitdiffhomepage
path: root/patches/unapplied/server/0315-Implement-CraftBlockSoundGroup.patch
blob: d3f6dfe2604b0253681c59a59d7ea6bee8d1ce6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: simpleauthority <jacob@algorithmjunkie.com>
Date: Tue, 28 May 2019 03:48:51 -0700
Subject: [PATCH] Implement CraftBlockSoundGroup


diff --git a/src/main/java/com/destroystokyo/paper/block/CraftBlockSoundGroup.java b/src/main/java/com/destroystokyo/paper/block/CraftBlockSoundGroup.java
new file mode 100644
index 0000000000000000000000000000000000000000..c5b07ec346105d1b95c1c938ffca12a21642040c
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/block/CraftBlockSoundGroup.java
@@ -0,0 +1,39 @@
+package com.destroystokyo.paper.block;
+
+import net.minecraft.world.level.block.SoundType;
+import org.bukkit.Sound;
+import org.bukkit.craftbukkit.CraftSound;
+
+@Deprecated(forRemoval = true)
+public class CraftBlockSoundGroup implements BlockSoundGroup {
+    private final SoundType soundEffectType;
+
+    public CraftBlockSoundGroup(SoundType soundEffectType) {
+        this.soundEffectType = soundEffectType;
+    }
+
+    @Override
+    public Sound getBreakSound() {
+        return CraftSound.getBukkit(soundEffectType.getBreakSound());
+    }
+
+    @Override
+    public Sound getStepSound() {
+        return CraftSound.getBukkit(soundEffectType.getStepSound());
+    }
+
+    @Override
+    public Sound getPlaceSound() {
+        return CraftSound.getBukkit(soundEffectType.getPlaceSound());
+    }
+
+    @Override
+    public Sound getHitSound() {
+        return CraftSound.getBukkit(soundEffectType.getHitSound());
+    }
+
+    @Override
+    public Sound getFallSound() {
+        return CraftSound.getBukkit(soundEffectType.getFallSound());
+    }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 2f01b47b9aa669bff551a3966a5a2caf0fee0de7..97f0f5fac4e1ddf1f39981687d08adf6a5662457 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -649,4 +649,16 @@ public class CraftBlock implements Block {
     public String getTranslationKey() {
         return this.getNMS().getBlock().getDescriptionId();
     }
+
+    // Paper start
+    @Override
+    public com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup() {
+        return new com.destroystokyo.paper.block.CraftBlockSoundGroup(getNMS().getBlock().defaultBlockState().getSoundType());
+    }
+
+    @Override
+    public org.bukkit.SoundGroup getBlockSoundGroup() {
+        return org.bukkit.craftbukkit.CraftSoundGroup.getSoundGroup(this.getNMS().getSoundType());
+    }
+    // Paper end
 }