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
2020-05-06 11:48:49 +02:00
index 0000000000000000000000000000000000000000..99f99330d01fc61ce8ede9f225b0c42bd8f9ded1
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;
+
+import net.minecraft.server.SoundEffectType;
+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() {
+ return CraftSound.getSoundByEffect(soundEffectType.getBreakSound());
+ }
+
+ @Override
+ public Sound getStepSound() {
+ return CraftSound.getSoundByEffect(soundEffectType.getStepSound());
+ }
+
+ @Override
+ public Sound getPlaceSound() {
+ return CraftSound.getSoundByEffect(soundEffectType.getPlaceSound());
+ }
+
+ @Override
+ public Sound getHitSound() {
+ return CraftSound.getSoundByEffect(soundEffectType.getHitSound());
+ }
+
+ @Override
+ public Sound getFallSound() {
+ return CraftSound.getSoundByEffect(soundEffectType.getFallSound());
+ }
+}
diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java
2020-04-22 17:11:50 +02:00
index cca2bf1045c1305a9defa5241909b50711b85d4c..321eae23c575528788b1b575f17593580d6ba737 100644
2019-05-28 12:53:48 +02:00
--- a/src/main/java/net/minecraft/server/IBlockData.java
+++ b/src/main/java/net/minecraft/server/IBlockData.java
2020-04-22 17:11:50 +02:00
@@ -276,6 +276,7 @@ public class IBlockData extends BlockDataAbstract<Block, IBlockData> implements
2019-05-28 12:53:48 +02:00
return this.getBlock().isTicking(this);
}
+ public final SoundEffectType getStepSound() { return this.r(); } // Paper - OBFHELPER
public SoundEffectType r() {
return this.getBlock().getStepSound(this);
}
diff --git a/src/main/java/net/minecraft/server/SoundEffectType.java b/src/main/java/net/minecraft/server/SoundEffectType.java
2020-06-07 10:51:00 +02:00
index b774d2d8d903acc1ce4c5bd9240b2e96779e1d53..adf0913a0ecc3eaf330bee303d9cc7fb4bc51dee 100644
2019-05-28 12:53:48 +02:00
--- a/src/main/java/net/minecraft/server/SoundEffectType.java
+++ b/src/main/java/net/minecraft/server/SoundEffectType.java
2019-12-12 17:20:43 +01:00
@@ -27,10 +27,10 @@ public class SoundEffectType {
public static final SoundEffectType w = new SoundEffectType(1.0F, 1.0F, SoundEffects.BLOCK_LANTERN_BREAK, SoundEffects.BLOCK_LANTERN_STEP, SoundEffects.BLOCK_LANTERN_PLACE, SoundEffects.BLOCK_LANTERN_HIT, SoundEffects.BLOCK_LANTERN_FALL);
2019-05-28 12:53:48 +02:00
public final float x;
2019-12-12 17:20:43 +01:00
public final float y;
- private final SoundEffect z;
+ private final SoundEffect z; public final SoundEffect getBreakSound() { return this.z; } // Paper - OBFHELPER
2019-05-28 12:53:48 +02:00
private final SoundEffect A;
2019-12-12 17:20:43 +01:00
private final SoundEffect B;
- private final SoundEffect C;
2020-06-07 10:51:00 +02:00
+ private final SoundEffect C; public final SoundEffect getHitSound() { return this.C; } // Paper - OBFHELPER
2019-12-12 17:20:43 +01:00
private final SoundEffect D;
2019-05-28 12:53:48 +02:00
public SoundEffectType(float f, float f1, SoundEffect soundeffect, SoundEffect soundeffect1, SoundEffect soundeffect2, SoundEffect soundeffect3, SoundEffect soundeffect4) {
2019-12-12 17:20:43 +01:00
@@ -51,14 +51,17 @@ public class SoundEffectType {
return this.y;
2019-05-28 12:53:48 +02:00
}
+ public final SoundEffect getStepSound() { return this.d(); } // Paper - OBFHELPER
public SoundEffect d() {
2019-12-12 17:20:43 +01:00
return this.A;
2019-05-28 12:53:48 +02:00
}
+ public final SoundEffect getPlaceSound() { return this.e(); } // Paper - OBFHELPER
public SoundEffect e() {
2019-12-12 17:20:43 +01:00
return this.B;
2019-05-28 12:53:48 +02:00
}
+ public final SoundEffect getFallSound() { return this.g(); } // Paper - OBFHELPER
public SoundEffect g() {
2019-12-12 17:20:43 +01:00
return this.D;
2019-05-28 12:53:48 +02:00
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
2020-05-12 07:27:03 +02:00
index 30b7c9038d3a95b80304e052a5d629b461f76e99..1fc7f55fcaa1f9aaa4c675f9fcd508ffb80e9629 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
2020-05-12 07:27:03 +02:00
@@ -704,4 +704,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
}