use of net.minecraft.server.v1_16_R2.EntityLiving in project Citizens2 by CitizensDev.
the class NMSImpl method setHeadYaw.
@Override
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
if (!(entity instanceof LivingEntity))
return;
EntityLiving handle = (EntityLiving) getHandle(entity);
yaw = Util.clampYaw(yaw);
handle.aO = yaw;
if (!(handle instanceof EntityHuman)) {
handle.aN = yaw;
}
handle.aP = yaw;
}
use of net.minecraft.server.v1_16_R2.EntityLiving in project Citizens2 by CitizensDev.
the class NMSImpl method setKnockbackResistance.
@Override
public void setKnockbackResistance(LivingEntity entity, double d) {
EntityLiving handle = NMSImpl.getHandle(entity);
handle.getAttributeInstance(GenericAttributes.KNOCKBACK_RESISTANCE).setValue(d);
}
use of net.minecraft.server.v1_16_R2.EntityLiving in project Citizens2 by CitizensDev.
the class NMSImpl method setVerticalMovement.
@Override
public void setVerticalMovement(org.bukkit.entity.Entity bukkitEntity, double d) {
if (!bukkitEntity.getType().isAlive())
return;
EntityLiving handle = NMSImpl.getHandle((LivingEntity) bukkitEntity);
handle.aR = (float) d;
}
use of net.minecraft.server.v1_16_R2.EntityLiving in project Citizens2 by CitizensDev.
the class NMSImpl method openHorseScreen.
@Override
public void openHorseScreen(Tameable horse, Player equipper) {
EntityLiving handle = NMSImpl.getHandle(horse);
EntityHuman equipperHandle = (EntityHuman) NMSImpl.getHandle(equipper);
if (handle == null || equipperHandle == null)
return;
boolean wasTamed = horse.isTamed();
horse.setTamed(true);
((EntityHorseAbstract) handle).f(equipperHandle);
horse.setTamed(wasTamed);
}
use of net.minecraft.server.v1_16_R2.EntityLiving in project Citizens2 by CitizensDev.
the class CitizensBlockBreaker method strengthMod.
private float strengthMod(IBlockData block) {
ItemStack itemstack = getCurrentItem();
float f = itemstack.a(block);
if (getHandle() instanceof EntityLiving) {
EntityLiving handle = (EntityLiving) getHandle();
if (f > 1.0F) {
int i = EnchantmentManager.getDigSpeedEnchantmentLevel(handle);
if (i > 0) {
f += i * i + 1;
}
}
if (handle.hasEffect(MobEffects.FASTER_DIG)) {
f *= (1.0F + (handle.getEffect(MobEffects.FASTER_DIG).getAmplifier() + 1) * 0.2F);
}
if (handle.hasEffect(MobEffects.SLOWER_DIG)) {
float f1 = 1.0F;
switch(handle.getEffect(MobEffects.SLOWER_DIG).getAmplifier()) {
case 0:
f1 = 0.3F;
break;
case 1:
f1 = 0.09F;
break;
case 2:
f1 = 0.0027F;
break;
case 3:
default:
f1 = 8.1E-4F;
}
f *= f1;
}
if (handle.a(TagsFluid.WATER) && !EnchantmentManager.h(handle)) {
f /= 5.0F;
}
}
if (!getHandle().isOnGround()) {
f /= 5.0F;
}
return f;
}
Aggregations