Package universalelectricity.api.vector

Examples of universalelectricity.api.vector.Vector3


        {
          TileForceFieldProjector projector = (TileForceFieldProjector) fortronFrequency;

          if (projector.getCalculatedField() != null)
          {
            if (projector.getCalculatedField().contains(new Vector3(evt.x, evt.y, evt.z)))
            {
              projector.markFieldUpdate = true;
            }
          }
        }
View Full Code Here


  }

  @ForgeSubscribe
  public void livingSpawnEvent(LivingSpawnEvent evt)
  {
    IInterdictionMatrix interdictionMatrix = MFFSHelper.getNearestInterdictionMatrix(evt.world, new Vector3(evt.entityLiving));

    if (interdictionMatrix != null && !(evt.entity instanceof EntityPlayer))
    {
      if (interdictionMatrix.getModuleCount(ModularForceFieldSystem.itemModuleAntiSpawn) > 0)
      {
View Full Code Here

          }
        }

        IBiometricIdentifier biometricIdentifier = this.getProjector(world, x, y, z).getBiometricIdentifier();

        if (new Vector3(entity).distance(new Vector3(x, y, z).add(0.4)) < 0.5)
        {
          if (entity instanceof EntityLiving && !world.isRemote)
          {
            ((EntityLiving) entity).addPotionEffect(new PotionEffect(Potion.confusion.id, 4 * 20, 3));
            ((EntityLiving) entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 20, 1));
View Full Code Here

  }

  @Override
  public boolean isInField(IFieldInteraction projector, Vector3 position)
  {
    Vector3 projectorPos = new Vector3((TileEntity) projector);
    projectorPos.add(projector.getTranslation());
    Vector3 relativePosition = position.clone().subtract(projectorPos);
    relativePosition.rotate(-projector.getRotationYaw(), -projector.getRotationPitch());
    Cuboid region = new Cuboid(projector.getNegativeScale().clone().scale(-1), projector.getPositiveScale());
    return region.intersects(relativePosition);
  }
View Full Code Here

  public boolean onProject(IProjector projector, Set<Vector3> fields)
  {
    final double repulsionVelocity = Math.max(projector.getModuleCount(this) / 20, 1.2);
    final Set<Vector3> field = projector.getCalculatedField();

    Cuboid volume = new Cuboid(projector.getNegativeScale().clone().invert(), projector.getPositiveScale().clone().add(1)).add(new Vector3((TileEntity) projector).add(projector.getTranslation()));
    List<Entity> entities = ((TileEntity) projector).getWorldObj().getEntitiesWithinAABB(Entity.class, volume.toAABB());

    for (Entity entity : entities)
    {
      Vector3 fieldPos = new Vector3(entity).floor();

      if (field.contains(fieldPos))
      {
        if (entity instanceof EntityPlayer)
        {
          EntityPlayer entityPlayer = (EntityPlayer) entity;

          if (entityPlayer.isSneaking())
          {
            IBiometricIdentifier biometricIdentifier = projector.getBiometricIdentifier();

            if (entityPlayer.capabilities.isCreativeMode)
            {
              continue;
            }
            else if (biometricIdentifier != null)
            {
              if (biometricIdentifier.isAccessGranted(entityPlayer.username, Permission.FORCE_FIELD_WARP))
              {
                continue;
              }
            }
          }
        }

        Vector3 repellDirection = new Vector3(entity).difference(fieldPos.clone().translate(0.5)).normalize();
        entity.motionX = repellDirection.x * Math.max(repulsionVelocity, Math.abs(entity.motionX));
        entity.motionY = repellDirection.y * Math.max(repulsionVelocity, Math.abs(entity.motionY));
        entity.motionZ = repellDirection.z * Math.max(repulsionVelocity, Math.abs(entity.motionZ));
        entity.moveEntity(entity.motionX, entity.motionY, entity.motionZ);
        entity.onGround = true;
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();

    final int xStretch = posScale.intX() + negScale.intX();
    final int yStretch = posScale.intY() + negScale.intY();
    final int zStretch = posScale.intZ() + negScale.intZ();
    final Vector3 translation = new Vector3(0, -negScale.intY(), 0);

    final int inverseThickness = (int) Math.max((yStretch + zStretch) / 4f, 1);
    System.out.println(inverseThickness);

    for (float y = 0; y <= yStretch; y += 1f)
    {
      for (float x = -xStretch; x <= xStretch; x += 1f)
      {
        for (float z = -zStretch; z <= zStretch; z += 1f)
        {
          double yTest = (y / yStretch) * inverseThickness;
          double xzPositivePlane = (1 - (x / xStretch) - (z / zStretch)) * inverseThickness;
          double xzNegativePlane = (1 + (x / xStretch) - (z / zStretch)) * inverseThickness;

          // Positive Positive Plane
          if (x >= 0 && z >= 0 && Math.round(xzPositivePlane) == Math.round(yTest))
          {
            fieldBlocks.add(new Vector3(x, y, z).add(translation));
            fieldBlocks.add(new Vector3(x, y, -z).add(translation));
          }

          // Negative Positive Plane
          if (x <= 0 && z >= 0 && Math.round(xzNegativePlane) == Math.round(yTest))
          {
            fieldBlocks.add(new Vector3(x, y, -z).add(translation));
            fieldBlocks.add(new Vector3(x, y, z).add(translation));
          }

          // Ground Level Plane
          if (y == 0 && (Math.abs(x) + Math.abs(z)) < (xStretch + yStretch) / 2)
          {
            fieldBlocks.add(new Vector3(x, y, z).add(translation));
          }
        }
      }
    }

View Full Code Here

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

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

    int xStretch = posScale.intX() + negScale.intX();
    int yStretch = posScale.intY() + negScale.intY();
    int zStretch = posScale.intZ() + negScale.intZ();
    Vector3 translation = new Vector3(0, -0.4, 0);

    for (float x = -xStretch; x <= xStretch; x++)
    {
      for (float z = -zStretch; z <= zStretch; z++)
      {
        for (float y = 0; y <= yStretch; y++)
        {
          Vector3 position = new Vector3(x, y, z).add(translation);

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

  }

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

    int xStretch = posScale.intX() + negScale.intX();
    int yStretch = posScale.intY() + negScale.intY();
    int zStretch = posScale.intZ() + negScale.intZ();

    Vector3 projectorPos = new Vector3((TileEntity) projector);
    projectorPos.add(projector.getTranslation());
    projectorPos.add(new Vector3(0, -negScale.intY() + 1, 0));

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

    Cuboid region = new Cuboid(negScale.scale(-1), posScale);

    if (region.isIn(relativePosition) && relativePosition.y > 0)
    {
View Full Code Here

      yTranslationPos = this.getModuleCount(ModularForceFieldSystem.itemModuleTranslate, this.getSlotsBasedOnDirection(ForgeDirection.UP));
      yTranslationNeg = this.getModuleCount(ModularForceFieldSystem.itemModuleTranslate, this.getSlotsBasedOnDirection(ForgeDirection.DOWN));
    }

    Vector3 translation = new Vector3(xTranslationPos - xTranslationNeg, yTranslationPos - yTranslationNeg, zTranslationPos - zTranslationNeg);

    if (Settings.USE_CACHE)
    {
      this.cache.put(cacheID, translation);
    }
View Full Code Here

    zScalePos += omnidirectionalScale;
    xScalePos += omnidirectionalScale;
    yScalePos += omnidirectionalScale;

    Vector3 positiveScale = new Vector3(xScalePos, yScalePos, zScalePos);

    if (Settings.USE_CACHE)
    {
      this.cache.put(cacheID, positiveScale);
    }
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.