Package universalelectricity.api.vector

Examples of universalelectricity.api.vector.Vector3


        Iterator<Vector3> it = fieldToBeProjected.iterator();

        fieldLoop:
        while (it.hasNext())
        {
          Vector3 vector = it.next();

          Block block = Block.blocksList[vector.getBlockID(this.worldObj)];

          if (canReplaceBlock(vector, block))
          {
            /**
             * Prevents the force field projector from disintegrating itself.
             */
            if (block != ModularForceFieldSystem.blockForceField && !vector.equals(new Vector3(this)))
            {
              if (this.worldObj.getChunkFromBlockCoords(vector.intX(), vector.intZ()).isChunkLoaded)
              {
                constructionCount++;

                for (IModule module : getModules(getModuleSlots()))
                {
                  int flag = module.onProject(this, vector.clone());

                  if (flag == 1)
                  {
                    continue fieldLoop;
                  }
                  else if (flag == 2)
                  {
                    break fieldLoop;
                  }
                }

                if (!this.worldObj.isRemote)
                {
                  this.worldObj.setBlock(vector.intX(), vector.intY(), vector.intZ(), ModularForceFieldSystem.blockForceField.blockID, 0, 2);
                }

                this.forceFields.add(vector);

                  /*
                   * Sets the controlling projector of the force field block to
                   * this one.
                   */
                TileEntity tileEntity = this.worldObj.getBlockTileEntity(vector.intX(), vector.intY(), vector.intZ());

                if (tileEntity instanceof TileForceField)
                {
                  ((TileForceField) tileEntity).setProjector(new Vector3(this));
                }

                this.requestFortron(1, true);

                if (constructionCount >= constructionSpeed)
View Full Code Here


          }
        }

        while (it.hasNext())
        {
          Vector3 vector = it.next();
          Block block = Block.blocksList[vector.getBlockID(this.worldObj)];

          if (block == ModularForceFieldSystem.blockForceField)
          {
            this.worldObj.setBlock(vector.intX(), vector.intY(), vector.intZ(), 0, 0, 3);
          }
        }
      }
    }
