Package Hexel.blocks.types

Examples of Hexel.blocks.types.Block


        }
      }
      else {
        Vector3i closestBlock = blocksAttacking.get(blocksAttacking.size()-1);
        Vector3i tmp3i = new Vector3i();
        Block b = thingBridge.engine.chunks.getBlock(closestBlock.x, closestBlock.y, closestBlock.z, tmp3i, (Chunk)null);
        if (!(b instanceof BlockEmpty || b instanceof BlockWater)){
          if (closestBlock != null) {
            RemoveBlock ab = new RemoveBlock();
            ab.x = closestBlock.x;
            ab.y = closestBlock.y;
View Full Code Here


    while (v.mag() < t.mag()) {
      v.add(step);

      HexGeometry.cartesianToBlock(v.x + offset.x, v.y + offset.y, v.z + offset.z, tmp2d, blockPos);

      Block b = this.chunks.getBlock(blockPos.x, blockPos.y, blockPos.z, tmp3i, (Chunk)null);
      blocks.add(new Vector3i(blockPos));
      if (!(b instanceof BlockEmpty || b instanceof BlockWater)) {
        break;
      }
    }
View Full Code Here

      v.add(step);

      HexGeometry.cartesianToBlock(v.x + offset.x, v.y + offset.y, v.z
          + offset.z, tmp2d, blockPos);

      Block b = this.chunks.getBlock(blockPos.x, blockPos.y, blockPos.z, tmp3i, (Chunk)null);
      if (!(b instanceof BlockEmpty || b instanceof BlockWater)) {
        return blockPos;
      }
    }
    return null;
View Full Code Here

    while (v.mag() < t.mag()) {
      v.add(step);
      HexGeometry.cartesianToBlock(v.x + offset.x, v.y + offset.y, v.z
          + offset.z, tmp2d, blockPos);

      Block b = this.chunks.getBlock(blockPos.x, blockPos.y, blockPos.z, tmp3i, (Chunk)null);
      if (!(b instanceof BlockEmpty || b instanceof BlockWater)) {
        return farthestEmpty;
      } else {
        farthestEmpty.x = blockPos.x;
        farthestEmpty.y = blockPos.y;
View Full Code Here

        if (thing instanceof BlockManipulator) {
          BlockAction action = ((BlockManipulator) thing)
              .getBlockAction();
          if (action instanceof AddBlock) {
            AddBlock addBlockAction = (AddBlock) action;
            Block original = this.chunks.getBlock(addBlockAction.x, addBlockAction.y, addBlockAction.z, tmp, (Chunk)null);
            this.chunks.setBlock(addBlockAction.x, addBlockAction.y, addBlockAction.z, addBlockAction.block, tmp, tmp2, null);
            if (thing instanceof Volumetric) {
              if (thing instanceof Cuboid) {
                Vector3d offset = Resources.vector3dResourcePool.aquire();
                offset.x = 0;
                offset.y = 0;
                offset.z = 0;
                if (this.thingTools.fixOffset((Cuboid) thing,
                    offset, false, this.fixOffsetTmps) != null)
                  this.chunks.setBlock(addBlockAction.x,
                      addBlockAction.y, addBlockAction.z,
                      original, tmp, tmp2, null);
                else {
                  if (thing instanceof InventoryOwner) {
                    InventoryOwner inventoryOwner = (InventoryOwner) thing;
                    inventoryOwner.rmBlock(addBlockAction.block);
                  }
                }
                Resources.vector3dResourcePool.recycle(offset);
              }
            }
          } else if (action instanceof RemoveBlock) {
            RemoveBlock rmBlockAction = (RemoveBlock) action;
            Block b = this.chunks.getBlock(rmBlockAction.x, rmBlockAction.y, rmBlockAction.z, tmp, (Chunk)null);
            if (b.getHealth() < 0) {
              this.chunks.setBlock(rmBlockAction.x, rmBlockAction.y, rmBlockAction.z, BlockEmpty.Make(0), tmp, tmp2, null);
              if (thing instanceof InventoryOwner) {
                InventoryOwner inventoryOwner = (InventoryOwner) thing;
                inventoryOwner.addBlock(b);
              }
            } else {
              Block newB = BlockTools.updateHealth(b, b.getHealth()-1);
              this.chunks.setBlock(rmBlockAction.x, rmBlockAction.y, rmBlockAction.z, newB, tmp, tmp2, null);
            }
          }
        }
      }
View Full Code Here

  }

  public boolean collidesWater(double x, double y, double z, Vector2d tmp2d, Vector3i tmp3i) {
    Vector3i blockPos = new Vector3i();
    HexGeometry.cartesianToBlock(x, y, z, tmp2d, blockPos);
    Block b = this.chunks.getBlock(blockPos.x, blockPos.y, blockPos.z, tmp3i, (Chunk)null);
    return b instanceof BlockWater;
  }
View Full Code Here

        partialFix.x = 0;
        partialFix.y = 0;
        partialFix.z = 0;
        collides(c, offset, p.x, p.y, p.z, partialFix, tmps.collidesTmps);
        if (partialFix.x != 0 || partialFix.y != 0 || partialFix.z != 0){
          Block b = chunks.getBlock(p.x, p.y, p.z, tmps.tmp3i, (Chunk)null);
          if (checkCollidableBlock.isColliding(b)){
            tmps.toFixBlockSet.add(partialFix);
            return true;
          }
          else {
View Full Code Here

    if (step % (60) == 0){
      ArrayList<Vector3i> blocksIntersectingThing = thingBridge.thingTools.getBlocksIntersectingThing(this, thingBridge.fixOffsetTmps);
      Vector3i tmp = new Vector3i();
      if (thingBridge.engine.getAmbientLight() > .75){
        for (Vector3i v : blocksIntersectingThing){
          Block b = thingBridge.engine.chunks.getBlock(v.x, v.y, v.z, tmp, (Chunk)null);
          if (b instanceof BlockEmpty){
            BlockEmpty be = (BlockEmpty)b;
            double lightLevel = thingBridge.engine.getAmbientLight() - be.naturalLightLevel*1.0/BlockTransparent.MAX_LIGHT_LEVEL;
            if (lightLevel > .9){
              this.health -= .1;
View Full Code Here

    Vector2i tmp2 = new Vector2i();

    for (int x = 0; x < 32; x++) {
      for (int y = 0; y < 16; y++) {
        for (int z = 0; z < 32; z++) {
          Block b = chunk.get(x, y, z);
          int gx = p.x * 32 + x;
          int gy = p.y * 16 + y;
          int gz = p.z * 32 + z;
          HighestBlockChunk hbc = chunks.getHighestBlockChunkAtXY(gx, gy, tmp2);
          simBlock(gx, gy, gz, chunk, hbc, b, step, deltas);
View Full Code Here

    if (bd.hasGrass){
      if (bd.health < bd.getMaxHealth()){
        blockDeltaAdder.addBlockDelta(BlockDelta.Aquire(bx, by, bz, BlockDirt.Make(b.getHealth(), false), chunks.getStepsToSim(bx, by, bz, tmp3i, c)));
      }
      else {
        Block ab = chunks.getBlock(bx, by, bz+1, tmp3i, c);
        if (!(ab instanceof BlockEmpty) && !(ab instanceof BlockLeaf)){
          blockDeltaAdder.addBlockDelta(BlockDelta.Aquire(bx, by, bz, BlockDirt.Make(b.getHealth(), false), chunks.getStepsToSim(bx, by, bz, tmp3i, c)));
        }
      }
    }
View Full Code Here

TOP

Related Classes of Hexel.blocks.types.Block

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.