本文整理汇总了Java中net.minecraft.enchantment.EnchantmentProtection.func_92092_a方法的典型用法代码示例。如果您正苦于以下问题:Java EnchantmentProtection.func_92092_a方法的具体用法?Java EnchantmentProtection.func_92092_a怎么用?Java EnchantmentProtection.func_92092_a使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.enchantment.EnchantmentProtection
的用法示例。
在下文中一共展示了EnchantmentProtection.func_92092_a方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: affectDinEntities
import net.minecraft.enchantment.EnchantmentProtection; //导入方法依赖的package包/类
/**
* Affects all entities within the radius with the effects of Din's Fire
*/
private void affectDinEntities(World world, EntityPlayer player, float radius) {
List<Entity> list = world.getEntitiesWithinAABBExcludingEntity(player, player.getEntityBoundingBox().expand(radius, radius / 2F, radius));
Vec3 vec3 = new Vec3(player.posX, player.posY, player.posZ);
for (int k2 = 0; k2 < list.size(); ++k2) {
Entity entity = list.get(k2);
double d0 = entity.posX - player.posX;
double d1 = entity.posY + (double) entity.getEyeHeight() - player.posY;
double d2 = entity.posZ - player.posZ;
double d8 = (double) MathHelper.sqrt_double(d0 * d0 + d1 * d1 + d2 * d2);
if (d8 != 0.0D) {
d0 /= d8;
d1 /= d8;
d2 /= d8;
double d10 = (double) world.getBlockDensity(vec3, entity.getEntityBoundingBox());
float amount = 32.0F * (float) d10;
if (entity.isImmuneToFire()) {
amount *= 0.25F;
}
if (entity.attackEntityFrom(new DamageSourceFireIndirect("magic.din", player, player, true).setMagicDamage(), amount) && !entity.isImmuneToFire()) {
if (world.rand.nextFloat() < d10) {
entity.setFire(10);
}
}
double d11 = EnchantmentProtection.func_92092_a(entity, d10);
entity.motionX += d0 * d11;
entity.motionY += d1 * d11;
entity.motionZ += d2 * d11;
}
}
}
示例2: clipExplosionResistance
import net.minecraft.enchantment.EnchantmentProtection; //导入方法依赖的package包/类
public static double clipExplosionResistance(Entity ent, double dmg) {
double ret = EnchantmentProtection.func_92092_a(ent, dmg);
if (ret < 0) return 0;
return ret;
}
示例3: affectEntitiesWithin
import net.minecraft.enchantment.EnchantmentProtection; //导入方法依赖的package包/类
/**
* Affects all entities within the explosion, causing damage if flagged to do so
*/
protected void affectEntitiesWithin() {
float diameter = explosionSize * 2.0F;
int i1 = MathHelper.floor_double(explosionX - (double) explosionSize - 1.0D);
int j1 = MathHelper.floor_double(explosionY - (double) explosionSize - 1.0D);
int k1 = MathHelper.floor_double(explosionZ - (double) explosionSize - 1.0D);
int i2 = MathHelper.floor_double(explosionX + (double) explosionSize + 1.0D);
int j2 = MathHelper.floor_double(explosionY + (double) explosionSize + 1.0D);
int k2 = MathHelper.floor_double(explosionZ + (double) explosionSize + 1.0D);
List<Entity> list = worldObj.getEntitiesWithinAABBExcludingEntity(exploder, new AxisAlignedBB((double)i1, (double)j1, (double)k1, (double)i2, (double)j2, (double)k2));
net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(worldObj, this, list, diameter);
Vec3 vec3 = new Vec3(explosionX, explosionY, explosionZ);
for (int n = 0; n < list.size(); ++n) {
Entity entity = list.get(n);
if (entity.isImmuneToExplosions()) {
continue;
}
double d7 = (scalesWithDistance ? entity.getDistance(explosionX, explosionY, explosionZ) / (double) diameter : 0.0D);
if (d7 <= 1.0D) {
double d0 = entity.posX - explosionX;
double d1 = entity.posY + (double) entity.getEyeHeight() - explosionY;
double d2 = entity.posZ - explosionZ;
double d8 = (double) MathHelper.sqrt_double(d0 * d0 + d1 * d1 + d2 * d2);
if (d8 != 0.0D) {
d0 /= d8;
d1 /= d8;
d2 /= d8;
double d9 = (double) worldObj.getBlockDensity(vec3, entity.getEntityBoundingBox());
double d10 = (1.0D - d7) * d9;
float amount = (damage == 0.0F ? (float)((int)((d10 * d10 + d10) / 2.0D * 8.0D * diameter + 1.0D)) : damage * (float) d10);
if (entity.attackEntityFrom(getDamageSource(), amount) && isFlaming && !entity.isImmuneToFire()) {
if (!scalesWithDistance || rand.nextFloat() < d10) {
entity.setFire(burnTime);
}
}
double d11 = EnchantmentProtection.func_92092_a(entity, d10);
entity.motionX += d0 * d11 * motionFactor;
entity.motionY += d1 * d11 * motionFactor;
entity.motionZ += d2 * d11 * motionFactor;
if (entity instanceof EntityPlayer) {
playerKnockbackMap.put((EntityPlayer) entity, new Vec3(d0 * d10, d1 * d10, d2 * d10));
}
}
}
}
}