mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-25 08:38:45 +01:00
116 lines
4.7 KiB
Diff
116 lines
4.7 KiB
Diff
From 3d6591b285cbe5e769d02e69c51098ccdd2318bf 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 000000000..99f99330d
|
|
--- /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
|
|
index 9fd1b4915..21f734a73 100644
|
|
--- a/src/main/java/net/minecraft/server/IBlockData.java
|
|
+++ b/src/main/java/net/minecraft/server/IBlockData.java
|
|
@@ -271,6 +271,7 @@ public class IBlockData extends BlockDataAbstract<Block, IBlockData> implements
|
|
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
|
|
index 5460d409b..ccd5b0529 100644
|
|
--- a/src/main/java/net/minecraft/server/SoundEffectType.java
|
|
+++ b/src/main/java/net/minecraft/server/SoundEffectType.java
|
|
@@ -26,10 +26,10 @@ public class SoundEffectType {
|
|
public static final SoundEffectType v = 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);
|
|
public final float w;
|
|
public final float x;
|
|
- private final SoundEffect y;
|
|
+ private final SoundEffect y; public final SoundEffect getBreakSound() { return this.y; } // Paper - OBFHELPER
|
|
private final SoundEffect z;
|
|
private final SoundEffect A;
|
|
- private final SoundEffect B;
|
|
+ private final SoundEffect B; public final SoundEffect getHitSound() { return this.B; } // Paper - OBFHELPER
|
|
private final SoundEffect C;
|
|
|
|
public SoundEffectType(float f, float f1, SoundEffect soundeffect, SoundEffect soundeffect1, SoundEffect soundeffect2, SoundEffect soundeffect3, SoundEffect soundeffect4) {
|
|
@@ -50,14 +50,17 @@ public class SoundEffectType {
|
|
return this.x;
|
|
}
|
|
|
|
+ public final SoundEffect getStepSound() { return this.d(); } // Paper - OBFHELPER
|
|
public SoundEffect d() {
|
|
return this.z;
|
|
}
|
|
|
|
+ public final SoundEffect getPlaceSound() { return this.e(); } // Paper - OBFHELPER
|
|
public SoundEffect e() {
|
|
return this.A;
|
|
}
|
|
|
|
+ public final SoundEffect getFallSound() { return this.g(); } // Paper - OBFHELPER
|
|
public SoundEffect g() {
|
|
return this.C;
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
index 166c918d7..5296c6d9b 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
@@ -689,4 +689,11 @@ public class CraftBlock implements Block {
|
|
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
|
|
}
|
|
--
|
|
2.23.0
|
|
|