Ejemplo n.º 1
0
  @Override
  public void updateEntity(World world, int x, int y, int z, int meta) {
    super.updateTileEntity();
    int temp = (int) (15 * this.getArraySize() * this.getArrayOverallBrightness());
    for (int i = -3; i <= 3; i++) {
      for (int j = -3; j <= 3; j++) {
        if (ConfigRegistry.BLOCKDAMAGE.getState()) {
          ReikaWorldHelper.temperatureEnvironment(world, x + i, y + 1, z + j, Math.min(temp, 1750));
          if (temp >= 1500) {
            this.delete();
            world.setBlock(x, y, z, Blocks.flowing_lava);
          }
        }
        AxisAlignedBB above =
            AxisAlignedBB.getBoundingBox(x + i, y + 1, z + j, x + i + 1, y + 2, z + j + 1);
        List<EntityLivingBase> in = world.getEntitiesWithinAABB(EntityLivingBase.class, above);
        for (EntityLivingBase e : in) {
          if (temp > 400) e.setFire(3);
        }
      }
    }
    if (world.getBlock(x, y - 1, z) == Blocks.air
        || MachineRegistry.getMachine(world, x, y - 1, z) != this.getMachine()) {
      // ReikaJavaLibrary.pConsole("TOWER: "+this.getTowerHeight()+";  SIZE: "+this.getArraySize());
      this.generatePower(world, x, y, z);
    } else {
      write = null;
    }
    if (world.getBlock(x, y + 1, z) != Blocks.air) return;

    mirrorTimer.update();
    if (mirrorTimer.checkCap()) {
      if (solarBlocks.isEmpty()) {
        lightMultiplier = 0;
        solarBlocks.recursiveAdd(world, x, y, z, this.getTileEntityBlockID());
        numberMirrors = solarBlocks.getSize();
        while (solarBlocks.getSize() > 0) {
          Coordinate c = solarBlocks.getNextAndMoveOn();
          MachineRegistry m = MachineRegistry.getMachine(world, c.xCoord, c.yCoord, c.zCoord);
          if (m == MachineRegistry.MIRROR) {
            TileEntityMirror te =
                (TileEntityMirror) world.getTileEntity(c.xCoord, c.yCoord, c.zCoord);
            te.targetloc = new Coordinate(x, y, z);
            float light = te.getLightLevel();
            lightMultiplier += light;
          } else numberMirrors--;
        }
        lightMultiplier /= 15F;
        lightMultiplier /= numberMirrors;
      }
    }

    if (write != null) {
      this.basicPowerReceiver();
    }
  }
 public void setColor(CrystalElement e) {
   if (worldObj.isRemote) return;
   color = e;
   BlockArray runes = this.getRuneLocations(worldObj, xCoord, yCoord, zCoord);
   for (int i = 0; i < runes.getSize(); i++) {
     Coordinate c = runes.getNthBlock(i);
     if (c.getBlock(worldObj) == ChromaBlocks.RUNE.getBlockInstance())
       worldObj.setBlockMetadataWithNotify(c.xCoord, c.yCoord, c.zCoord, color.ordinal(), 3);
   }
 }
Ejemplo n.º 3
0
  @Override
  public void overheat(World world, int x, int y, int z) {
    BlockArray blocks = new BlockArray();
    MachineRegistry m = this.getMachine();
    blocks.recursiveAddWithMetadata(world, x, y, z, m.getBlock(), m.getMachineMetadata());

    for (int i = 0; i < blocks.getSize(); i++) {
      Coordinate c = blocks.getNthBlock(i);
      ReikaSoundHelper.playSoundAtBlock(
          world, c.xCoord, c.yCoord, c.zCoord, "random.fizz", 0.4F, 1);
      ReikaParticleHelper.LAVA.spawnAroundBlock(world, c.xCoord, c.yCoord, c.zCoord, 36);
      c.setBlock(world, Blocks.flowing_lava);
    }
  }
  private BlockArray getRuneLocations(World world, int x, int y, int z) {
    BlockArray blocks = new BlockArray();
    blocks.addBlockCoordinate(x - 3, y - 4, z - 1);
    blocks.addBlockCoordinate(x - 1, y - 4, z - 3);

    blocks.addBlockCoordinate(x + 3, y - 4, z - 1);
    blocks.addBlockCoordinate(x + 1, y - 4, z - 3);

    blocks.addBlockCoordinate(x - 3, y - 4, z + 1);
    blocks.addBlockCoordinate(x - 1, y - 4, z + 3);

    blocks.addBlockCoordinate(x + 3, y - 4, z + 1);
    blocks.addBlockCoordinate(x + 1, y - 4, z + 3);
    return blocks;
  }