Package colonies.src

Examples of colonies.src.Point


    return true;
  }
 
  @Override
  public void startExecuting(){
    destination = new Point(citizen.employer);
    citizen.getNavigator().tryMoveToXYZ(destination.x, destination.y, destination.z, 0.35f);
  }
View Full Code Here


  }
 
    public void startExecuting()
    {
      if(citizen.homeTown == null) return;
      destination = new Point(citizen.homeTown);
       citizen.getNavigator().tryMoveToXYZ(destination.x, destination.y+1, destination.z, 0.25f);
    }
View Full Code Here

    public boolean continueExecuting()
    {
      // if destination not yet established, search for shelter
      if(destination == null){
        Point candidate = new Point();
        for(int i = 0; i < 10; ++i){
          candidate.polarTranslation(Utility.rng.nextRadian(), Math.PI/2, Utility.rng.nextInt(20));
          candidate.plus(citizen.posX, citizen.posY, citizen.posZ);
          Utility.terrainAdjustment(citizen.worldObj, candidate);
          if(!citizen.worldObj.canBlockSeeTheSky((int)candidate.x, (int)candidate.y, (int)candidate.z)){
            destination = candidate;
            citizen.getNavigator().tryMoveToXYZ(destination.x, destination.y, destination.z, 0.35f);
          } // else try another spot
View Full Code Here

             }
         
             newGuy.giveName();
            
          // pick a random direction at the town perimeter
          Point p = new Point(this.xCoord, this.yCoord, this.zCoord);
          Point q = new Point();
          Utility.Debug(p.toString());
          q.polarTranslation(Utility.rng.nextRadian(), (float)(Math.PI/2.2), 14d);
          p.plus(q);
          this.terrainAdjustment(p);

          // spawn mob
            newGuy.setLocationAndAngles(Math.floor(p.x), Math.floor(p.y), Math.floor(p.z), Utility.rng.nextFloat()*360.0f, 0.0f);
View Full Code Here

  public String getTextureFile(){
    return ClientProxy.CHESTCONTAINER_PNG;
  }
 
  public Point getPoint(){
    return new Point(this.xCoord, this.yCoord, this.zCoord);
  }
View Full Code Here

      // player town border markers
      // CLIENT SIDE ONLY
      // if(world.isRemote) return;
     
      Point p = new Point();
      for(int angle = 0; angle < 32; ++angle){
        p.set(0, 0, 0);
        p.polarTranslation((float)angle/32.0 * 2*Math.PI, Math.PI/2, 14d);
        p.plus(x, y, z);
        this.terrainAdjustment(world, p);
        world.spawnParticle("reddust", p.x, p.y+0.5, p.z, -0.5,0.5,0.8);
      }
    }
View Full Code Here

        Utility.chatMessage("Place a town hall first");
        return false;
        }
        else{
          // RULE: place only within town
          Point here = new Point(x,y,z);
          double distanceToTown = here.getDistance(TileEntityTownHall.playerTown.getPoint());
          if(Math.floor(distanceToTown) > Math.floor(TileEntityTownHall.playerTown.townPerimeter)){
            Utility.chatMessage("Too far from Town. "
                + (int)distanceToTown + "m > "
                + (int)TileEntityTownHall.playerTown.townPerimeter + "m");
            return false;
View Full Code Here

  public boolean continueExecuting()
  {
   
    if(destination == null && this.bottomOfTree == null) { // suitable destination not yet established
     
      Point candidate = new Point();
      int blockID = 0;
     
      for(int i = 0; i < 100; ++i) {
       
        //choose a spot 5-10m away from citizen in a random direction
//        candidate.polarTranslation(Utility.rng.nextRadian(), Math.PI/2, 5 + Utility.rng.nextInt(5));
//        candidate.plus(citizen.posX, citizen.posY, citizen.posZ);
       
        Vec3 tempVec = this.lookForWorkLocation();       
       
        if ( tempVec != null ) {
          candidate.x = tempVec.xCoord;
          candidate.y = tempVec.yCoord;
          candidate.z = tempVec.zCoord;
        }
       
        // move destination away from logging camp if necessary
        if(candidate.getDistance(citizen.homeTown.xCoord, citizen.homeTown.yCoord, citizen.homeTown.zCoord) < 10){
          double theta = Math.atan2(candidate.y - citizen.homeTown.yCoord, candidate.x - citizen.homeTown.xCoord);
          candidate.polarTranslation(theta, Math.PI/2, 10);
        }     
        //Utility.terrainAdjustment(citizen.worldObj, candidate);     
       
        blockID = citizen.worldObj.getBlockId((int)candidate.x, (int)candidate.y, (int)candidate.z);         
        if( blockID == Block.wood.blockID  ) //TODO: look for a tree here with leaves.
View Full Code Here

  }
 
 
  private void findGroundPoint()
    {
    bottomOfTree = new Point(destination.x, destination.y, destination.z);
   
        while ( taskEntityWorld.getBlockId((int)Math.floor(bottomOfTree.x), (int)Math.floor(bottomOfTree.y), (int)Math.floor(bottomOfTree.z)) != Block.dirt.blockID  )
        {
          bottomOfTree.y--;
        }       
View Full Code Here

    }
 
  private void findTopOfTree() {
   
    topOfTree = new Point(destination.x, destination.y, destination.z);
   
        while (( taskEntityWorld.getBlockId((int)Math.floor(topOfTree.x), (int)Math.floor(topOfTree.y), (int)Math.floor(topOfTree.z)) ==  Block.leaves.blockID ||
            taskEntityWorld.getBlockId((int)Math.floor(topOfTree.x), (int)Math.floor(topOfTree.y), (int)Math.floor(topOfTree.z)) == Block.wood.blockID ) && 
            !this.taskEntityWorld.canBlockSeeTheSky((int)topOfTree.x, (int)topOfTree.y, (int)topOfTree.z))
        {
View Full Code Here

TOP

Related Classes of colonies.src.Point

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.