use of net.minecraft.server.v1_10_R1.EntityLiving in project Citizens2 by CitizensDev.
the class CitizensBlockBreaker method strengthMod.
private float strengthMod(Block 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(MobEffectList.FASTER_DIG)) {
f *= (1.0F + (handle.getEffect(MobEffectList.FASTER_DIG).getAmplifier() + 1) * 0.2F);
}
if (handle.hasEffect(MobEffectList.SLOWER_DIG)) {
float f1 = 1.0F;
switch(handle.getEffect(MobEffectList.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(Material.WATER) && !EnchantmentManager.j(handle)) {
f /= 5.0F;
}
}
if (!getHandle().onGround) {
f /= 5.0F;
}
return f;
}
use of net.minecraft.server.v1_10_R1.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.aJ = yaw;
if (!(handle instanceof EntityHuman))
handle.aI = yaw;
handle.aK = yaw;
}
use of net.minecraft.server.v1_10_R1.EntityLiving in project Citizens2 by CitizensDev.
the class NMSImpl method openHorseScreen.
@Override
public void openHorseScreen(Tameable horse, Player equipper) {
EntityLiving handle = NMSImpl.getHandle((LivingEntity) horse);
EntityLiving equipperHandle = NMSImpl.getHandle(equipper);
if (handle == null || equipperHandle == null)
return;
boolean wasTamed = horse.isTamed();
horse.setTamed(true);
((EntityHorse) handle).g((EntityHuman) equipperHandle);
horse.setTamed(wasTamed);
}
use of net.minecraft.server.v1_10_R1.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.c).setValue(d);
}
use of net.minecraft.server.v1_10_R1.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;
}
Aggregations