mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Added back loot from 1.7.10
This commit is contained in:
parent
19b0cc7223
commit
2afc7ba124
3 changed files with 82 additions and 24 deletions
|
@ -115,7 +115,6 @@ public class ActuallyAdditions{
|
||||||
TileEntityBase.init();
|
TileEntityBase.init();
|
||||||
new CommonEvents();
|
new CommonEvents();
|
||||||
InitCrafting.init();
|
InitCrafting.init();
|
||||||
DungeonLoot.init();
|
|
||||||
InitEntities.init();
|
InitEntities.init();
|
||||||
|
|
||||||
proxy.init(event);
|
proxy.init(event);
|
||||||
|
|
|
@ -19,6 +19,7 @@ import de.ellpeck.actuallyadditions.mod.data.PlayerData;
|
||||||
import de.ellpeck.actuallyadditions.mod.data.WorldData;
|
import de.ellpeck.actuallyadditions.mod.data.WorldData;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.ConnectionPair;
|
import de.ellpeck.actuallyadditions.mod.misc.ConnectionPair;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.misc.DungeonLoot;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||||
|
@ -46,6 +47,7 @@ public class CommonEvents{
|
||||||
|
|
||||||
public CommonEvents(){
|
public CommonEvents(){
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
MinecraftForge.EVENT_BUS.register(new DungeonLoot());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkAchievements(ItemStack gotten, EntityPlayer player, InitAchievements.Type type){
|
public static void checkAchievements(ItemStack gotten, EntityPlayer player, InitAchievements.Type type){
|
||||||
|
|
|
@ -10,36 +10,93 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.misc;
|
package de.ellpeck.actuallyadditions.mod.misc;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.world.storage.loot.LootEntryItem;
|
||||||
|
import net.minecraft.world.storage.loot.LootPool;
|
||||||
|
import net.minecraft.world.storage.loot.LootTableList;
|
||||||
|
import net.minecraft.world.storage.loot.RandomValueRange;
|
||||||
|
import net.minecraft.world.storage.loot.conditions.LootCondition;
|
||||||
|
import net.minecraft.world.storage.loot.functions.LootFunction;
|
||||||
|
import net.minecraft.world.storage.loot.functions.SetCount;
|
||||||
|
import net.minecraft.world.storage.loot.functions.SetMetadata;
|
||||||
|
import net.minecraftforge.event.LootTableLoadEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
//TODO Fix dungeon loot (oh god)
|
public class DungeonLoot{
|
||||||
public final class DungeonLoot{
|
|
||||||
|
|
||||||
public static void init(){
|
@SubscribeEvent
|
||||||
if(ConfigBoolValues.DUNGEON_LOOT.isEnabled()){
|
public void onLootTableLoad(LootTableLoadEvent event){
|
||||||
ModUtil.LOGGER.info("Initializing Dungeon Loot...");
|
if(ConfigBoolValues.DUNGEON_LOOT.isEnabled() && event.getName() != null && event.getTable() != null){
|
||||||
|
boolean addCrystals = false;
|
||||||
|
boolean addDrillCore = false;
|
||||||
|
boolean addQuartz = false;
|
||||||
|
boolean addBatWings = false;
|
||||||
|
boolean addBook = false;
|
||||||
|
|
||||||
/*ChestGenHooks dungeon = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST);
|
if(LootTableList.CHESTS_SIMPLE_DUNGEON.equals(event.getName())){
|
||||||
ChestGenHooks mineshaft = ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR);
|
addCrystals = true;
|
||||||
ChestGenHooks blacksmith = ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH);
|
addDrillCore = true;
|
||||||
|
addQuartz = true;
|
||||||
for(int i = 0; i < TheCrystals.values().length; i++){
|
}
|
||||||
WeightedRandomChestContent item = new WeightedRandomChestContent(InitItems.itemCrystal, i, 2, 4, 5);
|
else if(LootTableList.CHESTS_ABANDONED_MINESHAFT.equals(event.getName())){
|
||||||
WeightedRandomChestContent block = new WeightedRandomChestContent(Item.getItemFromBlock(InitBlocks.blockCrystal), i, 1, 3, 1);
|
addCrystals = true;
|
||||||
dungeon.addItem(item);
|
addDrillCore = true;
|
||||||
dungeon.addItem(block);
|
}
|
||||||
mineshaft.addItem(item);
|
else if(LootTableList.CHESTS_VILLAGE_BLACKSMITH.equals(event.getName())){
|
||||||
mineshaft.addItem(block);
|
addDrillCore = true;
|
||||||
|
addQuartz = true;
|
||||||
|
addBatWings = true;
|
||||||
|
addBook = true;
|
||||||
|
}
|
||||||
|
else if(LootTableList.CHESTS_STRONGHOLD_LIBRARY.equals(event.getName())){
|
||||||
|
addBatWings = true;
|
||||||
|
addBook = true;
|
||||||
|
}
|
||||||
|
else if(LootTableList.CHESTS_IGLOO_CHEST.equals(event.getName())){
|
||||||
|
addBatWings = true;
|
||||||
}
|
}
|
||||||
WeightedRandomChestContent drillCore = new WeightedRandomChestContent(InitItems.itemMisc, TheMiscItems.DRILL_CORE.ordinal(), 1, 1, 3);
|
|
||||||
dungeon.addItem(drillCore);
|
|
||||||
mineshaft.addItem(drillCore);
|
|
||||||
blacksmith.addItem(drillCore);
|
|
||||||
|
|
||||||
WeightedRandomChestContent quartz = new WeightedRandomChestContent(InitItems.itemMisc, TheMiscItems.QUARTZ.ordinal(), 3, 4, 30);
|
LootPool pool = event.getTable().getPool("main");
|
||||||
dungeon.addItem(quartz);
|
if(pool != null){
|
||||||
blacksmith.addItem(quartz);*/
|
LootCondition[] noCondition = new LootCondition[0];
|
||||||
|
|
||||||
|
if(addCrystals){
|
||||||
|
LootFunction damage = new SetMetadata(noCondition, new RandomValueRange(0, TheCrystals.values().length-1));
|
||||||
|
LootFunction amount = new SetCount(noCondition, new RandomValueRange(1, 3));
|
||||||
|
LootFunction[] functions = new LootFunction[]{damage, amount};
|
||||||
|
|
||||||
|
pool.addEntry(new LootEntryItem(InitItems.itemCrystal, 50, 0, functions, noCondition, ModUtil.MOD_ID+":crystalItems"));
|
||||||
|
pool.addEntry(new LootEntryItem(Item.getItemFromBlock(InitBlocks.blockCrystal), 5, 0, functions, noCondition, ModUtil.MOD_ID+":crystalBlocks"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(addDrillCore){
|
||||||
|
LootFunction damage = new SetMetadata(noCondition, new RandomValueRange(TheMiscItems.DRILL_CORE.ordinal()));
|
||||||
|
pool.addEntry(new LootEntryItem(InitItems.itemMisc, 10, 0, new LootFunction[]{damage}, noCondition, ModUtil.MOD_ID+":drillCore"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(addQuartz){
|
||||||
|
LootFunction damage = new SetMetadata(noCondition, new RandomValueRange(TheMiscItems.QUARTZ.ordinal()));
|
||||||
|
LootFunction amount = new SetCount(noCondition, new RandomValueRange(1, 10));
|
||||||
|
pool.addEntry(new LootEntryItem(InitItems.itemMisc, 80, 0, new LootFunction[]{damage, amount}, noCondition, ModUtil.MOD_ID+":quartz"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(addBatWings){
|
||||||
|
LootFunction damage = new SetMetadata(noCondition, new RandomValueRange(TheMiscItems.BAT_WING.ordinal()));
|
||||||
|
LootFunction amount = new SetCount(noCondition, new RandomValueRange(1, 2));
|
||||||
|
pool.addEntry(new LootEntryItem(InitItems.itemMisc, 5, 0, new LootFunction[]{damage, amount}, noCondition, ModUtil.MOD_ID+":batWings"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(addBook){
|
||||||
|
LootFunction amount = new SetCount(noCondition, new RandomValueRange(1));
|
||||||
|
pool.addEntry(new LootEntryItem(InitItems.itemBooklet, 100, 0, new LootFunction[]{amount}, noCondition, ModUtil.MOD_ID+":booklet"));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue