use of com.minecolonies.coremod.network.messages.client.PlayAudioMessage in project minecolonies by ldtteam.
the class HordeRaidEvent method sendHordeMessage.
/**
* Sends the right horde message.
*/
protected void sendHordeMessage() {
int total = 0;
for (IColonyEvent event : colony.getEventManager().getEvents().values()) {
if (event instanceof HordeRaidEvent) {
total += ((HordeRaidEvent) event).horde.hordeSize;
}
}
raidBar.setPercent((float) horde.hordeSize / horde.initialSize);
if (total == 0) {
LanguageHandler.sendPlayersMessage(colony.getImportantMessageEntityPlayers(), LanguageHandler.translateKey(ALL_BARBARIANS_KILLED_MESSAGE), colony.getName());
PlayAudioMessage audio = new PlayAudioMessage(horde.initialSize <= SMALL_HORDE_SIZE ? RaidSounds.VICTORY_EARLY : RaidSounds.VICTORY, SoundCategory.RECORDS);
PlayAudioMessage.sendToAll(getColony(), false, true, audio);
if (colony.getRaiderManager().getLostCitizen() == 0) {
colony.getCitizenManager().updateModifier("raidwithoutdeath");
}
} else if (total > 0 && total <= SMALL_HORDE_SIZE) {
LanguageHandler.sendPlayersMessage(colony.getMessagePlayerEntities(), ONLY_X_BARBARIANS_LEFT_MESSAGE, total);
}
}
use of com.minecolonies.coremod.network.messages.client.PlayAudioMessage in project minecolonies by ldtteam.
the class EgyptianRaidEvent method onStart.
@Override
public void onStart() {
super.onStart();
PlayAudioMessage.sendToAll(getColony(), true, false, new PlayAudioMessage(RaidSounds.DESERT_RAID_WARNING));
}
use of com.minecolonies.coremod.network.messages.client.PlayAudioMessage in project minecolonies by Minecolonies.
the class HordeRaidEvent method sendHordeMessage.
/**
* Sends the right horde message.
*/
protected void sendHordeMessage() {
int total = 0;
for (IColonyEvent event : colony.getEventManager().getEvents().values()) {
if (event instanceof HordeRaidEvent) {
total += ((HordeRaidEvent) event).horde.hordeSize;
}
}
raidBar.setPercent((float) horde.hordeSize / horde.initialSize);
if (total == 0) {
MessageUtils.format(ALL_BARBARIANS_KILLED_MESSAGE, colony.getName()).sendTo(colony).forManagers();
PlayAudioMessage audio = new PlayAudioMessage(horde.initialSize <= SMALL_HORDE_SIZE ? RaidSounds.VICTORY_EARLY : RaidSounds.VICTORY, SoundCategory.RECORDS);
PlayAudioMessage.sendToAll(getColony(), false, true, audio);
if (colony.getRaiderManager().getLostCitizen() == 0) {
colony.getCitizenManager().updateModifier("raidwithoutdeath");
}
} else if (total > 0 && total <= SMALL_HORDE_SIZE) {
MessageUtils.format(ONLY_X_BARBARIANS_LEFT_MESSAGE, total).sendTo(colony).forManagers();
}
}
use of com.minecolonies.coremod.network.messages.client.PlayAudioMessage in project minecolonies by Minecolonies.
the class AmazonRaidEvent method onUpdate.
@Override
public void onUpdate() {
super.onUpdate();
if (--musicCooldown <= 0) {
PlayAudioMessage.sendToAll(getColony(), true, true, new PlayAudioMessage(RaidSounds.AMAZON_RAID));
musicCooldown = 20;
}
}
use of com.minecolonies.coremod.network.messages.client.PlayAudioMessage in project minecolonies by Minecolonies.
the class HordeRaidEvent method onStart.
@Override
public void onStart() {
if (spawnPathResult != null && spawnPathResult.isDone()) {
final Path path = spawnPathResult.getPath();
if (path != null && path.canReach()) {
spawnPoint = path.getEndNode().asBlockPos();
}
this.wayPoints = ShipBasedRaiderUtils.createWaypoints(colony.getWorld(), path, WAYPOINT_SPACING);
}
final BlockPos spawnPos = ShipBasedRaiderUtils.getLoadedPositionTowardsCenter(spawnPoint, colony, MAX_SPAWN_DEVIATION, spawnPoint, MIN_CENTER_DISTANCE, 10);
if (spawnPos == null) {
status = EventStatus.CANCELED;
return;
}
status = EventStatus.PREPARING;
spawnCampFires(spawnPos);
final double dist = colony.getCenter().distSqr(spawnPos);
if (dist < MIN_CENTER_DISTANCE * MIN_CENTER_DISTANCE) {
campFireTime = 6;
} else {
campFireTime = 3;
}
spawnHorde(spawnPos, colony, id, horde.numberOfBosses, horde.numberOfArchers, horde.numberOfRaiders);
updateRaidBar();
MessageUtils.format(RAID_EVENT_MESSAGE + horde.getMessageID(), BlockPosUtil.calcDirection(colony.getCenter(), spawnPoint), colony.getName()).sendTo(colony).forManagers();
PlayAudioMessage audio = new PlayAudioMessage(horde.initialSize <= SMALL_HORDE_SIZE ? RaidSounds.WARNING_EARLY : RaidSounds.WARNING, SoundCategory.RECORDS);
PlayAudioMessage.sendToAll(getColony(), false, false, audio);
}
Aggregations