Exemplo n.º 1
0
  @Override
  public void removeFromWorld() {
    if (!origin.isSet()) {
      return;
    }

    Origin o = origin;

    for (TileWrapper m : o.vect.clone()) {
      if (m.isSet()) {
        worldObj.setBlockToAir(m.x, m.y, m.z);

        BuildCraftBuilders.markerBlock.dropBlockAsItem(worldObj, m.x, m.y, m.z, 0, 0);
      }
    }

    worldObj.setBlockToAir(o.vectO.x, o.vectO.y, o.vectO.z);

    BuildCraftBuilders.markerBlock.dropBlockAsItem(worldObj, o.vectO.x, o.vectO.y, o.vectO.z, 0, 0);
  }
Exemplo n.º 2
0
  @Override
  public void postPacketHandling(PacketUpdate packet) {
    super.postPacketHandling(packet);

    switchSignals();

    if (origin.vectO.isSet()) {
      origin.vectO.getMarker(worldObj).updateSignals();

      for (TileWrapper w : origin.vect) {
        TileMarker m = w.getMarker(worldObj);

        if (m != null) {
          m.updateSignals();
        }
      }
    }

    createLasers();
  }
Exemplo n.º 3
0
 public boolean isSet() {
   return vectO.isSet();
 }
Exemplo n.º 4
0
  @Override
  public void destroy() {
    TileMarker markerOrigin = null;

    if (origin.isSet()) {
      markerOrigin = origin.vectO.getMarker(worldObj);

      Origin o = origin;

      if (markerOrigin != null && markerOrigin.lasers != null) {
        for (EntityBlock entity : markerOrigin.lasers) {
          if (entity != null) {
            entity.setDead();
          }
        }
        markerOrigin.lasers = null;
      }

      for (TileWrapper m : o.vect) {
        TileMarker mark = m.getMarker(worldObj);

        if (mark != null) {
          if (mark.lasers != null) {
            for (EntityBlock entity : mark.lasers) {
              if (entity != null) {
                entity.setDead();
              }
            }
            mark.lasers = null;
          }

          if (mark != this) {
            mark.origin = new Origin();
          }
        }
      }

      if (markerOrigin != this && markerOrigin != null) {
        markerOrigin.origin = new Origin();
      }

      for (TileWrapper wrapper : o.vect) {
        TileMarker mark = wrapper.getMarker(worldObj);

        if (mark != null) {
          mark.updateSignals();
        }
      }
      if (markerOrigin != null) {
        markerOrigin.updateSignals();
      }
    }

    if (signals != null) {
      for (EntityBlock block : signals) {
        if (block != null) {
          block.setDead();
        }
      }
    }

    signals = null;

    if (!worldObj.isRemote && markerOrigin != null && markerOrigin != this) {
      markerOrigin.sendNetworkUpdate();
    }
  }