当前位置: 首页>>代码示例>>Java>>正文


Java EnchantmentProtection.func_92092_a方法代码示例

本文整理汇总了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;
		}
	}
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:34,代码来源:ItemSpiritCrystal.java

示例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;
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:6,代码来源:HookTargetsServer.java

示例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));
				}
			}
		}
	}
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:49,代码来源:CustomExplosion.java


注:本文中的net.minecraft.enchantment.EnchantmentProtection.func_92092_a方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。