diff options
| author | draknyte1 <draknyte1@hotmail.com> | 2016-11-04 15:23:26 +1000 |
|---|---|---|
| committer | draknyte1 <draknyte1@hotmail.com> | 2016-11-04 15:23:26 +1000 |
| commit | 0669f5eb9d5029a8b94ec552171b0837605f7747 (patch) | |
| tree | 6b40e64c04d51b7a33cf2f0b35f7232cf37c4247 /src/Java/gtPlusPlus/core/util/entity | |
| parent | 3654052fb63a571c5eaca7f20714b87c17f7e966 (diff) | |
| download | GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.tar.gz GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.tar.bz2 GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.zip | |
$ Cleaned up the entire project.
> Much neat, very nices.
Diffstat (limited to 'src/Java/gtPlusPlus/core/util/entity')
| -rw-r--r-- | src/Java/gtPlusPlus/core/util/entity/EntityUtils.java | 85 |
1 files changed, 48 insertions, 37 deletions
diff --git a/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java b/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java index be41e765d1..a571f1d76d 100644 --- a/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java +++ b/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java @@ -11,55 +11,66 @@ import net.minecraft.world.biome.BiomeGenBase; public class EntityUtils { - public static void setEntityOnFire(Entity entity, int length){ - entity.setFire(length); + public static boolean applyRadiationDamageToEntity(final int damage, final World world, + final Entity entityHolding) { + if (!world.isRemote) { + if (damage > 0 && entityHolding instanceof EntityLivingBase) { + final EntityLivingBase entityLiving = (EntityLivingBase) entityHolding; + if (!ItemArmorHazmat.hasCompleteHazmat(entityLiving)) { + int duration; + if (entityLiving.getActivePotionEffect(IC2Potion.radiation) != null) { + // Utils.LOG_INFO("t"); + duration = damage * 5 + entityLiving.getActivePotionEffect(IC2Potion.radiation).getDuration(); + } + else { + // Utils.LOG_INFO("f"); + duration = damage * 30; + } + IC2Potion.radiation.applyTo(entityLiving, duration, damage * 15); + } + } + return true; + } + return false; } - public static int getFacingDirection(Entity entity){ - int d = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360) + 0.50) & 3; - return d; + public static Block findBlockUnderEntity(final Entity parEntity) { + final int blockX = MathHelper.floor_double(parEntity.posX); + final int blockY = MathHelper.floor_double(parEntity.boundingBox.minY) - 1; + final int blockZ = MathHelper.floor_double(parEntity.posZ); + return parEntity.worldObj.getBlock(blockX, blockY, blockZ); } @Deprecated - public static Block findBlockUnderEntityNonBoundingBox(Entity parEntity){ - int blockX = MathHelper.floor_double(parEntity.posX); - int blockY = MathHelper.floor_double(parEntity.posY-0.2D - (double)parEntity.yOffset); - int blockZ = MathHelper.floor_double(parEntity.posZ); + public static Block findBlockUnderEntityNonBoundingBox(final Entity parEntity) { + final int blockX = MathHelper.floor_double(parEntity.posX); + final int blockY = MathHelper.floor_double(parEntity.posY - 0.2D - parEntity.yOffset); + final int blockZ = MathHelper.floor_double(parEntity.posZ); return parEntity.worldObj.getBlock(blockX, blockY, blockZ); } - public static Block findBlockUnderEntity(Entity parEntity){ - int blockX = MathHelper.floor_double(parEntity.posX); - int blockY = MathHelper.floor_double(parEntity.boundingBox.minY)-1; - int blockZ = MathHelper.floor_double(parEntity.posZ); - return parEntity.worldObj.getBlock(blockX, blockY, blockZ); + public static int getFacingDirection(final Entity entity) { + final int d = MathHelper.floor_double(entity.rotationYaw * 4.0F / 360 + 0.50) & 3; + return d; } - //TODO - public static void registerEntityToBiomeSpawns(Class<EntityLiving> classy, EnumCreatureType EntityType, BiomeGenBase baseBiomeGen){ - EntityRegistry.addSpawn(classy, 6, 1, 5, EntityType, baseBiomeGen); //change the values to vary the spawn rarity, biome, etc. + // TODO + public static void registerEntityToBiomeSpawns(final Class<EntityLiving> classy, final EnumCreatureType EntityType, + final BiomeGenBase baseBiomeGen) { + EntityRegistry.addSpawn(classy, 6, 1, 5, EntityType, baseBiomeGen); // change + // the + // values + // to + // vary + // the + // spawn + // rarity, + // biome, + // etc. } - public static boolean applyRadiationDamageToEntity(int damage, World world, Entity entityHolding){ - if (!world.isRemote){ - if (damage > 0 && (entityHolding instanceof EntityLivingBase)) { - EntityLivingBase entityLiving = (EntityLivingBase) entityHolding; - if (!ItemArmorHazmat.hasCompleteHazmat(entityLiving)) { - int duration; - if (entityLiving.getActivePotionEffect(IC2Potion.radiation) != null){ - //Utils.LOG_INFO("t"); - duration = (damage*5)+entityLiving.getActivePotionEffect(IC2Potion.radiation).getDuration(); - } - else { - //Utils.LOG_INFO("f"); - duration = damage*30; - } - IC2Potion.radiation.applyTo(entityLiving, duration, damage * 15); - } - } - return true; - } - return false; + public static void setEntityOnFire(final Entity entity, final int length) { + entity.setFire(length); } } |
