use of net.minecraft.world.storage.loot.LootEntry in project Adventurers-Toolbox by the-realest-stu.
the class LootTableHandler method lootTableLoad.
@SubscribeEvent
public static void lootTableLoad(LootTableLoadEvent event) {
if (Config.ENABLE_SCHEMATICS) {
if (!Config.DUNGEON_SCHEMATICS.isEmpty() && event.getName().toString().equals("minecraft:chests/simple_dungeon")) {
LootEntry[] entries = new LootEntry[Config.DUNGEON_SCHEMATICS.size()];
for (int i = 0; i < entries.length; i++) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString(ItemSchematic.type_tag, Config.DUNGEON_SCHEMATICS.get(i));
entries[i] = new LootEntryItem(ModItems.schematic, 1, 0, new LootFunction[] { new SetNBT(new LootCondition[0], nbt) }, new LootCondition[0], Config.DUNGEON_SCHEMATICS.get(i));
}
LootPool pool = new LootPool(entries, new LootCondition[0], new RandomValueRange(0, Math.min(3, entries.length)), new RandomValueRange(0), "schematics");
event.getTable().addPool(pool);
}
if (!Config.BLACKSMITH_SCHEMATICS.isEmpty() && event.getName().toString().equals("minecraft:chests/village_blacksmith")) {
LootEntry[] entries = new LootEntry[Config.BLACKSMITH_SCHEMATICS.size()];
for (int i = 0; i < entries.length; i++) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString(ItemSchematic.type_tag, Config.BLACKSMITH_SCHEMATICS.get(i));
entries[i] = new LootEntryItem(ModItems.schematic, 1, 0, new LootFunction[] { new SetNBT(new LootCondition[0], nbt) }, new LootCondition[0], Config.BLACKSMITH_SCHEMATICS.get(i));
}
LootPool pool = new LootPool(entries, new LootCondition[0], new RandomValueRange(0, Math.min(3, entries.length)), new RandomValueRange(0), "schematics");
event.getTable().addPool(pool);
}
if (!Config.BONUS_CHEST_SCHEMATICS.isEmpty() && event.getName().toString().equals("minecraft:chests/spawn_bonus_chest")) {
LootEntry[] entries = new LootEntry[Config.BONUS_CHEST_SCHEMATICS.size()];
for (int i = 0; i < entries.length; i++) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString(ItemSchematic.type_tag, Config.BONUS_CHEST_SCHEMATICS.get(i));
entries[i] = new LootEntryItem(ModItems.schematic, 1, 0, new LootFunction[] { new SetNBT(new LootCondition[0], nbt) }, new LootCondition[0], Config.BONUS_CHEST_SCHEMATICS.get(i));
}
LootPool pool = new LootPool(entries, new LootCondition[0], new RandomValueRange(0, Math.min(3, entries.length)), new RandomValueRange(0), "schematics");
event.getTable().addPool(pool);
}
}
}
use of net.minecraft.world.storage.loot.LootEntry in project Gaspunk by Ladysnake.
the class ModItems method onLootTableLoad.
@SubscribeEvent
public static void onLootTableLoad(LootTableLoadEvent event) {
if (event.getName().toString().equals("minecraft:chests/nether_bridge")) {
ResourceLocation loc = new ResourceLocation(GasPunk.MOD_ID, "inject/nether_bridge");
LootEntry entry = new LootEntryTable(loc, 1, 1, new LootCondition[0], "gaspunk_sulfur_entry");
LootPool pool = new LootPool(new LootEntry[] { entry }, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "gaspunk_sulfur_pool");
event.getTable().addPool(pool);
}
}
use of net.minecraft.world.storage.loot.LootEntry in project pnc-repressurized by TeamPneumatic.
the class EventHandlerPneumaticCraft method onLootTableLoad.
@SubscribeEvent
public void onLootTableLoad(LootTableLoadEvent event) {
if (ConfigHandler.general.enableDungeonLoot) {
String prefix = "minecraft:chests/";
String name = event.getName().toString();
if (name.startsWith(prefix)) {
String file = name.substring(name.indexOf(prefix) + prefix.length());
switch(file) {
case "abandoned_mineshaft":
case "desert_pyramid":
case "jungle_temple":
case "simple_dungeon":
case "spawn_bonus_chest":
case "stronghold_corridor":
case "village_blacksmith":
LootEntry entry = new LootEntryTable(RL("inject/simple_dungeon_loot"), 1, 0, new LootCondition[0], "pneumaticcraft_inject_entry");
LootPool pool = new LootPool(new LootEntry[] { entry }, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "pneumaticcraft_inject_pool");
event.getTable().addPool(pool);
break;
default:
break;
}
}
}
}
use of net.minecraft.world.storage.loot.LootEntry in project Random-Things by lumien231.
the class RTEventHandler method loadLootTable.
@SubscribeEvent
public void loadLootTable(LootTableLoadEvent event) {
LootTable table = event.getTable();
if (event.getName().equals(LootTableList.CHESTS_SIMPLE_DUNGEON)) {
if (Worldgen.LAVA_CHARM)
addSingleItemWithChance("lavaCharm", table, ModItems.lavaCharm, 0.1f);
if (Worldgen.SUMMONING_PENDULUM)
addSingleItemWithChance("summoningPendulum", table, ModItems.summoningPendulum, 0.1f);
if (Worldgen.MAGIC_HOOD)
addSingleItemWithChance("magicHood", table, ModItems.magicHood, 0.15f);
if (Worldgen.SLIME_CUBE)
addSingleItemWithChance("slimeCube", table, Item.getItemFromBlock(ModBlocks.slimeCube), 0.3f);
} else if (Worldgen.LAVA_CHARM && event.getName().equals(LootTableList.CHESTS_NETHER_BRIDGE)) {
addSingleItemWithChance("lavaCharm", table, ModItems.lavaCharm, 0.3f);
} else if (Worldgen.MAGIC_HOOD && event.getName().equals(LootTableList.CHESTS_VILLAGE_BLACKSMITH)) {
addSingleItemWithChance("magicHood", table, ModItems.magicHood, 0.02f);
} else if (Worldgen.SUMMONING_PENDULUM && event.getName().equals(LootTableList.CHESTS_STRONGHOLD_CORRIDOR)) {
addSingleItemWithChance("summoningPendulum", table, ModItems.summoningPendulum, 0.5f);
} else if (Worldgen.SLIME_CUBE && event.getName().equals(LootTableList.CHESTS_JUNGLE_TEMPLE)) {
addSingleItemWithChance("slimeCube", table, Item.getItemFromBlock(ModBlocks.slimeCube), 0.8f);
}
if (Worldgen.BIOME_CRYSTAL && event.getName().toString().startsWith("minecraft:chests/")) {
LootEntry crystalEntry = new LootEntryItem(ModItems.biomeCrystal, 1, 0, new LootFunction[] { new LootFunction(new LootCondition[] {}) {
@Override
public ItemStack apply(ItemStack stack, Random rand, LootContext context) {
Object[] locationArray = Biome.REGISTRY.getKeys().toArray();
ResourceLocation randomLocation = (ResourceLocation) locationArray[rand.nextInt(locationArray.length)];
stack.setTagCompound(new NBTTagCompound());
stack.getTagCompound().setString("biomeName", randomLocation.toString());
return stack;
}
} }, new LootCondition[] {}, "randomthings:biomeCrystal");
LootPool crystalPool = new LootPool(new LootEntry[] { crystalEntry }, new LootCondition[] { new RandomChance(0.2f) }, new RandomValueRange(1, 1), new RandomValueRange(0, 0), "randomthings:biomeCrystal");
table.addPool(crystalPool);
}
}
use of net.minecraft.world.storage.loot.LootEntry in project harvestcraft by MatrexsVigil.
the class LootHandler method handleLootTableMod.
public static void handleLootTableMod(LootTableLoadEvent event) {
final List<CustomLootPool> customLootPools = getCustomLootPools(event.getName());
for (CustomLootPool customLootPool : customLootPools) {
final String lootPoolId = customLootPool.isSeperateLootPool() ? SEPARATE_LOOT_POOL_ID : VANILLA_LOOT_POOL_ID;
createPoolIfNotExists(event.getTable(), lootPoolId);
final LootPool lootPool = event.getTable().getPool(lootPoolId);
for (LootEntry entry : customLootPool.getLootEntries()) {
lootPool.addEntry(entry);
}
}
}
Aggregations