本文整理汇总了Java中net.minecraft.world.storage.loot.conditions.LootConditionManager类的典型用法代码示例。如果您正苦于以下问题:Java LootConditionManager类的具体用法?Java LootConditionManager怎么用?Java LootConditionManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LootConditionManager类属于net.minecraft.world.storage.loot.conditions包,在下文中一共展示了LootConditionManager类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: init
import net.minecraft.world.storage.loot.conditions.LootConditionManager; //导入依赖的package包/类
public void init(FMLInitializationEvent event)
{
// Register custom loot tables and auxiliaries
LootConditionManager.registerCondition(new LootIsModLoaded.Serializer());
LootTableList.register(new ResourceLocation(BetterThanWeagles.MODID, "custom/simple_dungeon_chest"));
ModVillagers.registerVillagerTrades();
// Set up integration with other mods
if (Loader.isModLoaded("actuallyadditions"))
{
IntegrationAAdditions.init();
}
if (Loader.isModLoaded("immersiveengineering"))
{
IntegrationIEngineering.init();
}
if (Loader.isModLoaded("tconstruct"))
{
IntegrationTinkers.init();
}
if (Loader.isModLoaded("thermalexpansion"))
{
IntegrationThermal.init();
}
}
开发者ID:DarkMorford,项目名称:BetterThanWeagles,代码行数:30,代码来源:CommonProxy.java
示例2: createLootRoll
import net.minecraft.world.storage.loot.conditions.LootConditionManager; //导入依赖的package包/类
/**
* generates the contents for a single roll.
* The first for loop calculates the sum of all the lootentries
* and the second for loop adds a random item
* with items with higher weights being more probable.
*/
protected void createLootRoll(Collection<ItemStack> stacks, Random rand, LootContext context)
{
List<LootEntry> list = Lists.<LootEntry>newArrayList();
int i = 0;
for (LootEntry lootentry : this.lootEntries)
{
if (LootConditionManager.testAllConditions(lootentry.conditions, rand, context))
{
int j = lootentry.getEffectiveWeight(context.getLuck());
if (j > 0)
{
list.add(lootentry);
i += j;
}
}
}
if (i != 0 && !list.isEmpty())
{
int k = rand.nextInt(i);
for (LootEntry lootentry1 : list)
{
k -= lootentry1.getEffectiveWeight(context.getLuck());
if (k < 0)
{
lootentry1.addLoot(stacks, rand, context);
return;
}
}
}
}
开发者ID:sudofox,项目名称:Backmemed,代码行数:42,代码来源:LootPool.java
示例3: generateLoot
import net.minecraft.world.storage.loot.conditions.LootConditionManager; //导入依赖的package包/类
/**
* generates loot and puts it in an inventory
*/
public void generateLoot(Collection<ItemStack> stacks, Random rand, LootContext context)
{
if (LootConditionManager.testAllConditions(this.poolConditions, rand, context))
{
int i = this.rolls.generateInt(rand) + MathHelper.floor(this.bonusRolls.generateFloat(rand) * context.getLuck());
for (int j = 0; j < i; ++j)
{
this.createLootRoll(stacks, rand, context);
}
}
}
开发者ID:sudofox,项目名称:Backmemed,代码行数:16,代码来源:LootPool.java
示例4: addLoot
import net.minecraft.world.storage.loot.conditions.LootConditionManager; //导入依赖的package包/类
public void addLoot(Collection<ItemStack> stacks, Random rand, LootContext context)
{
ItemStack itemstack = new ItemStack(this.item);
for (LootFunction lootfunction : this.functions)
{
if (LootConditionManager.testAllConditions(lootfunction.getConditions(), rand, context))
{
itemstack = lootfunction.apply(itemstack, rand, context);
}
}
if (!itemstack.func_190926_b())
{
if (itemstack.func_190916_E() < this.item.getItemStackLimit())
{
stacks.add(itemstack);
}
else
{
int i = itemstack.func_190916_E();
while (i > 0)
{
ItemStack itemstack1 = itemstack.copy();
itemstack1.func_190920_e(Math.min(itemstack.getMaxStackSize(), i));
i -= itemstack1.func_190916_E();
stacks.add(itemstack1);
}
}
}
}
开发者ID:sudofox,项目名称:Backmemed,代码行数:33,代码来源:LootEntryItem.java
示例5: createLootRoll
import net.minecraft.world.storage.loot.conditions.LootConditionManager; //导入依赖的package包/类
/**
* generates the contents for a single roll.
* The first for loop calculates the sum of all the lootentries
* and the second for loop adds a random item
* with items with higher weights being more probable.
*/
protected void createLootRoll(Collection<ItemStack> stacks, Random rand, LootContext context)
{
List<LootEntry> list = Lists.<LootEntry>newArrayList();
int i = 0;
for (LootEntry lootentry : this.lootEntries)
{
if (LootConditionManager.testAllConditions(lootentry.conditions, rand, context))
{
int j = lootentry.getEffectiveWeight(context.getLuck());
if (j > 0)
{
list.add(lootentry);
i += j;
}
}
}
if (i != 0 && !list.isEmpty())
{
int k = rand.nextInt(i);
for (LootEntry lootentry1 : list)
{
k -= lootentry1.getEffectiveWeight(context.getLuck());
if (k < 0)
{
lootentry1.addLoot(stacks, rand, context);
return;
}
}
}
}
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:42,代码来源:LootPool.java
示例6: generateLoot
import net.minecraft.world.storage.loot.conditions.LootConditionManager; //导入依赖的package包/类
/**
* generates loot and puts it in an inventory
*/
public void generateLoot(Collection<ItemStack> stacks, Random rand, LootContext context)
{
if (LootConditionManager.testAllConditions(this.poolConditions, rand, context))
{
int i = this.rolls.generateInt(rand) + MathHelper.floor_float(this.bonusRolls.generateFloat(rand) * context.getLuck());
for (int j = 0; j < i; ++j)
{
this.createLootRoll(stacks, rand, context);
}
}
}
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:16,代码来源:LootPool.java
示例7: addLoot
import net.minecraft.world.storage.loot.conditions.LootConditionManager; //导入依赖的package包/类
public void addLoot(Collection<ItemStack> stacks, Random rand, LootContext context)
{
ItemStack itemstack = new ItemStack(this.item);
for (LootFunction lootfunction : this.functions)
{
if (LootConditionManager.testAllConditions(lootfunction.getConditions(), rand, context))
{
itemstack = lootfunction.apply(itemstack, rand, context);
}
}
if (itemstack.stackSize > 0)
{
if (itemstack.stackSize < this.item.getItemStackLimit(itemstack))
{
stacks.add(itemstack);
}
else
{
int i = itemstack.stackSize;
while (i > 0)
{
ItemStack itemstack1 = itemstack.copy();
itemstack1.stackSize = Math.min(itemstack.getMaxStackSize(), i);
i -= itemstack1.stackSize;
stacks.add(itemstack1);
}
}
}
}
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:33,代码来源:LootEntryItem.java
注:本文中的net.minecraft.world.storage.loot.conditions.LootConditionManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论