本文整理汇总了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;
}
}
}
}
示例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"));
}
}
示例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"));
}
}
}
示例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);
}
}
示例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);
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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"));
}
}
}
示例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"));
}
示例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"));
}
}
}
}
示例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 + "\'");
}
}
示例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;
}