当前位置: 首页>>代码示例>>Java>>正文


Java SetCount类代码示例

本文整理汇总了Java中net.minecraft.world.storage.loot.functions.SetCount的典型用法代码示例。如果您正苦于以下问题:Java SetCount类的具体用法?Java SetCount怎么用?Java SetCount使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SetCount类属于net.minecraft.world.storage.loot.functions包,在下文中一共展示了SetCount类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onLootTableLoad

import net.minecraft.world.storage.loot.functions.SetCount; //导入依赖的package包/类
@SubscribeEvent
public static void onLootTableLoad(LootTableLoadEvent event) {
    ResourceLocation tableName = event.getName();
    LootPool pool = null;
    int bandage = 0, plaster = 0, morphine = 0;
    if (tableName.equals(LootTableList.CHESTS_SPAWN_BONUS_CHEST)) {
        pool = event.getTable().getPool("main");
        bandage = 8;
        plaster = 16;
        morphine = 4;
    } else if (tableName.equals(LootTableList.CHESTS_STRONGHOLD_CORRIDOR) || tableName.equals(LootTableList.CHESTS_STRONGHOLD_CROSSING) || tableName.equals(LootTableList.CHESTS_ABANDONED_MINESHAFT)) {
        pool = event.getTable().getPool("main");
        bandage = 20;
        plaster = 24;
        morphine = 8;
    }

    if (pool != null) {
        pool.addEntry(new LootEntryItem(FirstAidItems.BANDAGE, bandage, 0, new SetCount[]{new SetCount(new LootCondition[0], new RandomValueRange(1, 3))}, new LootCondition[0], FirstAid.MODID + "bandage"));
        pool.addEntry(new LootEntryItem(FirstAidItems.PLASTER, plaster, 0, new SetCount[]{new SetCount(new LootCondition[0], new RandomValueRange(1, 5))}, new LootCondition[0], FirstAid.MODID + "plaster"));
        pool.addEntry(new LootEntryItem(FirstAidItems.MORPHINE, morphine, 0, new SetCount[]{new SetCount(new LootCondition[0], new RandomValueRange(1, 2))}, new LootCondition[0], FirstAid.MODID + "morphine"));
    }
}
 
开发者ID:ichttt,项目名称:FirstAid,代码行数:24,代码来源:EventHandler.java

示例2: onLootTablesLoaded

import net.minecraft.world.storage.loot.functions.SetCount; //导入依赖的package包/类
@SubscribeEvent
public void onLootTablesLoaded (LootTableLoadEvent event) {
    
    // Checks to see if the loot table being loaded is the basic dungeon chest.
    if (event.getName().equals(LootTableList.CHESTS_SIMPLE_DUNGEON)) {
        
        // Gets pool2 from the loot table. This pool is where common loot like zombie flesh
        // bones and string goes.
        final LootPool pool2 = event.getTable().getPool("pool2");
        
        // Makes sure the pool has not been deleted.
        if (pool2 != null) {
            
            // Adds cookies to the loot pool. Has a weight of 10 and spawns in stacks of 1
            // to 5.
            pool2.addEntry(new LootEntryItem(Items.COOKIE, 10, 0, new LootFunction[] { new SetCount(new LootCondition[0], new RandomValueRange(1, 5)) }, new LootCondition[0], "tutorial:cookie"));
            
            // Adds Lime Green Dye to the loot pool. Has a weight of 10.
            pool2.addEntry(new LootEntryItem(Items.DYE, 10, 0, new LootFunction[] { new SetDamage(new LootCondition[0], new RandomValueRange(10, 10)) }, new LootCondition[0], "tutorial:dyes"));
        }
    }
    
    // Checks to see if the loot table being loaded is for the mob we are looking for
    if (event.getName().equals(LootTableList.ENTITIES_PIG)) {
        
        // Gets main from the loot table. This pool is where the basic drops like porkchop are.
        final LootPool main = event.getTable().getPool("main");
        
        // Makes sure that the main pool actually exists. It can be deleted by other mods.
        if (main != null) {
            
            // Adds a carrot to the pool. Carrots will now drop just as often as pork chops.
            main.addEntry(new LootEntryItem(Items.CARROT, 1, 0, new LootFunction[0], new LootCondition[0], "tutorial:carrot"));
            
            // Adds an apple to the loot pool. This entry is only used if the pig was killed by a player.
            main.addEntry(new LootEntryItem(Items.APPLE, 1, 0, new LootFunction[0], new LootCondition[] { new KilledByPlayer(false)}, "tutorial:player"));
        }
    }
}
 
开发者ID:Minecraft-Forge-Tutorials,项目名称:Loot-Tables,代码行数:40,代码来源:LootTablesMod.java

示例3: createCountFunction

import net.minecraft.world.storage.loot.functions.SetCount; //导入依赖的package包/类
public static SetCount createCountFunction(float min,float max)
   {
return createCountFunction(min, max, NO_CONDITIONS);
   }
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:5,代码来源:LootUtil.java

示例4: setCount

import net.minecraft.world.storage.loot.functions.SetCount; //导入依赖的package包/类
private @Nonnull SetCount setCount(int min, int max) {
  return new SetCount(NO_CONDITIONS, new RandomValueRange(min, min));
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:4,代码来源:LootManager.java

示例5: addLoot

import net.minecraft.world.storage.loot.functions.SetCount; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:Darkhax-Minecraft,项目名称:Bookshelf,代码行数:22,代码来源:RegistryHelper.java


注:本文中的net.minecraft.world.storage.loot.functions.SetCount类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。