use of icbm.classic.lib.transform.vector.Pos in project ICBM-Classic by BuiltBrokenModding.
the class PoisonContagion method performEffect.
@Override
public void performEffect(EntityLivingBase entityLiving, int amplifier) {
World world = entityLiving.world;
if (!(entityLiving instanceof EntityZombie) && !(entityLiving instanceof EntityPigZombie)) {
entityLiving.attackEntityFrom(DamageSource.MAGIC, 1);
}
if (entityLiving.world.rand.nextFloat() > 0.8) {
int r = 13;
AxisAlignedBB entitySurroundings = new AxisAlignedBB(entityLiving.posX - r, entityLiving.posY - r, entityLiving.posZ - r, entityLiving.posX + r, entityLiving.posY + r, entityLiving.posZ + r);
List<EntityLivingBase> entities = entityLiving.world.getEntitiesWithinAABB(EntityLivingBase.class, entitySurroundings);
for (EntityLivingBase entity : entities) {
if (entity != null && entity != entityLiving) {
if (entity instanceof EntityPig) {
EntityPigZombie newEntity = new EntityPigZombie(entity.world);
newEntity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);
if (!entity.world.isRemote) {
entity.world.spawnEntity(newEntity);
}
entity.setDead();
} else if (entity instanceof EntityVillager) {
if ((world.getDifficulty() == EnumDifficulty.NORMAL || world.getDifficulty() == EnumDifficulty.HARD)) {
EntityVillager entityvillager = (EntityVillager) entity;
EntityZombieVillager entityzombievillager = new EntityZombieVillager(world);
entityzombievillager.copyLocationAndAnglesFrom(entityvillager);
world.removeEntity(entityvillager);
entityzombievillager.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(entityzombievillager)), null);
entityzombievillager.setProfession(entityvillager.getProfession());
entityzombievillager.setChild(entityvillager.isChild());
entityzombievillager.setNoAI(entityvillager.isAIDisabled());
if (entityvillager.hasCustomName()) {
entityzombievillager.setCustomNameTag(entityvillager.getCustomNameTag());
entityzombievillager.setAlwaysRenderNameTag(entityvillager.getAlwaysRenderNameTag());
}
world.spawnEntity(entityzombievillager);
world.playEvent((EntityPlayer) null, 1026, new BlockPos(entity), 0);
}
entity.setDead();
}
ICBMClassic.contagios_potion.poisonEntity(new Pos(entity), entity);
}
}
}
}
use of icbm.classic.lib.transform.vector.Pos in project ICBM-Classic by BuiltBrokenModding.
the class Cube method add.
public Cube add(double x, double y, double z) {
if (isValid() && canEdit) {
pointOne = new Pos(pointOne.x() + x, pointOne.y() + y, pointOne.z() + z);
pointTwo = new Pos(pointTwo.x() + x, pointTwo.y() + y, pointTwo.z() + z);
recalc();
}
return this;
}
use of icbm.classic.lib.transform.vector.Pos in project ICBM-Classic by BuiltBrokenModding.
the class Cube method recalc.
/**
* Called after the cube's data has changed in order
* to update any internal data.
*/
protected void recalc() {
if (canEdit) {
if (pointOne != null && pointTwo != null) {
lowerPoint = new Pos(Math.min(pointOne.x(), pointTwo.x()), Math.min(pointOne.y(), pointTwo.y()), Math.min(pointOne.z(), pointTwo.z()));
higherPoint = new Pos(Math.max(pointOne.x(), pointTwo.x()), Math.max(pointOne.y(), pointTwo.y()), Math.max(pointOne.z(), pointTwo.z()));
this.center = new Pos(min().x() + (getSizeX() / 2), min().y() + (getSizeY() / 2), min().z() + (getSizeZ() / 2));
} else {
this.center = null;
}
}
}
use of icbm.classic.lib.transform.vector.Pos in project ICBM-Classic by BuiltBrokenModding.
the class Cube method getCorners.
public static IPos3D[] getCorners(Cube box) {
IPos3D[] array = new IPos3D[8];
if (box.isValid()) {
double l = box.pointTwo.x() - box.pointOne.x();
double w = box.pointTwo.z() - box.pointOne.z();
double h = box.pointTwo.y() - box.pointOne.y();
array[0] = new Pos(box.pointOne.x(), box.pointOne.y(), box.pointOne.z());
array[1] = new Pos(box.pointOne.x(), box.pointOne.y() + h, box.pointOne.z());
array[2] = new Pos(box.pointOne.x(), box.pointOne.y() + h, box.pointOne.z() + w);
array[3] = new Pos(box.pointOne.x(), box.pointOne.y(), box.pointOne.z() + w);
array[4] = new Pos(box.pointOne.x() + l, box.pointOne.y(), box.pointOne.z());
array[5] = new Pos(box.pointOne.x() + l, box.pointOne.y() + h, box.pointOne.z());
array[6] = new Pos(box.pointOne.x() + l, box.pointOne.y() + h, box.pointOne.z() + w);
array[7] = new Pos(box.pointOne.x() + l, box.pointOne.y(), box.pointOne.z() + w);
}
return array;
}
use of icbm.classic.lib.transform.vector.Pos in project ICBM-Classic by BuiltBrokenModding.
the class ClientProxy method spawnMissileSmoke.
@Override
public void spawnMissileSmoke(EntityMissile missile) {
if (missile.world.isRemote) {
if (missile.missileType == MissileFlightType.PAD_LAUNCHER) {
if (missile.motionY > -1) {
if (missile.world.isRemote && missile.motionY > -1) {
if (missile.launcherHasAirBelow == -1) {
BlockPos bp = new BlockPos(Math.signum(missile.posX) * Math.floor(Math.abs(missile.posX)), missile.posY - 2, Math.signum(missile.posZ) * Math.floor(Math.abs(missile.posZ)));
missile.launcherHasAirBelow = missile.world.isAirBlock(bp) ? 1 : 0;
}
Pos position = new Pos((IPos3D) missile);
// The distance of the smoke relative
// to the missile.
double distance = -1.2f;
// The delta Y of the smoke.
double y = Math.sin(Math.toRadians(missile.rotationPitch)) * distance;
// The horizontal distance of the
// smoke.
double dH = Math.cos(Math.toRadians(missile.rotationPitch)) * distance;
// The delta X and Z.
double x = Math.sin(Math.toRadians(missile.rotationYaw)) * dH;
double z = Math.cos(Math.toRadians(missile.rotationYaw)) * dH;
position = position.add(x, y, z);
if (// pre-launch phase
missile.preLaunchSmokeTimer > 0 && missile.ticksInAir <= missile.getMaxPreLaunchSmokeTimer()) {
Pos launcherSmokePosition = position.sub(0, 2, 0);
if (missile.launcherHasAirBelow == 1) {
Pos velocity = new Pos(0, -1, 0).addRandom(missile.world.rand, 0.5);
for (int i = 0; i < 10; i++) {
// smoke below the launcher
spawnAirParticle(missile.world, launcherSmokePosition, velocity.x(), velocity.y(), velocity.z(), 1, 1, 1, 8, 180);
launcherSmokePosition = launcherSmokePosition.multiply(1 - 0.025 * Math.random(), 1 - 0.025 * Math.random(), 1 - 0.025 * Math.random());
}
}
for (int i = 0; i < 5; i++) {
Pos velocity = new Pos(0, 0.25, 0).addRandom(missile.world.rand, 0.125);
// smoke below the launcher
spawnAirParticle(missile.world, position, velocity.x(), velocity.y(), velocity.z(), 1, 1, 1, 5, 40);
}
} else {
missile.getLastSmokePos().add(position);
Pos lastPos = null;
if (missile.getLastSmokePos().size() > 5) {
lastPos = missile.getLastSmokePos().get(0);
missile.getLastSmokePos().remove(0);
}
spawnAirParticle(missile.world, position, -missile.motionX * 0.75, -missile.motionY * 0.75, -missile.motionZ * 0.75, 1, 0.75f, 0, 5, 10);
if (missile.ticksInAir > 5 && lastPos != null) {
for (int i = 0; i < 10; i++) {
spawnAirParticle(missile.world, lastPos, -missile.motionX * 0.5, -missile.motionY * 0.5, -missile.motionZ * 0.5, 1, 1, 1, (int) Math.max(1d, 6d * (1 / (1 + missile.posY / 100))), 100);
position.multiply(1 - 0.025 * Math.random(), 1 - 0.025 * Math.random(), 1 - 0.025 * Math.random());
}
}
}
}
}
} else {
Pos position = new Pos((IPos3D) missile);
// The distance of the smoke relative
// to the missile.
double distance = -1.2f;
// The delta Y of the smoke.
double y = Math.sin(Math.toRadians(missile.rotationPitch)) * distance;
// The horizontal distance of the
// smoke.
double dH = Math.cos(Math.toRadians(missile.rotationPitch)) * distance;
// The delta X and Z.
double x = Math.sin(Math.toRadians(missile.rotationYaw)) * dH;
double z = Math.cos(Math.toRadians(missile.rotationYaw)) * dH;
position = position.add(x, y, z);
for (int i = 0; i < 10; i++) {
spawnAirParticle(missile.world, position, -missile.motionX * 0.5, -missile.motionY * 0.5, -missile.motionZ * 0.5, 1, 1, 1, (int) Math.max(1d, 6d * (1 / (1 + missile.posY / 100))), 100);
position.multiply(1 - 0.025 * Math.random(), 1 - 0.025 * Math.random(), 1 - 0.025 * Math.random());
}
}
}
}
Aggregations