Package micdoodle8.mods.galacticraft.api.vector

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


                            if (!(blockID instanceof BlockAir) && this.getDistanceFromServer(x, y, z) < bubbleSizeSq)
                            {
                                if (doGrass && blockID instanceof ITerraformableBlock && ((ITerraformableBlock) blockID).isTerraformable(this.worldObj, x, y, z))
                                {
                                    this.terraformableBlocksList.add(new BlockVec3(x, y, z));
                                }
                                else if (doTrees)
                                {
                                    Block blockIDAbove = this.worldObj.getBlock(x, y + 1, z);
                                  if (blockID == Blocks.grass && blockIDAbove instanceof BlockAir)
                                  {
                                        this.grassBlockList.add(new BlockVec3(x, y, z));
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

        if (!this.worldObj.isRemote && this.terraformableBlocksList.size() > 0 && this.ticks % 15 == 0)
        {
            ArrayList<BlockVec3> terraformableBlocks2 = new ArrayList<BlockVec3>(this.terraformableBlocksList);

            int randomIndex = this.worldObj.rand.nextInt(this.terraformableBlocksList.size());
            BlockVec3 vec = terraformableBlocks2.get(randomIndex);

            if (vec.getBlock(this.worldObj) instanceof ITerraformableBlock)
            {
              Block id;
 
              switch (this.worldObj.rand.nextInt(40))
              {
              case 0:
                  if (this.worldObj.func_147469_q(vec.x - 1, vec.y, vec.z) && this.worldObj.func_147469_q(vec.x + 1, vec.y, vec.z) && this.worldObj.func_147469_q(vec.x, vec.y, vec.z - 1) && this.worldObj.func_147469_q(vec.x, vec.y, vec.z + 1))
                  {
                      id = Blocks.flowing_water;
                  }
                  else
                  {
                      id = Blocks.grass;
                  }
                  break;
              default:
                  id = Blocks.grass;
                  break;
              }
 
              this.worldObj.setBlock(vec.x, vec.y, vec.z, id);
 
              if (id == Blocks.grass)
              {
                  this.useCount[0]++;
                  this.waterTank.drain(1, true);
                  this.checkUsage(1);
              }
              else if (id == Blocks.flowing_water)
              {
                  this.checkUsage(2);
              }
            }

            this.terraformableBlocksList.remove(randomIndex);
        }

        if (!this.worldObj.isRemote && !this.treesDisabled && this.grassBlockList.size() > 0 && this.ticks % 50 == 0)
        {
            int randomIndex = this.worldObj.rand.nextInt(this.grassBlockList.size());
            BlockVec3 vecGrass = grassBlockList.get(randomIndex);

            if (vecGrass.getBlock(this.worldObj) == Blocks.grass)
            {
              BlockVec3 vecSapling = vecGrass.translate(010);
              ItemStack sapling = this.getFirstSaplingStack();
              boolean flag = false;

              //Attempt to prevent placement too close to other trees
              for (BlockVec3 testVec : this.grownTreesList)
              {
                if (testVec.distanceSquared(vecSapling) < 9)
                {
                  flag = true;
                  break;
                }
              }

              if (!flag && sapling != null)
              {
                Block b = Block.getBlockFromItem(sapling.getItem());
                this.worldObj.setBlock(vecSapling.x, vecSapling.y, vecSapling.z, b, sapling.getItemDamage(), 3);
                if (b instanceof BlockSapling)
                {
                  if (this.worldObj.getBlockLightValue(vecSapling.x, vecSapling.y, vecSapling.z) >= 9)
                  {
                    ((BlockSapling)b).func_149878_d(this.worldObj, vecSapling.x, vecSapling.y, vecSapling.z, this.worldObj.rand);
                    this.grownTreesList.add(vecSapling.clone());
                  }
                }
                else if (b instanceof BlockBush)
                {
                  if (this.worldObj.getBlockLightValue(vecSapling.x, vecSapling.y, vecSapling.z) >= 5)
                    //Hammer the update tick a few times to try to get it to grow - it won't always
                    for (int j = 0; j < 12; j++)
                    {
                      if (this.worldObj.getBlock(vecSapling.x, vecSapling.y, vecSapling.z) == b)
                        ((BlockBush)b).updateTick(this.worldObj, vecSapling.x, vecSapling.y, vecSapling.z, this.worldObj.rand);
                      else
                      {
                        this.grownTreesList.add(vecSapling.clone());
                        break;
                      }
                    }
                }
View Full Code Here


    {
        this.mainBlockPosition = placedPosition;

        for (int y = 0; y < 3; y++)
        {
            final BlockVec3 vecToAdd = new BlockVec3(placedPosition.x, placedPosition.y + y, placedPosition.z);

            if (!vecToAdd.equals(placedPosition))
            {
                ((BlockMulti) GCBlocks.fakeBlock).makeFakeBlock(this.worldObj, vecToAdd, placedPosition, 5);
            }
        }
    }
View Full Code Here

    }

    @Override
    public void onDestroy(TileEntity callingBlock)
    {
        final BlockVec3 thisBlock = new BlockVec3(this);

        int x1 = 0;
        int x2 = 0;
        int z1 = 0;
        int z2 = 0;
View Full Code Here

    @Override
    public void readFromNBT(NBTTagCompound nbt)
    {
        super.readFromNBT(nbt);
        this.mainBlockPosition = new BlockVec3(nbt.getCompoundTag("mainBlockPosition"));
    }
View Full Code Here

    {
        float provide = this.getOxygenProvide(outputDirection);

        if (provide > 0)
        {
            TileEntity outputTile = new BlockVec3(this).modifyPositionFromSide(outputDirection).getTileEntity(this.worldObj);
            IOxygenNetwork outputNetwork = NetworkHelper.getOxygenNetworkFromTileEntity(outputTile, outputDirection);

            if (outputNetwork != null)
            {
                float powerRequest = outputNetwork.getRequest(this);
View Full Code Here

    {
        float provide = this.getHydrogenProvide(outputDirection);

        if (provide > 0)
        {
            TileEntity outputTile = new BlockVec3(this).modifyPositionFromSide(outputDirection).getTileEntity(this.worldObj);
            if (EnergyConfigHandler.isMekanismLoaded())
            {
                //TODO Gas item handling - internal tank (IGasItem)
                //int acceptedHydrogen = GasTransmission.addGas(itemStack, type, amount);
                //this.provideHydrogen(acceptedHydrogen, true);
View Full Code Here

                    for (Object obj : chunk.chunkTileEntityMap.values())
                    {
                        if (obj != this && obj instanceof ILaserNode)
                        {
                            BlockVec3 deltaPos = new BlockVec3(this).subtract(new BlockVec3(((ILaserNode) obj).getTile()));

                            if (deltaPos.x < 16 && deltaPos.y < 16 && deltaPos.z < 16)
                            {
                                ILaserNode laserNode = (ILaserNode) obj;
View Full Code Here

    {
        int index = -1;

        for (int i = 0; i < this.nodeList.size(); i++)
        {
            if (new BlockVec3(this.nodeList.get(i).getTile()).equals(new BlockVec3(node.getTile())))
            {
                index = i;
                break;
            }
        }

        if (index != -1)
        {
            this.nodeList.set(index, node);
            return;
        }

        if (this.nodeList.isEmpty())
        {
            this.nodeList.add(node);
        }
        else
        {
            int nodeCompare = this.nodeList.get(0).compareTo(node, new BlockVec3(this));

            if (nodeCompare <= 0)
            {
                this.nodeList.addFirst(node);
                return;
            }

            nodeCompare = this.nodeList.get(this.nodeList.size() - 1).compareTo(node, new BlockVec3(this));

            if (nodeCompare >= 0)
            {
                this.nodeList.addLast(node);
                return;
View Full Code Here

    {
        int index = -1;

        for (int i = 0; i < this.nodeList.size(); i++)
        {
            if (new BlockVec3(this.nodeList.get(i).getTile()).equals(new BlockVec3(node.getTile())))
            {
                index = i;
                break;
            }
        }

        if (new BlockVec3(node.getTile()).equals(this.targetVec))
        {
            if (index == 0)
            {
                if (this.nodeList.size() > 1)
                {
View Full Code Here

    }

    @Override
    public int compareTo(ILaserNode otherNode, BlockVec3 origin)
    {
        int thisDistance = new BlockVec3(this).subtract(origin).getMagnitudeSquared();
        int otherDistance = new BlockVec3(otherNode.getTile()).subtract(origin).getMagnitudeSquared();

        if (thisDistance < otherDistance)
        {
            return 1;
        }
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.