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()); }
public EntryBuilder tag(NBTTagCompound compound) { return this.function(new SetNBT(new LootCondition[0], compound)); }
@SubscribeEvent public void onLootTableLoad(LootTableLoadEvent event) { // wither skellies drop necrotic bones if(event.getName().equals(LootTableList.ENTITIES_WITHER_SKELETON)) { LootCondition[] lootConditions = new LootCondition[0]; LootEntry entry = new LootEntryItem(TinkerCommons.matNecroticBone.getItem(), 1, 0, new LootFunction[]{new SetMetadata(lootConditions, new RandomValueRange(TinkerCommons.matNecroticBone.getMetadata()))}, lootConditions, "necrotic_bone"); event.getTable().addPool(new LootPool(new LootEntry[]{entry}, new LootCondition[]{ new KilledByPlayer(false), new RandomChanceWithLooting(0.07f, 0.05f) }, new RandomValueRange(1), new RandomValueRange(0), "necrotic_bone")); } }
private @Nonnull static SetCount setCount(int min, int max) { return new SetCount(NO_CONDITIONS, new RandomValueRange(min, min)); }
private @Nonnull static SetDamage setDamage(Item item, int damage) { return new SetDamage(NO_CONDITIONS, new RandomValueRange(damage > 0 ? damage : 1, damage > 0 ? damage : item.getMaxDamage())); }
@Override public void preInit(FMLPreInitializationEvent event) { LootFunctionManager.registerFunction(new SetAsTreasureFunction.Serializer()); }
@SubscribeEvent public void loadLootTable( LootTableLoadEvent event ) { if( event.getName() == LootTableList.CHESTS_ABANDONED_MINESHAFT ) { // 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(); 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" ) ); } ); } }
public EntryBuilder count(int min, int max) { return this.function(new SetCount(new LootCondition[0], new RandomValueRange(min, max))); }
private @Nonnull static SetNBT setNBT(ItemStack stack) { return new SetNBT(NO_CONDITIONS, NullHelper.first(stack.getTagCompound(), new NBTTagCompound())); }
@Override public void preInit(FMLPreInitializationEvent event) { ancient_tome = new ItemAncientTome(); LootFunctionManager.registerFunction(new EnchantTomeFunction.Serializer()); }
private @Nonnull static SetMetadata setMetadata(int meta) { return new SetMetadata(NO_CONDITIONS, new RandomValueRange(meta)); }
/** * Creates a new loot entry that will be added to the loot pools when a world is loaded. * * @param location The loot table to add the loot to. You can use * {@link net.minecraft.world.storage.loot.LootTableList} for convenience. * @param name The name of the entry being added. This will be prefixed with {@link #modid} * . * @param pool The name of the pool to add the entry to. This pool must already exist. * @param weight The weight of the entry. * @param item The item to add. * @param meta The metadata for the loot. * @param min The smallest item size. * @param max The largest item size. * @return A builder object. It can be used to fine tune the loot entry. */ public LootBuilder addLoot (ResourceLocation location, String name, String pool, int weight, Item item, int meta, int min, int max) { final LootBuilder loot = this.addLoot(location, name, pool, weight, item, meta); loot.addFunction(new SetCount(new LootCondition[0], new RandomValueRange(min, max))); return loot; }
@SubscribeEvent public static void preInit(EnderIOLifecycleEvent.PreInit event) { LootFunctionManager.registerFunction(new LootSelector.Serializer()); LootFunctionManager.registerFunction(new SetRandomEnergy.Serializer()); LootFunctionManager.registerFunction(new SetRandomDarkUpgrade.Serializer()); LootFunctionManager.registerFunction(new UseThings.Serializer()); LootFunctionManager.registerFunction(new Potion.Serializer()); AnvilCapacitorRecipe.create(); }
private @Nonnull static SetMetadata setMetadata(int metaMin, int metaMax) { return new SetMetadata(NO_CONDITIONS, new RandomValueRange(metaMin, metaMax)); }
private LootHandler() { for (String s : INJECTION_TABLES) { LootTableList.register(new ResourceLocation(REFERENCE.MODID, s)); } LootFunctionManager.registerFunction(new AddBookNbt.Serializer()); LootFunctionManager.registerFunction(new SetItemTier.Serializer()); LootFunctionManager.registerFunction(new SetItemBloodCharge.Serializer()); LootFunctionManager.registerFunction(new SetMetaBasedOnLevel.Serializer()); LootConditionManager.registerCondition(new StakeCondition.Serializer()); }
public EntryBuilder data(int min, int max) { return this.function(new SetMetadata(new LootCondition[0], new RandomValueRange(min, max))); }
@EventHandler public void preInit(FMLPreInitializationEvent event) { loadConfig(); syncConfig(); MinecraftForge.EVENT_BUS.register(new EventLiving()); TAB = new CreativeTab(MODID); ModEntities.init(); MinecraftForge.EVENT_BUS.register(PROXY); logger.info("A raven flies from the north to the sea"); logger.info("A dragon whispers her name in the east"); ThaumcraftCompatBridge.loadThaumcraftCompat(); LootFunctionManager.registerFunction(new CustomizeToDragon.Serializer()); }
/** * Creates a new loot entry that will be added to the loot pools when a world is loaded. * * @param location The loot table to add the loot to. You can use * {@link net.minecraft.world.storage.loot.LootTableList} for convenience. * @param name The name of the entry being added. This will be prefixed with {@link #modid} * . * @param pool The name of the pool to add the entry to. This pool must already exist. * @param weight The weight of the entry. * @param item The item to add. * @param meta The metadata for the loot. * @return A builder object. It can be used to fine tune the loot entry. */ public LootBuilder addLoot (ResourceLocation location, String name, String pool, int weight, Item item, int meta) { final LootBuilder loot = this.addLoot(location, name, pool, weight, item); loot.addFunction(new SetMetadata(new LootCondition[0], new RandomValueRange(meta, meta))); return loot; }
@Override public void setupAPI() { ChipsetManager.solderManager = new SolderManager(); ChipsetManager.circuitRegistry = new CircuitRegistry(); AlleleRegistry alleleRegistry = new AlleleRegistry(); AlleleManager.alleleRegistry = alleleRegistry; AlleleManager.climateHelper = new ClimateUtil(); AlleleManager.alleleFactory = new AlleleFactory(); alleleRegistry.initialize(); LootFunctionManager.registerFunction(new SetSpeciesNBT.Serializer()); MultiblockManager.logicFactory = new MultiblockLogicFactory(); RecipeManagers.hygroregulatorManager = new HygroregulatorManager(); }
@SubscribeEvent public void onLootTableLoad(LootTableLoadEvent event) { LootFunction[] funcs = new LootFunction[] { new SetMetadata(new LootCondition[0], new RandomValueRange(0, enableRainbowRuneChests ? 16 : 15)) }; if(event.getName().equals(LootTableList.CHESTS_SIMPLE_DUNGEON)) event.getTable().getPool("main").addEntry(new LootEntryItem(rune, dungeonWeight, itemQuality, funcs, new LootCondition[0], "quark:rune")); else if(event.getName().equals(LootTableList.CHESTS_NETHER_BRIDGE)) event.getTable().getPool("main").addEntry(new LootEntryItem(rune, netherFortressWeight, itemQuality, funcs, new LootCondition[0], "quark:rune")); else if(event.getName().equals(LootTableList.CHESTS_JUNGLE_TEMPLE)) event.getTable().getPool("main").addEntry(new LootEntryItem(rune, jungleTempleWeight, itemQuality, funcs, new LootCondition[0], "quark:rune")); else if(event.getName().equals(LootTableList.CHESTS_DESERT_PYRAMID)) event.getTable().getPool("main").addEntry(new LootEntryItem(rune, desertTempleWeight, itemQuality, funcs, new LootCondition[0], "quark:rune")); }