private void addNewAttunement( final IItemDefinition definition, final TunnelType type ) { definition.maybeStack( 1 ).ifPresent( definitionStack -> this.addNewAttunement( definitionStack, type ) ); } }
@Nonnull private Optional<ItemStack> getCellOutput( final ItemStack compared ) { for( final Map.Entry<IItemDefinition, IItemDefinition> entry : this.cellMappings.entrySet() ) { if( entry.getKey().isSameAs( compared ) ) { return entry.getValue().maybeStack( 1 ); } } return Optional.empty(); }
@Nonnull private Optional<ItemStack> getNonCellOutput( final ItemStack compared ) { for( final Map.Entry<IItemDefinition, IItemDefinition> entry : this.nonCellMappings.entrySet() ) { if( entry.getKey().isSameAs( compared ) ) { return entry.getValue().maybeStack( 1 ); } } return Optional.empty(); }
private ItemStack findFirst( final IItemDefinition... choices ) { for( final IItemDefinition definition : choices ) { Optional<ItemStack> maybeIs = definition.maybeStack( 1 ); if( maybeIs.isPresent() ) { return maybeIs.get(); } } return new ItemStack( Blocks.CHEST ); } }
private void addDescription( IModRegistry registry, IItemDefinition itemDefinition, String message ) { itemDefinition.maybeStack( 1 ).ifPresent( itemStack -> registry.addIngredientInfo( itemStack, ItemStack.class, message ) ); }
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 ItemStack getItemStackRepresentation() { return AEApi.instance().definitions().parts().storageBus().maybeStack( 1 ).orElse( ItemStack.EMPTY ); }
@Override public ItemStack getItemStackRepresentation() { return AEApi.instance().definitions().parts().iface().maybeStack( 1 ).orElse( ItemStack.EMPTY ); }
@Override public ItemStack getItemStackRepresentation() { return AEApi.instance().definitions().parts().fluidIface().maybeStack( 1 ).orElse( ItemStack.EMPTY ); }
@Override public ItemStack getItemStackRepresentation() { return AEApi.instance().definitions().parts().fluidFormationnPlane().maybeStack( 1 ).orElse( ItemStack.EMPTY ); }
@Override public ItemStack getItemStackRepresentation() { return AEApi.instance().definitions().parts().formationPlane().maybeStack( 1 ).orElse( ItemStack.EMPTY ); }
@Override public ItemStack getItemStackRepresentation() { return AEApi.instance().definitions().parts().fluidStorageBus().maybeStack( 1 ).orElse( ItemStack.EMPTY ); }
private void registerFacadeRecipe( IDefinitions definitions, IModRegistry registry ) { Optional<Item> itemFacade = definitions.items().facade().maybeItem(); Optional<ItemStack> cableAnchor = definitions.parts().cableAnchor().maybeStack( 1 ); if( itemFacade.isPresent() && cableAnchor.isPresent() ) { registry.addRecipeRegistryPlugin( new FacadeRegistryPlugin( (ItemFacade) itemFacade.get(), cableAnchor.get() ) ); } }
@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 ItemStack getItemStack( final PartItemStack type ) { if( type == PartItemStack.WORLD || type == PartItemStack.NETWORK || type == PartItemStack.WRENCH || type == PartItemStack.PICK ) { return super.getItemStack( type ); } final Optional<ItemStack> maybeMEStack = AEApi.instance().definitions().parts().p2PTunnelME().maybeStack( 1 ); if( maybeMEStack.isPresent() ) { return maybeMEStack.get(); } return super.getItemStack( type ); }
@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(); } }
@Override public ItemStack asItemStackRepresentation() { ItemStack is = Api.INSTANCE.definitions().items().dummyFluidItem().maybeStack( 1 ).orElse( ItemStack.EMPTY ); if( !is.isEmpty() ) { FluidDummyItem item = (FluidDummyItem) is.getItem(); item.setFluidStack( is, this.getFluidStack() ); return is; } return ItemStack.EMPTY; }
@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 public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { super.drawBG( offsetX, offsetY, mouseX, mouseY ); final IDefinitions definitions = AEApi.instance().definitions(); definitions.items().cell1k().maybeStack( 1 ).ifPresent( cell1kStack -> this.drawItem( offsetX + 66 - 8, offsetY + 17, cell1kStack ) ); definitions.blocks().drive().maybeStack( 1 ).ifPresent( driveStack -> this.drawItem( offsetX + 94 + 8, offsetY + 17, driveStack ) ); }