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


Java LivingDropsEvent类代码示例

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


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

示例1: dropClay

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入依赖的package包/类
@SubscribeEvent
public void dropClay(LivingDropsEvent event) {
    EntityLivingBase deadEntity = event.getEntityLiving();
    World world = deadEntity.getEntityWorld();
    BlockPos position = deadEntity.getPosition();
    double x = position.getX();
    double y = position.getY();
    double z = position.getZ();
    if (deadEntity instanceof EntityWitherSkeleton) {
        if (world.rand.nextInt(10) == 5) {
            event.getDrops().add(new EntityItem(world, x, y, z, new ItemStack(Items.CLAY_BALL)));
        }
    } else if (deadEntity instanceof EntityDragon || deadEntity instanceof EntityWither) {
        event.getDrops().add(new EntityItem(world, x, y, z, new ItemStack(Items.CLAY_BALL)));
    }
}
 
开发者ID:elifoster,项目名称:MakeClayValuableAgain,代码行数:17,代码来源:ClayProgressionImprovements.java

示例2: getPlayer

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入依赖的package包/类
public static EntityPlayer getPlayer(Event event)
{
	if(event instanceof LivingEvent && ((LivingEvent)event).getEntity() instanceof EntityPlayer)
		return (EntityPlayer)((LivingEvent)event).getEntity();
	if(event instanceof RenderGameOverlayEvent || event instanceof RenderWorldLastEvent || event instanceof ClientTickEvent)
		return HarshenCastle.proxy.getPlayer();
	if(event instanceof PlayerTickEvent)
		return ((PlayerTickEvent)event).player;
	if(event instanceof PlayerEvent)
		return ((PlayerEvent)event).player;
	if(event instanceof net.minecraftforge.event.entity.player.PlayerEvent)
		return ((net.minecraftforge.event.entity.player.PlayerEvent)event).getEntityPlayer();
	if(event instanceof PlayerPunchedEvent)
		return ((PlayerPunchedEvent)event).attacker;
	if(event instanceof LivingDropsEvent && isSourceFromPlayer(((LivingDropsEvent)event).getSource()))
		return getPlayerFromSource(((LivingDropsEvent)event).getSource());
	return null;
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:19,代码来源:HarshenUtils.java

示例3: onLivingDropsEvent

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入依赖的package包/类
@SubscribeEvent
public static void onLivingDropsEvent(LivingDropsEvent event) {
	if (ConfigHandler.dropMoney && !(event.getEntityLiving() instanceof EntityPlayer) && event.getEntityLiving() instanceof IMob && event.getEntityLiving().getEntityWorld().isRemote == false) {
		if (event.getSource().getTrueSource() != null && event.getSource().getTrueSource() instanceof EntityPlayer && !(event.getSource().getTrueSource() instanceof FakePlayer)) {
			CurrencyUtils.dropMoneyAmount(event.getEntityLiving().getMaxHealth() / ConfigHandler.mobDivisionValue, event.getEntityLiving().getEntityWorld(), event.getEntityLiving().posX, event.getEntityLiving().posY, event.getEntityLiving().posZ);
			return;
		}

		if (event.getSource().getTrueSource() != null && event.getSource().getTrueSource() != null && event.getSource().getTrueSource() instanceof EntityArrow) {
			EntityArrow arrow = (EntityArrow) event.getSource().getTrueSource();
			if (arrow.shootingEntity instanceof EntityPlayer && !(arrow.shootingEntity instanceof FakePlayer)) {
				CurrencyUtils.dropMoneyAmount(event.getEntityLiving().getMaxHealth() / ConfigHandler.mobDivisionValue, event.getEntityLiving().getEntityWorld(), event.getEntityLiving().posX, event.getEntityLiving().posY, event.getEntityLiving().posZ);
				return;
			}
		}
	}
}
 
开发者ID:Zundrel,项目名称:Never-Enough-Currency,代码行数:18,代码来源:ModEventHandler.java

示例4: dropEvent

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void dropEvent(LivingDropsEvent event) {
	if (event.entityLiving.worldObj.isRemote)
		return;

	if (EtFuturum.enableSkullDrop)
		dropHead(event.entityLiving, event.source, event.lootingLevel, event.drops);

	Random rand = event.entityLiving.worldObj.rand;
	if (EtFuturum.enableMutton && event.entityLiving instanceof EntitySheep) {
		int amount = rand.nextInt(3) + 1 + rand.nextInt(1 + event.lootingLevel);
		for (int i = 0; i < amount; i++)
			if (event.entityLiving.isBurning())
				addDrop(new ItemStack(ModItems.cooked_mutton), event.entityLiving, event.drops);
			else
				addDrop(new ItemStack(ModItems.raw_mutton), event.entityLiving, event.drops);
	}
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:19,代码来源:ServerEventHandler.java

示例5: 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

示例6: netherDrop

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入依赖的package包/类
@SubscribeEvent
public void netherDrop(final LivingDropsEvent event) {
    if (ExtraUtils.divisionSigil != null && event.entityLiving instanceof EntityWither && event.source.getSourceOfDamage() instanceof EntityPlayer && event.entity.worldObj != null && event.entity.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) {
        final EntityPlayer player = (EntityPlayer)event.source.getSourceOfDamage();
        NBTTagCompound t = new NBTTagCompound();
        if (player.getEntityData().hasKey("PlayerPersisted")) {
            t = player.getEntityData().getCompoundTag("PlayerPersisted");
        }
        else {
            player.getEntityData().setTag("PlayerPersisted", (NBTBase)t);
        }
        int kills = 0;
        if (t.hasKey("witherKills")) {
            kills = t.getInteger("witherKills");
        }
        ++kills;
        t.setInteger("witherKills", kills);
        if (kills == 1 || !t.hasKey("hasSigil") || event.entity.worldObj.rand.nextInt(10) == 0) {
            final ItemStack item = new ItemStack(ExtraUtils.divisionSigil);
            final EntityItem entityitem = new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, item);
            entityitem.delayBeforeCanPickup = 10;
            event.drops.add(entityitem);
        }
    }
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:26,代码来源:EventHandlerServer.java

示例7: onMobDrops

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入依赖的package包/类
@SubscribeEvent
public void onMobDrops(LivingDropsEvent e)
{
    World world = e.getEntity().getEntityWorld();
    Random rng = world.rand;
    if (e.getEntity() instanceof EntitySkeleton) {
        EntitySkeleton skele = (EntitySkeleton) e.getEntity();
        if (skele.getSkeletonType() == 1) {
            if (rng.nextFloat() < 0.20 + (e.getLootingLevel() + 1 * 0.05))
                e.getDrops().add(new EntityItem(world, skele.posX, skele.posY, skele.posZ, new ItemStack(ModItems.MobDust, 1, 0)));
        }
    }

    if (e.getEntity() instanceof EntityCaveSpider) {
        if (rng.nextFloat() < 0.20 + (e.getLootingLevel() + 1 * 0.05))
            e.getDrops().add(new EntityItem(world, e.getEntity().posX, e.getEntity().posY, e.getEntity().posZ, new ItemStack(ModItems.MobDust, 1, 1)));
    }
}
 
开发者ID:GamingsModding,项目名称:LittleThings-old,代码行数:19,代码来源:DustMobDrop.java

示例8: onEntityDrops

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入依赖的package包/类
@SubscribeEvent
   public void onEntityDrops(LivingDropsEvent event)
{
	int alea;
	
	if (event.entityLiving instanceof EntityMob)
		alea = 20;
	else
		alea = 50;
	
	if (event.entityLiving.worldObj.rand.nextInt(alea) < 1 + event.lootingLevel * 2)
	{
		EntityItem e;
		
		e = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, new ItemStack(ItemRegister.getRandomArmor(), 1));
		e = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, new ItemStack(ItemRegistry1.bagdrop, 1));
		
		
		event.drops.add(e);
	}
}
 
