use of party.lemons.biomemakeover.util.access.StatusEffectAccess 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);
}
}
}
}
Aggregations