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);
}
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();
}
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);
}
}
}
}
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;
}
Aggregations