@Override
  public TMultiPart newPart(
      ItemStack stack,
      EntityPlayer player,
      World world,
      BlockCoord coord,
      int face,
      Vector3 vecHit) {
    TransmitterType type = TransmitterType.values()[stack.getItemDamage()];

    if (type.getTransmission() != TransmissionType.ITEM) {
      Coord4D obj = new Coord4D(coord.x, coord.y, coord.z, world.provider.dimensionId);

      List<ITransmitterNetwork<?, ?>> networks = new ArrayList<ITransmitterNetwork<?, ?>>();

      for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
        TileEntity tile = obj.getFromSide(side).getTileEntity(world);

        if (tile instanceof IGridTransmitter
            && TransmissionType.checkTransmissionType(tile, type.getTransmission())) {
          networks.add(((IGridTransmitter) tile).getTransmitterNetwork());
        }
      }

      if (networks.size() > 0) {
        if (!networks.iterator().next().canMerge(networks)) {
          return null;
        }
      }
    }

    return PartTransmitter.getPartType(TransmitterType.values()[getDamage(stack)]);
  }
Exemple #2
0
 public static boolean isCable(TileEntity tileEntity) {
   return TransmissionType.checkTransmissionType(tileEntity, TransmissionType.ENERGY);
 }
Exemple #3
0
 public static boolean checkTransmissionType(
     TileEntity tile1, TransmissionType type, TileEntity tile2) {
   return type.checkTransmissionType(tile1, tile2);
 }
Exemple #4
0
 public static boolean checkTransmissionType(ITransmitter sideTile, TransmissionType type) {
   return type.checkTransmissionType(sideTile);
 }