Search in sources :

Example 1 with HurtByTargetGoal

use of net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal in project Tropicraft by Tropicraft.

the class AshenEntity method registerGoals.

@Override
protected void registerGoals() {
    goalSelector.addGoal(1, new FloatGoal(this));
    goalSelector.addGoal(2, new AIAshenChaseAndPickupLostMask(this, 1.0D));
    goalSelector.addGoal(3, new AIAshenShootDart(this));
    goalSelector.addGoal(4, new RandomStrollGoal(this, 1.0D));
    goalSelector.addGoal(5, new EntityAIMeleeAndRangedAttack(this, 1.0D, 20 * 2, 20 * 10, 5F));
    goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 8.0F));
    goalSelector.addGoal(7, new RandomLookAroundGoal(this));
    targetSelector.addGoal(1, new HurtByTargetGoal(this));
    // TODO: Change predicate in last parameter below?
    targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true));
    targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, EntityKoaBase.class, true));
}
Also used : RandomLookAroundGoal(net.minecraft.world.entity.ai.goal.RandomLookAroundGoal) EntityKoaBase(net.tropicraft.core.common.entity.passive.EntityKoaBase) AIAshenShootDart(net.tropicraft.core.common.entity.ai.ashen.AIAshenShootDart) Player(net.minecraft.world.entity.player.Player) LookAtPlayerGoal(net.minecraft.world.entity.ai.goal.LookAtPlayerGoal) HurtByTargetGoal(net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal) FloatGoal(net.minecraft.world.entity.ai.goal.FloatGoal) EntityAIMeleeAndRangedAttack(net.tropicraft.core.common.entity.ai.ashen.EntityAIMeleeAndRangedAttack) AIAshenChaseAndPickupLostMask(net.tropicraft.core.common.entity.ai.ashen.AIAshenChaseAndPickupLostMask) RandomStrollGoal(net.minecraft.world.entity.ai.goal.RandomStrollGoal)

Example 2 with HurtByTargetGoal

use of net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal in project Tropicraft by Tropicraft.

the class VMonkeyEntity method registerGoals.

@Override
protected void registerGoals() {
    super.registerGoals();
    goalSelector.addGoal(1, new FloatGoal(this));
    goalSelector.addGoal(3, new MonkeyFollowNearestPinaColadaHolderGoal(this, 1.0D, 2.0F, 10.0F));
    goalSelector.addGoal(3, new LeapAtTargetGoal(this, 0.4F));
    goalSelector.addGoal(3, new MonkeyPickUpPinaColadaGoal(this));
    goalSelector.addGoal(2, new MonkeyStealDrinkGoal(this));
    goalSelector.addGoal(2, new MonkeySitAndDrinkGoal(this));
    goalSelector.addGoal(2, new MonkeyAngryThrowGoal(this));
    goalSelector.addGoal(4, new MonkeySitInChairGoal(this));
    goalSelector.addGoal(4, new SitWhenOrderedToGoal(this));
    goalSelector.addGoal(6, new MeleeAttackGoal(this, 1.0D, true));
    goalSelector.addGoal(7, new FollowOwnerGoal(this, 1.0D, 10.0F, 2.0F, false));
    goalSelector.addGoal(8, new RandomStrollGoal(this, 1.0D));
    goalSelector.addGoal(9, new LookAtPlayerGoal(this, Player.class, 8.0F));
    goalSelector.addGoal(9, new RandomLookAroundGoal(this));
    targetSelector.addGoal(1, new OwnerHurtByTargetGoal(this));
    targetSelector.addGoal(2, new OwnerHurtTargetGoal(this));
    targetSelector.addGoal(3, new HurtByTargetGoal(this));
}
Also used : Player(net.minecraft.world.entity.player.Player) MonkeySitAndDrinkGoal(net.tropicraft.core.common.entity.ai.vmonkey.MonkeySitAndDrinkGoal) OwnerHurtByTargetGoal(net.minecraft.world.entity.ai.goal.target.OwnerHurtByTargetGoal) HurtByTargetGoal(net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal) OwnerHurtByTargetGoal(net.minecraft.world.entity.ai.goal.target.OwnerHurtByTargetGoal) OwnerHurtTargetGoal(net.minecraft.world.entity.ai.goal.target.OwnerHurtTargetGoal) MonkeyFollowNearestPinaColadaHolderGoal(net.tropicraft.core.common.entity.ai.vmonkey.MonkeyFollowNearestPinaColadaHolderGoal) RandomLookAroundGoal(net.minecraft.world.entity.ai.goal.RandomLookAroundGoal) MonkeyStealDrinkGoal(net.tropicraft.core.common.entity.ai.vmonkey.MonkeyStealDrinkGoal) MonkeyPickUpPinaColadaGoal(net.tropicraft.core.common.entity.ai.vmonkey.MonkeyPickUpPinaColadaGoal) LookAtPlayerGoal(net.minecraft.world.entity.ai.goal.LookAtPlayerGoal) MonkeySitInChairGoal(net.tropicraft.core.common.entity.ai.vmonkey.MonkeySitInChairGoal) MeleeAttackGoal(net.minecraft.world.entity.ai.goal.MeleeAttackGoal) MonkeyAngryThrowGoal(net.tropicraft.core.common.entity.ai.vmonkey.MonkeyAngryThrowGoal) LeapAtTargetGoal(net.minecraft.world.entity.ai.goal.LeapAtTargetGoal) FloatGoal(net.minecraft.world.entity.ai.goal.FloatGoal) FollowOwnerGoal(net.minecraft.world.entity.ai.goal.FollowOwnerGoal) RandomStrollGoal(net.minecraft.world.entity.ai.goal.RandomStrollGoal) SitWhenOrderedToGoal(net.minecraft.world.entity.ai.goal.SitWhenOrderedToGoal)

