use of com.minecolonies.coremod.network.messages.client.CircleParticleEffectMessage in project minecolonies by ldtteam.
the class EntityAIWorkHealer method freeCure.
/**
* Do free cure magic.
*
* @return the next state to go to.
*/
private IAIState freeCure() {
if (currentPatient == null) {
return DECIDE;
}
final ICitizenData data = getOwnBuilding().getColony().getCitizenManager().getCivilian(currentPatient.getId());
if (data == null || !data.getEntity().isPresent() || !data.getEntity().get().getCitizenDiseaseHandler().isSick()) {
currentPatient = null;
return DECIDE;
}
final EntityCitizen citizen = (EntityCitizen) data.getEntity().get();
if (walkToBlock(citizen.blockPosition())) {
progressTicks = 0;
return FREE_CURE;
}
progressTicks++;
if (progressTicks < MAX_PROGRESS_TICKS) {
Network.getNetwork().sendToTrackingEntity(new StreamParticleEffectMessage(worker.position().add(0, 2, 0), citizen.position(), ParticleTypes.HEART, progressTicks % MAX_PROGRESS_TICKS, MAX_PROGRESS_TICKS), worker);
Network.getNetwork().sendToTrackingEntity(new CircleParticleEffectMessage(worker.position().add(0, 2, 0), ParticleTypes.HEART, progressTicks), worker);
return getState();
}
progressTicks = 0;
worker.getCitizenExperienceHandler().addExperience(BASE_XP_GAIN);
citizen.getCitizenDiseaseHandler().cure();
currentPatient.setState(Patient.PatientState.TREATED);
currentPatient = null;
return DECIDE;
}
use of com.minecolonies.coremod.network.messages.client.CircleParticleEffectMessage in project minecolonies by ldtteam.
the class EntityAIWorkHealer method wander.
/**
* Wander around in the colony from citizen to citizen.
*
* @return the next state to go to.
*/
private IAIState wander() {
if (remotePatient == null || !remotePatient.getEntity().isPresent()) {
return DECIDE;
}
final EntityCitizen citizen = (EntityCitizen) remotePatient.getEntity().get();
if (walkToBlock(remotePatient.getEntity().get().blockPosition())) {
return getState();
}
Network.getNetwork().sendToTrackingEntity(new CircleParticleEffectMessage(remotePatient.getEntity().get().position(), ParticleTypes.HEART, 1), worker);
citizen.heal(citizen.getMaxHealth() - citizen.getHealth() - 5 - getOwnBuilding().getBuildingLevel());
citizen.markDirty();
worker.getCitizenExperienceHandler().addExperience(1);
remotePatient = null;
return START_WORKING;
}
Aggregations