Package buildcraft.api.transport

Examples of buildcraft.api.transport.IPipePluggable


    return canPipeConnect_internal(with, side);
  }

  protected boolean hasBlockingPluggable(ForgeDirection side) {
    IPipePluggable pluggable = sideProperties.pluggables[side.ordinal()];
    return pluggable != null && pluggable.blocking(this, side);
  }
View Full Code Here


    return true;
  }

  private void updateCoreState() {
    for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
      IPipePluggable pluggable = sideProperties.pluggables[i];
      coreState.gates[i] = pluggable instanceof ItemGate.GatePluggable ? (ItemGate.GatePluggable) pluggable : null;
    }
  }
View Full Code Here

  public boolean hasEnabledFacade(ForgeDirection direction) {
    return hasFacade(direction) && !renderState.facadeMatrix.getFacadeTransparent(direction);
  }

  public ItemStack getFacade(ForgeDirection direction) {
    IPipePluggable pluggable = sideProperties.pluggables[direction.ordinal()];
    return pluggable instanceof ItemFacade.FacadePluggable ?
        ItemFacade.getFacade(((ItemFacade.FacadePluggable) pluggable).states) : null;
  }
View Full Code Here

    return pluggable instanceof ItemFacade.FacadePluggable ?
        ItemFacade.getFacade(((ItemFacade.FacadePluggable) pluggable).states) : null;
  }

  public DockingStation getStation(ForgeDirection direction) {
    IPipePluggable pluggable = sideProperties.pluggables[direction.ordinal()];
    return pluggable instanceof ItemRobotStation.RobotStationPluggable ?
        ((ItemRobotStation.RobotStationPluggable) pluggable).getStation() : null;
  }
View Full Code Here

  public static class SideProperties {
    IPipePluggable[] pluggables = new IPipePluggable[ForgeDirection.VALID_DIRECTIONS.length];

    public void writeToNBT(NBTTagCompound nbt) {
      for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
        IPipePluggable pluggable = pluggables[i];
        final String key = "pluggable[" + i + "]";
        if (pluggable == null) {
          nbt.removeTag(key);
        } else {
          NBTTagCompound pluggableData = new NBTTagCompound();
          pluggableData.setString("pluggableClass", pluggable.getClass().getName());
          pluggable.writeToNBT(pluggableData);
          nbt.setTag(key, pluggableData);
        }
      }
    }
View Full Code Here

          Class<?> pluggableClass = Class.forName(pluggableData.getString("pluggableClass"));
          if (!IPipePluggable.class.isAssignableFrom(pluggableClass)) {
            BCLog.logger.warn("Wrong pluggable class: " + pluggableClass);
            continue;
          }
          IPipePluggable pluggable = (IPipePluggable) pluggableClass.newInstance();
          pluggable.readFromNBT(pluggableData);
          pluggables[i] = pluggable;
        } catch (Exception e) {
          BCLog.logger.warn("Failed to load side state");
          e.printStackTrace();
        }
      }

      // Migration code
      for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
        IPipePluggable pluggable = null;
        if (nbt.hasKey("facadeState[" + i + "]")) {
          pluggable = new ItemFacade.FacadePluggable(FacadeState.readArray(nbt.getTagList("facadeState[" + i + "]", Constants.NBT.TAG_COMPOUND)));
        } else {
          // Migration support for 5.0.x and 6.0.x
          if (nbt.hasKey("facadeBlocks[" + i + "]")) {
View Full Code Here

      pluggables = newPluggables;
    }

    public boolean dropItem(TileGenericPipe pipe, ForgeDirection direction) {
      boolean result = false;
      IPipePluggable pluggable = pluggables[direction.ordinal()];
      if (pluggable != null) {
        pluggable.onDetachedPipe(pipe, direction);
        ItemStack[] stacks = pluggable.getDropItems(pipe);
        if (stacks != null) {
          for (ItemStack stack : stacks) {
            InvUtils.dropItems(pipe.worldObj, stack, pipe.xCoord, pipe.yCoord, pipe.zCoord);
          }
        }
View Full Code Here

      }
    }

    public void validate(TileGenericPipe pipe) {
      for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
        IPipePluggable p = pluggables[d.ordinal()];

        if (p != null) {
          p.validate(pipe, d);
        }
      }
    }
View Full Code Here

TOP

Related Classes of buildcraft.api.transport.IPipePluggable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.