开发者ID:GhostMonk3408,项目名称:MidgarCrusade,代码行数:22,代码来源:LivingEntityEvent.java

示例9: onLivingDrop

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入依赖的package包/类
@SubscribeEvent
public void onLivingDrop(LivingDropsEvent event) {

    final Entity entity = event.getEntity();
    if (entity.hasCapability(Capability.CHISELED_SHEEP, null)) {
        final IChiseledSheepCapability capability = entity.getCapability(Capability.CHISELED_SHEEP, null);
        if (capability.isChiseled())
        {
            final List<EntityItem> drops = event.getDrops();
            final ItemStack chiselItemStack = capability.getChiselItemStack();
            final Item chiselItem = chiselItemStack.getItem();

            drops.removeIf(entityItem -> ItemStackHelper.isStackForBlock(entityItem.getEntityItem(), Blocks.WOOL));

            drops.add(new EntityItem(entity.worldObj, entity.posX, entity.posY, entity.posZ, chiselItemStack.copy()));

            MinecraftForge.EVENT_BUS.post(new ShearMadnessSheepKilledEvent(
                    drops,
                    event.getSource(),
                    event.getLootingLevel(),
                    chiselItemStack,
                    entity
            ));
        }
    }
}
 
开发者ID:AtomicBlom,项目名称:ShearMadness,代码行数:27,代码来源:CommonForgeEventProxy.java

