本文整理汇总了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());
}
}
示例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);
}
}
}
}
}
示例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);
}
}
}
示例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());
}
}
}
示例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);
}
示例6: getSource
import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入方法依赖的package包/类
@Override
public DamageSource getSource(LivingDropsEvent o) {
return o.getSource();
}
示例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());
}
示例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());
}
示例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());
}
示例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;
}
示例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());
}
示例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());
}
示例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);
}