From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: simpleauthority 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..c5b07ec346105d1b95c1c938ffca12a21642040c --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/block/CraftBlockSoundGroup.java @@ -0,0 +1,39 @@ +package com.destroystokyo.paper.block; + +import net.minecraft.world.level.block.SoundType; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.CraftSound; + +@Deprecated(forRemoval = true) +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 13da02b84d7e748d61fdf5db01d92a8d8cd5c799..2e3b675dca8cec906d533141e158e5db6ae87042 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -646,4 +646,16 @@ 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()); + } + + @Override + public org.bukkit.SoundGroup getBlockSoundGroup() { + return org.bukkit.craftbukkit.CraftSoundGroup.getSoundGroup(this.getNMS().getSoundType()); + } + // Paper end }