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


Java LootCondition类代码示例

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


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

示例1: onLootTableLoad

import net.minecraft.world.storage.loot.conditions.LootCondition; //导入依赖的package包/类
@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;
            }
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:26,代码来源:EventHandlerPneumaticCraft.java

示例2: onLootTableLoad

import net.minecraft.world.storage.loot.conditions.LootCondition; //导入依赖的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

示例3: onLootTableEvent

import net.minecraft.world.storage.loot.conditions.LootCondition; //导入依赖的package包/类
@SubscribeEvent
public void onLootTableEvent(LootTableLoadEvent event)
{
    if(Clef.config.lootSpawnRate > 0)
    {
        for(String s : Clef.config.disabledLootChests)
        {
            if(event.getName().toString().equals(s))
            {
                return;
            }
        }
        if(event.getName().getResourcePath().contains("chest"))
        {
            event.getTable().addPool(new LootPool(new LootEntry[] { new LootEntryItem(Clef.itemInstrument, Clef.config.lootSpawnRate, 0, new LootFunction[] { new LootFunction(new LootCondition[0])
            {
                @Override
                public ItemStack apply(ItemStack stack, Random rand, LootContext context)
                {
                    InstrumentLibrary.assignRandomInstrument(stack);
                    return stack;
                }
            } }, new LootCondition[0], "clef_instrument_pool") }, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0), "clef_instrument"));
        }
    }
}
 
开发者ID:iChun,项目名称:Clef,代码行数:27,代码来源:EventHandlerServer.java

示例4: deserialize

