private boolean isBlockAtLocation( final IBlockAccess w, final BlockPos pos, final IBlockDefinition def ) { return def.maybeBlock().map( block -> block == w.getBlockState( pos ).getBlock() ).orElse( false ); } }
this.validSpawn.add( Blocks.STAINED_HARDENED_CLAY ); this.skyStoneDefinition.maybeBlock().ifPresent( this.invalidSpawn::add ); this.invalidSpawn.add( Blocks.PLANKS ); this.invalidSpawn.add( Blocks.IRON_DOOR );
private double getMaxEnergyCapacity() { final Block blockID = Block.getBlockFromItem( this ); final IBlockDefinition energyCell = Api.INSTANCE.definitions().blocks().energyCell(); return energyCell.maybeBlock().map( block -> { if( blockID == block ) { return 200000; } else { return 8 * 200000; } } ).orElse( 0 ); }
public QuartzWorldGen() { final IBlocks blocks = AEApi.instance().definitions().blocks(); final IBlockDefinition oreDefinition = blocks.quartzOre(); final IBlockDefinition chargedDefinition = blocks.quartzOreCharged(); this.oreNormal = oreDefinition.maybeBlock() .map( b -> new WorldGenMinable( b.getDefaultState(), AEConfig.instance().getQuartzOresPerCluster() ) ) .orElse( null ); this.oreCharged = chargedDefinition.maybeBlock() .map( b -> new WorldGenMinable( b.getDefaultState(), AEConfig.instance().getQuartzOresPerCluster() ) ) .orElse( null ); }
@Override public void onReady() { super.onReady(); final IBlockDefinition quantumRing = AEApi.instance().definitions().blocks().quantumRing(); final Optional<Block> maybeLinkBlock = quantumRing.maybeBlock(); final Optional<ItemStack> maybeLinkStack = quantumRing.maybeStack( 1 ); final boolean isPresent = maybeLinkBlock.isPresent() && maybeLinkStack.isPresent(); if( isPresent && this.getBlockType() == maybeLinkBlock.get() ) { final ItemStack linkStack = maybeLinkStack.get(); this.getProxy().setVisualRepresentation( linkStack ); } }
private static IBlockDefinition makeSlab( String slabId, String doubleSlabId, FeatureFactory registry, IBlockDefinition blockDef ) if( !blockDef.maybeBlock().isPresent() ) Block block = blockDef.maybeBlock().get(); .build(); if( !slabDef.maybeBlock().isPresent() ) BlockSlab slabBlock = (BlockSlab) slabDef.maybeBlock().get(); .build(); Verify.verify( doubleSlabDef.maybeBlock().isPresent() ); BlockSlab doubleSlabBlock = (BlockSlab) doubleSlabDef.maybeBlock().get();
private static IBlockDefinition makeStairs( String registryName, FeatureFactory registry, IBlockDefinition block ) { return registry.block( registryName, () -> new BlockStairCommon( block.maybeBlock().get(), block.identifier() ) ) .features( AEFeature.DECORATIVE_BLOCKS ) .rendering( new BlockRenderingCustomizer() { @Override @SideOnly( Side.CLIENT ) public void customize( IBlockRendering rendering, IItemRendering itemRendering ) { ModelResourceLocation model = new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, registryName ), "facing=east,half=bottom,shape=straight" ); itemRendering.model( model ); } } ) .build(); }
public void getRandomInset( final IMeteoriteWorld w, final int x, final int y, final int z ) { final double a = Math.random(); if( a > 0.9 ) { this.putter.put( w, x, y, z, Blocks.COBBLESTONE ); } else if( a > 0.8 ) { this.putter.put( w, x, y, z, Blocks.STONE ); } else if( a > 0.7 ) { this.putter.put( w, x, y, z, Blocks.GRASS ); } else if( a > 0.6 ) { this.skyStoneDefinition.maybeBlock().ifPresent( block -> this.putter.put( w, x, y, z, block ) ); } else if( a > 0.5 ) { this.putter.put( w, x, y, z, Blocks.GRAVEL ); } else { this.putter.put( w, x, y, z, Platform.AIR_BLOCK ); } } }
Optional<Block> maybeBlock = AEApi.instance().definitions().blocks().skyStoneBlock().maybeBlock(); if( maybeBlock.isPresent() )
this.skyStoneDefinition.maybeBlock().ifPresent( block -> this.placeMeteoriteSkyStone( w, x, y, z, block ) ); this.skyChestDefinition.maybeBlock().ifPresent( block -> this.putter.put( w, x, y, z, block ) );
@Override public Chunk generateChunk( final int x, final int z ) { final Chunk chunk = new Chunk( this.world, x, z ); final byte[] biomes = chunk.getBiomeArray(); Biome biome = AppEng.instance().getStorageBiome(); byte biomeId = (byte) Biome.getIdForBiome( biome ); for( int k = 0; k < biomes.length; ++k ) { biomes[k] = biomeId; } AEApi.instance().definitions().blocks().matrixFrame().maybeBlock().ifPresent( block -> this.fillChunk( chunk, block.getDefaultState() ) ); chunk.setModified( false ); if( !chunk.isTerrainPopulated() ) { chunk.setTerrainPopulated( true ); chunk.resetRelightChecks(); } return chunk; }
public CachedPlane( final World w, final int minX, final int minY, final int minZ, final int maxX, final int maxY, final int maxZ ) Block matrixFrameBlock = AEApi.instance().definitions().blocks().matrixFrame().maybeBlock().orElse( null ); if( matrixFrameBlock != null )
.blocks() .matrixFrame() .maybeBlock() .ifPresent( matrixFrameBlock -> this.transverseEdges( dstX - 1, dstY - 1, dstZ - 1, dstX + scaleX + 1, dstY + scaleY + 1, dstZ + scaleZ + 1, new WrapInMatrixFrame( matrixFrameBlock.getDefaultState(), dstWorld ) ) );
final Optional<Block> maybeMultiPartBlock = multiPart.maybeBlock(); final Optional<ItemBlock> maybeMultiPartItemBlock = multiPart.maybeItemBlock(); if( mySide != null ) multiPart.maybeBlock().ifPresent( multiPartBlock ->
AEApi.instance().definitions().materials().calcProcessor().maybeStack(1).orElse(ItemStack.EMPTY), 'G', AEApi.instance().definitions().blocks().quartzGlass().maybeBlock().orElse(Blocks.GLASS) )); this.addFakeCrafting(new ResourceLocation(ModGlobals.MOD_ID, "cells/essentia_cell_4k")); AEApi.instance().definitions().materials().engProcessor().maybeStack(1).orElse(ItemStack.EMPTY), 'G', AEApi.instance().definitions().blocks().quartzGlass().maybeBlock().orElse(Blocks.GLASS) )); }); AEApi.instance().definitions().materials().engProcessor().maybeStack(1).orElse(ItemStack.EMPTY), 'G', AEApi.instance().definitions().blocks().quartzGlass().maybeBlock().orElse(Blocks.GLASS) )); this.addFakeCrafting(new ResourceLocation(ModGlobals.MOD_ID, "cells/essentia_cell_64k"));