use of hellfirepvp.astralsorcery.common.util.sound.CategorizedSoundEvent in project AstralSorcery by HellFirePvP.
the class TileAltar method doCraftSound.
@OnlyIn(Dist.CLIENT)
private void doCraftSound() {
if (SoundHelper.getSoundVolume(SoundCategory.BLOCKS) > 0) {
ActiveSimpleAltarRecipe activeRecipe = this.getActiveRecipe();
AltarType type = this.getAltarType();
if (clientCraftSound == null || ((PositionedLoopSound) clientCraftSound).hasStoppedPlaying()) {
CategorizedSoundEvent sound = SoundsAS.ALTAR_CRAFT_LOOP_T1;
switch(type) {
case ATTUNEMENT:
sound = SoundsAS.ALTAR_CRAFT_LOOP_T2;
break;
case CONSTELLATION:
sound = SoundsAS.ALTAR_CRAFT_LOOP_T3;
break;
case RADIANCE:
sound = SoundsAS.ALTAR_CRAFT_LOOP_T4;
break;
}
clientCraftSound = SoundHelper.playSoundLoopFadeInClient(sound, new Vector3(this).add(0.5, 0.5, 0.5), 0.6F, 1F, false, (s) -> isRemoved() || SoundHelper.getSoundVolume(SoundCategory.BLOCKS) <= 0 || this.getActiveRecipe() == null).setFadeInTicks(40).setFadeOutTicks(20);
}
if (activeRecipe.getState() == ActiveSimpleAltarRecipe.CraftingState.WAITING && type.isThisGEThan(AltarType.RADIANCE)) {
if (clientWaitSound == null || ((PositionedLoopSound) clientWaitSound).hasStoppedPlaying()) {
clientWaitSound = SoundHelper.playSoundLoopFadeInClient(SoundsAS.ALTAR_CRAFT_LOOP_T4_WAITING, new Vector3(this).add(0.5, 0.5, 0.5), 0.7F, 1F, false, (s) -> isRemoved() || SoundHelper.getSoundVolume(SoundCategory.BLOCKS) <= 0 || this.getActiveRecipe() == null || this.getActiveRecipe().getState() != ActiveSimpleAltarRecipe.CraftingState.WAITING).setFadeInTicks(30).setFadeOutTicks(10);
}
((PositionedLoopSound) clientCraftSound).setVolumeMultiplier(0.75F);
} else {
((PositionedLoopSound) clientCraftSound).setVolumeMultiplier(1F);
}
} else {
clientWaitSound = null;
clientCraftSound = null;
}
}
use of hellfirepvp.astralsorcery.common.util.sound.CategorizedSoundEvent in project AstralSorcery by HellFirePvP.
the class TileInfuser method doCraftSound.
@OnlyIn(Dist.CLIENT)
private void doCraftSound() {
if (SoundHelper.getSoundVolume(SoundCategory.BLOCKS) > 0) {
if (clientCraftSound == null || ((PositionedLoopSound) clientCraftSound).hasStoppedPlaying()) {
CategorizedSoundEvent sound = SoundsAS.INFUSER_CRAFT_LOOP;
clientCraftSound = SoundHelper.playSoundLoopFadeInClient(sound, new Vector3(this).add(0.5, 0.5, 0.5), 1F, 1F, false, (s) -> isRemoved() || SoundHelper.getSoundVolume(SoundCategory.BLOCKS) <= 0 || this.getActiveRecipe() == null).setFadeInTicks(30).setFadeOutTicks(20);
}
} else {
clientCraftSound = null;
}
}
use of hellfirepvp.astralsorcery.common.util.sound.CategorizedSoundEvent in project AstralSorcery by HellFirePvP.
the class RegistrySounds method registerSound.
private static <T extends SoundEvent> T registerSound(String jsonName, SoundCategory predefinedCategory) {
ResourceLocation res = AstralSorcery.key(jsonName);
CategorizedSoundEvent se = new CategorizedSoundEvent(res, predefinedCategory);
se.setRegistryName(res);
return registerSound((T) se);
}
Aggregations