Implement CraftBlockSoundGroup

This commit is contained in:
simpleauthority 2019-05-28 03:48:51 -07:00
parent f5be267fbf
commit ab02b04a98
2 changed files with 51 additions and 0 deletions

View file

@ -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.minecraftToBukkit(soundEffectType.getBreakSound());
}
@Override
public Sound getStepSound() {
return CraftSound.minecraftToBukkit(soundEffectType.getStepSound());
}
@Override
public Sound getPlaceSound() {
return CraftSound.minecraftToBukkit(soundEffectType.getPlaceSound());
}
@Override
public Sound getHitSound() {
return CraftSound.minecraftToBukkit(soundEffectType.getHitSound());
}
@Override
public Sound getFallSound() {
return CraftSound.minecraftToBukkit(soundEffectType.getFallSound());
}
}

View file

@ -622,4 +622,16 @@ public class CraftBlock implements Block {
public String getTranslationKey() {
return this.getNMS().getBlock().getDescriptionId();
}
// 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
}