本文整理匯總了Java中net.minecraft.util.DamageSource.MAGIC屬性的典型用法代碼示例。如果您正苦於以下問題:Java DamageSource.MAGIC屬性的具體用法?Java DamageSource.MAGIC怎麽用?Java DamageSource.MAGIC使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類net.minecraft.util.DamageSource
的用法示例。
在下文中一共展示了DamageSource.MAGIC屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getItemsFromLootPool
public static List<ItemStack> getItemsFromLootPool(World world, ResourceLocation locationOfTable, String poolName)
{
LootContext context = new LootContext(1f, (WorldServer) world, world.getLootTableManager(), null, null, DamageSource.MAGIC);
List<ItemStack> list = Lists.<ItemStack>newArrayList();
world.getLootTableManager().getLootTableFromLocation(locationOfTable).getPool(poolName).generateLoot(list, new Random(), context);
return exposeList(list);
}
示例2: attackEntityFrom
/**
* Called when the entity is attacked.
*/
@Override
public boolean attackEntityFrom(DamageSource source, float amount) {
if (this.recentlyHit > 0 && source == DamageSource.MAGIC)
this.recentlyHit=Math.max(20, this.recentlyHit);
if (this.isEntityInvulnerable(source))
return false;
else if (super.attackEntityFrom(source, amount)) {
Entity entity = source.getTrueSource();
return this.getRidingEntity() != entity && this.getRidingEntity() != entity ? true : true;
} else
return false;
}
示例3: getItemsFromLootTable
public static List<ItemStack> getItemsFromLootTable(World world, ResourceLocation locationOfTable)
{
LootContext context = new LootContext(1f, (WorldServer) world, world.getLootTableManager(), null, null, DamageSource.MAGIC);
return exposeList(world.getLootTableManager().getLootTableFromLocation(locationOfTable).generateLootForPools(new Random(), context));
}