@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 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 ) ); } } }
else if( this.getInternalCurrentPower() > POWER_THRESHOLD && materials.certusQuartzCrystal().isSameAs( myItem ) )
@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 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 ); }
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; }
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() ); }
@SubscribeEvent public void loadLootTable( LootTableLoadEvent event ) { if( event.getName() == LootTableList.CHESTS_ABANDONED_MINESHAFT ) { // TODO 1.9.4 aftermath - All these loot quality, pools and stuff. Figure it out and balance it. final IMaterials materials = AEApi.instance().definitions().materials(); materials.certusQuartzCrystal().maybeStack( 1 ).ifPresent( is -> { event.getTable() .addPool( new LootPool( new LootEntry[] { new LootEntryItem( is.getItem(), 2, 3, new LootFunction[] { new SetMetadata( null, new RandomValueRange( is.getItemDamage() ) ) }, new LootCondition[] { new RandomChance( 1 ) }, "AE2 Crystal_" + is.getItemDamage() ) }, new LootCondition[0], new RandomValueRange( 1, 4 ), new RandomValueRange( 0, 2 ), "AE2 Crystals" ) ); } ); materials.certusQuartzDust().maybeStack( 1 ).ifPresent( is -> { event.getTable() .addPool( new LootPool( new LootEntryItem[] { new LootEntryItem( is.getItem(), 2, 3, new LootFunction[] { new SetMetadata( null, new RandomValueRange( is.getItemDamage() ) ) }, new LootCondition[] { new RandomChance( 1 ) }, "AE2 Dust_" + is.getItemDamage() ) }, new LootCondition[0], new RandomValueRange( 1, 4 ), new RandomValueRange( 0, 2 ), "AE2 DUSTS" ) ); } ); } }