Search in sources :

Example 1 with TraitData

use of com.teamresourceful.resourcefulbees.api.beedata.traits.TraitData in project ResourcefulBees by Resourceful-Bees.

the class ResourcefulBee method makeStuckInBlock.

@Override
public void makeStuckInBlock(BlockState state, @NotNull Vec3 vector) {
    TraitData info = getTraitData();
    boolean isSpider = info.hasSpecialAbilities() && info.getSpecialAbilities().contains(TraitConstants.SPIDER);
    if (state.is(Blocks.COBWEB) && isSpider)
        return;
    super.makeStuckInBlock(state, vector);
}
Also used : TraitData(com.teamresourceful.resourcefulbees.api.beedata.traits.TraitData)

Example 2 with TraitData

use of com.teamresourceful.resourcefulbees.api.beedata.traits.TraitData in project ResourcefulBees by Resourceful-Bees.

the class ResourcefulBee method customServerAiStep.

@Override
protected void customServerAiStep() {
    TraitData info = getTraitData();
    if (info.hasTraits() && info.hasSpecialAbilities()) {
        info.getSpecialAbilities().forEach(ability -> {
            switch(ability) {
                case TraitConstants.TELEPORT:
                    doTeleportEffect();
                    break;
                case TraitConstants.FLAMMABLE:
                    doFlameEffect();
                    break;
                case TraitConstants.SLIMY:
                    doSlimeEffect();
                    break;
                case TraitConstants.ANGRY:
                    doAngryEffect();
                    break;
                default:
            }
        });
    }
    super.customServerAiStep();
}
Also used : TraitData(com.teamresourceful.resourcefulbees.api.beedata.traits.TraitData)

Example 3 with TraitData

use of com.teamresourceful.resourcefulbees.api.beedata.traits.TraitData in project ResourcefulBees by Resourceful-Bees.

the class BeeJar method setBeeAngry.

public static void setBeeAngry(Bee beeEntity, Player player) {
    if (beeEntity.isAngry()) {
        beeEntity.setTarget(player);
        if (beeEntity instanceof ResourcefulBee) {
            ResourcefulBee customBee = (ResourcefulBee) beeEntity;
            TraitData traitData = customBee.getTraitData();
            if (traitData.getDamageTypes().stream().anyMatch(damageType -> damageType.getType().equals(TraitConstants.EXPLOSIVE))) {
                customBee.setExplosiveCooldown(60);
            }
        }
    }
}
Also used : ResourcefulBee(com.teamresourceful.resourcefulbees.entity.passive.ResourcefulBee) TraitData(com.teamresourceful.resourcefulbees.api.beedata.traits.TraitData)

Example 4 with TraitData

use of com.teamresourceful.resourcefulbees.api.beedata.traits.TraitData in project ResourcefulBees by Resourceful-Bees.

the class ResourcefulBee method doHurtTarget.

@Override
public boolean doHurtTarget(@NotNull Entity entityIn) {
    float damage = (float) getAttributeValue(Attributes.ATTACK_DAMAGE);
    TraitData info = getTraitData();
    boolean flag = entityIn.hurt(DamageSource.sting(this), damage);
    if (flag && this.getCombatData().removeStingerOnAttack()) {
        this.doEnchantDamageEffects(this, entityIn);
        if (entityIn instanceof LivingEntity) {
            ((LivingEntity) entityIn).setStingerCount(((LivingEntity) entityIn).getStingerCount() + 1);
        }
    }
    if (entityIn instanceof LivingEntity) {
        int i = getDifficultyModifier();
        if (info.hasTraits() && info.hasDamageTypes()) {
            info.getDamageTypes().forEach(damageType -> {
                if (damageType.getType().equals(TraitConstants.SET_ON_FIRE))
                    entityIn.setSecondsOnFire(i * damageType.getAmplifier());
                if (damageType.getType().equals(TraitConstants.EXPLOSIVE))
                    this.explode(i / damageType.getAmplifier());
            });
        }
        if (i > 0 && info.hasTraits() && info.hasPotionDamageEffects()) {
            info.getPotionDamageEffects().forEach(damageEffect -> ((LivingEntity) entityIn).addEffect(new MobEffectInstance(damageEffect.getEffect(), i * 20, damageEffect.getStrength())));
        }
        if (canPoison(info))
            ((LivingEntity) entityIn).addEffect(new MobEffectInstance(MobEffects.POISON, i * 20, 0));
    }
    this.setTarget(null);
    this.setHasStung(Config.BEE_DIES_FROM_STING.get() && this.getCombatData().removeStingerOnAttack());
    this.playSound(SoundEvents.BEE_STING, 1.0F, 1.0F);
    return flag;
}
Also used : MobEffectInstance(net.minecraft.world.effect.MobEffectInstance) TraitData(com.teamresourceful.resourcefulbees.api.beedata.traits.TraitData)

Aggregations

TraitData (com.teamresourceful.resourcefulbees.api.beedata.traits.TraitData)4 ResourcefulBee (com.teamresourceful.resourcefulbees.entity.passive.ResourcefulBee)1 MobEffectInstance (net.minecraft.world.effect.MobEffectInstance)1