use of net.minecraft.entity.effect.StatusEffectInstance in project Biome-Makeover by Lemonszz.
the class WitchEntityMixin method tickMovement.
@Inject(at = @At("TAIL"), method = "tickMovement")
public void tickMovement(CallbackInfo cbi) {
if (!isDrinking()) {
if (random.nextFloat() < 0.10) {
boolean found = false;
for (StatusEffectInstance effect : getStatusEffects()) if (((StatusEffectAccess) effect.getEffectType()).bm_getType() == StatusEffectType.HARMFUL) {
found = true;
break;
}
if (found) {
this.equipStack(EquipmentSlot.MAINHAND, PotionUtil.setPotion(new ItemStack(Items.POTION), BMPotions.ANTIDOTE_POT));
this.drinkTimeLeft = this.getMainHandStack().getMaxUseTime();
this.setDrinking(true);
if (!this.isSilent()) {
this.world.playSound(null, this.getX(), this.getY(), this.getZ(), SoundEvents.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
}
EntityAttributeInstance entityAttributeInstance = this.getAttributeInstance(EntityAttributes.GENERIC_MOVEMENT_SPEED);
entityAttributeInstance.removeModifier(DRINKING_SPEED_PENALTY_MODIFIER);
entityAttributeInstance.addTemporaryModifier(DRINKING_SPEED_PENALTY_MODIFIER);
}
}
}
}
use of net.minecraft.entity.effect.StatusEffectInstance in project Biome-Makeover by Lemonszz.
the class GlowfishBucketSaveCriterion method computeFallDamage.
protected int computeFallDamage(ServerPlayerEntity playerEntity) {
StatusEffectInstance statusEffectInstance = playerEntity.getStatusEffect(StatusEffects.JUMP_BOOST);
float f = statusEffectInstance == null ? 0.0F : (float) (statusEffectInstance.getAmplifier() + 1);
return MathHelper.ceil((playerEntity.fallDistance - 3.0F - f) * 1);
}
use of net.minecraft.entity.effect.StatusEffectInstance in project Biome-Makeover by Lemonszz.
the class EnchantedTotemItem method activateTotem.
@Override
public void activateTotem(LivingEntity entity, ItemStack stack) {
if (stack != null) {
if (entity instanceof ServerPlayerEntity) {
((ServerPlayerEntity) entity).incrementStat(Stats.USED.getOrCreateStat(Items.TOTEM_OF_UNDYING));
Criteria.USED_TOTEM.trigger((ServerPlayerEntity) entity, stack);
}
entity.setHealth(entity.getMaxHealth() / 2F);
entity.clearStatusEffects();
entity.addStatusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 500, 1));
entity.addStatusEffect(new StatusEffectInstance(StatusEffects.ABSORPTION, 1200, 3));
entity.addStatusEffect(new StatusEffectInstance(StatusEffects.FIRE_RESISTANCE, 2000, 0));
entity.addStatusEffect(new StatusEffectInstance(StatusEffects.RESISTANCE, 2000, 0));
entity.world.sendEntityStatus(entity, (byte) 35);
}
}
use of net.minecraft.entity.effect.StatusEffectInstance in project friends-and-foes by Faboslav.
the class IceologerIceChunkEntity method damage.
private void damage(LivingEntity hitEntity) {
LivingEntity livingEntity = this.getOwner();
if (hitEntity.isAlive() == false || hitEntity.isInvulnerable() == true || hitEntity == livingEntity || (livingEntity != null && livingEntity.isTeammate(hitEntity))) {
return;
}
hitEntity.damage(DamageSource.MAGIC, 12.0F);
hitEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 80));
}
use of net.minecraft.entity.effect.StatusEffectInstance in project friends-and-foes by Faboslav.
the class IllusionerEntityMixin method createIllusions.
private void createIllusions() {
this.setWasAttacked(true);
this.setTicksUntilCanCreateIllusions(ILLUSION_LIFETIME_TICKS);
this.playMirrorSound();
Vec3d illusionerPosition = this.getPos();
float slice = 2.0F * (float) Math.PI / MAX_ILLUSIONS_COUNT;
int radius = 9;
int randomPoint = RandomGenerator.generateInt(0, MAX_ILLUSIONS_COUNT - 1);
for (int point = 0; point < MAX_ILLUSIONS_COUNT; ++point) {
float angle = slice * point;
int x = (int) (illusionerPosition.getX() + radius * MathHelper.cos(angle));
int y = (int) illusionerPosition.getY();
int z = (int) (illusionerPosition.getZ() + radius * MathHelper.sin(angle));
this.createIllusion(x, y, z);
if (randomPoint == point) {
boolean teleportResult = this.tryToTeleport(x, y, z);
if (teleportResult) {
this.addStatusEffect(new StatusEffectInstance(StatusEffects.INVISIBILITY, INVISIBILITY_TICKS));
this.spawnCloudParticles();
}
}
}
}
Aggregations