Search in sources :

Example 36 with Pos

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;
}
Also used : Pos(icbm.classic.lib.transform.vector.Pos) BlockPos(net.minecraft.util.math.BlockPos) Location(icbm.classic.lib.transform.vector.Location)

Example 37 with Pos

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);
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) Pos(icbm.classic.lib.transform.vector.Pos) BlockPos(net.minecraft.util.math.BlockPos) CapabilityExplosiveStack(icbm.classic.lib.capability.ex.CapabilityExplosiveStack) EnumFacing(net.minecraft.util.EnumFacing) Block(net.minecraft.block.Block)

Example 38 with 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));
}
Also used : Pos(icbm.classic.lib.transform.vector.Pos)

Example 39 with Pos

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);
    }
}
Also used : IPos3D(com.builtbroken.jlib.data.vector.IPos3D) Pos(icbm.classic.lib.transform.vector.Pos) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

Pos (icbm.classic.lib.transform.vector.Pos)39 BlockPos (net.minecraft.util.math.BlockPos)22 TileEntity (net.minecraft.tileentity.TileEntity)8 Entity (net.minecraft.entity.Entity)6 ChunkPos (net.minecraft.util.math.ChunkPos)6 EnumFacing (net.minecraft.util.EnumFacing)5 TextComponentString (net.minecraft.util.text.TextComponentString)5 IPos3D (com.builtbroken.jlib.data.vector.IPos3D)4 ItemStack (net.minecraft.item.ItemStack)4 Location (icbm.classic.lib.transform.vector.Location)3 Point (icbm.classic.lib.transform.vector.Point)3 FakeRadioSender (icbm.classic.prefab.FakeRadioSender)3 EntityPlayer (net.minecraft.entity.player.EntityPlayer)3 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)3 ICBMClassic (icbm.classic.ICBMClassic)2 IWorldPosition (icbm.classic.api.data.IWorldPosition)2 IWorldPosItem (icbm.classic.api.items.IWorldPosItem)2 IExplosiveData (icbm.classic.api.reg.IExplosiveData)2 ItemLaserDetonator (icbm.classic.content.items.ItemLaserDetonator)2 ItemRemoteDetonator (icbm.classic.content.items.ItemRemoteDetonator)2