mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-31 00:20:44 +01:00
Implement CraftBlockSoundGroup
This commit is contained in:
parent
f5be267fbf
commit
ab02b04a98
2 changed files with 51 additions and 0 deletions
|
@ -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());
|
||||||
|
}
|
||||||
|
}
|
|
@ -622,4 +622,16 @@ public class CraftBlock implements Block {
|
||||||
public String getTranslationKey() {
|
public String getTranslationKey() {
|
||||||
return this.getNMS().getBlock().getDescriptionId();
|
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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue