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


Java LivingDropsEvent.getSource方法代码示例

本文整理汇总了Java中net.minecraftforge.event.entity.living.LivingDropsEvent.getSource方法的典型用法代码示例。如果您正苦于以下问题:Java LivingDropsEvent.getSource方法的具体用法?Java LivingDropsEvent.getSource怎么用?Java LivingDropsEvent.getSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.event.entity.living.LivingDropsEvent的用法示例。


在下文中一共展示了LivingDropsEvent.getSource方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDrops

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onDrops(LivingDropsEvent event) {
	World world = event.getEntity().getEntityWorld();

	if (world.isRemote || !(event.getEntity() instanceof EntityCreature)) {
		return;
	}

	if (event.getSource() == null || event.getSource().getTrueSource() == null){
		return;
	}

	if (!(event.getSource().getTrueSource() instanceof EntityPlayer)) {
		return;
	}

	if (event.getEntity().getTags().contains(NemesisSystem.TAG_NEMESIS)) {
		handleNemesisDrops(event.getDrops(), (EntityCreature) event.getEntity());
	}
}
 
开发者ID:ToroCraft,项目名称:NemesisSystem,代码行数:21,代码来源:DeathHandler.java

示例2: onEntityDropLoot

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityDropLoot(LivingDropsEvent event)
{
	if (event.getSource() instanceof EntityDamageSource)
	{
		EntityLivingBase entity = event.getEntityLiving();
		EntityDamageSource source = (EntityDamageSource) event.getSource();

		if (source.getEntity() instanceof EntityPlayer)
		{
			EntityPlayer player = (EntityPlayer) source.getEntity();
			ItemStack currentItem = player.inventory.getCurrentItem();

			if (currentItem != null && currentItem.getItem() instanceof ItemSkyrootSword && !(entity instanceof EntityPlayer) && !(entity instanceof EntityWither))
			{
				for (EntityItem items : event.getDrops())
				{
					EntityItem item = new EntityItem(entity.worldObj, entity.posX, entity.posY, entity.posZ, items.getEntityItem());
					entity.worldObj.spawnEntityInWorld(item);
				}
			}
		}
	}
}
 
开发者ID:Modding-Legacy,项目名称:Aether-Legacy,代码行数:25,代码来源:AetherEventHandler.java

示例3: onLivingDrops

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onLivingDrops(LivingDropsEvent event)
{
    DamageSource source = event.getSource();

    if (source != null && source.damageType != null &&
        source.damageType.equals("player") && source.getImmediateSource() instanceof EntityPlayer)
    {
        ItemStack stack = ((EntityPlayer) source.getImmediateSource()).getHeldItemMainhand();

        if (stack.isEmpty() == false && stack.getItem() == EnderUtilitiesItems.ENDER_SWORD)
        {
            ((ItemEnderSword) stack.getItem()).handleLivingDropsEvent(stack, event);
        }
    }
}
 
开发者ID:maruohon,项目名称:enderutilities,代码行数:17,代码来源:LivingDropsEventHandler.java

示例4: onDropItems

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onDropItems(LivingDropsEvent event) {
    if (event.getEntity() instanceof EntityWolf) {
        @Nullable IWolfArmorCapability wolfArmorCapability = event.getEntity().getCapability(CapabilityWolfArmor.WOLF_ARMOR_CAPABILITY, null);
        if (wolfArmorCapability != null) {
            DamageSource source = event.getSource();
            wolfArmorCapability.dropEquipment(source != null && source.getTrueSource() instanceof EntityPlayer, event.getLootingLevel());
        }
    }
}
 
开发者ID:CenturionFox,项目名称:wolfarmor,代码行数:11,代码来源:CapabilityWolfArmor.java

示例5: onVillagerDrops

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入方法依赖的package包/类
private static void onVillagerDrops(EntityVillager villager, LivingDropsEvent eventDrop)
{
	// ドロップするアイテムのリスト
	// これにEntityItemを追加することでドロップを追加できる
	List<EntityItem> drops = eventDrop.getDrops();

	VillagerEvent.dropInventory(drops, villager);
	VillagerEvent.dropEmeralds(drops, villager);

	DamageSource damage = eventDrop.getSource();
	VillagerEvent.dropVillagerBlockSlab(drops, villager, damage);
}
 
开发者ID:a1lic,项目名称:McMod-CubicVillager,代码行数:13,代码来源:VillagerEvent.java

