Beispiel #1
0
  public void onBlockRemoval() {
    if (wireSet[IPipe.WireColor.Red.ordinal()]) {
      Utils.dropItems(
          worldObj, new ItemStack(BuildCraftTransport.redPipeWire), xCoord, yCoord, zCoord);
    }

    if (wireSet[IPipe.WireColor.Blue.ordinal()]) {
      Utils.dropItems(
          worldObj, new ItemStack(BuildCraftTransport.bluePipeWire), xCoord, yCoord, zCoord);
    }

    if (wireSet[IPipe.WireColor.Green.ordinal()]) {
      Utils.dropItems(
          worldObj, new ItemStack(BuildCraftTransport.greenPipeWire), xCoord, yCoord, zCoord);
    }

    if (wireSet[IPipe.WireColor.Yellow.ordinal()]) {
      Utils.dropItems(
          worldObj, new ItemStack(BuildCraftTransport.yellowPipeWire), xCoord, yCoord, zCoord);
    }

    if (hasGate()) {
      gate.dropGate(worldObj, xCoord, yCoord, zCoord);
    }

    for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
      if (container.hasFacade(direction)) {
        container.dropFacade(direction);
      }
      if (container.hasPlug(direction)) {
        container.removeAndDropPlug(direction);
      }
    }

    if (broadcastRedstone) {
      updateNeighbors(false); // self will update due to block id changing
    }
  }
  @Override
  public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int i, int j, int k) {
    float xMin = Utils.pipeMinPos,
        xMax = Utils.pipeMaxPos,
        yMin = Utils.pipeMinPos,
        yMax = Utils.pipeMaxPos,
        zMin = Utils.pipeMinPos,
        zMax = Utils.pipeMaxPos;

    TileEntity tile1 = world.getBlockTileEntity(i, j, k);

    if (tile1 instanceof TileGenericPipe) {
      TileGenericPipe tileG = (TileGenericPipe) tile1;
      if (tileG.isPipeConnected(ForgeDirection.WEST) || tileG.hasFacade(ForgeDirection.WEST)) {
        xMin = 0.0F;
      }

      if (tileG.isPipeConnected(ForgeDirection.EAST) || tileG.hasFacade(ForgeDirection.EAST)) {
        xMax = 1.0F;
      }

      if (tileG.isPipeConnected(ForgeDirection.DOWN) || tileG.hasFacade(ForgeDirection.DOWN)) {
        yMin = 0.0F;
      }

      if (tileG.isPipeConnected(ForgeDirection.UP) || tileG.hasFacade(ForgeDirection.UP)) {
        yMax = 1.0F;
      }

      if (tileG.isPipeConnected(ForgeDirection.NORTH) || tileG.hasFacade(ForgeDirection.NORTH)) {
        zMin = 0.0F;
      }

      if (tileG.isPipeConnected(ForgeDirection.SOUTH) || tileG.hasFacade(ForgeDirection.SOUTH)) {
        zMax = 1.0F;
      }

      if (tileG.hasFacade(ForgeDirection.EAST) || tileG.hasFacade(ForgeDirection.WEST)) {
        yMin = 0.0F;
        yMax = 1.0F;
        zMin = 0.0F;
        zMax = 1.0F;
      }

      if (tileG.hasFacade(ForgeDirection.UP) || tileG.hasFacade(ForgeDirection.DOWN)) {
        xMin = 0.0F;
        xMax = 1.0F;
        zMin = 0.0F;
        zMax = 1.0F;
      }

      if (tileG.hasFacade(ForgeDirection.SOUTH) || tileG.hasFacade(ForgeDirection.NORTH)) {
        xMin = 0.0F;
        xMax = 1.0F;
        yMin = 0.0F;
        yMax = 1.0F;
      }
    }

    return AxisAlignedBB.getBoundingBox(
        (double) i + xMin,
        (double) j + yMin,
        (double) k + zMin,
        (double) i + xMax,
        (double) j + yMax,
        (double) k + zMax);
  }
  @SuppressWarnings("rawtypes")
  @Override
  public void addCollisionBoxesToList(
      World world,
      int i,
      int j,
      int k,
      AxisAlignedBB axisalignedbb,
      List arraylist,
      Entity par7Entity) {
    setBlockBounds(
        Utils.pipeMinPos,
        Utils.pipeMinPos,
        Utils.pipeMinPos,
        Utils.pipeMaxPos,
        Utils.pipeMaxPos,
        Utils.pipeMaxPos);
    super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);

    TileEntity tile1 = world.getBlockTileEntity(i, j, k);
    TileGenericPipe tileG = (TileGenericPipe) tile1;

    if (tileG.isPipeConnected(ForgeDirection.WEST)) {
      setBlockBounds(
          0.0F,
          Utils.pipeMinPos,
          Utils.pipeMinPos,
          Utils.pipeMaxPos,
          Utils.pipeMaxPos,
          Utils.pipeMaxPos);
      super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
    }

    if (tileG.isPipeConnected(ForgeDirection.EAST)) {
      setBlockBounds(
          Utils.pipeMinPos,
          Utils.pipeMinPos,
          Utils.pipeMinPos,
          1.0F,
          Utils.pipeMaxPos,
          Utils.pipeMaxPos);
      super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
    }

    if (tileG.isPipeConnected(ForgeDirection.DOWN)) {
      setBlockBounds(
          Utils.pipeMinPos,
          0.0F,
          Utils.pipeMinPos,
          Utils.pipeMaxPos,
          Utils.pipeMaxPos,
          Utils.pipeMaxPos);
      super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
    }

    if (tileG.isPipeConnected(ForgeDirection.UP)) {
      setBlockBounds(
          Utils.pipeMinPos,
          Utils.pipeMinPos,
          Utils.pipeMinPos,
          Utils.pipeMaxPos,
          1.0F,
          Utils.pipeMaxPos);
      super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
    }

    if (tileG.isPipeConnected(ForgeDirection.NORTH)) {
      setBlockBounds(
          Utils.pipeMinPos,
          Utils.pipeMinPos,
          0.0F,
          Utils.pipeMaxPos,
          Utils.pipeMaxPos,
          Utils.pipeMaxPos);
      super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
    }

    if (tileG.isPipeConnected(ForgeDirection.SOUTH)) {
      setBlockBounds(
          Utils.pipeMinPos,
          Utils.pipeMinPos,
          Utils.pipeMinPos,
          Utils.pipeMaxPos,
          Utils.pipeMaxPos,
          1.0F);
      super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
    }

    if (tileG != null) {
      float facadeThickness = PipeWorldRenderer.facadeThickness;

      if (tileG.hasFacade(ForgeDirection.EAST)) {
        setBlockBounds(1 - facadeThickness, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
        super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
      }

      if (tileG.hasFacade(ForgeDirection.WEST)) {
        setBlockBounds(0.0F, 0.0F, 0.0F, facadeThickness, 1.0F, 1.0F);
        super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
      }

      if (tileG.hasFacade(ForgeDirection.UP)) {
        setBlockBounds(0.0F, 1 - facadeThickness, 0.0F, 1.0F, 1.0F, 1.0F);
        super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
      }

      if (tileG.hasFacade(ForgeDirection.DOWN)) {
        setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, facadeThickness, 1.0F);
        super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
      }

      if (tileG.hasFacade(ForgeDirection.SOUTH)) {
        setBlockBounds(0.0F, 0.0F, 1 - facadeThickness, 1.0F, 1.0F, 1.0F);
        super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
      }

      if (tileG.hasFacade(ForgeDirection.NORTH)) {
        setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, facadeThickness);
        super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
      }
    }

    setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
  }