コード例 #1
0
  public void removeTile(CrystalNetworkTile te) {
    tiles.remove(PylonFinder.getLocation(te));

    if (te instanceof NotifiedNetworkTile) {
      notifyCache.remove(te);
    }
    for (NotifiedNetworkTile tile : notifyCache) {
      tile.onTileNetworkTopologyChange(te, true);
    }

    if (te instanceof TileEntityCrystalPylon) {
      TileEntityCrystalPylon tile = (TileEntityCrystalPylon) te;
      TileEntityCache<TileEntityCrystalPylon> c = pylons.get(tile.getColor());
      if (c != null) c.remove(tile);
    }
    Collection<CrystalFlow> li = flows.get(te.getWorld().provider.dimensionId);
    Iterator<CrystalFlow> it = li.iterator();
    while (it.hasNext()) {
      CrystalFlow p = it.next();
      if (p.contains(te)) {
        CrystalNetworkLogger.logFlowBreak(p, FlowFail.TILE);
        p.resetTiles();
        p.receiver.onPathBroken(p, FlowFail.TILE);
        it.remove();
      }
    }
    PylonFinder.removePathsWithTile(te);
    WorldCrystalNetworkData.initNetworkData(te.getWorld()).setDirty(true); // was false
    if (te instanceof TileEntityCrystalPylon) {
      PylonLocationData.initNetworkData(te.getWorld()).setDirty(true);
    }
  }
コード例 #2
0
  public void addTile(CrystalNetworkTile te) {
    if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
      WorldLocation loc = PylonFinder.getLocation(te);
      CrystalNetworkTile old = tiles.get(loc);
      if (old != null) { // cache cleaning; old TEs may get out of sync for things like charge
        this.removeTile(old);
      }
      tiles.put(loc, te);
      if (te instanceof TileEntityCrystalPylon) {
        this.addPylon((TileEntityCrystalPylon) te);
      }
      this.verifyTileAt(te, loc);

      for (NotifiedNetworkTile tile : notifyCache) {
        tile.onTileNetworkTopologyChange(te, false);
      }

      if (te instanceof NotifiedNetworkTile) {
        notifyCache.add((NotifiedNetworkTile) te);
      }

      WorldCrystalNetworkData.initNetworkData(te.getWorld()).setDirty(true);
      if (te instanceof TileEntityCrystalPylon) {
        PylonLocationData.initNetworkData(te.getWorld()).setDirty(true);
      }
    }
  }