Example 3 with HurtByTargetGoal

use of net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal in project Tropicraft by Tropicraft.

the class EntityKoaBase method updateUniqueEntityAI.

/*public void initTrades() {

        this.offers = new MerchantOffers();





        MerchantRecipeList list = new MerchantRecipeList();

        //stack count given is the base amount that will be multiplied based on value of currency traded for

        //item worth notes:
        //cooked marlin restores double that of cooked fish
        //1 leather drops, 4+ scales drop per mob

        if (getRole() == Roles.FISHERMAN) {

            addTradeForCurrencies(list, new ItemStack(Items.TROPICAL_FISH, 5));
            addTradeForCurrencies(list, new ItemStack(ItemRegistry.fishingNet, 1));
            addTradeForCurrencies(list, new ItemStack(ItemRegistry.fishingRod, 1));
            addTradeForCurrencies(list, new ItemStack(ItemRegistry.freshMarlin, 3));
            addTradeForCurrencies(list, new ItemStack(ItemRegistry.fertilizer, 5));

            //TODO: 1.14 fix
            for (int i = 0; i < EntityTropicalFish.NAMES.length; i++) {
                addTradeForCurrencies(list, new ItemStack(ItemRegistry.rawTropicalFish, 1, i));
            }
            for (int i = 0; i < ItemRiverFish.FISH_COLORS.length; i++) {
                addTradeForCurrencies(list, new ItemStack(ItemRegistry.rawRiverFish, 1, i));
            }

        } else if (getRole() == Roles.HUNTER) {

            addTradeForCurrencies(list, new ItemStack(ItemRegistry.frogLeg, 5));
            addTradeForCurrencies(list, new ItemStack(ItemRegistry.iguanaLeather, 2));
            addTradeForCurrencies(list, new ItemStack(ItemRegistry.scale, 5));

        }

        try {
            _buyingList.set(this, list);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }*/
/*public void addTradeForCurrencies(MerchantRecipeList list, ItemStack sell) {
        double pearlWhiteWorth = 1;
        double pearlBlackWorth = 1.5D;

        List<Double> listTradeCosts = new ArrayList<>();

        ItemStack stack1 = sell.copy();
        stack1.setCount((int)Math.round(sell.getCount() * pearlWhiteWorth));
        list.add(new MerchantRecipe(new ItemStack(ItemRegistry.whitePearl), stack1));

        ItemStack stack2 = sell.copy();
        stack2.setCount((int)Math.round(sell.getCount() * pearlBlackWorth));
        list.add(new MerchantRecipe(new ItemStack(ItemRegistry.blackPearl), stack2));

    }*/
