Search in sources :

Example 11 with CircleParticleEffectMessage

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;
}
Also used : StreamParticleEffectMessage(com.minecolonies.coremod.network.messages.client.StreamParticleEffectMessage) ICitizenData(com.minecolonies.api.colony.ICitizenData) CircleParticleEffectMessage(com.minecolonies.coremod.network.messages.client.CircleParticleEffectMessage) AbstractEntityCitizen(com.minecolonies.api.entity.citizen.AbstractEntityCitizen) EntityCitizen(com.minecolonies.coremod.entity.citizen.EntityCitizen)

Example 12 with CircleParticleEffectMessage

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;
}
Also used : CircleParticleEffectMessage(com.minecolonies.coremod.network.messages.client.CircleParticleEffectMessage) AbstractEntityCitizen(com.minecolonies.api.entity.citizen.AbstractEntityCitizen) EntityCitizen(com.minecolonies.coremod.entity.citizen.EntityCitizen)

Aggregations

CircleParticleEffectMessage (com.minecolonies.coremod.network.messages.client.CircleParticleEffectMessage)12 ItemStack (net.minecraft.item.ItemStack)8 AbstractEntityCitizen (com.minecolonies.api.entity.citizen.AbstractEntityCitizen)6 ICitizenData (com.minecolonies.api.colony.ICitizenData)4 EntityCitizen (com.minecolonies.coremod.entity.citizen.EntityCitizen)4 StreamParticleEffectMessage (com.minecolonies.coremod.network.messages.client.StreamParticleEffectMessage)4 AbstractBuilding (com.minecolonies.coremod.colony.buildings.AbstractBuilding)2 EnchanterStationsModule (com.minecolonies.coremod.colony.buildings.modules.EnchanterStationsModule)2 BuildingEnchanter (com.minecolonies.coremod.colony.buildings.workerbuildings.BuildingEnchanter)2 ArrayList (java.util.ArrayList)2 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)2 BlockPos (net.minecraft.util.math.BlockPos)2 Vector3d (net.minecraft.util.math.vector.Vector3d)2