Exemple #1
0
 public Human(ArrayList<Building> buildings) {
   route.addAll(buildings);
   route.get(0).addHuman(this);
   name = WorldHelper.getRandomName();
   surname = WorldHelper.getRandomSurname();
   pesel =
       Integer.toString(new Random().nextInt(400000) + 600000)
           + Integer.toString(new Random().nextInt(100000));
 }
Exemple #2
0
 /**
  * get info to display in info box
  *
  * @return
  */
 @Override
 public ArrayList<HBox> getInfo() {
   ArrayList<HBox> hBoxes = new ArrayList<>();
   hBoxes.add(WorldHelper.createHBox("imię", name));
   hBoxes.add(WorldHelper.createHBox("nazwisko", surname));
   hBoxes.add(WorldHelper.createHBox("pesel", pesel));
   hBoxes.add(WorldHelper.createHBox("cel", route.get(1).toString()));
   String stateText =
       state == WorldHelper.HumanState.IN_PORT
           ? "czekam w " + route.get(0).toString()
           : "w podróży";
   hBoxes.add(WorldHelper.createHBox("stan", stateText));
   hBoxes.add(WorldHelper.createHBox("podróż", tourist == 1 ? "biznesowa" : "turystyczna"));
   return hBoxes;
 }
  @Override
  public void doExplosionB(boolean spawnParticles) {
    worldObj.playSoundEffect(
        this.explosionX,
        this.explosionY,
        this.explosionZ,
        "random.explode",
        4.0F,
        (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F);

    if (this.explosionSize >= 2.0F && this.isSmoking)
      worldObj.spawnParticle(
          "hugeexplosion", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D);
    else
      worldObj.spawnParticle(
          "largeexplode", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D);

    Iterator iterator;
    ChunkPosition chunkposition;
    int i;
    int j;
    int k;
    Block block;
    List<ItemStack> list = Lists.newArrayList();

    if (this.isSmoking) {
      iterator = this.affectedBlockPositions.iterator();

      while (iterator.hasNext()) {
        chunkposition = (ChunkPosition) iterator.next();
        i = chunkposition.chunkPosX;
        j = chunkposition.chunkPosY;
        k = chunkposition.chunkPosZ;
        block = worldObj.getBlock(i, j, k);

        if (spawnParticles) {
          double d0 = (double) ((float) i + worldObj.rand.nextFloat());
          double d1 = (double) ((float) j + worldObj.rand.nextFloat());
          double d2 = (double) ((float) k + worldObj.rand.nextFloat());
          double d3 = d0 - this.explosionX;
          double d4 = d1 - this.explosionY;
          double d5 = d2 - this.explosionZ;
          double d6 = (double) MathHelper.sqrt_double(d3 * d3 + d4 * d4 + d5 * d5);
          d3 /= d6;
          d4 /= d6;
          d5 /= d6;
          double d7 = 0.5D / (d6 / (double) this.explosionSize + 0.1D);
          d7 *= (double) (worldObj.rand.nextFloat() * worldObj.rand.nextFloat() + 0.3F);
          d3 *= d7;
          d4 *= d7;
          d5 *= d7;
          worldObj.spawnParticle(
              "explode",
              (d0 + this.explosionX * 1.0D) / 2.0D,
              (d1 + this.explosionY * 1.0D) / 2.0D,
              (d2 + this.explosionZ * 1.0D) / 2.0D,
              d3,
              d4,
              d5);
          worldObj.spawnParticle("smoke", d0, d1, d2, d3, d4, d5);
        }

        if (block.getMaterial() != Material.air) {
          ArrayList<ItemStack> drops =
              block.getDrops(worldObj, i, j, k, worldObj.getBlockMetadata(i, j, k), 0);
          if (drops != null && drops.size() > 0) list.addAll(drops);

          block.onBlockExploded(worldObj, i, j, k, this);
        }
      }

      Entity ent = this.getExplosivePlacedBy();
      WorldHelper.createLootDrop(list, worldObj, explosionX, explosionY, explosionZ);
    }
  }