示例6: getSource

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入方法依赖的package包/类
@Override
public DamageSource getSource(LivingDropsEvent o) {
    return o.getSource();
}
 
开发者ID:McJty,项目名称:InControl,代码行数:5,代码来源:LootRule.java

示例7: isMatch

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入方法依赖的package包/类
@Override
public BaseMatchResult isMatch(LivingDropsEvent evt, ItemStack drop) {
    if(evt.getSource() == null || evt.getSource().getEntity() == null) return BaseMatchResult.False;
    return matches(evt.getSource().getEntity().getEntityWorld(), evt.getSource().getEntity());
}
 
开发者ID:legendblade,项目名称:CraftingHarmonics,代码行数:6,代码来源:IsScoreboardMatcher.java

示例8: isMatch

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入方法依赖的package包/类
/**
 * Should return true if this matcher matches the given event
 *
 * @param event The event to match
 * @param drop  The dropped item; this can be modified.
 * @return True if it should match; false otherwise
 */
@Override
public BaseMatchResult isMatch(LivingDropsEvent event, ItemStack drop) {
    if(event.getSource() == null) return BaseMatchResult.False;
    return matches(event.getSource().getEntity());
}
 
开发者ID:legendblade,项目名称:CraftingHarmonics,代码行数:13,代码来源:ManaMatcher.java

示例9: isMatch

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入方法依赖的package包/类
/**
 * Should return true if this matcher matches the given event
 *
 * @param event The event to match
 * @param drop  The dropped item; this can be modified.
 * @return True if it should match; false otherwise
 */
@Override
public BaseMatchResult isMatch(LivingDropsEvent event, ItemStack drop) {
    if(event.getSource() == null || event.getSource().getEntity() == null) return BaseMatchResult.False;
    return matches(event.getSource().getEntity().getEntityWorld(), event.getSource().getEntity());
}
 
开发者ID:legendblade,项目名称:CraftingHarmonics,代码行数:13,代码来源:RangeScoreboardMatcher.java

示例10: isMatch

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入方法依赖的package包/类
/**
 * Should return true if this matcher matches the given event
 *
 * @param event The event to match
 * @param drop  The dropped item; this can be modified.
 * @return True if it should match; false otherwise
 */
@Override
public BaseMatchResult isMatch(LivingDropsEvent event, ItemStack drop) {
    return event.getSource() != null ? matches(event.getSource().getEntity()) : BaseMatchResult.False;
}
 
开发者ID:legendblade,项目名称:CraftingHarmonics,代码行数:12,代码来源:HasAchievementMatcher.java

示例11: isMatch

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入方法依赖的package包/类
/**
 * Should return true if this matcher matches the given event
 *
 * @param evt The event to match
 * @param drop         The dropped item; this can be modified.
 * @return True if it should match; false otherwise
 */
@Override
public BaseMatchResult isMatch(LivingDropsEvent evt, ItemStack drop) {
    if(evt.getSource() == null) return BaseMatchResult.True;
    return damageEntity(evt.getSource().getEntity());
}
 
开发者ID:legendblade,项目名称:CraftingHarmonics,代码行数:13,代码来源:DamagePlayerMatcher.java

示例12: isMatch

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入方法依赖的package包/类
/**
 * Should return true if this matcher matches the given event
 *
 * @param evt The event to match
 * @param drop             The dropped item; this can be modified.
 * @return True if it should match; false otherwise
 */
@Override
public BaseMatchResult isMatch(LivingDropsEvent evt, ItemStack drop) {
    if(evt.getSource() == null || evt.getSource().getEntity() == null) return BaseMatchResult.False;
    return matches(evt.getSource().getEntity(), evt.getSource().getEntity().getEntityWorld());
}
 
开发者ID:legendblade,项目名称:CraftingHarmonics,代码行数:13,代码来源:CooldownMatcher.java

示例13: isMatch

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入方法依赖的package包/类
/**
 * Should return true if this matcher matches the given event
 *
 * @param event The event to match
 * @param drop  The dropped item; this can be modified.
 * @return True if it should match; false otherwise
 */
@Override
public BaseMatchResult isMatch(LivingDropsEvent event, ItemStack drop) {
    if(event.getSource() == null && mode == PlayerMatcherMode.CURRENT) return BaseMatchResult.False;
    return matches(event.getSource() != null ? event.getSource().getEntity() : null);
}
 
开发者ID:legendblade,项目名称:CraftingHarmonics,代码行数:13,代码来源:QuestStatusMatcher.java


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