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


Java LootEntry类代码示例

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


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

示例1: onLootTableLoad

import net.minecraft.world.storage.loot.LootEntry; //导入依赖的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.LootEntry; //导入依赖的package包/类
@SubscribeEvent
public void onLootTableLoad(LootTableLoadEvent event) {
  LootPool main = event.getTable().getPool(LOOTPOOLNAME);
  if (main == null) {
    //create my own.  EX: mobs that have no drops (bats) also have empty loot table, so i have to inject an entry in the table before I fill it
    event.getTable().addPool(new LootPool(new LootEntry[0], new LootCondition[0], new RandomValueRange(1F, 2F), new RandomValueRange(1F, 1F), LOOTPOOLNAME));
    main = event.getTable().getPool(LOOTPOOLNAME);
    if (main == null) {
      ModCyclic.logger.error("could not insert Loot Pool for table :" + event.getName().toString());
      return;
    }
  }
  if (enableChestLoot) {
    onLootChestTableLoad(main, event);
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:17,代码来源:LootTableModule.java

示例3: addPool

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

示例4: addTables

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

示例5: lootTableLoad

import net.minecraft.world.storage.loot.LootEntry; //导入依赖的package包/类
@SubscribeEvent
public void lootTableLoad(final LootTableLoadEvent event) {
	if (NemesisConfig.DISCOVERY_ENABLED && isLootTarget(event)) {

		// TODO improve roll settings

		String name = LOOT_TABLE.toString();
		LootEntry entry = new LootEntryTable(LOOT_TABLE, 1, 0, new LootCondition[0], name);

		RandomValueRange rolls = new RandomValueRange(0, 1);
		LootPool pool = new LootPool(new LootEntry[] { entry }, new LootCondition[0], rolls, rolls, name);
		event.getTable().addPool(pool);
	}
}
 
开发者ID:ToroCraft,项目名称:NemesisSystem,代码行数:15,代码来源:LootHandler.java

示例6: tableToItemStacks

import net.minecraft.world.storage.loot.LootEntry; //导入依赖的package包/类
/**
 * Converts a LootTable to a list of possible drops, only looks for Item and metadata.
 * @param table the loot table to get items from
 * @return a LinkedList of the stacks in the loot table
 */
public static List<ItemStack> tableToItemStacks(LootTable table){
	List<ItemStack> stacks = new LinkedList<>();
	for(LootPool p:getPools(table)){
		for(LootEntry entry:getEntries(p)){
			if(entry instanceof LootEntryItem){
				LootEntryItem ei = (LootEntryItem)entry;
				Item item = getItem(ei);
				LootFunction[] functs = getFunctions(ei);
				boolean metaSet = false;
				for(LootFunction func:functs){
					if(func instanceof SetMetadata){
						metaSet=true;
						RandomValueRange range = (RandomValueRange)ReflectionHelper.getPrivateValue(SetMetadata.class, (SetMetadata)func, "metaRange","field_186573_b");
						int meta = MathHelper.floor(range.getMin());
						stacks.add(new ItemStack(item,1,meta));
					}
				}
				if(!metaSet)stacks.add(new ItemStack(item));
			}
			/* won't bother with this case for now
			else if(entry instanceof LootEntryTable){
				//restart with that table
				ResourceLocation location = (ResourceLocation) ReflectionHelper.getPrivateValue(LootEntryTable.class, (LootEntryTable)entry, "table","field_186371_a");
			}
			*/
		}
	}
	return stacks;
}
 
开发者ID:Xilef11,项目名称:runesofwizardry-classics,代码行数:35,代码来源:LootUtils.java

示例7: onLootLoading

import net.minecraft.world.storage.loot.LootEntry; //导入依赖的package包/类
@SubscribeEvent
public static void onLootLoading(LootTableLoadEvent event) {
    if (event.getName().toString().equals("minecraft:gameplay/fishing")) {
        LootPool pool = event.getTable().getPool("main");
        if (pool != null) {
            for (String name : LOOT_TABLES) {
                LootEntry entry = pool.getEntry("minecraft:" + name);
                pool.addEntry(getEntry(MOD_ID + "_" + name.replace(FISHING, ""), name, getVanillaQuality(entry), getVanillaWeight(entry)));
            }
        }
    }
}
 
开发者ID:GirafiStudios,项目名称:Culinary-Cultivation,代码行数:13,代码来源:FishingLootEvent.java

示例8: onLootTableLoad

import net.minecraft.world.storage.loot.LootEntry; //导入依赖的package包/类
@SubscribeEvent
public void onLootTableLoad(LootTableLoadEvent event) {
    String name = event.getName().toString();
    if (name.startsWith("minecraft:chests/simple_dungeon") || name.startsWith("minecraft:chests/desert_pyramid") || name.startsWith("minecraft:chests/jungle_temple")) {
        event.getTable().addPool(new LootPool(new LootEntry[] { new LootEntryTable(new ResourceLocation(Allomancy.MODID, "inject/lerasium"), 1, 0, new LootCondition[0], "allomancy_inject_entry") }, new LootCondition[0], new RandomValueRange(1),
                new RandomValueRange(0, 1), "allomancy_inject_pool"));
    }
}
 
开发者ID:legobmw99,项目名称:Allomancy,代码行数:9,代码来源:CommonEventHandler.java

示例9: createLootEntry

import net.minecraft.world.storage.loot.LootEntry; //导入依赖的package包/类
private @Nonnull LootEntry createLootEntry(@Nonnull Item item, int meta, int minStackSize, int maxStackSize, float chance) {
  LootCondition[] chanceCond = new LootCondition[] { new RandomChance(chance) };
  final ResourceLocation registryName = NullHelper.notnull(item.getRegistryName(), "found unregistered item");
  if (item.isDamageable()) {
    return new LootEntryItem(item, 1, 1, new LootFunction[] { setCount(minStackSize, maxStackSize), setDamage(item, meta), setEnergy() }, chanceCond,
        registryName.toString() + ":" + meta);
  } else {
    return new LootEntryItem(item, 1, 1, new LootFunction[] { setCount(minStackSize, maxStackSize), setMetadata(meta) }, chanceCond,
        registryName.toString() + ":" + meta);
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:12,代码来源:LootManager.java

示例10: getLootPool

import net.minecraft.world.storage.loot.LootEntry; //导入依赖的package包/类
public static LootPool getLootPool(ResourceLocation res){
	return new LootPool(new LootEntry[]{new LootEntryTable(res, 1, 0, new LootCondition[0], "combined")},
			new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0), "combined");
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:5,代码来源:TF2EventsCommon.java

示例11: getEntries

import net.minecraft.world.storage.loot.LootEntry; //导入依赖的package包/类
public static List<LootEntry> getEntries(LootPool pool)
{
    return ReflectionHelper.getPrivateValue(LootPool.class, pool, "lootEntries", "field_186453_a");
}
 
开发者ID:Xilef11,项目名称:runesofwizardry-classics,代码行数:5,代码来源:LootUtils.java

示例12: createPoolIfNotExists

import net.minecraft.world.storage.loot.LootEntry; //导入依赖的package包/类
public static void createPoolIfNotExists(LootTable lootTable, String poolId) {
    if (poolId.equals(VANILLA_LOOT_POOL_ID) || lootTable.getPool(poolId) != null) return;
    lootTable.addPool(new LootPool(new LootEntry[] {}, new LootCondition[] {}, new RandomValueRange(1), new RandomValueRange(0), poolId));
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:5,代码来源:LootHelper.java

示例13: FyrestonePool

import net.minecraft.world.storage.loot.LootEntry; //导入依赖的package包/类
public FyrestonePool()
{
	super(new LootEntry[0], new LootCondition[0], new RandomValueRange(0, 0), new RandomValueRange(0, 0), VersionInfo.ModName);
}
 
开发者ID:gunnerwolf,项目名称:Fyrestone,代码行数:5,代码来源:LootHandler.java

示例14: getVanillaQuality

import net.minecraft.world.storage.loot.LootEntry; //导入依赖的package包/类
private static int getVanillaQuality(LootEntry entry) {
    return ReflectionHelper.getPrivateValue(LootEntry.class, entry, "quality", "field_186365_d");
}
 
开发者ID:GirafiStudios,项目名称:Culinary-Cultivation,代码行数:4,代码来源:FishingLootEvent.java

示例15: getVanillaWeight

import net.minecraft.world.storage.loot.LootEntry; //导入依赖的package包/类
private static int getVanillaWeight(LootEntry entry) {
    return ReflectionHelper.getPrivateValue(LootEntry.class, entry, "weight", "field_186364_c");
}
 
开发者ID:GirafiStudios,项目名称:Culinary-Cultivation,代码行数:4,代码来源:FishingLootEvent.java


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