Package appeng.api.util

Examples of appeng.api.util.AEItemDefinition


    Items items = appeng.core.Api.instance.items();
    Materials materials = appeng.core.Api.instance.materials();
    Parts parts = appeng.core.Api.instance.parts();
    Blocks blocks = appeng.core.Api.instance.blocks();

    AEItemDefinition materialItem = addFeature( ItemMultiMaterial.class );

    Class materialClass = materials.getClass();
    for (MaterialType mat : MaterialType.values())
    {
      try
      {
        if ( mat == MaterialType.InvalidType )
          ((ItemMultiMaterial) materialItem.item()).createMaterial( mat );
        else
        {
          Field f = materialClass.getField( "material" + mat.name() );
          IStackSrc is = ((ItemMultiMaterial) materialItem.item()).createMaterial( mat );
          if ( is != null )
            f.set( materials, new DamagedItemDefinition( is ) );
          else
            f.set( materials, new NullItemDefinition() );
        }
      }
      catch (Throwable err)
      {
        AELog.severe( "Error creating material: " + mat.name() );
        throw new RuntimeException( err );
      }
    }

    AEItemDefinition partItem = addFeature( ItemMultiPart.class );

    Class partClass = parts.getClass();
    for (PartType type : PartType.values())
    {
      try
      {
        if ( type == PartType.InvalidType )
          ((ItemMultiPart) partItem.item()).createPart( type, null );
        else
        {
          Field f = partClass.getField( "part" + type.name() );
          Enum variants[] = type.getVariants();
          if ( variants == null )
          {
            ItemStackSrc is = ((ItemMultiPart) partItem.item()).createPart( type, null );
            if ( is != null )
              f.set( parts, new DamagedItemDefinition( is ) );
            else
              f.set( parts, new NullItemDefinition() );
          }
          else
          {
            if ( variants[0] instanceof AEColor )
            {
              ColoredItemDefinition def = new ColoredItemDefinition();

              for (Enum v : variants)
              {
                ItemStackSrc is = ((ItemMultiPart) partItem.item()).createPart( type, v );
                if ( is != null )
                  def.add( (AEColor) v, is );
              }

              f.set( parts, def );
            }
          }
        }
      }
      catch (Throwable err)
      {
        AELog.severe( "Error creating part: " + type.name() );
        throw new RuntimeException( err );
      }
    }

    // very important block!
    blocks.blockMultiPart = addFeature( BlockCableBus.class );

    blocks.blockCraftingUnit = addFeature( BlockCraftingUnit.class );
    blocks.blockCraftingAccelerator = new WrappedDamageItemDefinition( blocks.blockCraftingUnit, 1 );
    blocks.blockCraftingMonitor = addFeature( BlockCraftingMonitor.class );
    blocks.blockCraftingStorage1k = addFeature( BlockCraftingStorage.class );
    blocks.blockCraftingStorage4k = new WrappedDamageItemDefinition( blocks.blockCraftingStorage1k, 1 );
    blocks.blockCraftingStorage16k = new WrappedDamageItemDefinition( blocks.blockCraftingStorage1k, 2 );
    blocks.blockCraftingStorage64k = new WrappedDamageItemDefinition( blocks.blockCraftingStorage1k, 3 );
    blocks.blockMolecularAssembler = addFeature( BlockMolecularAssembler.class );

    blocks.blockQuartzOre = addFeature( OreQuartz.class );
    blocks.blockQuartzOreCharged = addFeature( OreQuartzCharged.class );
    blocks.blockMatrixFrame = addFeature( BlockMatrixFrame.class );
    blocks.blockQuartz = addFeature( BlockQuartz.class );
    blocks.blockFluix = addFeature( BlockFluix.class );
    blocks.blockSkyStone = addFeature( BlockSkyStone.class );
    blocks.blockSkyChest = addFeature( BlockSkyChest.class );
    blocks.blockSkyCompass = addFeature( BlockSkyCompass.class );

    blocks.blockQuartzGlass = addFeature( BlockQuartzGlass.class );
    blocks.blockQuartzVibrantGlass = addFeature( BlockQuartzLamp.class );
    blocks.blockQuartzPillar = addFeature( BlockQuartzPillar.class );
    blocks.blockQuartzChiseled = addFeature( BlockQuartzChiseled.class );
    blocks.blockQuartzTorch = addFeature( BlockQuartzTorch.class );
    blocks.blockLightDetector = addFeature( BlockLightDetector.class );
    blocks.blockCharger = addFeature( BlockCharger.class );
    blocks.blockQuartzGrowthAccelerator = addFeature( BlockQuartzGrowthAccelerator.class );

    blocks.blockGrindStone = addFeature( BlockGrinder.class );
    blocks.blockCrankHandle = addFeature( BlockCrank.class );
    blocks.blockInscriber = addFeature( BlockInscriber.class );
    blocks.blockWireless = addFeature( BlockWireless.class );
    blocks.blockTinyTNT = addFeature( BlockTinyTNT.class );

    blocks.blockQuantumRing = addFeature( BlockQuantumRing.class );
    blocks.blockQuantumLink = addFeature( BlockQuantumLinkChamber.class );

    blocks.blockSpatialPylon = addFeature( BlockSpatialPylon.class );
    blocks.blockSpatialIOPort = addFeature( BlockSpatialIOPort.class );

    blocks.blockController = addFeature( BlockController.class );
    blocks.blockDrive = addFeature( BlockDrive.class );
    blocks.blockChest = addFeature( BlockChest.class );
    blocks.blockInterface = addFeature( BlockInterface.class );
    blocks.blockCellWorkbench = addFeature( BlockCellWorkbench.class );
    blocks.blockIOPort = addFeature( BlockIOPort.class );
    blocks.blockCondenser = addFeature( BlockCondenser.class );
    blocks.blockEnergyAcceptor = addFeature( BlockEnergyAcceptor.class );
    blocks.blockVibrationChamber = addFeature( BlockVibrationChamber.class );

    blocks.blockEnergyCell = addFeature( BlockEnergyCell.class );
    blocks.blockEnergyCellDense = addFeature( BlockDenseEnergyCell.class );
    blocks.blockEnergyCellCreative = addFeature( BlockCreativeEnergyCell.class );

    blocks.blockSecurity = addFeature( BlockSecurity.class );
    blocks.blockPaint = addFeature( BlockPaint.class );

    items.itemCellCreative = addFeature( ItemCreativeStorageCell.class );
    items.itemViewCell = addFeature( ItemViewCell.class );
    items.itemEncodedPattern = addFeature( ItemEncodedPattern.class );

    items.itemCell1k = addFeature( ItemBasicStorageCell.class, MaterialType.Cell1kPart, 1 );
    items.itemCell4k = addFeature( ItemBasicStorageCell.class, MaterialType.Cell4kPart, 4 );
    items.itemCell16k = addFeature( ItemBasicStorageCell.class, MaterialType.Cell16kPart, 16 );
    items.itemCell64k = addFeature( ItemBasicStorageCell.class, MaterialType.Cell64kPart, 64 );

    items.itemSpatialCell2 = addFeature( ItemSpatialStorageCell.class, MaterialType.Cell2SpatialPart, 2 );
    items.itemSpatialCell16 = addFeature( ItemSpatialStorageCell.class, MaterialType.Cell16SpatialPart, 16 );
    items.itemSpatialCell128 = addFeature( ItemSpatialStorageCell.class, MaterialType.Cell128SpatialPart, 128 );

    items.itemCertusQuartzKnife = addFeature( ToolQuartzCuttingKnife.class, AEFeature.CertusQuartzTools );
    items.itemCertusQuartzWrench = addFeature( ToolQuartzWrench.class, AEFeature.CertusQuartzTools );
    items.itemCertusQuartzAxe = addFeature( ToolQuartzAxe.class, AEFeature.CertusQuartzTools );
    items.itemCertusQuartzHoe = addFeature( ToolQuartzHoe.class, AEFeature.CertusQuartzTools );
    items.itemCertusQuartzPick = addFeature( ToolQuartzPickaxe.class, AEFeature.CertusQuartzTools );
    items.itemCertusQuartzShovel = addFeature( ToolQuartzSpade.class, AEFeature.CertusQuartzTools );
    items.itemCertusQuartzSword = addFeature( ToolQuartzSword.class, AEFeature.CertusQuartzTools );

    items.itemNetherQuartzKnife = addFeature( ToolQuartzCuttingKnife.class, AEFeature.NetherQuartzTools );
    items.itemNetherQuartzWrench = addFeature( ToolQuartzWrench.class, AEFeature.NetherQuartzTools );
    items.itemNetherQuartzAxe = addFeature( ToolQuartzAxe.class, AEFeature.NetherQuartzTools );
    items.itemNetherQuartzHoe = addFeature( ToolQuartzHoe.class, AEFeature.NetherQuartzTools );
    items.itemNetherQuartzPick = addFeature( ToolQuartzPickaxe.class, AEFeature.NetherQuartzTools );
    items.itemNetherQuartzShovel = addFeature( ToolQuartzSpade.class, AEFeature.NetherQuartzTools );
    items.itemNetherQuartzSword = addFeature( ToolQuartzSword.class, AEFeature.NetherQuartzTools );

    items.itemMassCannon = addFeature( ToolMassCannon.class );
    items.itemMemoryCard = addFeature( ToolMemoryCard.class );
    items.itemChargedStaff = addFeature( ToolChargedStaff.class );
    items.itemEntropyManipulator = addFeature( ToolEntropyManipulator.class );
    items.itemColorApplicator = addFeature( ToolColorApplicator.class );

    items.itemWirelessTerminal = addFeature( ToolWirelessTerminal.class );
    items.itemNetworkTool = addFeature( ToolNetworkTool.class );
    items.itemPortableCell = addFeature( ToolPortableCell.class );
    items.itemBiometricCard = addFeature( ToolBiometricCard.class );

    items.itemFacade = addFeature( ItemFacade.class );
    items.itemCrystalSeed = addFeature( ItemCrystalSeed.class );

    ColoredItemDefinition paintBall, lumenPaintBall;
    items.itemPaintBall = paintBall = new ColoredItemDefinition();
    items.itemLumenPaintBall = lumenPaintBall = new ColoredItemDefinition();
    AEItemDefinition pb = addFeature( ItemPaintBall.class );

    for (AEColor c : AEColor.values())
    {
      if ( c != AEColor.Transparent )
      {
        paintBall.add( c, new ItemStackSrc( pb.item(), c.ordinal() ) );
        lumenPaintBall.add( c, new ItemStackSrc( pb.item(), 20 + c.ordinal() ) );
      }
    }

    addFeature( ToolEraser.class );
    addFeature( ToolMeteoritePlacer.class );
View Full Code Here


    Blocks blocks = AEApi.instance().blocks();
    Block cable = blocks.blockMultiPart.block();
    for (Field f : blocks.getClass().getFields())
    {
      AEItemDefinition def;
      try
      {
        def = (AEItemDefinition) f.get( blocks );
        if ( def != null )
        {
          Block myBlock = def.block();
          if ( myBlock instanceof IOrientableBlock && ((IOrientableBlock) myBlock).usesMetadata() && def.entity() == null )
          {
            SchematicRegistry.registerSchematicBlock( myBlock, AERotatableBlockSchematic.class );
          }
          else if ( myBlock == cable )
          {
            SchematicRegistry.registerSchematicBlock( myBlock, AECableSchematicTile.class );
          }
          else if ( def.entity() != null )
          {
            SchematicRegistry.registerSchematicBlock( myBlock, AEGenericSchematicTile.class );
          }
        }
      }
View Full Code Here

TOP

Related Classes of appeng.api.util.AEItemDefinition

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.