use of icbm.classic.lib.transform.vector.Pos in project ICBM-Classic by BuiltBrokenModding.
the class BlastNuclear method doExplode.
@Override
public boolean doExplode(int callCount) {
super.doExplode(callCount);
int r = this.callCount;
if (this.world().isRemote) {
for (int x = -r; x < r; x++) {
for (int z = -r; z < r; z++) {
double distance = MathHelper.sqrt(x * x + z * z);
if (distance < r && distance > r - 1) {
Location targetPosition = this.location.add(new Pos(x, 0, z));
if (this.world().rand.nextFloat() < Math.max(0.001 * r, 0.05)) {
// 5F, 1F);
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, targetPosition.x(), targetPosition.y(), targetPosition.z(), 0, 0, 0);
}
}
}
}
}
return false;
}
use of icbm.classic.lib.transform.vector.Pos in project ICBM-Classic by BuiltBrokenModding.
the class BlockExplosive method onBlockPlacedBy.
/**
* Called when the block is placed in the world.
*/
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entityLiving, ItemStack itemStack) {
final TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityExplosive) {
TileEntityExplosive explosive = (TileEntityExplosive) tile;
explosive.capabilityExplosive = new CapabilityExplosiveStack(itemStack.copy());
if (world.getRedstonePowerFromNeighbors(pos) > 0) {
BlockExplosive.triggerExplosive(world, pos, false);
}
// If so, then detonate.
for (EnumFacing rotation : EnumFacing.HORIZONTALS) {
Pos position = new Pos(pos).add(rotation);
Block blockId = position.getBlock(world);
if (blockId == Blocks.FIRE || blockId == Blocks.FLOWING_LAVA || blockId == Blocks.LAVA) {
BlockExplosive.triggerExplosive(world, pos, true);
break;
}
}
if (entityLiving != null) {
// TODO turn into event and logger
ICBMClassic.logger().info("ICBMClassic>>BlockExplosive#onBlockPlacedBy: " + entityLiving.getName() + " placed " + explosive.capabilityExplosive.getExplosiveData().getRegistryName() + " in: " + pos);
}
}
}
use of icbm.classic.lib.transform.vector.Pos in project ICBM-Classic by BuiltBrokenModding.
the class TileLauncherPrefab method readFromNBT.
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this._targetPos = new Pos(nbt.getCompoundTag(NBTConstants.TARGET));
}
use of icbm.classic.lib.transform.vector.Pos in project ICBM-Classic by BuiltBrokenModding.
the class TileCruiseLauncher method updateAimAngle.
protected void updateAimAngle() {
if (getTarget() != null && !getTarget().isZero()) {
Pos aimPoint = getTarget();
Pos center = new Pos((IPos3D) this).add(0.5);
aim.set(center.toEulerAngle(aimPoint).clampTo360());
aim.setYaw(EulerAngle.clampPos360(aim.yaw()));
} else {
aim.set(0, 0, 0);
}
}
Aggregations