Package micdoodle8.mods.galacticraft.api.vector

Examples of micdoodle8.mods.galacticraft.api.vector.BlockVec3


        }
    }

    public void removeAsteroid(int x, int y, int z)
    {
        BlockVec3 coords = new BlockVec3(x, y, z);
        if (this.asteroidCentres.contains(coords))
        {
            this.asteroidCentres.remove(coords);

            if (this.dataNotLoaded)
View Full Code Here


        this.datafile.markDirty();
    }

    public BlockVec3 getClosestAsteroidXZ(int x, int y, int z)
    {
        BlockVec3 target = new BlockVec3(x, y, z);
        if (this.asteroidCentres.size() == 0)
        {
            return null;
        }

        BlockVec3 result = null;
        int lowestDistance = Integer.MAX_VALUE;

        for (BlockVec3 test : this.asteroidCentres)
        {
            int dx = target.x - test.x;
View Full Code Here

   *
   * @param meta  The meta of the screen prior to breaking or rotation
   */
  public void breakScreen(int meta)
  {
    BlockVec3 vec = new BlockVec3(this);
    TileEntity tile;
    int side = this.getRight(meta);

    int left = this.connectionsLeft;
    int right = this.connectionsRight;
    int up = this.connectionsUp;
    int down = this.connectionsDown;
 
    boolean doUp = this.connectedUp;
    boolean doDown = this.connectedDown;
    boolean doLeft = this.connectedLeft;
    boolean doRight = this.connectedRight;

      for (int x = -left; x <= right; x++)
      {
        for (int z = -up; z <= down; z++)
        {
          if (x == 0 && z == 0) this.resetToSingle();
          else
          {
            BlockVec3 newVec = vec.clone().modifyPositionFromSide(ForgeDirection.getOrientation(side), x).modifyPositionFromSide(ForgeDirection.DOWN, z);
            tile = newVec.getTileEntity(this.worldObj);
            if (tile instanceof TileEntityScreen && tile.getBlockMetadata() == meta)
            {
              ((TileEntityScreen)tile).resetToSingle();
            }
          }
View Full Code Here

   
    TileEntity tileUp = null;
    TileEntity tileDown = null;
    TileEntity tileLeft = null;
    TileEntity tileRight = null;
    BlockVec3 vec = new BlockVec3(this);

    //First, basic check that a neighbour is there and in the same orientation
    if (this.connectedUp)
    {
      tileUp = vec.getTileEntityOnSide(this.worldObj, 1);
      this.connectedUp = tileUp instanceof TileEntityScreen && tileUp.getBlockMetadata() == meta && !tileUp.isInvalid();
    }

    if (this.connectedDown)
    {
      tileDown = vec.getTileEntityOnSide(this.worldObj, 0);
      this.connectedDown = tileDown instanceof TileEntityScreen && tileDown.getBlockMetadata() == meta && !tileDown.isInvalid();
    }

    if (this.connectedLeft)
    {
      int side = this.getLeft(meta);
      tileLeft = vec.getTileEntityOnSide(this.worldObj, side);
      this.connectedLeft = tileLeft instanceof TileEntityScreen && tileLeft.getBlockMetadata() == meta && !tileLeft.isInvalid();
    }

    if (this.connectedRight)
    {
      int side = this.getRight(meta);
      tileRight = vec.getTileEntityOnSide(this.worldObj, side);
      this.connectedRight = tileRight instanceof TileEntityScreen && tileRight.getBlockMetadata() == meta && !tileRight.isInvalid();
    }

    //Now test whether a connection can be sustained with that other tile
    if (this.connectedUp)
View Full Code Here

      int down = 0;
      int left = 0;
      int right = 0;
    int meta = this.getBlockMetadata() & 7;

      BlockVec3 vec = new BlockVec3(this);
      TileEntityScreen tile = this;
      while (up < 8)
      {
        if (tile.connectedUp)
        {
          up++;
          TileEntity newTile = vec.getTileEntityOnSide(this.worldObj, 1);
          if (newTile instanceof TileEntityScreen)
          {
            tile = (TileEntityScreen) newTile;
            vec.translate(010);
          }
          else
          {
            System.out.println("Debug - connected up to a non-screen tile");
            tile.connectedUp = false;
            tile.markDirty();
            up--;
            break;
          }
        }
        else
          break;
      }

      vec = new BlockVec3(this);
      tile = this;
      while (down < 8 - up)
      {
        if (tile.connectedDown)
        {
          down++;
          TileEntity newTile = vec.getTileEntityOnSide(this.worldObj, 0);
          if (newTile instanceof TileEntityScreen)
          {
            tile = (TileEntityScreen) newTile;
            vec.translate(0,  -10);
          }
          else
          {
            System.out.println("Debug - connected down to a non-screen tile");
            tile.connectedDown = false;
            tile.markDirty();
            down--;
            break;
          }
        }
        else
          break;
      }

      vec = new BlockVec3(this);
      tile = this;
    int leftside = this.getLeft(meta);
      while (left < ((up + down == 0) ? 1 : 8))
      {
        if (tile.connectedLeft)
        {
          left++;
          TileEntity newTile = vec.getTileEntityOnSide(this.worldObj, leftside);
          if (newTile instanceof TileEntityScreen)
          {
            tile = (TileEntityScreen) newTile;
            vec = vec.newVecSide(leftside);
          }
          else
          {
            System.out.println("Debug - connected left to a non-screen tile");
            tile.connectedLeft = false;
            tile.markDirty();
            left--;
            break;
          }
        }
        else
          break;
      }

      vec = new BlockVec3(this);
      tile = this;
    int rightside = this.getRight(meta);
      while (right < ((up + down == 0) ? 1 : 8) - left)
      {
        if (tile.connectedRight)
        {
          right++;
          TileEntity newTile = vec.getTileEntityOnSide(this.worldObj, rightside);
          if (newTile instanceof TileEntityScreen)
          {
            tile = (TileEntityScreen) newTile;
            vec = vec.newVecSide(rightside);
          }
          else
          {
            System.out.println("Debug - connected right to a non-screen tile");
            tile.connectedRight = false;
            tile.markDirty();
            right--;
            break;
          }
        }
        else
          break;
      }
     
      this.log("Screen size check midpoint "+up+" "+down+" "+left+" "+right+" ");

      vec = new BlockVec3(this);
      TileEntity newtile = vec.getTileEntityOnSide(this.worldObj, 1);
      TileEntityScreen tileUp = (newtile instanceof TileEntityScreen) ? (TileEntityScreen)newtile : null;
      newtile = vec.getTileEntityOnSide(this.worldObj, 0);
      TileEntityScreen tileDown = (newtile instanceof TileEntityScreen) ? (TileEntityScreen)newtile : null;
      newtile = vec.getTileEntityOnSide(this.worldObj, leftside);
      TileEntityScreen tileLeft = (newtile instanceof TileEntityScreen) ? (TileEntityScreen)newtile : null;
      newtile = vec.getTileEntityOnSide(this.worldObj, rightside);
      TileEntityScreen tileRight = (newtile instanceof TileEntityScreen) ? (TileEntityScreen)newtile : null;
      //Prevent 3 x 1 and longer
      if (left + right == 0 && up + down >= 1)
      {
        if (up > 0 && !tileUp.connectedUp//No need for null check if up > 0
View Full Code Here

      int barrierDown = down;
      int barrierLeft = left;
      int barrierRight = right;
     
    int meta = this.getBlockMetadata() & 7;
      BlockVec3 vec = new BlockVec3(this);
      ArrayList<TileEntityScreen> screenList = new ArrayList<TileEntityScreen>();

    int side = this.getRight(meta);
   
      for (int x = -left; x <= right; x++)
      {
        for (int z = -up; z <= down; z++)
        {
          BlockVec3 newVec = vec.clone().modifyPositionFromSide(ForgeDirection.getOrientation(side), x).modifyPositionFromSide(ForgeDirection.DOWN, z);
          TileEntity tile = newVec.getTileEntity(this.worldObj);
          if (tile instanceof TileEntityScreen && tile.getBlockMetadata() == meta && !tile.isInvalid())
          {
            TileEntityScreen screenTile = (TileEntityScreen)tile;
            screenList.add(screenTile);
           
View Full Code Here

    }

    private boolean canJoinRight()
    {
      int meta = this.getBlockMetadata();
      TileEntity te = new BlockVec3(this).getTileEntityOnSide(this.worldObj, this.getRight(meta));
      if (!(te instanceof TileEntityScreen)) return false;
      TileEntityScreen screenTile = (TileEntityScreen) te;
      if (screenTile.getBlockMetadata() != meta) return false;
      if (screenTile.connectionsUp != this.connectionsUp) return false;
      if (screenTile.connectionsDown != this.connectionsDown) return false;
View Full Code Here

   

    private boolean canJoinLeft()
    {
      int meta = this.getBlockMetadata();
      TileEntity te = new BlockVec3(this).getTileEntityOnSide(this.worldObj, this.getLeft(meta));
      if (!(te instanceof TileEntityScreen)) return false;
      TileEntityScreen screenTile = (TileEntityScreen) te;
      if (screenTile.getBlockMetadata() != meta) return false;
      if (screenTile.connectionsUp != this.connectionsUp) return false;
      if (screenTile.connectionsDown != this.connectionsDown) return false;
View Full Code Here

    }

    private boolean canJoinUp()
    {
      int meta = this.getBlockMetadata();
      TileEntity te = new BlockVec3(this).getTileEntityOnSide(this.worldObj, 1);
      if (!(te instanceof TileEntityScreen)) return false;
      TileEntityScreen screenTile = (TileEntityScreen) te;
      if (screenTile.getBlockMetadata() != meta) return false;
      if (screenTile.connectionsLeft != this.connectionsLeft) return false;
      if (screenTile.connectionsRight != this.connectionsRight) return false;
View Full Code Here

    }

    private boolean canJoinDown()
    {
      int meta = this.getBlockMetadata();
      TileEntity te = new BlockVec3(this).getTileEntityOnSide(this.worldObj, 0);
      if (!(te instanceof TileEntityScreen)) return false;
      TileEntityScreen screenTile = (TileEntityScreen) te;
      if (screenTile.getBlockMetadata() != meta) return false;
      if (screenTile.connectionsLeft != this.connectionsLeft) return false;
      if (screenTile.connectionsRight != this.connectionsRight) return false;
View Full Code Here

TOP

Related Classes of micdoodle8.mods.galacticraft.api.vector.BlockVec3

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.