2020-05-06 11:48:49 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2019-05-28 12:53:48 +02:00
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
2021-03-16 08:19:45 +01:00
index 0000000000000000000000000000000000000000..34b3b858f616c4a1f877e6e58d315de2d8ff0720
2019-05-28 12:53:48 +02:00
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/block/CraftBlockSoundGroup.java
@@ -0,0 +1,38 @@
+package com.destroystokyo.paper.block;
+
2021-03-16 08:19:45 +01:00
+import net.minecraft.world.level.block.SoundEffectType;
2019-05-28 12:53:48 +02:00
+import org.bukkit.Sound;
+import org.bukkit.craftbukkit.CraftSound;
+
+public class CraftBlockSoundGroup implements BlockSoundGroup {
+ private final SoundEffectType soundEffectType;
+
+ public CraftBlockSoundGroup(SoundEffectType soundEffectType) {
+ this.soundEffectType = soundEffectType;
+ }
+
+ @Override
+ public Sound getBreakSound() {
2020-11-26 00:49:06 +01:00
+ return CraftSound.getBukkit(soundEffectType.getBreakSound());
2019-05-28 12:53:48 +02:00
+ }
+
+ @Override
+ public Sound getStepSound() {
2020-11-26 00:49:06 +01:00
+ return CraftSound.getBukkit(soundEffectType.getStepSound());
2019-05-28 12:53:48 +02:00
+ }
+
+ @Override
+ public Sound getPlaceSound() {
2020-11-26 00:49:06 +01:00
+ return CraftSound.getBukkit(soundEffectType.getPlaceSound());
2019-05-28 12:53:48 +02:00
+ }
+
+ @Override
+ public Sound getHitSound() {
2020-11-26 00:49:06 +01:00
+ return CraftSound.getBukkit(soundEffectType.getHitSound());
2019-05-28 12:53:48 +02:00
+ }
+
+ @Override
+ public Sound getFallSound() {
2020-11-26 00:49:06 +01:00
+ return CraftSound.getBukkit(soundEffectType.getFallSound());
2019-05-28 12:53:48 +02:00
+ }
+}
2021-03-16 08:19:45 +01:00
diff --git a/src/main/java/net/minecraft/world/level/block/SoundEffectType.java b/src/main/java/net/minecraft/world/level/block/SoundEffectType.java
index 0987b25ac586d5d7b7954256c740fdf736498dae..b2a52c6bad5a83f34188b8f3db18c61ff9f52869 100644
--- a/src/main/java/net/minecraft/world/level/block/SoundEffectType.java
+++ b/src/main/java/net/minecraft/world/level/block/SoundEffectType.java
@@ -54,10 +54,10 @@ public class SoundEffectType {
2020-06-25 16:09:55 +02:00
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);
2021-01-16 03:18:08 +01:00
public final float volume;
public final float pitch;
- public final SoundEffect breakSound;
+ public final SoundEffect breakSound; public final SoundEffect getBreakSound() { return this.breakSound; } // Paper - OBFHELPER // PAIL private -> public, rename breakSound
private final SoundEffect stepSound;
private final SoundEffect placeSound;
- public final SoundEffect hitSound;
+ public final SoundEffect hitSound; public final SoundEffect getHitSound() { return this.hitSound; } // Paper - OBFHELPER // PAIL private -> public, rename hitSound
private final SoundEffect fallSound;
2019-05-28 12:53:48 +02:00
public SoundEffectType(float f, float f1, SoundEffect soundeffect, SoundEffect soundeffect1, SoundEffect soundeffect2, SoundEffect soundeffect3, SoundEffect soundeffect4) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
2021-04-21 09:42:33 +02:00
index 8a6d8f21937ce7e2ac4623a3083421ed5ef9aa63..724b230259b1b44bc9fdde6c4fcbcdde5f690e05 100644
2019-05-28 12:53:48 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
2021-04-21 09:42:33 +02:00
@@ -750,4 +750,11 @@ public class CraftBlock implements Block {
2019-05-28 12:53:48 +02:00
AxisAlignedBB aabb = shape.getBoundingBox();
return new BoundingBox(getX() + aabb.minX, getY() + aabb.minY, getZ() + aabb.minZ, getX() + aabb.maxX, getY() + aabb.maxY, getZ() + aabb.maxZ);
}
+
+ // Paper start
+ @Override
+ public com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup() {
+ return new com.destroystokyo.paper.block.CraftBlockSoundGroup(getNMSBlock().getBlockData().getStepSound());
+ }
+ // Paper end
}