本文整理汇总了Java中net.minecraft.world.storage.loot.LootEntryItem类的典型用法代码示例。如果您正苦于以下问题:Java LootEntryItem类的具体用法?Java LootEntryItem怎么用?Java LootEntryItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LootEntryItem类属于net.minecraft.world.storage.loot包,在下文中一共展示了LootEntryItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onLootTableLoad
import net.minecraft.world.storage.loot.LootEntryItem; //导入依赖的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.LootEntryItem; //导入依赖的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
示例3: replaceCookedWithCharred
import net.minecraft.world.storage.loot.LootEntryItem; //导入依赖的package包/类
private static void replaceCookedWithCharred(LootPool targetPool, Item targetItem, ItemStack replacementStack, int minCount, int maxCount)
{
List<LootFunction> charredFunctions = Lists.newArrayList();
if(replacementStack.getItemDamage() != 0) charredFunctions.add(LootUtil.createSetMetadata(replacementStack.getItemDamage()));
if(replacementStack.getTagCompound() != null) charredFunctions.add(LootUtil.createSetNBT(replacementStack.getTagCompound()));
charredFunctions.add(LootUtil.createCountFunction(minCount, maxCount));
charredFunctions.add(LootUtil.createLootingFunc(0, 1));
LootCondition notOnFire = new EntityHasProperty(new EntityProperty[] {new EntityOnFire(false)}, EntityTarget.THIS);
LootCondition onFire = new EntityHasProperty(new EntityProperty[] {new EntityOnFire(true)}, EntityTarget.THIS);
targetPool.removeEntry(targetItem.getRegistryName().toString());
targetPool.addEntry(new LootEntryItem(targetItem, 1, 1, new LootFunction[] {LootUtil.createCountFunction(1, 3), LootUtil.createLootingFunc(0, 1)}, new LootCondition[] {notOnFire}, targetItem.getRegistryName().toString()));
targetPool.addEntry(new LootEntryItem(replacementStack.getItem(), 1, 1, charredFunctions.toArray(new LootFunction[charredFunctions.size()]), new LootCondition[] {onFire}, ModMain.MODID + ":charred_+" + targetItem.getRegistryName().getResourcePath().toString()));
}
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:16,代码来源:BBEventHandler.java
示例4: removeSmeltFunction
import net.minecraft.world.storage.loot.LootEntryItem; //导入依赖的package包/类
private void removeSmeltFunction(LootPool pool, Item targetItem, Item replacement, int minCount, int maxCount)
{
LootCondition notOnFire = new EntityHasProperty(new EntityProperty[] {new EntityOnFire(false)}, EntityTarget.THIS);
LootCondition onFire = new EntityHasProperty(new EntityProperty[] {new EntityOnFire(true)}, EntityTarget.THIS);
pool.removeEntry(targetItem.getRegistryName().toString());
pool.addEntry(new LootEntryItem(targetItem, 1, 1, new LootFunction[] {LootUtil.createCountFunction(1, 3), LootUtil.createLootingFunc(0, 1)}, new LootCondition[] {notOnFire}, targetItem.getRegistryName().toString()));
pool.addEntry(new LootEntryItem(replacement, 1, 1, new LootFunction[] {LootUtil.createCountFunction(1, 3), LootUtil.createLootingFunc(0, 1)}, new LootCondition[] {onFire}, replacement.getRegistryName().toString()));
}
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:10,代码来源:BBEventHandler.java
示例5: tableToItemStacks
import net.minecraft.world.storage.loot.LootEntryItem; //导入依赖的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
示例6: onLootTableLoad
import net.minecraft.world.storage.loot.LootEntryItem; //导入依赖的package包/类
@SubscribeEvent
public static void onLootTableLoad(LootTableLoadEvent e) {
final ResourceLocation rl = e.getName();
if (rl.equals(LootTableList.CHESTS_VILLAGE_BLACKSMITH) || rl.equals(LootTableList.CHESTS_ABANDONED_MINESHAFT) || rl.equals(LootTableList.CHESTS_JUNGLE_TEMPLE)) {
final LootTable lt = e.getTable();
LootPool lp = lt.getPool("pool0");
if (lp == null)
lp = lt.getPool("main");
if (lp != null) {
lp.addEntry(new LootEntryItem(MCFluxResources.UPCHIP, 20, 0, new LootFunction[0], new LootCondition[0], "mcflux:loot/upchip"));
}
}
}
开发者ID:Szewek,项目名称:Minecraft-Flux,代码行数:14,代码来源:MCFluxEvents.java
示例7: onLootTablesLoaded
import net.minecraft.world.storage.loot.LootEntryItem; //导入依赖的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
示例8: onLootTableLoad
import net.minecraft.world.storage.loot.LootEntryItem; //导入依赖的package包/类
@SubscribeEvent
public void onLootTableLoad (LootTableLoadEvent event) {
if (allowDungeonLoot && event.getName().equals(LootTableList.CHESTS_NETHER_BRIDGE)) {
final LootPool main = event.getTable().getPool("main");
if (main != null) {
main.addEntry(new LootEntryItem(itemRing, weight, 0, new LootFunction[] { new SetDamage(new LootCondition[0], new RandomValueRange(0, ItemRing.varients.length - 1)) }, new LootCondition[0], "darkutils:nether_rings"));
}
}
}
开发者ID:Darkhax-Minecraft,项目名称:Dark-Utilities,代码行数:13,代码来源:FeatureEnchantedRing.java
示例9: onLootTableLoad
import net.minecraft.world.storage.loot.LootEntryItem; //导入依赖的package包/类
@SubscribeEvent
public void onLootTableLoad (LootTableLoadEvent event) {
final LootTable table = event.getTable();
if (skeletonDropDust && event.getName().equals(LootTableList.ENTITIES_WITHER_SKELETON)) {
final LootPool pool1 = table.getPool("pool1");
if (pool1 != null) {
pool1.addEntry(new LootEntryItem(itemMaterial, dustDropWeight, 0, new LootFunction[0], new LootCondition[0], DarkUtils.MOD_ID + ":wither_dust"));
}
}
}
开发者ID:Darkhax-Minecraft,项目名称:Dark-Utilities,代码行数:15,代码来源:FeatureMaterial.java
示例10: createLootEntry
import net.minecraft.world.storage.loot.LootEntryItem; //导入依赖的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
示例11: onLootTableLoad
import net.minecraft.world.storage.loot.LootEntryItem; //导入依赖的package包/类
@SubscribeEvent
public void onLootTableLoad(LootTableLoadEvent e)
{
Worldgen.addLoot(e.getTable(), e.getName());
if (BBConfig.moreBones)
{
if(e.getName().equals(LootTableList.ENTITIES_SKELETON))
{
LootPool pool1 = e.getTable().getPool("pool1");
pool1.removeEntry("minecraft:bone");
pool1.addEntry(new LootEntryItem(Items.BONE, 1, 1, new LootFunction[] {LootUtil.createCountFunction(1, 3), LootUtil.createLootingFunc(0, 1)}, LootUtil.NO_CONDITIONS, Items.BONE.getRegistryName().toString()));
}
}
if (BBConfig.flamingAnimalsDropCharredMeat)
{
if(e.getName().equals(LootTableList.ENTITIES_COW))
{
replaceCookedWithCharred(e.getTable().getPool("pool1"), Items.BEEF, new ItemStack(RegisterItems.charredMeat, 1, ItemCharredMeat.META_MEAT), 1, 3);
}
else if(e.getName().equals(LootTableList.ENTITIES_PIG))
{
replaceCookedWithCharred(e.getTable().getPool("main"), Items.PORKCHOP, new ItemStack(RegisterItems.charredMeat, 1, ItemCharredMeat.META_MEAT), 1, 3);
}
else if(e.getName().equals(LootTableList.ENTITIES_CHICKEN))
{
replaceCookedWithCharred(e.getTable().getPool("pool1"), Items.CHICKEN, new ItemStack(RegisterItems.charredMeat, 1, ItemCharredMeat.META_CHICKEN), 1, 1);
}
else if(e.getName().equals(LootTableList.ENTITIES_SHEEP))
{
replaceCookedWithCharred(e.getTable().getPool("main"), Items.MUTTON, new ItemStack(RegisterItems.charredMeat, 1, ItemCharredMeat.META_MUTTON), 1, 2);
}
else if(e.getName().equals(LootTableList.ENTITIES_RABBIT))
{
replaceCookedWithCharred(e.getTable().getPool("pool1"), Items.RABBIT, new ItemStack(RegisterItems.charredMeat, 1, ItemCharredMeat.META_RABBIT), 0, 1);
}
}
else
{
if(e.getName().equals(LootTableList.ENTITIES_COW))
{
removeSmeltFunction(e.getTable().getPool("pool1"), Items.BEEF, Items.COOKED_BEEF, 1, 3);
}
else if(e.getName().equals(LootTableList.ENTITIES_PIG))
{
removeSmeltFunction(e.getTable().getPool("main"), Items.PORKCHOP, Items.COOKED_PORKCHOP, 1, 3);
}
else if(e.getName().equals(LootTableList.ENTITIES_CHICKEN))
{
removeSmeltFunction(e.getTable().getPool("pool1"), Items.CHICKEN, Items.COOKED_CHICKEN, 1, 1);
}
else if(e.getName().equals(LootTableList.ENTITIES_SHEEP))
{
removeSmeltFunction(e.getTable().getPool("main"), Items.MUTTON, Items.COOKED_MUTTON, 1, 2);
}
else if(e.getName().equals(LootTableList.ENTITIES_RABBIT))
{
removeSmeltFunction(e.getTable().getPool("pool1"), Items.RABBIT, Items.COOKED_RABBIT, 0, 1);
}
}
if(e.getName().equals(LootTableList.ENTITIES_SPIDER) || e.getName().equals(LootTableList.ENTITIES_CAVE_SPIDER))
{
if (!BBConfig.spidersDropString)
{
e.getTable().getPool("main").removeEntry("minecraft:string");
}
e.getTable().getPool("main").addEntry(new LootEntryItem(RegisterItems.silk, 1, 1, new LootFunction[] {LootUtil.createCountFunction(2, 4), LootUtil.createLootingFunc(0, 1)}, LootUtil.NO_CONDITIONS, RegisterItems.silk.getRegistryName().toString()));
}
}
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:69,代码来源:BBEventHandler.java
示例12: addItemToTable
import net.minecraft.world.storage.loot.LootEntryItem; //导入依赖的package包/类
public static void addItemToTable(LootTable table, String poolName, Item item, int weight, int quality, LootFunction[] functions, LootCondition[] conditions)
{
table.getPool("main").addEntry(new LootEntryItem(item, weight, quality, functions, conditions, item.getRegistryName().toString()));
}
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:5,代码来源:LootUtil.java
示例13: getItem
import net.minecraft.world.storage.loot.LootEntryItem; //导入依赖的package包/类
public static Item getItem(LootEntryItem lootEntry)
{
return ReflectionHelper.getPrivateValue(LootEntryItem.class, lootEntry, "item", "field_186368_a");
}
开发者ID:Xilef11,项目名称:runesofwizardry-classics,代码行数:5,代码来源:LootUtils.java
示例14: getFunctions
import net.minecraft.world.storage.loot.LootEntryItem; //导入依赖的package包/类
public static LootFunction[] getFunctions(LootEntryItem lootEntry)
{
return ReflectionHelper.getPrivateValue(LootEntryItem.class, lootEntry, "functions", "field_186369_b");
}
开发者ID:Xilef11,项目名称:runesofwizardry-classics,代码行数:5,代码来源:LootUtils.java
示例15: createLootEntryItem
import net.minecraft.world.storage.loot.LootEntryItem; //导入依赖的package包/类
public static LootEntryItem createLootEntryItem(Item item, int weight, int quality) {
return createLootEntryItem(item, weight, quality, new LootFunction[]{});
}
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:4,代码来源:LootHelper.java
示例16: addLoot
import net.minecraft.world.storage.loot.LootEntryItem; //导入依赖的package包/类
private static void addLoot(LootPool pool, Item item, int weight)
{
pool.addEntry(new LootEntryItem(item, weight, 0, new LootFunction[0], new LootCondition[0], Reference.MOD_ID + item.getUnlocalizedName()));
}
开发者ID:alxnns1,项目名称:MobHunter,代码行数:5,代码来源:LootHandler.java
示例17: addLoot
import net.minecraft.world.storage.loot.LootEntryItem; //导入依赖的package包/类
private void addLoot(LootPool main, Item item, int rando) {
if (item != null) {//shortcut fix bc of new module config system that can delete items
main.addEntry(new LootEntryItem(item, rando, 0, new LootFunction[0], new LootCondition[0], Const.MODRES + item.getUnlocalizedName()));
}
}
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:6,代码来源:LootTableModule.java
示例18: createDarkSteelLootEntry
import net.minecraft.world.storage.loot.LootEntryItem; //导入依赖的package包/类
private @Nonnull LootEntry createDarkSteelLootEntry(@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");
return new LootEntryItem(item, 1, 1, new LootFunction[] { setCount(minStackSize, maxStackSize), setDamage(item, meta), setUpgrades(), setEnergy() },
chanceCond, registryName.toString() + ":" + meta);
}
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:7,代码来源:LootManager.java
示例19: createLootCapacitor
import net.minecraft.world.storage.loot.LootEntryItem; //导入依赖的package包/类
private @Nonnull LootEntry createLootCapacitor(float chance) {
capCount++;
return new LootEntryItem(itemBasicCapacitor.getItemNN(), 1, 1, new LootFunction[] { ls, setMetadata(3, 4) },
new LootCondition[] { new RandomChance(chance) }, itemBasicCapacitor.getUnlocalisedName() + capCount);
}
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:6,代码来源:LootManager.java
示例20: build
import net.minecraft.world.storage.loot.LootEntryItem; //导入依赖的package包/类
/**
* Builds the LootEntryItem so it can be used with vanilla MC.
*
* @return The LootEntryItem that was built.
*/
public LootEntryItem build () {
return new LootEntryItem(this.item, this.weight, this.quality, this.functions.toArray(new LootFunction[0]), this.conditions.toArray(new LootCondition[0]), this.name);
}
开发者ID:Darkhax-Minecraft,项目名称:Bookshelf,代码行数:10,代码来源:LootBuilder.java
注:本文中的net.minecraft.world.storage.loot.LootEntryItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论