public void updateUniqueEntityAI() {
    // TODO: 1.14 maybe not needed, since villagers use diff system
    /*Set<GoalSelector.EntityAITaskEntry> executingTaskEntries = ReflectionHelper.getPrivateValue(GoalSelector.class, this.goalSelector, "field_75780_b", "executingTaskEntries");
        if (executingTaskEntries != null) {
            for (GoalSelector.EntityAITaskEntry entry : this.goalSelector.taskEntries) {
                entry.action.resetTask();
            }
            executingTaskEntries.clear();
        }

        Set<GoalSelector.EntityAITaskEntry> executingTaskEntries2 = ReflectionHelper.getPrivateValue(GoalSelector.class, this.targetSelector, "field_75780_b", "executingTaskEntries");
        if (executingTaskEntries2 != null) {
            for (GoalSelector.EntityAITaskEntry entry : this.targetSelector.taskEntries) {
                entry.action.resetTask();
            }
            executingTaskEntries2.clear();
        }*/
    /*this.goalSelector.taskEntries.clear();
        this.targetSelector.taskEntries.clear();*/
    this.goalSelector.getRunningGoals().forEach(WrappedGoal::stop);
    this.targetSelector.getRunningGoals().forEach(WrappedGoal::stop);
    int curPri = 0;
    this.goalSelector.addGoal(curPri++, new FloatGoal(this));
    this.goalSelector.addGoal(curPri++, new EntityAIAvoidEntityOnLowHealth(this, LivingEntity.class, ENEMY_PREDICATE, 12.0F, 1.4D, 1.4D, 15F));
    this.goalSelector.addGoal(curPri++, new EntityAIEatToHeal(this));
    this.goalSelector.addGoal(curPri++, new TradeWithPlayerGoal(this));
    this.goalSelector.addGoal(curPri++, new MeleeAttackGoal(this, 1F, true) {

        @Override
        public void start() {
            super.start();
            if (this.mob instanceof EntityKoaBase) {
                ((EntityKoaBase) this.mob).setFightingItem();
            }
        }

        @Override
        protected double getAttackReachSqr(LivingEntity attackTarget) {
            return this.mob.getType().getDimensions().width * 2.5F * this.mob.getType().getDimensions().width * 2.5F + attackTarget.getType().getDimensions().width;
        }
    });
    this.goalSelector.addGoal(curPri++, new EntityAITemptHelmet(this, 1.0D, false, TEMPTATION_ITEMS));
    this.goalSelector.addGoal(curPri++, new MoveTowardsRestrictionGoal(this, 1D));
    this.goalSelector.addGoal(curPri++, new EntityAIKoaMate(this));
    this.goalSelector.addGoal(curPri++, new EntityAIChillAtFire(this));
    this.goalSelector.addGoal(curPri++, new EntityAIPartyTime(this));
    if (canFish()) {
        this.goalSelector.addGoal(curPri++, new EntityAIGoneFishin(this));
    }
    if (isBaby()) {
        this.goalSelector.addGoal(curPri++, new EntityAIPlayKoa(this, 1.2D));
    }
    this.goalSelector.addGoal(curPri, new LookAtPlayerGoal(this, Player.class, 3.0F, 1.0F));
    this.goalSelector.addGoal(curPri++, new EntityAIWanderNotLazy(this, 1D, 40));
    this.goalSelector.addGoal(curPri++, new LookAtPlayerGoal(this, Mob.class, 8.0F));
    this.targetSelector.addGoal(1, new HurtByTargetGoal(this));
    // i dont think this one works, change to predicate
    if (canHunt()) {
        this.targetSelector.addGoal(2, new NearestAttackableTargetGoal(this, LivingEntity.class, 10, true, false, ENEMY_PREDICATE));
    }
}
Also used : AgeableMob(net.minecraft.world.entity.AgeableMob) Mob(net.minecraft.world.entity.Mob) Player(net.minecraft.world.entity.player.Player) MoveTowardsRestrictionGoal(net.minecraft.world.entity.ai.goal.MoveTowardsRestrictionGoal) EntityAIChillAtFire(net.tropicraft.core.common.entity.ai.EntityAIChillAtFire) EntityAIKoaMate(net.tropicraft.core.common.entity.ai.EntityAIKoaMate) HurtByTargetGoal(net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal) NearestAttackableTargetGoal(net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal) WrappedGoal(net.minecraft.world.entity.ai.goal.WrappedGoal) EntityAIEatToHeal(net.tropicraft.core.common.entity.ai.EntityAIEatToHeal) LivingEntity(net.minecraft.world.entity.LivingEntity) EntityAITemptHelmet(net.tropicraft.core.common.entity.ai.EntityAITemptHelmet) EntityAIGoneFishin(net.tropicraft.core.common.entity.ai.EntityAIGoneFishin) LookAtPlayerGoal(net.minecraft.world.entity.ai.goal.LookAtPlayerGoal) EntityAIAvoidEntityOnLowHealth(net.tropicraft.core.common.entity.ai.EntityAIAvoidEntityOnLowHealth) MeleeAttackGoal(net.minecraft.world.entity.ai.goal.MeleeAttackGoal) EntityAIPartyTime(net.tropicraft.core.common.entity.ai.EntityAIPartyTime) EntityAIPlayKoa(net.tropicraft.core.common.entity.ai.EntityAIPlayKoa) TradeWithPlayerGoal(net.minecraft.world.entity.ai.goal.TradeWithPlayerGoal) EntityAIWanderNotLazy(net.tropicraft.core.common.entity.ai.EntityAIWanderNotLazy) FloatGoal(net.minecraft.world.entity.ai.goal.FloatGoal)

Example 4 with HurtByTargetGoal

use of net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal in project Tropicraft by Tropicraft.

the class TropiSkellyEntity method registerGoals.

