@Override public Item getItemDropped( final IBlockState state, final Random rand, final int fortune ) { return AEApi.instance() .definitions() .materials() .certusQuartzCrystal() .maybeItem() .orElseThrow( () -> new MissingDefinitionException( "Tried to access certus quartz crystal, even though they are disabled" ) ); }
@Override public ItemStack getContainerItem( final ItemStack itemStack ) { return AEApi.instance() .definitions() .materials() .emptyStorageCell() .maybeStack( 1 ) .orElseThrow( () -> new MissingDefinitionException( "Tried to use empty storage cells while basic storage cells are defined." ) ); }
@Override public Item getItemDropped( final IBlockState state, final Random rand, final int fortune ) { return AEApi.instance() .definitions() .materials() .certusQuartzCrystalCharged() .maybeItem() .orElseThrow( () -> new MissingDefinitionException( "Tried to access charged certus quartz crystal, even though they are disabled" ) ); }
@Override public int damageDropped( final IBlockState state ) { return AEApi.instance() .definitions() .materials() .certusQuartzCrystalCharged() .maybeStack( 1 ) .orElseThrow( () -> new MissingDefinitionException( "Tried to access charged certus quartz crystal, even though they are disabled" ) ) .getItemDamage(); }
@Override public int damageDropped( final IBlockState state ) { return AEApi.instance() .definitions() .materials() .certusQuartzCrystal() .maybeStack( 1 ) .orElseThrow( () -> new MissingDefinitionException( "Tried to access certus quartz crystal, even though they are disabled" ) ) .getItemDamage(); } }
private ItemStack getOutput() { final IMaterials materials = AEApi.instance().definitions().materials(); switch( (CondenserOutput) this.cm.getSetting( Settings.CONDENSER_OUTPUT ) ) { case MATTER_BALLS: return materials.matterBall().maybeStack( 1 ).orElse( ItemStack.EMPTY ); case SINGULARITY: return materials.singularity().maybeStack( 1 ).orElse( ItemStack.EMPTY ); case TRASH: default: return ItemStack.EMPTY; } }
private List<ItemStack> getViableStorageComponents( CondenserOutputWrapper recipeWrapper ) { CondenserOutput condenserOutput = recipeWrapper.getCondenserOutput(); IMaterials materials = AEApi.instance().definitions().materials(); List<ItemStack> viableComponents = new ArrayList<>(); materials.cell1kPart().maybeStack( 1 ).ifPresent( itemStack -> this.addViableComponent( condenserOutput, viableComponents, itemStack ) ); materials.cell4kPart().maybeStack( 1 ).ifPresent( itemStack -> this.addViableComponent( condenserOutput, viableComponents, itemStack ) ); materials.cell16kPart().maybeStack( 1 ).ifPresent( itemStack -> this.addViableComponent( condenserOutput, viableComponents, itemStack ) ); materials.cell64kPart().maybeStack( 1 ).ifPresent( itemStack -> this.addViableComponent( condenserOutput, viableComponents, itemStack ) ); return viableComponents; }
@Override public boolean allowInsert( IItemHandler inv, final int i, final ItemStack itemstack ) { final IItemDefinition cert = AEApi.instance().definitions().materials().certusQuartzCrystal(); return Platform.isChargeable( itemstack ) || cert.isSameAs( itemstack ); }
@Override protected void dropEmptyStorageCellCase( final InventoryAdaptor ia, final EntityPlayer player ) { AEApi.instance().definitions().materials().emptyStorageCell().maybeStack( 1 ).ifPresent( is -> { final ItemStack extraA = ia.addItems( is ); if( !extraA.isEmpty() ) { player.dropItem( extraA, false ); } } ); } }
@Override protected void dropEmptyStorageCellCase( final InventoryAdaptor ia, final EntityPlayer player ) { AEApi.instance().definitions().materials().emptyStorageCell().maybeStack( 1 ).ifPresent( is -> { final ItemStack extraA = ia.addItems( is ); if( !extraA.isEmpty() ) { player.dropItem( extraA, false ); } } ); } }
public DisassembleRecipe() { final IDefinitions definitions = AEApi.instance().definitions(); final IBlocks blocks = definitions.blocks(); final IItems items = definitions.items(); final IMaterials mats = definitions.materials(); this.cellMappings = new HashMap<>( 4 ); this.nonCellMappings = new HashMap<>( 5 ); this.cellMappings.put( items.cell1k(), mats.cell1kPart() ); this.cellMappings.put( items.cell4k(), mats.cell4kPart() ); this.cellMappings.put( items.cell16k(), mats.cell16kPart() ); this.cellMappings.put( items.cell64k(), mats.cell64kPart() ); this.nonCellMappings.put( items.encodedPattern(), mats.blankPattern() ); this.nonCellMappings.put( blocks.craftingStorage1k(), mats.cell1kPart() ); this.nonCellMappings.put( blocks.craftingStorage4k(), mats.cell4kPart() ); this.nonCellMappings.put( blocks.craftingStorage16k(), mats.cell16kPart() ); this.nonCellMappings.put( blocks.craftingStorage64k(), mats.cell64kPart() ); }
@Override public ItemStack getStack() { final IItemHandler baseInv = this.getItemHandler(); final ItemStack input = baseInv.getStackInSlot( 0 ); if( input == ItemStack.EMPTY ) { return ItemStack.EMPTY; } if( SlotRestrictedInput.isMetalIngot( input ) ) { if( ContainerQuartzKnife.this.myName.length() > 0 ) { return AEApi.instance().definitions().materials().namePress().maybeStack( 1 ).map( namePressStack -> { final NBTTagCompound compound = Platform.openNbtData( namePressStack ); compound.setString( "InscribeName", ContainerQuartzKnife.this.myName ); return namePressStack; } ).orElse( ItemStack.EMPTY ); } } return ItemStack.EMPTY; }
public TileWireless() { this.inv.setFilter( new AEItemDefinitionFilter( AEApi.instance().definitions().materials().wirelessBooster() ) ); this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL ); this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) ); }
public static boolean isRecipePrioritized( final ItemStack what ) { final IMaterials materials = AEApi.instance().definitions().materials(); boolean isPurified = materials.purifiedCertusQuartzCrystal().isSameAs( what ); isPurified |= materials.purifiedFluixCrystal().isSameAs( what ); isPurified |= materials.purifiedNetherQuartzCrystal().isSameAs( what ); return isPurified; } }
private boolean isPattern( final ItemStack output ) { if( output.isEmpty() ) { return false; } final IDefinitions definitions = AEApi.instance().definitions(); boolean isPattern = definitions.items().encodedPattern().isSameAs( output ); isPattern |= definitions.materials().blankPattern().isSameAs( output ); return isPattern; }
public static boolean canRepair( final AEFeature type, final ItemStack a, final ItemStack b ) { if( b.isEmpty() || a.isEmpty() ) { return false; } if( type == AEFeature.CERTUS_QUARTZ_TOOLS ) { final IItemDefinition certusQuartzCrystal = AEApi.instance().definitions().materials().certusQuartzCrystal(); return certusQuartzCrystal.isSameAs( b ); } if( type == AEFeature.NETHER_QUARTZ_TOOLS ) { return Items.QUARTZ == b.getItem(); } return false; }
@Override public void applyTurn() { this.injectExternalPower( PowerUnits.AE, POWER_PER_CRANK_TURN, Actionable.MODULATE ); final ItemStack myItem = this.inv.getStackInSlot( 0 ); if( this.getInternalCurrentPower() > POWER_THRESHOLD ) { final IMaterials materials = AEApi.instance().definitions().materials(); if( materials.certusQuartzCrystal().isSameAs( myItem ) ) { this.extractAEPower( this.getInternalMaxPower(), Actionable.MODULATE, PowerMultiplier.CONFIG ); materials.certusQuartzCrystalCharged().maybeStack( myItem.getCount() ).ifPresent( charged -> this.inv.setStackInSlot( 0, charged ) ); } } }
@Override public boolean allowExtract( IItemHandler inv, final int slotIndex, int amount ) { ItemStack extractedItem = inv.getStackInSlot( slotIndex ); if( Platform.isChargeable( extractedItem ) ) { final IAEItemPowerStorage ips = (IAEItemPowerStorage) extractedItem.getItem(); if( ips.getAECurrentPower( extractedItem ) >= ips.getAEMaxPower( extractedItem ) ) { return true; } } return AEApi.instance().definitions().materials().certusQuartzCrystalCharged().isSameAs( extractedItem ); } }
public void activate( final EntityPlayer player ) { if( !Platform.hasPermissions( new DimensionalCoord( this ), player ) ) { return; } final ItemStack myItem = this.inv.getStackInSlot( 0 ); if( myItem.isEmpty() ) { ItemStack held = player.inventory.getCurrentItem(); if( AEApi.instance().definitions().materials().certusQuartzCrystal().isSameAs( held ) || Platform.isChargeable( held ) ) { held = player.inventory.decrStackSize( player.inventory.currentItem, 1 ); this.inv.setStackInSlot( 0, held ); } } else { final List<ItemStack> drops = new ArrayList<>(); drops.add( myItem ); this.inv.setStackInSlot( 0, ItemStack.EMPTY ); Platform.spawnDrops( this.world, this.pos.offset( this.getForward() ), drops ); } }
@Override public ItemStack getIconItemStack() { final IDefinitions definitions = AEApi.instance().definitions(); final IBlocks blocks = definitions.blocks(); final IItems items = definitions.items(); final IMaterials materials = definitions.materials(); return this.findFirst( blocks.controller(), blocks.chest(), blocks.cellWorkbench(), blocks.fluixBlock(), items.cell1k(), items.networkTool(), materials.fluixCrystal(), materials.certusQuartzCrystal(), materials.skyDust() ); }