本文整理汇总了Java中net.minecraft.enchantment.EnchantmentProtection类的典型用法代码示例。如果您正苦于以下问题:Java EnchantmentProtection类的具体用法?Java EnchantmentProtection怎么用?Java EnchantmentProtection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EnchantmentProtection类属于net.minecraft.enchantment包,在下文中一共展示了EnchantmentProtection类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setFire
import net.minecraft.enchantment.EnchantmentProtection; //导入依赖的package包/类
/**
* Sets entity to burn for x amount of seconds, cannot lower amount of existing fire.
*/
public void setFire(int seconds)
{
int i = seconds * 20;
i = EnchantmentProtection.getFireTimeForEntity(this, i);
if (this.fire < i)
{
this.fire = i;
}
}
示例2: setFire
import net.minecraft.enchantment.EnchantmentProtection; //导入依赖的package包/类
/**
* Sets entity to burn for x amount of seconds, cannot lower amount of existing fire.
*/
public void setFire(int seconds)
{
int i = seconds * 20;
if (this instanceof EntityLivingBase)
{
i = EnchantmentProtection.getFireTimeForEntity((EntityLivingBase)this, i);
}
if (this.field_190534_ay < i)
{
this.field_190534_ay = i;
}
}
示例3: setFire
import net.minecraft.enchantment.EnchantmentProtection; //导入依赖的package包/类
/**
* Sets entity to burn for x amount of seconds, cannot lower amount of existing fire.
*/
public void setFire(int seconds)
{
int i = seconds * 20;
if (this instanceof EntityLivingBase)
{
i = EnchantmentProtection.getFireTimeForEntity((EntityLivingBase)this, i);
}
if (this.fire < i)
{
this.fire = i;
}
}
示例4: setFire
import net.minecraft.enchantment.EnchantmentProtection; //导入依赖的package包/类
/**
* Sets entity to burn for x amount of seconds, cannot lower amount of existing fire.
*/
public void setFire(int p_70015_1_)
{
int j = p_70015_1_ * 20;
j = EnchantmentProtection.getFireTimeForEntity(this, j);
if (this.fire < j)
{
this.fire = j;
}
}
示例5: setFire
import net.minecraft.enchantment.EnchantmentProtection; //导入依赖的package包/类
/**
* Sets entity to burn for x amount of seconds, cannot lower amount of existing fire.
*/
public void setFire(int par1)
{
int var2 = par1 * 20;
var2 = EnchantmentProtection.getFireTimeForEntity(this, var2);
if (this.fire < var2)
{
this.fire = var2;
}
}
示例6: setFire
import net.minecraft.enchantment.EnchantmentProtection; //导入依赖的package包/类
public void setFire(int p_70015_1_)
{
int j = p_70015_1_ * 20;
j = EnchantmentProtection.getFireTimeForEntity(this, j);
if (this.fire < j)
{
this.fire = j;
}
}
示例7: 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;
}
}
}
示例8: func_70015_d
import net.minecraft.enchantment.EnchantmentProtection; //导入依赖的package包/类
public void func_70015_d(int p_70015_1_) {
int var2 = p_70015_1_ * 20;
var2 = EnchantmentProtection.func_92093_a(this, var2);
if(this.field_70151_c < var2) {
this.field_70151_c = var2;
}
}
示例9: setFire
import net.minecraft.enchantment.EnchantmentProtection; //导入依赖的package包/类
/**
* Sets entity to burn for x amount of seconds, cannot lower amount of existing fire.
*/
public void setFire(int par1)
{
int j = par1 * 20;
j = EnchantmentProtection.getFireTimeForEntity(this, j);
if (this.fire < j)
{
this.fire = j;
}
}
示例10: doExplosionA
import net.minecraft.enchantment.EnchantmentProtection; //导入依赖的package包/类
/**
* Does the first part of the explosion (only make damage to entities)
*/
@Override
public void doExplosionA() {
float f3 = this.explosionSize * 2.0F;
int k1 = MathHelper.floor_double(this.explosionX - f3 - 1.0D);
int l1 = MathHelper.floor_double(this.explosionX + f3 + 1.0D);
int i2 = MathHelper.floor_double(this.explosionY - f3 - 1.0D);
int i1 = MathHelper.floor_double(this.explosionY + f3 + 1.0D);
int j2 = MathHelper.floor_double(this.explosionZ - f3 - 1.0D);
int j1 = MathHelper.floor_double(this.explosionZ + f3 + 1.0D);
List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder,
new AxisAlignedBB(k1, i2, j2, l1, i1, j1));
net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.worldObj, this, list, f3);
Vec3d vec3d = new Vec3d(this.explosionX, this.explosionY, this.explosionZ);
for (Entity entity : list) {
if (!entity.isImmuneToExplosions()) {
double d12 = entity.getDistance(this.explosionX, this.explosionY, this.explosionZ) / f3;
if (d12 <= 1.0D) {
double d5 = entity.posX - this.explosionX;
double d7 = entity.posY + entity.getEyeHeight() - this.explosionY;
double d9 = entity.posZ - this.explosionZ;
double d13 = MathHelper.sqrt_double(d5 * d5 + d7 * d7 + d9 * d9);
if (d13 != 0.0D) {
d5 = d5 / d13;
d7 = d7 / d13;
d9 = d9 / d13;
double d14 = this.worldObj.getBlockDensity(vec3d, entity.getEntityBoundingBox());
double d10 = (1.0D - d12) * d14;
entity.attackEntityFrom(
new EntityDamageSource("explosion", exploder).setDifficultyScaled().setExplosion(),
((int) ((d10 * d10 + d10) / 2.0D * 7.0D * f3 + 1.0D)));
double d11 = 1.0D;
if (entity instanceof EntityLivingBase) {
d11 = EnchantmentProtection.getBlastDamageReduction((EntityLivingBase) entity, d10);
}
entity.motionX += d5 * d11;
entity.motionY += d7 * d11;
entity.motionZ += d9 * d11;
if (entity instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) entity;
if (!entityplayer.isSpectator() &&
(!entityplayer.isCreative() || !entityplayer.capabilities.isFlying)) {
this.playerKnockbackMap.put(entityplayer, new Vec3d(d5 * d10, d7 * d10, d9 * d10));
}
}
}
}
}
}
}
示例11: 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;
}
示例12: 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));
}
}
}
}
}