Пример #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();
    }
  }
Пример #2
0
  public static PowerSourceList getAllFrom(
      World world,
      ForgeDirection dir,
      int x,
      int y,
      int z,
      PowerSourceTracker io,
      ShaftMerger caller) {
    PowerSourceList pwr = new PowerSourceList();

    TileEntity tile = world.getTileEntity(x, y, z);

    if (caller != null) {
      if (pwr.passesThrough(caller)
          || (tile instanceof ShaftMerger && pwr.passesThrough((ShaftMerger) tile))
          || tile == caller) {
        pwr.isLooping = true;
        caller.onPowerLooped(pwr);
        return pwr;
      }
    }

    if (tile instanceof ShaftMerger) {
      pwr.mergers.add((ShaftMerger) tile);
      if (tile == caller) {
        pwr.isLooping = true;
      }
    }

    try {
      if (tile instanceof TileEntityIOMachine) {
        TileEntityIOMachine te = (TileEntityIOMachine) tile;
        if (!te.isWritingTo(io) && !te.isWritingTo2(io)) {
          return pwr;
        }
        if (te.isReadingFrom(io)
            || te.isReadingFrom2(io)
            || te.isReadingFrom3(io)
            || te.isReadingFrom4(io)) {
          return pwr;
        }
        pwr.addAll(te.getPowerSources(io, caller));
      } else if (tile instanceof PowerSourceTracker) {
        pwr.addAll(((PowerSourceTracker) tile).getPowerSources(io, caller));
      } else if (tile instanceof PowerGenerator) {
        pwr.addSource((PowerGenerator) tile);
      } else if (tile instanceof WorldRift) {
        WorldLocation loc = ((WorldRift) tile).getLinkTarget();
        if (loc != null) {
          int dx = loc.xCoord + dir.offsetX;
          int dy = loc.yCoord + dir.offsetY;
          int dz = loc.zCoord + dir.offsetZ;
          return getAllFrom(world, dir, dx, dy, dz, io, caller);
        }
      }
      pwr.caller = caller;

      if (pwr.passesThrough(caller)) {
        pwr.isLooping = true;
      }

      return pwr;
    } catch (StackOverflowError e) {
      // e.printStackTrace();
      RotaryCraft.logger.logError("PowerSourceList SOE!");
      return pwr;
    }
  }
Пример #3
0
  @Override
  protected void readSyncTag(NBTTagCompound NBT) {
    super.readSyncTag(NBT);

    tank.readFromNBT(NBT);
  }
Пример #4
0
  @Override
  protected void writeSyncTag(NBTTagCompound NBT) {
    super.writeSyncTag(NBT);

    tank.writeToNBT(NBT);
  }