use of net.minecraft.util.SoundEvent in project minecolonies by Minecolonies.
the class EntityAIWorkFisherman method playNeedRodSound.
/**
* Plays a sound when the fisherman needs a rod.
*/
private void playNeedRodSound() {
if (worker != null) {
final SoundEvent needFishingRod = worker.isFemale() ? FishermanSounds.Female.needFishingRod : FishermanSounds.Male.needFishingRod;
SoundUtils.playSoundAtCitizenWithChance(world, worker.getPosition(), needFishingRod, CHANCE_TO_PLAY_SOUND);
}
}
use of net.minecraft.util.SoundEvent in project minecolonies by Minecolonies.
the class DeliverymanSounds method playSaturationSound.
/**
* Play the saturation sound depending on the saturation.
*
* @param worldIn world to play it in.
* @param position position to play it at.
* @param isFemale the gender.
* @param saturation the saturation.
*/
public void playSaturationSound(final World worldIn, final BlockPos position, final boolean isFemale, final double saturation) {
//While there are no male sounds
if (!isFemale) {
return;
}
final SoundEvent saturationFeedback;
if (saturation < EntityCitizen.LOW_SATURATION) {
saturationFeedback = Female.saturationVeryLow;
} else if (saturation < EntityCitizen.AVERAGE_SATURATION) {
saturationFeedback = Female.saturationLow;
} else {
saturationFeedback = Female.saturationHigh;
}
SoundUtils.playSoundAtCitizenWithChance(worldIn, position, saturationFeedback, getBasicSoundChance());
}
use of net.minecraft.util.SoundEvent in project minecolonies by Minecolonies.
the class FishermanSounds method playSound.
/**
* Plays fisherman sounds.
*
* @param worldIn the world to play the sound in.
* @param position the position to play the sound at.
* @param isFemale the gender.
*/
@Override
public void playSound(final World worldIn, final BlockPos position, final boolean isFemale, final double saturation) {
//Leaving it as switch-case we may add further random sound categories here (Whistling, singing, etc).
switch(rand.nextInt(NUMBER_OF_SOUNDS + 1)) {
case 1:
final SoundEvent generalPhrases = isFemale ? FishermanSounds.Female.generalPhrases : FishermanSounds.Male.generalPhrases;
SoundUtils.playSoundAtCitizenWithChance(worldIn, position, generalPhrases, getPhraseChance());
break;
case 2:
final SoundEvent noises = isFemale ? FishermanSounds.Female.noises : FishermanSounds.Male.noises;
SoundUtils.playSoundAtCitizenWithChance(worldIn, position, noises, getBasicSoundChance());
break;
default:
break;
}
}
use of net.minecraft.util.SoundEvent in project minecolonies by Minecolonies.
the class EntityAIWorkFisherman method playCaughtFishSound.
/**
* Plays a sound with a chance when a fish has been caught.
*/
private void playCaughtFishSound() {
if (worker != null) {
final SoundEvent iGotOne = worker.isFemale() ? FishermanSounds.Female.iGotOne : FishermanSounds.Male.iGotOne;
SoundUtils.playSoundAtCitizenWithChance(world, worker.getPosition(), iGotOne, CHANCE_TO_PLAY_SOUND);
}
}
use of net.minecraft.util.SoundEvent in project minecolonies by Minecolonies.
the class DeliverymanSounds method playSound.
/**
* Plays fisherman sounds.
* Suppressing Sonar Rule squid:S109
* This rule wants to prevent magic numbers
* But in this case the rule does not apply because its not a magic number its a % chance.
* For every sound category we have 1 increasing number.
*
* @param worldIn the world to play the sound in.
* @param position the position to play the sound at.
* @param isFemale the gender.
* @param saturation the saturation.
*/
@SuppressWarnings(MAGIC_NUMBERS_SHOULD_NOT_BE_USED)
@Override
public void playSound(final World worldIn, final BlockPos position, final boolean isFemale, final double saturation) {
//While there are no male sounds
if (!isFemale) {
return;
}
//Leaving it as switch-case we may add further random sound categories here (Whistling, singing, etc).
switch(rand.nextInt(NUMBER_OF_SOUNDS + 1)) {
case 1:
final SoundEvent noises = DeliverymanSounds.Female.noises;
SoundUtils.playSoundAtCitizenWithChance(worldIn, position, noises, getBasicSoundChance());
break;
case 2:
playSaturationSound(worldIn, position, isFemale, saturation);
break;
default:
final SoundEvent generalPhrases = DeliverymanSounds.Female.generalPhrases;
SoundUtils.playSoundAtCitizenWithChance(worldIn, position, generalPhrases, getPhraseChance());
break;
}
}
Aggregations