Skip to content

Commit

Permalink
Merge pull request #28 from bode-mmk/add-kokeshi-root
Browse files Browse the repository at this point in the history
add loot table
  • Loading branch information
bode-mmk authored Jul 19, 2019
2 parents caea000 + bd5f505 commit 1405d56
Show file tree
Hide file tree
Showing 6 changed files with 1,286 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/com/dse/dseMod/DseMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.dse.dseMod.block.BlockWeatherFrog;
import com.dse.dseMod.entity.EntityDsecart;
import com.dse.dseMod.entity.EntityDsecartEmpty;
import com.dse.dseMod.event.LootHandler;
import com.dse.dseMod.item.Dsecart;
import com.dse.dseMod.item.ItemDirectionedSlab;
import com.dse.dseMod.item.ItemKokeshi;
Expand Down Expand Up @@ -51,6 +52,7 @@
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
Expand Down Expand Up @@ -396,9 +398,15 @@ public void preInit(FMLPreInitializationEvent event) {
GameRegistry.addSmelting(ITEMS.mamedol_seeds, new ItemStack(ITEMS.mamedol_seeds_irimame), 0.1f);
EntityRegistry.registerModEntity(new ResourceLocation(DseMod.MODID,"Dsecart"), EntityDsecart.class, "DsecartEntity", 0, this, 250, 1, false);
EntityRegistry.registerModEntity(new ResourceLocation(DseMod.MODID,"DsecartEmpty"), EntityDsecartEmpty.class, "DsecarEmptytEntity", 1, this, 250, 1, false);

proxy.preInit(event);
}

@Mod.EventHandler
public void init(FMLInitializationEvent event) {
MinecraftForge.EVENT_BUS.register(new LootHandler());
}

@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event) {
MinecraftForge.addGrassSeed(new ItemStack(ITEMS.mamedol_seeds), 1);
Expand Down
45 changes: 45 additions & 0 deletions src/main/java/com/dse/dseMod/event/LootHandler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.dse.dseMod.event;

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.minecraftforge.event.LootTableLoadEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

public final class LootHandler {
public LootHandler() {
LootTableList.register(new ResourceLocation("dsemod:dse_abandoned_mineshaft"));
LootTableList.register(new ResourceLocation("dsemod:dse_desert_pyramid"));
LootTableList.register(new ResourceLocation("dsemod:dse_jungle_temple"));
LootTableList.register(new ResourceLocation("dsemod:dse_simple_dungeon"));
}

@SubscribeEvent
public void lootLoad(LootTableLoadEvent evt) {
if(evt.getName().toString().equals("minecraft:chests/abandoned_mineshaft")) {
LootEntry entry = new LootEntryTable(new ResourceLocation("dsemod:dse_abandoned_mineshaft"), 1, 0, new LootCondition[0], "dse_abandoned_mineshaft_entry");
LootPool pool = new LootPool(new LootEntry[] {entry}, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "dse_abndoned_mineshaft_pool");

evt.getTable().addPool(pool);
}else if(evt.getName().toString().equals("minecraft:chests/desert_pyramid")) {
LootEntry entry = new LootEntryTable(new ResourceLocation("dsemod:dse_desert_pyramid"), 1, 0, new LootCondition[0], "dse_desert_pyramid_entry");
LootPool pool = new LootPool(new LootEntry[] {entry}, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "dse_desert_pyramid_pool");

evt.getTable().addPool(pool);
}else if(evt.getName().toString().equals("minecraft:chests/jungle_temple")) {
LootEntry entry = new LootEntryTable(new ResourceLocation("dsemod:dse_jungle_temple"), 1, 0, new LootCondition[0], "dse_jungle_temple_entry");
LootPool pool = new LootPool(new LootEntry[] {entry}, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "dse_jungle_temple_pool");

evt.getTable().addPool(pool);
}else if(evt.getName().toString().equals("minecraft:chests/simple_dungeon")) {
LootEntry entry = new LootEntryTable(new ResourceLocation("dsemod:dse_simple_dungeon"), 1, 0, new LootCondition[0], "dse_simple_dungeon_entry");
LootPool pool = new LootPool(new LootEntry[] {entry}, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "dse_simple_dungeon_pool");

evt.getTable().addPool(pool);
}
}
}
Loading

0 comments on commit 1405d56

Please sign in to comment.