示例10: 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

示例11: onMobDrops

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入依赖的package包/类
@SubscribeEvent
public void onMobDrops(LivingDropsEvent event) {
    World w = event.getEntity().getEntityWorld();
    if (!w.isRemote && event.getSource().getTrueSource() instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) event.getSource().getTrueSource();
        if (event.getEntity() instanceof EntityMob && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), identifier)) {

            int r = random.nextInt(2);
            ItemStack i = null;
            switch (r) {
                case 0:
                    i = new ItemStack(Items.BLAZE_POWDER, random.nextInt(3));
                    break;
                case 1:
                    i = new ItemStack(Items.BLAZE_ROD, random.nextInt(3));
                    break;
                case 2:
                    i = new ItemStack(Items.COAL, random.nextInt(3));
                    break;
            }
            assert i != null;
            event.getDrops().add(0, new EntityItem(w, event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, i));
        }
    }
}
 
开发者ID:TeamFRM,项目名称:TAIGA,代码行数:26,代码来源:TraitGarishly.java

示例12: onWitherDeath

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入依赖的package包/类
@SubscribeEvent
@SuppressWarnings("unused")
public void onWitherDeath(LivingDropsEvent event) {
    if(ItemRegistry.getInstance().itemRecord == null) {
        return;
    }
    if(!(event.getEntity() instanceof EntityWither)) {
        return;
    }
    Entity killer = event.getSource().getSourceOfDamage();
    if(event.isRecentlyHit() && killer != null && killer instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) killer;
        ItemStack left = player.getHeldItem(EnumHand.MAIN_HAND);
        ItemStack right = player.getHeldItem(EnumHand.OFF_HAND);
        if(isValidStack(left) && isValidStack(right)) {
            EntityItem drop = new EntityItem(event.getEntity().getEntityWorld(), event.getEntity().posX, event.getEntity().posY+0.5D, event.getEntity().posZ,
                    new ItemStack(ItemRegistry.getInstance().itemRecord));
            event.getDrops().add(drop);
        }
    }
}
 
开发者ID:InfinityRaider,项目名称:3DManeuverGear,代码行数:22,代码来源:EntityLivingHandler.java

