2021-06-11 14:02:28 +02:00
|
|
|
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
|
2023-09-23 04:06:03 +02:00
|
|
|
index 0000000000000000000000000000000000000000..3913c407a3bfa7dfa4a5e374a5e792962fcdafe6
|
2021-06-11 14:02:28 +02:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/block/CraftBlockSoundGroup.java
|
2022-04-30 22:44:22 +02:00
|
|
|
@@ -0,0 +1,39 @@
|
2021-06-11 14:02:28 +02:00
|
|
|
+package com.destroystokyo.paper.block;
|
|
|
|
+
|
|
|
|
+import net.minecraft.world.level.block.SoundType;
|
|
|
|
+import org.bukkit.Sound;
|
|
|
|
+import org.bukkit.craftbukkit.CraftSound;
|
|
|
|
+
|
2022-04-30 22:44:22 +02:00
|
|
|
+@Deprecated(forRemoval = true)
|
2021-06-11 14:02:28 +02:00
|
|
|
+public class CraftBlockSoundGroup implements BlockSoundGroup {
|
|
|
|
+ private final SoundType soundEffectType;
|
|
|
|
+
|
|
|
|
+ public CraftBlockSoundGroup(SoundType soundEffectType) {
|
|
|
|
+ this.soundEffectType = soundEffectType;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Sound getBreakSound() {
|
2023-09-23 04:06:03 +02:00
|
|
|
+ return CraftSound.minecraftToBukkit(soundEffectType.getBreakSound());
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Sound getStepSound() {
|
2023-09-23 04:06:03 +02:00
|
|
|
+ return CraftSound.minecraftToBukkit(soundEffectType.getStepSound());
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Sound getPlaceSound() {
|
2023-09-23 04:06:03 +02:00
|
|
|
+ return CraftSound.minecraftToBukkit(soundEffectType.getPlaceSound());
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Sound getHitSound() {
|
2023-09-23 04:06:03 +02:00
|
|
|
+ return CraftSound.minecraftToBukkit(soundEffectType.getHitSound());
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Sound getFallSound() {
|
2023-09-23 04:06:03 +02:00
|
|
|
+ return CraftSound.minecraftToBukkit(soundEffectType.getFallSound());
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
2024-01-16 19:27:39 +01:00
|
|
|
index 013298c424025cd88f15d61e50d196f70fa4c58b..d4e14ac1514e2d8b87b4667a91c90eded3ba6636 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
2023-12-05 23:21:44 +01:00
|
|
|
@@ -622,4 +622,16 @@ public class CraftBlock implements Block {
|
2023-02-15 23:10:14 +01:00
|
|
|
public String getTranslationKey() {
|
|
|
|
return this.getNMS().getBlock().getDescriptionId();
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
2021-11-24 04:42:31 +01:00
|
|
|
+
|
2021-06-11 14:02:28 +02:00
|
|
|
+ // Paper start
|
|
|
|
+ @Override
|
|
|
|
+ public com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup() {
|
2021-07-22 20:11:56 +02:00
|
|
|
+ return new com.destroystokyo.paper.block.CraftBlockSoundGroup(getNMS().getBlock().defaultBlockState().getSoundType());
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
2022-04-30 22:44:22 +02:00
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public org.bukkit.SoundGroup getBlockSoundGroup() {
|
|
|
|
+ return org.bukkit.craftbukkit.CraftSoundGroup.getSoundGroup(this.getNMS().getSoundType());
|
|
|
|
+ }
|
2021-06-11 14:02:28 +02:00
|
|
|
+ // Paper end
|
|
|
|
}
|