예제 #1
0
  private void createLasers() {
    if (lasers != null) {
      for (EntityBlock entity : lasers) {
        if (entity != null) {
          CoreProxy.proxy.removeEntity(entity);
        }
      }
    }

    lasers = new EntityBlock[12];
    Origin o = origin;

    if (!origin.vect[0].isSet()) {
      o.xMin = origin.vectO.x;
      o.xMax = origin.vectO.x;
    } else if (origin.vect[0].x < xCoord) {
      o.xMin = origin.vect[0].x;
      o.xMax = xCoord;
    } else {
      o.xMin = xCoord;
      o.xMax = origin.vect[0].x;
    }

    if (!origin.vect[1].isSet()) {
      o.yMin = origin.vectO.y;
      o.yMax = origin.vectO.y;
    } else if (origin.vect[1].y < yCoord) {
      o.yMin = origin.vect[1].y;
      o.yMax = yCoord;
    } else {
      o.yMin = yCoord;
      o.yMax = origin.vect[1].y;
    }

    if (!origin.vect[2].isSet()) {
      o.zMin = origin.vectO.z;
      o.zMax = origin.vectO.z;
    } else if (origin.vect[2].z < zCoord) {
      o.zMin = origin.vect[2].z;
      o.zMax = zCoord;
    } else {
      o.zMin = zCoord;
      o.zMax = origin.vect[2].z;
    }

    lasers =
        Utils.createLaserBox(
            worldObj, o.xMin, o.yMin, o.zMin, o.xMax, o.yMax, o.zMax, LaserKind.Red);
  }
  @SideOnly(Side.CLIENT)
  public void activateLasers() {
    deactivateLasers();
    EntityClientPlayerMP player = FMLClientHandler.instance().getClient().thePlayer;
    int playerY = (int) player.posY - 1;
    for (ChunkCoordIntPair coords : persistentChunks) {
      int xCoord = coords.chunkXPos * 16;
      int zCoord = coords.chunkZPos * 16;

      addLasersToList(
          Utils.createLaserBox(
              player.worldObj,
              xCoord,
              playerY,
              zCoord,
              xCoord + 16,
              playerY,
              zCoord + 16,
              buildcraft.core.LaserKind.Blue));
      addLasersToList(
          Utils.createLaserBox(
              player.worldObj,
              xCoord,
              playerY - 20,
              zCoord,
              xCoord + 16,
              playerY - 20,
              zCoord + 16,
              buildcraft.core.LaserKind.Blue));
      addLasersToList(
          Utils.createLaserBox(
              player.worldObj,
              xCoord,
              playerY + 20,
              zCoord,
              xCoord + 16,
              playerY + 20,
              zCoord + 16,
              buildcraft.core.LaserKind.Blue));

      addLasersToList(
          Utils.createLaserBox(
              player.worldObj,
              xCoord + 7,
              playerY,
              zCoord + 7,
              xCoord + 9,
              playerY,
              zCoord + 9,
              buildcraft.core.LaserKind.Blue));
      addLasersToList(
          Utils.createLaserBox(
              player.worldObj,
              xCoord + 7,
              playerY - 20,
              zCoord + 7,
              xCoord + 9,
              playerY - 20,
              zCoord + 9,
              buildcraft.core.LaserKind.Blue));
      addLasersToList(
          Utils.createLaserBox(
              player.worldObj,
              xCoord + 7,
              playerY + 20,
              zCoord + 7,
              xCoord + 9,
              playerY + 20,
              zCoord + 9,
              buildcraft.core.LaserKind.Blue));
    }
    active = true;
  }