@Override
protected void registerGoals() {
    goalSelector.addGoal(0, new FloatGoal(this));
    goalSelector.addGoal(2, new MeleeAttackGoal(this, 1.0D, false));
    goalSelector.addGoal(5, new MoveTowardsRestrictionGoal(this, 1.0D));
    goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0D));
    goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 8.0F));
    goalSelector.addGoal(8, new RandomLookAroundGoal(this));
    targetSelector.addGoal(1, new HurtByTargetGoal(this));
    targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true));
    // TODO targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, EntityAshen.class, false));
    targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, EntityKoaBase.class, false));
}
Also used : RandomLookAroundGoal(net.minecraft.world.entity.ai.goal.RandomLookAroundGoal) EntityKoaBase(net.tropicraft.core.common.entity.passive.EntityKoaBase) Player(net.minecraft.world.entity.player.Player) WaterAvoidingRandomStrollGoal(net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal) MoveTowardsRestrictionGoal(net.minecraft.world.entity.ai.goal.MoveTowardsRestrictionGoal) LookAtPlayerGoal(net.minecraft.world.entity.ai.goal.LookAtPlayerGoal) MeleeAttackGoal(net.minecraft.world.entity.ai.goal.MeleeAttackGoal) HurtByTargetGoal(net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal) FloatGoal(net.minecraft.world.entity.ai.goal.FloatGoal)

Example 5 with HurtByTargetGoal

use of net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal in project Tropicraft by Tropicraft.

the class TropiCreeperEntity method registerGoals.

@Override
protected void registerGoals() {
    this.goalSelector.addGoal(1, new FloatGoal(this));
    this.goalSelector.addGoal(2, new TropiCreeperSwellGoal(this));
    this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, Ocelot.class, 6.0F, 1.0D, 1.2D));
    this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, Cat.class, 6.0F, 1.0D, 1.2D));
    this.goalSelector.addGoal(4, new MeleeAttackGoal(this, 1.0D, false));
    this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 0.8D));
    this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 8.0F));
    this.goalSelector.addGoal(6, new RandomLookAroundGoal(this));
    this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Player.class, true));
    this.targetSelector.addGoal(2, new HurtByTargetGoal(this));
}
Also used : Ocelot(net.minecraft.world.entity.animal.Ocelot) RandomLookAroundGoal(net.minecraft.world.entity.ai.goal.RandomLookAroundGoal) Player(net.minecraft.world.entity.player.Player) WaterAvoidingRandomStrollGoal(net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal) LookAtPlayerGoal(net.minecraft.world.entity.ai.goal.LookAtPlayerGoal) MeleeAttackGoal(net.minecraft.world.entity.ai.goal.MeleeAttackGoal) Cat(net.minecraft.world.entity.animal.Cat) HurtByTargetGoal(net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal) FloatGoal(net.minecraft.world.entity.ai.goal.FloatGoal) TropiCreeperSwellGoal(net.tropicraft.core.common.entity.ai.TropiCreeperSwellGoal)

Aggregations

FloatGoal (net.minecraft.world.entity.ai.goal.FloatGoal)5 LookAtPlayerGoal (net.minecraft.world.entity.ai.goal.LookAtPlayerGoal)5 HurtByTargetGoal (net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal)5 Player (net.minecraft.world.entity.player.Player)5 MeleeAttackGoal (net.minecraft.world.entity.ai.goal.MeleeAttackGoal)4 RandomLookAroundGoal (net.minecraft.world.entity.ai.goal.RandomLookAroundGoal)4 MoveTowardsRestrictionGoal (net.minecraft.world.entity.ai.goal.MoveTowardsRestrictionGoal)2 RandomStrollGoal (net.minecraft.world.entity.ai.goal.RandomStrollGoal)2 WaterAvoidingRandomStrollGoal (net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal)2 EntityKoaBase (net.tropicraft.core.common.entity.passive.EntityKoaBase)2 AgeableMob (net.minecraft.world.entity.AgeableMob)1 LivingEntity (net.minecraft.world.entity.LivingEntity)1 Mob (net.minecraft.world.entity.Mob)1 FollowOwnerGoal (net.minecraft.world.entity.ai.goal.FollowOwnerGoal)1 LeapAtTargetGoal (net.minecraft.world.entity.ai.goal.LeapAtTargetGoal)1 SitWhenOrderedToGoal (net.minecraft.world.entity.ai.goal.SitWhenOrderedToGoal)1 TradeWithPlayerGoal (net.minecraft.world.entity.ai.goal.TradeWithPlayerGoal)1 WrappedGoal (net.minecraft.world.entity.ai.goal.WrappedGoal)1 NearestAttackableTargetGoal (net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal)1 OwnerHurtByTargetGoal (net.minecraft.world.entity.ai.goal.target.OwnerHurtByTargetGoal)1