aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0322-Implement-CraftBlockSoundGroup.patch
blob: 14bf8faccc8312caa87402f84211f127f4b5ab44 (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
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..9a516520d975f52169e346adc4ec6d9db843db2f
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/block/CraftBlockSoundGroup.java
@@ -0,0 +1,38 @@
+package com.destroystokyo.paper.block;
+
+import net.minecraft.world.level.block.SoundType;
+import org.bukkit.Sound;
+import org.bukkit.craftbukkit.CraftSound;
+
+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 ba8f9ffed49bf377be8b37532d4f2bdcb8c44d82..250185af0abcfea380cc00e670c0076f7fe87446 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -644,4 +644,11 @@ public class CraftBlock implements Block {
 
         return iblockdata.canSurvive(world, this.position);
     }
+
+    // Paper start
+    @Override
+    public com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup() {
+        return new com.destroystokyo.paper.block.CraftBlockSoundGroup(getNMS().getBlock().defaultBlockState().getSoundType());
+    }
+    // Paper end
 }