Preliminary work on new loot system

This commit is contained in:
Vincent Lee committed 2016-05-10 11:55:50 -05:00
1 parent 46417330a4
commit dc8104f68b
14 files changed
+206 -73

No files matched your search

+1 -1
View File
@@ -4,6 +4,6 @@ version=r1.8
dir_output=../Build Output/Botania/
dir_repo=./
mc_version=1.9
forge_version=12.16.1.1888
forge_version=12.16.1.1898
build_number=303
mod_name=Botania
@@ -1,50 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jul 15, 2014, 3:17:00 PM (GMT)]
*/
package vazkii.botania.common.core.handler;
public final class ChestGenHandler {
public static void init() {
/* todo loot tables
String c = ChestGenHooks.BONUS_CHEST;
ChestGenHooks.addItem(c, new WeightedRandomChestContent(new ItemStack(ModItems.lexicon), 1, 1, 7));
ChestGenHooks.addItem(c, new WeightedRandomChestContent(new ItemStack(ModItems.blackLotus), 1, 1, 1));
c = ChestGenHooks.STRONGHOLD_CORRIDOR;
ChestGenHooks.addItem(c, new WeightedRandomChestContent(new ItemStack(ModItems.manaResource, 1, 1), 1, 1, 8));
ChestGenHooks.addItem(c, new WeightedRandomChestContent(new ItemStack(ModItems.manaResource, 1, 1), 1, 3, 2));
ChestGenHooks.addItem(c, new WeightedRandomChestContent(new ItemStack(ModItems.blackLotus), 1, 1, 6));
ChestGenHooks.addItem(c, new WeightedRandomChestContent(new ItemStack(ModItems.overgrowthSeed), 1, 1, 2));
c = ChestGenHooks.DUNGEON_CHEST;
ChestGenHooks.addItem(c, new WeightedRandomChestContent(new ItemStack(ModItems.manaResource, 1, 0), 1, 5, 9));
ChestGenHooks.addItem(c, new WeightedRandomChestContent(new ItemStack(ModItems.lexicon), 1, 1, 6));
ChestGenHooks.addItem(c, new WeightedRandomChestContent(new ItemStack(ModItems.manaBottle), 1, 1, 5));
ChestGenHooks.addItem(c, new WeightedRandomChestContent(new ItemStack(ModItems.blackLotus), 1, 1, 6));
ChestGenHooks.addItem(c, new WeightedRandomChestContent(new ItemStack(ModItems.overgrowthSeed), 1, 1, 2));
c = ChestGenHooks.PYRAMID_DESERT_CHEST;
ChestGenHooks.addItem(c, new WeightedRandomChestContent(new ItemStack(ModItems.blackLotus), 1, 1, 6));
ChestGenHooks.addItem(c, new WeightedRandomChestContent(new ItemStack(ModItems.overgrowthSeed), 1, 1, 2));
c = ChestGenHooks.MINESHAFT_CORRIDOR;
ChestGenHooks.addItem(c, new WeightedRandomChestContent(new ItemStack(ModItems.blackLotus), 1, 1, 6));
ChestGenHooks.addItem(c, new WeightedRandomChestContent(new ItemStack(ModItems.overgrowthSeed), 1, 1, 2));
c = ChestGenHooks.PYRAMID_JUNGLE_CHEST;
ChestGenHooks.addItem(c, new WeightedRandomChestContent(new ItemStack(ModItems.blackLotus), 1, 1, 6));
ChestGenHooks.addItem(c, new WeightedRandomChestContent(new ItemStack(ModItems.overgrowthSeed), 1, 1, 2));
c = ChestGenHooks.VILLAGE_BLACKSMITH;
ChestGenHooks.addItem(c, new WeightedRandomChestContent(new ItemStack(ModItems.blackLotus), 1, 1, 6));*/
}
}
@@ -1,21 +1,56 @@
package vazkii.botania.common.core.loot;
import com.google.common.collect.ImmutableList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.LootEntry;
import net.minecraft.world.storage.loot.LootEntryTable;
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.conditions.LootConditionManager;
import net.minecraft.world.storage.loot.functions.LootFunctionManager;
import net.minecraftforge.event.LootTableLoadEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import vazkii.botania.common.lib.LibMisc;
import java.util.List;
public final class LootHandler {
public static void init() {
LootTableList.register(new ResourceLocation(LibMisc.MOD_ID, "gaia_guardian"));
LootTableList.register(new ResourceLocation(LibMisc.MOD_ID, "gaia_guardian_2"));
private static final List<String> TABLES = ImmutableList.of(
"gaia_guardian", "gaia_guardian_2",
"inject/abandoned_mineshaft", "inject/desert_pyramid",
"inject/jungle_temple", "inject/simple_dungeon",
"inject/spawn_bonus_chest", "inject/stronghold_corridor",
"inject/village_blacksmith"
);
public LootHandler() {
for (String s : TABLES) {
LootTableList.register(new ResourceLocation(LibMisc.MOD_ID, s));
}
LootConditionManager.registerCondition(new TrueGuardianKiller.Serializer());
LootConditionManager.registerCondition(new EnableRelics.Serializer());
LootFunctionManager.registerFunction(new BindUuid.Serializer());
}
private LootHandler() {}
@SubscribeEvent
public void lootLoad(LootTableLoadEvent evt) {
switch (evt.getName().toString()) {
case "minecraft:chests/spawn_bonus_chest": break;
case "minecraft:chests/stronghold_corridor": break;
case "minecraft:chests/simple_dungeon": break;
case "minecraft:chests/desert_pyramid": break;
case "minecraft:chests/abandoned_mineshaft": break;
case "minecraft:chests/jungle_temple": break;
case "minecraft:chests/village_blacksmith": break;
}
}
private LootEntryTable getInjectEntry(String name) {
return new LootEntryTable(new ResourceLocation(LibMisc.MOD_ID, "inject/" + name), 1, 0, new LootCondition[0], "botania_inject");
}
}
@@ -56,7 +56,6 @@ import vazkii.botania.common.core.command.CommandOpen;
import vazkii.botania.common.core.command.CommandShare;
import vazkii.botania.common.core.command.CommandSkyblockSpread;
import vazkii.botania.common.core.handler.BiomeDecorationHandler;
import vazkii.botania.common.core.handler.ChestGenHandler;
import vazkii.botania.common.core.handler.CommonTickHandler;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.core.handler.InternalMethodHandler;
@@ -114,9 +113,6 @@ public class CommonProxy {
ModMultiblocks.init();
ModBanners.init();
ChestGenHandler.init();
LootHandler.init();
if(Botania.gardenOfGlassLoaded)
new WorldTypeSkyblock();
}
@@ -142,6 +138,7 @@ public class CommonProxy {
MinecraftForge.EVENT_BUS.register(new SheddingHandler());
MinecraftForge.EVENT_BUS.register(new SubTileNarslimmus.SpawnIntercepter());
MinecraftForge.EVENT_BUS.register(TileCorporeaIndex.getInputHandler());
MinecraftForge.EVENT_BUS.register(new LootHandler());
if(Botania.gardenOfGlassLoaded)
MinecraftForge.EVENT_BUS.register(new SkyblockWorldEvents());
@@ -17,7 +17,7 @@ public final class LibMisc {
public static final String MOD_NAME = MOD_ID;
public static final String BUILD = "GRADLE:BUILD";
public static final String VERSION = "GRADLE:VERSION-" + BUILD;
public static final String DEPENDENCIES = "required-after:Forge@[12.16.0.1874,];required-after:Baubles;after:Thaumcraft";
public static final String DEPENDENCIES = "required-after:Forge@[12.16.1.1898,];required-after:Baubles;after:Thaumcraft";
public static final String MC_VERSIONS = "[1.9]";
// Network Contants
@@ -1,7 +1,7 @@
{
"pools": [
{
"__comment": "Life essence",
"name": "life_essence",
"conditions": [{ "condition": "killed_by_player" }],
"rolls": 1,
"entries": [{
@@ -19,7 +19,7 @@
}]
},
{
"__comment": "Music disc",
"name": "music_disc",
"conditions": [
{ "condition": "killed_by_player" },
{ "condition": "random_chance", "chance": 0.2 }
@@ -1,7 +1,7 @@
{
"pools": [
{
"__comment": "Life essence",
"name": "life_essence",
"conditions": [{ "condition": "killed_by_player" }],
"rolls": 1,
"entries": [{
@@ -19,7 +19,7 @@
}]
},
{
"__comment": "Black Lotuses",
"name": "black_lotuses",
"conditions": [
{ "condition": "killed_by_player" },
{ "condition": "random_chance", "chance": 0.5 }
@@ -28,6 +28,7 @@
"entries": [
{
"type": "item",
"entryName": "superBlackLotus",
"name": "botania:blackLotus",
"weight": 3,
"quality": 1,
@@ -38,6 +39,7 @@
},
{
"type": "item",
"entryName": "normalBlackLotus",
"name": "botania:blackLotus",
"weight": 7,
"functions": [
@@ -48,7 +50,7 @@
]
},
{
"__comment": "Ancient wills",
"name": "ancient_wills",
"conditions": [{ "condition": "killed_by_player" }],
"rolls": 1,
"entries": [{
@@ -58,7 +60,7 @@
}]
},
{
"__comment": "Overgrowth seeds",
"name": "overgrowth_seeds",
"conditions": [
{ "condition": "killed_by_player" },
{ "condition": "random_chance", "chance": 0.25 }
@@ -71,7 +73,7 @@
}]
},
{
"__comment": "Manasteel",
"name": "manasteel",
"conditions": [
{ "condition": "killed_by_player" },
{ "condition": "random_chance", "chance": 0.9 }
@@ -84,7 +86,7 @@
}]
},
{
"__comment": "Mana pearl",
"name": "mana_pearl",
"conditions": [
{ "condition": "killed_by_player" },
{ "condition": "random_chance", "chance": 0.7 }
@@ -100,7 +102,7 @@
}]
},
{
"__comment": "Mana diamond",
"name": "mana_diamond",
"conditions": [
{ "condition": "killed_by_player" },
{ "condition": "random_chance", "chance": 0.5 }
@@ -116,7 +118,7 @@
}]
},
{
"__comment": "Runes",
"name": "runes",
"conditions": [{ "condition": "killed_by_player" }],
"rolls": { "min": 1, "max": 6 },
"entries": [{
@@ -130,7 +132,7 @@
}]
},
{
"__comment": "Pinkinator",
"name": "pinkinator",
"conditions": [
{ "condition": "killed_by_player" },
{ "condition": "random_chance", "chance": 0.2 }
@@ -142,7 +144,7 @@
}]
},
{
"__comment": "Music discs",
"name": "music_discs",
"conditions": [
{ "condition": "killed_by_player" },
{ "condition": "random_chance", "chance": 0.44 }
@@ -167,7 +169,7 @@
]
},
{
"__comment": "Relics",
"name": "relics",
"conditions": [
{ "condition": "killed_by_player" },
{ "condition": "botania:enable_relics" }
@@ -0,0 +1,19 @@
{
"__comment": "This table is injected into minecraft:chests/abandoned_mineshaft",
"pools": [{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "item",
"name": "botania:blackLotus",
"weight": 6
},
{
"type": "item",
"name": "botania:overgrowthSeed",
"weight": 2
}
]
}]
}
@@ -0,0 +1,19 @@
{
"__comment": "This table is injected into minecraft:chests/desert_pyramid",
"pools": [{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "item",
"name": "botania:blackLotus",
"weight": 6
},
{
"type": "item",
"name": "botania:overgrowthSeed",
"weight": 2
}
]
}]
}
@@ -0,0 +1,19 @@
{
"__comment": "This table is injected into minecraft:chests/jungle_temple",
"pools": [{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "item",
"name": "botania:blackLotus",
"weight": 6
},
{
"type": "item",
"name": "botania:overgrowthSeed",
"weight": 2
}
]
}]
}
@@ -0,0 +1,35 @@
{
"__comment": "This table is injected into minecraft:chests/simple_dungeon",
"pools": [{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "item",
"name": "botania:manaResource",
"weight": 9,
"functions": [{ "function": "set_count", "count": { "min": 1, "max": 5 } }]
},
{
"type": "item",
"name": "botania:lexicon",
"weight": 6
},
{
"type": "item",
"name": "botania:manaBottle",
"weight": 5
},
{
"type": "item",
"name": "botania:blackLotus",
"weight": 6
},
{
"type": "item",
"name": "botania:overgrowthSeed",
"weight": 2
}
]
}]
}
@@ -0,0 +1,19 @@
{
"__comment": "This table is injected into minecraft:chests/spawn_bonus_chest",
"pools": [{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "item",
"name": "botania:lexicon",
"weight": 7
},
{
"type": "item",
"name": "botania:blackLotus",
"weight": 1
}
]
}]
}
@@ -0,0 +1,25 @@
{
"__comment": "This table is injected into minecraft:chests/stronghold_corridor",
"pools": [{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "item",
"name": "botania:manaResource",
"weight": 10,
"functions": [{ "function": "set_count", "count": { "min": 1, "max": 3 } }]
},
{
"type": "item",
"name": "botania:blackLotus",
"weight": 6
},
{
"type": "item",
"name": "botania:overgrowthSeed",
"weight": 2
}
]
}]
}
@@ -0,0 +1,13 @@
{
"__comment": "This table is injected into minecraft:chests/village_blacksmith",
"pools": [{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "item",
"name": "botania:blackLotus"
}
]
}]
}