import net.minecraft.world.storage.loot.conditions.LootCondition; //导入依赖的package包/类
public SetAttributes deserialize(JsonObject object, JsonDeserializationContext deserializationContext, LootCondition[] conditionsIn)
{
    JsonArray jsonarray = JsonUtils.getJsonArray(object, "modifiers");
    SetAttributes.Modifier[] asetattributes$modifier = new SetAttributes.Modifier[jsonarray.size()];
    int i = 0;

    for (JsonElement jsonelement : jsonarray)
    {
        asetattributes$modifier[i++] = SetAttributes.Modifier.deserialize(JsonUtils.getJsonObject(jsonelement, "modifier"), deserializationContext);
    }

    if (asetattributes$modifier.length == 0)
    {
        throw new JsonSyntaxException("Invalid attribute modifiers array; cannot be empty");
    }
    else
    {
        return new SetAttributes(conditionsIn, asetattributes$modifier);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:21,代码来源:SetAttributes.java

示例5: deserialize

import net.minecraft.world.storage.loot.conditions.LootCondition; //导入依赖的package包/类
public EnchantRandomly deserialize(JsonObject object, JsonDeserializationContext deserializationContext, LootCondition[] conditionsIn)
{
    List<Enchantment> list = Lists.<Enchantment>newArrayList();

    if (object.has("enchantments"))
    {
        for (JsonElement jsonelement : JsonUtils.getJsonArray(object, "enchantments"))
        {
            String s = JsonUtils.getString(jsonelement, "enchantment");
            Enchantment enchantment = (Enchantment)Enchantment.REGISTRY.getObject(new ResourceLocation(s));

            if (enchantment == null)
            {
                throw new JsonSyntaxException("Unknown enchantment \'" + s + "\'");
            }

            list.add(enchantment);
        }
    }

    return new EnchantRandomly(conditionsIn, list);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:23,代码来源:EnchantRandomly.java

示例6: deserialize

import net.minecraft.world.storage.loot.conditions.LootCondition; //导入依赖的package包/类
public LootFunction deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    JsonObject jsonobject = JsonUtils.getJsonObject(p_deserialize_1_, "function");
    ResourceLocation resourcelocation = new ResourceLocation(JsonUtils.getString(jsonobject, "function"));
    LootFunction.Serializer<?> serializer;

    try
    {
        serializer = LootFunctionManager.getSerializerForName(resourcelocation);
    }
    catch (IllegalArgumentException var8)
    {
        throw new JsonSyntaxException("Unknown function \'" + resourcelocation + "\'");
    }

    return serializer.deserialize(jsonobject, p_deserialize_3_, (LootCondition[])JsonUtils.deserializeClass(jsonobject, "conditions", new LootCondition[0], p_deserialize_3_, LootCondition[].class));
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:LootFunctionManager.java

示例7: deserialize

import net.minecraft.world.storage.loot.conditions.LootCondition; //导入依赖的package包/类
public static LootEntryItem deserialize(JsonObject object, JsonDeserializationContext deserializationContext, int weightIn, int qualityIn, LootCondition[] conditionsIn)
{
    Item item = JsonUtils.getItem(object, "name");
    LootFunction[] alootfunction;

    if (object.has("functions"))
    {
        alootfunction = (LootFunction[])JsonUtils.deserializeClass(object, "functions", deserializationContext, LootFunction[].class);
    }
    else
    {
        alootfunction = new LootFunction[0];
    }

    return new LootEntryItem(item, weightIn, qualityIn, alootfunction, conditionsIn);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:17,代码来源:LootEntryItem.java

示例8: deserialize

import net.minecraft.world.storage.loot.conditions.LootCondition; //导入依赖的package包/类
public EnchantRandomly deserialize(JsonObject object, JsonDeserializationContext deserializationContext, LootCondition[] conditionsIn)
{
    List<Enchantment> list = null;

    if (object.has("enchantments"))
    {
        list = Lists.<Enchantment>newArrayList();

        for (JsonElement jsonelement : JsonUtils.getJsonArray(object, "enchantments"))
        {
            String s = JsonUtils.getString(jsonelement, "enchantment");
            Enchantment enchantment = (Enchantment)Enchantment.REGISTRY.getObject(new ResourceLocation(s));

            if (enchantment == null)
            {
                throw new JsonSyntaxException("Unknown enchantment \'" + s + "\'");
            }

            list.add(enchantment);
        }
    }

    return new EnchantRandomly(conditionsIn, list);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:25,代码来源:EnchantRandomly.java

示例9: deserialize

import net.minecraft.world.storage.loot.conditions.LootCondition; //导入依赖的package包/类
public static LootEntryItem deserialize(JsonObject object, JsonDeserializationContext deserializationContext, int weightIn, int qualityIn, LootCondition[] conditionsIn)
{
    String name = net.minecraftforge.common.ForgeHooks.readLootEntryName(object, "item");
    Item item = JsonUtils.getItem(object, "name");
    LootFunction[] alootfunction;

    if (object.has("functions"))
    {
        alootfunction = (LootFunction[])JsonUtils.deserializeClass(object, "functions", deserializationContext, LootFunction[].class);
    }
    else
    {
        alootfunction = new LootFunction[0];
    }

    return new LootEntryItem(item, weightIn, qualityIn, alootfunction, conditionsIn, name);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:LootEntryItem.java

示例10: addPool

import net.minecraft.world.storage.loot.conditions.LootCondition; //导入依赖的package包/类
private static void addPool(LootTable table)
{
	LootEntry common = new LootEntryTable(new ResourceLocation("lootslashconquer:chests/common_chest"), 60, 1, new LootCondition[0], "common");
	LootEntry uncommon = new LootEntryTable(new ResourceLocation("lootslashconquer:chests/uncommon_chest"), 25, 1, new LootCondition[0], "uncommon");
	LootEntry rare = new LootEntryTable(new ResourceLocation("lootslashconquer:chests/rare_chest"), 10, 1, new LootCondition[0], "rare");
	LootEntry legendary = new LootEntryTable(new ResourceLocation("lootslashconquer:chests/legendary_chest"), 5, 1, new LootCondition[0], "legendary");
	LootEntry exotic = new LootEntryTable(new ResourceLocation("lootslashconquer:chests/exotic_chest"), 2, 1, new LootCondition[0], "exotic");

	LootPool pool = new LootPool(new LootEntry[] { common, uncommon, rare, legendary, exotic }, new LootCondition[0], new RandomValueRange(0, 1), new RandomValueRange(0), "loot");

	table.addPool(pool);
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:13,代码来源:EventLoadLootTable.java

示例11: addTables

import net.minecraft.world.storage.loot.conditions.LootCondition; //导入依赖的package包/类
@SubscribeEvent
public void addTables(LootTableLoadEvent event){
    String name = event.getName().toString();
    if(Randores.getConfigObj().getModules().isDungeonLoot()) {
        if (is(name, chests)) {
            event.getTable().addPool(new LootPool(new LootEntry[] {new RandoresLootEntry(1, 2, true, 10, 20, new LootCondition[0], "randores_flexible_loot_entry")}, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "randores_flexible_pool"));
        } else if (name.contains("end_city_treasure")) {
            event.getTable().addPool(new LootPool(new LootEntry[] {new RandoresLootEntry(1, 5, true, 20, 50, new LootCondition[0], "randores_flexible_loot_entry")}, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "randores_flexible_pool"));
        } else if (name.contains("spawn_bonus_chest")) {
            event.getTable().addPool(new LootPool(new LootEntry[] {new RandoresLootEntry(1, 1, false, 0, 0, new LootCondition[0], "randores_flexible_loot_entry")}, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "randores_flexible_pool"));
        }
    }
}
 
开发者ID:Randores,项目名称:Randores2,代码行数:14,代码来源:RandoresLoot.java

示例12: addNotImportantToTable

import net.minecraft.world.storage.loot.conditions.LootCondition; //导入依赖的package包/类
public void addNotImportantToTable(LootTable table)
{
    List<LootEntry> entrs = new ArrayList<>();
    for (PapyrusData p : getPapyruses())
    {
        if (!p.isImportant())
        {
            NBTTagCompound tag = new NBTTagCompound();
            tag.setString("papyrus_id", p.getPapyrusId());
            entrs.add(new LootEntryItem(ItemRegistry.papyrus, 1, 1, new LootFunction[]{new SetNBT(new LootCondition[]{}, tag)}, new LootCondition[]{}, p.getPapyrusId()));
        }
    }
    table.addPool(new LootPool(entrs.toArray(new LootEntry[]{}), new LootCondition[]{}, new RandomValueRange(0, 1), new RandomValueRange(0), "papyruses"));
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:15,代码来源:PapyrusRegistry.java

示例13: onLootTablesLoaded

import net.minecraft.world.storage.loot.conditions.LootCondition; //导入依赖的package包/类
@SubscribeEvent
public void onLootTablesLoaded(LootTableLoadEvent event) {
	if ((event.getName().equals(LootTableList.CHESTS_ABANDONED_MINESHAFT)) || (event.getName().equals(LootTableList.CHESTS_SIMPLE_DUNGEON)) || (event.getName().equals(LootTableList.CHESTS_DESERT_PYRAMID)) || (event.getName().equals(LootTableList.CHESTS_NETHER_BRIDGE)) || (event.getName().equals(LootTableList.CHESTS_STRONGHOLD_LIBRARY)) || (event.getName().equals(LootTableList.CHESTS_END_CITY_TREASURE))) {
		LootPool mainPool = event.getTable().getPool("main");
		if (mainPool != null) {
			if (event.getName().equals(LootTableList.CHESTS_ABANDONED_MINESHAFT) || event.getName().equals(LootTableList.CHESTS_NETHER_BRIDGE) || event.getName().equals(LootTableList.CHESTS_SIMPLE_DUNGEON)) {
				mainPool.addEntry(new LootEntryItem(ModItems.FRIENDER_PEARL, 10, 0, new LootFunction[] {}, new LootCondition[0], ModGlobals.MODID + ":friender_pearl_loot"));
			}
		}
	}

}
 
开发者ID:p455w0rd,项目名称:EndermanEvolution,代码行数:13,代码来源:ModEvents.java

示例14: deserialize

import net.minecraft.world.storage.loot.conditions.LootCondition; //导入依赖的package包/类
public LootEntry deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    JsonObject jsonobject = JsonUtils.getJsonObject(p_deserialize_1_, "loot item");
    String s = JsonUtils.getString(jsonobject, "type");
    int i = JsonUtils.getInt(jsonobject, "weight", 1);
    int j = JsonUtils.getInt(jsonobject, "quality", 0);
    LootCondition[] alootcondition;

    if (jsonobject.has("conditions"))
    {
        alootcondition = (LootCondition[])JsonUtils.deserializeClass(jsonobject, "conditions", p_deserialize_3_, LootCondition[].class);
    }
    else
    {
        alootcondition = new LootCondition[0];
    }

    if ("item".equals(s))
    {
        return LootEntryItem.deserialize(jsonobject, p_deserialize_3_, i, j, alootcondition);
    }
    else if ("loot_table".equals(s))
    {
        return LootEntryTable.deserialize(jsonobject, p_deserialize_3_, i, j, alootcondition);
    }
    else if ("empty".equals(s))
    {
        return LootEntryEmpty.deserialize(jsonobject, p_deserialize_3_, i, j, alootcondition);
    }
    else
    {
        throw new JsonSyntaxException("Unknown loot entry type \'" + s + "\'");
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:35,代码来源:LootEntry.java

示例15: LootPool

import net.minecraft.world.storage.loot.conditions.LootCondition; //导入依赖的package包/类
public LootPool(LootEntry[] lootEntriesIn, LootCondition[] poolConditionsIn, RandomValueRange rollsIn, RandomValueRange bonusRollsIn)
{
    this.lootEntries = lootEntriesIn;
    this.poolConditions = poolConditionsIn;
    this.rolls = rollsIn;
    this.bonusRolls = bonusRollsIn;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:8,代码来源:LootPool.java


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