Search in sources :

Example 11 with MobEffectInstance

use of net.minecraft.world.effect.MobEffectInstance in project Tropicraft by Tropicraft.

the class MonkeySitAndDrinkGoal method tick.

@Override
public void tick() {
    waitCounter--;
    if (waitCounter <= 0) {
        entity.startUsingItem(InteractionHand.MAIN_HAND);
    }
    // If drinking complete
    ItemStack heldStack = entity.getMainHandItem();
    if (heldStack.getItem() == TropicraftItems.BAMBOO_MUG.get()) {
        entity.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 10 * 20, 2));
    }
}
Also used : MobEffectInstance(net.minecraft.world.effect.MobEffectInstance) ItemStack(net.minecraft.world.item.ItemStack)

Example 12 with MobEffectInstance

use of net.minecraft.world.effect.MobEffectInstance in project Tropicraft by Tropicraft.

the class EntityKoaBase method monitorHomeVillage.

public void monitorHomeVillage() {
    if (villageDimension != null) {
        // if not in home dimension, full reset
        if (this.level.dimension() != villageDimension) {
            dbg("koa detected different dimension, zapping memory");
            zapMemory();
            addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 5));
        }
    // }
    }
// TODO: 1.14 re-add
// findOrCreateNewVillage();
}
Also used : MobEffectInstance(net.minecraft.world.effect.MobEffectInstance)

Example 13 with MobEffectInstance

use of net.minecraft.world.effect.MobEffectInstance in project Tropicraft by Tropicraft.

the class TropiCreeperEntity method spawnLingeringCloud.

private void spawnLingeringCloud() {
    Collection<MobEffectInstance> collection = this.getActiveEffects();
    if (!collection.isEmpty()) {
        AreaEffectCloud areaeffectcloudentity = new AreaEffectCloud(level, getX(), getY(), getZ());
        areaeffectcloudentity.setRadius(2.5F);
        areaeffectcloudentity.setRadiusOnUse(-0.5F);
        areaeffectcloudentity.setWaitTime(10);
        areaeffectcloudentity.setDuration(areaeffectcloudentity.getDuration() / 2);
        areaeffectcloudentity.setRadiusPerTick(-areaeffectcloudentity.getRadius() / (float) areaeffectcloudentity.getDuration());
        for (MobEffectInstance effectinstance : collection) {
            areaeffectcloudentity.addEffect(new MobEffectInstance(effectinstance));
        }
        this.level.addFreshEntity(areaeffectcloudentity);
    }
}
Also used : MobEffectInstance(net.minecraft.world.effect.MobEffectInstance) AreaEffectCloud(net.minecraft.world.entity.AreaEffectCloud)

Aggregations

MobEffectInstance (net.minecraft.world.effect.MobEffectInstance)13 ItemStack (net.minecraft.world.item.ItemStack)5 Keys (org.spongepowered.api.data.Keys)4 PotionEffect (org.spongepowered.api.effect.potion.PotionEffect)4 DataProviderRegistrator (org.spongepowered.common.data.provider.DataProviderRegistrator)4 Constants (org.spongepowered.common.util.Constants)3 List (java.util.List)2 Set (java.util.Set)2 CompoundTag (net.minecraft.nbt.CompoundTag)2 ListTag (net.minecraft.nbt.ListTag)2 ClientboundLevelEventPacket (net.minecraft.network.protocol.game.ClientboundLevelEventPacket)2 ClientboundPlayerAbilitiesPacket (net.minecraft.network.protocol.game.ClientboundPlayerAbilitiesPacket)2 ClientboundUpdateMobEffectPacket (net.minecraft.network.protocol.game.ClientboundUpdateMobEffectPacket)2 PlayerList (net.minecraft.server.players.PlayerList)2 Entity (net.minecraft.world.entity.Entity)2 LivingEntity (net.minecraft.world.entity.LivingEntity)2 Player (net.minecraft.world.entity.player.Player)2 Items (net.minecraft.world.item.Items)2 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1