示例13: onLivingDrops

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入依赖的package包/类
@SubscribeEvent
public void onLivingDrops(LivingDropsEvent event)
{
	Entity e = event.entity;
	List<EntityItem> drops = event.drops;
	// Remove all drops from cows, sheep and pigs, add carcass drop
	if (e instanceof EntityCow || e instanceof EntityPig || e instanceof EntitySheep)
	{
		EntityAnimal a = (EntityAnimal) e;
		Iterator<EntityItem> it = drops.iterator();
		while (it.hasNext())
		{
			EntityItem i = it.next();
			it.remove();
		}

		if (a.getGrowingAge() == 0)
		{
			if (a instanceof EntityCow) a.dropItem(TanneryItems.bloodyCowCarcass, 1);
			else if (a instanceof EntityPig) a.dropItem(TanneryItems.bloodyPigCarcass, 1);
			else if (a instanceof EntitySheep) a.dropItem(TanneryItems.bloodySheepCarcass, 1);
		}
	}
}
 
开发者ID:hero887,项目名称:Tannery,代码行数:25,代码来源:EntityDropsHandler.java

示例14: onEntityKilled

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入依赖的package包/类
@SubscribeEvent
public void onEntityKilled(LivingDropsEvent event)
{
	// TODO remove when actual ark creatures are in place and dropping items
	if (event.getEntityLiving().world.isRemote) return;
	Random r = new Random();
	int x = r.nextInt(3) + 1;
	ItemStack meat = new ItemStack(ARKCraftItems.meat_raw, x);
	event.getDrops().add(new EntityItem(event.getEntityLiving().world, event.getEntityLiving().posX, event.getEntityLiving().posY,
			event.getEntityLiving().posZ, IDecayable.setDecayStart(meat, ARKCraft.proxy.getWorldTime())));
	if (r.nextDouble() < 0.05) event.getDrops().add(new EntityItem(event.getEntityLiving().world, event.getEntityLiving().posX,
			event.getEntityLiving().posY, event.getEntityLiving().posZ, IDecayable.setDecayStart(new ItemStack(
					ARKCraftItems.primemeat_raw), ARKCraft.proxy.getWorldTime())));
	if (event.getEntityLiving() instanceof EntitySpider || event.getEntityLiving() instanceof EntitySilverfish
			|| event.getEntityLiving() instanceof EntityEndermite) event.getDrops().add(new EntityItem(
					event.getEntityLiving().world, event.getEntityLiving().posX, event.getEntityLiving().posY,
					event.getEntityLiving().posZ, new ItemStack(ARKCraftItems.chitin, r.nextInt(3) + 1)));
	else event.getDrops().add(new EntityItem(event.getEntityLiving().world, event.getEntityLiving().posX,
			event.getEntityLiving().posY, event.getEntityLiving().posZ, new ItemStack(ARKCraftItems.hide, r.nextInt(3) + 1)));
}
 
开发者ID:BubbleTrouble14,项目名称:ARKCraft,代码行数:21,代码来源:CommonEventHandler.java

示例15: onEntityLivingDeath

import net.minecraftforge.event.entity.living.LivingDropsEvent; //导入依赖的package包/类
@SubscribeEvent
public void onEntityLivingDeath(LivingDropsEvent event) {
	if (MobRebirth.instance.getHasCustomMobSettings()) {
		if (EntityList.getKey(event.getEntityLiving()) != null)
			if (ArrayUtils.contains(ConfigValues.CUSTOMENTITIES, EntityList.getKey(event.getEntityLiving()).getResourcePath())) {
				if (ConfigValues.REBIRTHFROMNONPLAYERMAP.get(EntityList.getKey(event.getEntityLiving())))
					transition(event);
				else if (event.getSource().getTrueSource() instanceof EntityPlayer)
					transition(event);
				return;
			}
	}
	if (ConfigValues.REBIRTHFROMNONPLAYER)
		transition(event);
	else if (event.getSource().getTrueSource() instanceof EntityPlayer)
		transition(event);
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Mob-Rebirth,代码行数:18,代码来源:CommonEvents.java


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