Replaced all instances of Guava's Optional type with Java 8's Optional type, as discussed in #81. (#90)

This commit is contained in:
shartte
2016-08-24 19:06:10 +02:00
committed by Sebastian Hartte
parent c2a239a12f
commit e276aa682f
65 changed files with 306 additions and 468 deletions
+41 -5
View File
@@ -1,9 +1,6 @@
package appeng.loot;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.Iterables;
import net.minecraft.item.ItemStack;
import net.minecraft.world.storage.loot.LootEntry;
import net.minecraft.world.storage.loot.LootEntryItem;
import net.minecraft.world.storage.loot.LootPool;
@@ -28,8 +25,47 @@ public class ChestLoot
{
//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();
event.getTable().addPool( new LootPool( ( ( FluentIterable<LootEntryItem> ) Iterables.transform( materials.certusQuartzCrystal().maybeStack( 1 ).asSet(), ( ItemStack itemstack ) -> new LootEntryItem( itemstack.getItem(), 2, 3, new LootFunction[]{ new SetMetadata(null, new RandomValueRange( itemstack.getItemDamage() ))}, new LootCondition[]{ new RandomChance( 1 ) }, "AE2 Crystal_" + itemstack.getItemDamage() ) ) ).toArray( LootEntryItem.class ), new LootCondition[0], new RandomValueRange( 1, 4 ), new RandomValueRange( 0, 2 ), "AE2 Crystals" ) );
event.getTable().addPool( new LootPool( ( ( FluentIterable<LootEntryItem> ) Iterables.transform( materials.certusQuartzDust().maybeStack( 1 ).asSet(), ( ItemStack itemstack ) -> new LootEntryItem( itemstack.getItem(), 2, 3, new LootFunction[]{ new SetMetadata(null, new RandomValueRange( itemstack.getItemDamage() ))}, new LootCondition[]{ new RandomChance( 1 ) }, "AE2 Dust_" + itemstack.getItemDamage() ) ) ).toArray( LootEntryItem.class ), new LootCondition[0], new RandomValueRange( 1, 4 ), new RandomValueRange( 0, 2 ), "AE2 Dusts" ) );
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"
)
);
} );
}
}