View Full Code Here

  @Override
  public Set<Vector3> getExteriorPoints(IFieldInteraction projector)
  {
    final Set<Vector3> fieldBlocks = new HashSet<Vector3>();

    final Vector3 posScale = projector.getPositiveScale();
    final Vector3 negScale = projector.getNegativeScale();

    int radius = (posScale.intX() + negScale.intX() + posScale.intZ() + negScale.intZ()) / 2;
    int height = posScale.intY() + negScale.intY();

    for (float x = -radius; x <= radius; x += 1)
    {
      for (float z = -radius; z <= radius; z += 1)
      {
        for (float y = 0; y < height; y += 1)
        {
          if ((y == 0 || y == height - 1) && (x * x + z * z + RADIUS_Expansion) <= (radius * radius))
          {
            fieldBlocks.add(new Vector3(x, y, z));
          }
          if ((x * x + z * z + RADIUS_Expansion) <= (radius * radius) && (x * x + z * z + RADIUS_Expansion) >= ((radius - 1) * (radius - 1)))
          {
            fieldBlocks.add(new Vector3(x, y, z));
          }
        }
      }
    }

View Full Code Here

  @Override
  public Set<Vector3> getInteriorPoints(IFieldInteraction projector)
  {
    final Set<Vector3> fieldBlocks = new HashSet<Vector3>();

    final Vector3 translation = projector.getTranslation();

    final Vector3 posScale = projector.getPositiveScale();
    final Vector3 negScale = projector.getNegativeScale();

    int radius = (posScale.intX() + negScale.intX() + posScale.intZ() + negScale.intZ()) / 2;
    int height = posScale.intY() + negScale.intY();

    for (int x = -radius; x <= radius; x++)
    {
      for (int z = -radius; z <= radius; z++)
      {
        for (int y = 0; y < height; y++)
        {
          Vector3 position = new Vector3(x, y, z);

          if (this.isInField(projector, Vector3.translate(position, new Vector3((TileEntity) projector)).add(translation)))
          {
            fieldBlocks.add(position);
          }
        }
      }
View Full Code Here

  }

  @Override
  public boolean isInField(IFieldInteraction projector, Vector3 position)
  {
    Vector3 posScale = projector.getPositiveScale();
    Vector3 negScale = projector.getNegativeScale();

    int radius = (posScale.intX() + negScale.intX() + posScale.intZ() + negScale.intZ()) / 2;

    Vector3 projectorPos = new Vector3((TileEntity) projector);
    projectorPos.add(projector.getTranslation());

    Vector3 relativePosition = position.clone().subtract(projectorPos);
    relativePosition.rotate(-projector.getRotationYaw(), -projector.getRotationPitch());

    if (relativePosition.x * relativePosition.x + relativePosition.z * relativePosition.z + RADIUS_Expansion <= radius * radius)
    {
      return true;
    }
View Full Code Here

        {
          if (((renderX * renderX + renderZ * renderZ + RADIUS_Expansion) <= (radius * radius) && (renderX * renderX + renderZ * renderZ + RADIUS_Expansion) >= ((radius - 1) * (radius - 1))) || ((renderY == 0 || renderY == radius - 1) && (renderX * renderX + renderZ * renderZ + RADIUS_Expansion) <= (radius * radius)))
          {
            if (i % 2 == 0)
            {
              Vector3 vector = new Vector3(renderX, renderY, renderZ);
              GL11.glTranslated(vector.x, vector.y, vector.z);
              ModelCube.INSTNACE.render();
              GL11.glTranslated(-vector.x, -vector.y, -vector.z);
            }

View Full Code Here

  @Override
  public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer)
  {
    if (!entityPlayer.isSneaking())
    {
      Vector3 position = this.getLink(itemStack);

      if (position != null)
      {
        int blockId = position.getBlockID(world);

        if (Block.blocksList[blockId] != null)
        {
          Chunk chunk = world.getChunkFromBlockCoords(position.intX(), position.intZ());

          if (chunk != null && chunk.isChunkLoaded && (MFFSHelper.hasPermission(world, position, Action.RIGHT_CLICK_BLOCK, entityPlayer) || MFFSHelper.hasPermission(world, position, Permission.REMOTE_CONTROL, entityPlayer)))
          {
            float requiredEnergy = (float) Vector3.distance(new Vector3(entityPlayer), position) * (FluidContainerRegistry.BUCKET_VOLUME / 100);
            int receivedEnergy = 0;

            Set<IFortronFrequency> fortronTiles = FrequencyGrid.instance().getFortronTiles(world, new Vector3(entityPlayer), 50, this.getFrequency(itemStack));

            for (IFortronFrequency fortronTile : fortronTiles)
            {
              int consumedEnergy = fortronTile.requestFortron((int) Math.ceil(requiredEnergy / fortronTiles.size()), true);

              if (consumedEnergy > 0)
              {
                if (world.isRemote)
                {
                  ModularForceFieldSystem.proxy.renderBeam(world, new Vector3(entityPlayer).add(new Vector3(0, entityPlayer.getEyeHeight() - 0.2, 0)), new Vector3((TileEntity) fortronTile).add(0.5), 0.6f, 0.6f, 1, 20);
                }

                receivedEnergy += consumedEnergy;
              }

              if (receivedEnergy >= requiredEnergy)
              {
                try
                {
                  Block.blocksList[blockId].onBlockActivated(world, position.intX(), position.intY(), position.intZ(), entityPlayer, 0, 0, 0, 0);
                }
                catch (Exception e)
                {
                  e.printStackTrace();
                }
View Full Code Here

  {
    if (!evt.world.isRemote)
    {
      for (ItemStack itemStack : this.remotesCached)
      {
        if (!temporaryRemoteBlacklist.contains(itemStack) && new Vector3(evt.beforeX, evt.beforeY, evt.beforeZ).equals(this.getLink(itemStack)))
        {
          // TODO: Change remote to locate in other world?
          this.setLink(itemStack, new VectorWorld(evt.world, evt.afterX, evt.afterY, evt.afterZ));
          temporaryRemoteBlacklist.add(itemStack);
        }
View Full Code Here

          {
            Iterator<Vector3> it = fieldBlocks.iterator();

            while (it.hasNext())
            {
              Vector3 position = it.next();

              if (((IProjector) compareProjector).getInteriorPoints().contains(position) || ((IProjector) compareProjector).getMode().isInField((IProjector) compareProjector, position.clone()))
              {
                it.remove();
              }
            }
          }
View Full Code Here

  {
    NBTTagCompound nbt = NBTUtility.getNBTTagCompound(itemStack);

    list.add(LanguageUtility.getLocal("info.modeCustom.mode") + " " + (nbt.getBoolean(NBT_MODE) ? LanguageUtility.getLocal("info.modeCustom.substraction") : LanguageUtility.getLocal("info.modeCustom.additive")));

    Vector3 point1 = new Vector3(nbt.getCompoundTag(NBT_POINT_1));
    list.add(LanguageUtility.getLocal("info.modeCustom.point1") + " " + point1.intX() + ", " + point1.intY() + ", " + point1.intZ());

    Vector3 point2 = new Vector3(nbt.getCompoundTag(NBT_POINT_2));
    list.add(LanguageUtility.getLocal("info.modeCustom.point2") + " " + point2.intX() + ", " + point2.intY() + ", " + point2.intZ());

    int modeID = nbt.getInteger(NBT_ID);

    if (modeID > 0)
    {
View Full Code Here

TOP

Related Classes of universalelectricity.api.vector.Vector3

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.