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


Java LivingEvent.LivingUpdateEvent方法代码示例

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


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

示例1: onTick

import net.minecraftforge.event.entity.living.LivingEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onTick(LivingEvent.LivingUpdateEvent event) {
    if (!event.getEntityLiving().getEntityWorld().isRemote && event.getEntityLiving() instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) event.getEntityLiving();
        if (player.getFoodStats().needFood()) {
            for (ItemStack stack : player.inventory.mainInventory) {
                if (stack.getItem().equals(ItemRegistry.meatFeederItem)) {
                    int filledAmount = ((MeatFeederItem) stack.getItem()).getFilledAmount(stack);
                    if (filledAmount >= 200) {
                        ((MeatFeederItem) stack.getItem()).drain(stack, 200);
                        player.getFoodStats().setFoodLevel(player.getFoodStats().getFoodLevel() + 1);
                        return;
                    }
                }
            }
        }
    }
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:19,代码来源:MeatFeederTickHandler.java

示例2: onLivingUpdate

import net.minecraftforge.event.entity.living.LivingEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onLivingUpdate(LivingEvent.LivingUpdateEvent event) {
    if (!(event.getEntity() instanceof EntityPlayer)) {
        return;
    }
    EntityPlayer player = (EntityPlayer) event.getEntity();
    if (player.isDead) {
        this.hueManager.adjustColor(new Color(255, 0, 0));
        return;
    }
    BlockPos pos = player.getPosition();
    Chunk chunk = this.world.getChunkFromBlockCoords(pos);
    Biome biome = chunk.getBiome(pos, this.world.getBiomeProvider());
    String color = this.biomeMap.get(biome.getRegistryName().getResourcePath());
    if (color != null) {
        this.hueManager.adjustColor(color);
    }
}
 
开发者ID:remcohaszing,项目名称:minecraft-hue,代码行数:19,代码来源:EventListener.java

示例3: onUpdate

import net.minecraftforge.event.entity.living.LivingEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onUpdate(LivingEvent.LivingUpdateEvent ev) {
    EntityLivingBase entity = ev.getEntityLiving();
    for (EntityEquipmentSlot slot : armor) {
        Map<UUID, AbilitySeries> associated = map.get(slot);
        ItemStack stack = entity.getItemStackFromSlot(slot);
        if (!stack.isEmpty() && RandoresItemData.hasData(stack) && stack.getItem() instanceof RandoresItemArmor && EmpoweredEnchantment.appliedTo(stack)) {
            RandoresWorldData.delegateVoid(new RandoresItemData(stack), def -> {
                associated.put(entity.getPersistentID(), def.getAbilitySeries());
                def.getAbilitySeries().onArmorUpdate(entity);
            }, () -> {});
        } else if (associated.containsKey(entity.getPersistentID())) {
            associated.remove(entity.getPersistentID()).onArmorCancel(entity);
        }
    }
}
 
开发者ID:Randores,项目名称:Randores2,代码行数:17,代码来源:EmpoweredArmorListener.java

示例4: maximumOvercluck

import net.minecraftforge.event.entity.living.LivingEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void maximumOvercluck(LivingEvent.LivingUpdateEvent event) {
	
	if (!event.getEntityLiving().worldObj.isRemote && event.getEntityLiving() instanceof EntityChicken) {
		EntityChicken chicken = (EntityChicken)event.getEntityLiving();
		NBTTagCompound tag = chicken.getEntityData();
		if (!chicken.isChild() && tag.hasKey(ItemGeneric.TAG_OVERCLUCK)) {
			int timer = tag.getInteger(ItemGeneric.TAG_OVERCLUCK);
			tag.setInteger(ItemGeneric.TAG_OVERCLUCK, --timer);
			if (--timer <= 0)
			{
	            chicken.playSound(SoundEvents.ENTITY_CHICKEN_EGG, 1.0F, (chicken.worldObj.rand.nextFloat() - chicken.worldObj.rand.nextFloat()) * 0.2F + 1.0F);
	            chicken.dropItem(Items.EGG, 1);
	            timer = chicken.worldObj.rand.nextInt(60) + 900;
	            tag.setInteger(ItemGeneric.TAG_OVERCLUCK, timer);
			}
		}
	}
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:20,代码来源:UCEventHandlerServer.java

示例5: updateEntity

import net.minecraftforge.event.entity.living.LivingEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void updateEntity(final LivingEvent.LivingUpdateEvent event) {
    if (event.entity.worldObj.isRemote) {
        return;
    }
    if (event.entity.getEntityData().hasKey("CursedEarth")) {
        int c = event.entity.getEntityData().getInteger("CursedEarth");
        if (c == 0) {
            event.entity.setDead();
            NetworkHandler.sendParticle(event.entity.worldObj, "smoke", event.entity.posX, event.entity.posY + event.entity.height / 4.0f, event.entity.posZ, 0.0, 0.0, 0.0, false);
        }
        else {
            --c;
            event.entity.getEntityData().setInteger("CursedEarth", c);
        }
    }
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:18,代码来源:EventHandlerServer.java

示例6: skipTick

import net.minecraftforge.event.entity.living.LivingEvent; //导入方法依赖的package包/类
@SubscribeEvent
public static void skipTick(LivingEvent.LivingUpdateEvent event) {
	if (event.getEntity().getEntityData().hasKey("skip_tick")
			&& event.getEntity().getEntityData().hasKey("skip_tick_interval")
			&& event.getEntity().getEntityData().hasKey("skip_tick_interval_save")) {
		int tickCountdown = event.getEntity().getEntityData().getInteger("skip_tick");
		int tickInterval = event.getEntity().getEntityData().getInteger("skip_tick_interval");

		if (tickInterval <= 0) {
			event.getEntity().getEntityData().setInteger("skip_tick_interval", event.getEntity().getEntityData().getInteger("skip_tick_interval_save"));

			if (tickCountdown <= 0) {
				event.getEntity().getEntityData().removeTag("skip_tick");
				event.getEntity().getEntityData().removeTag("skip_tick_interval");
				event.getEntity().getEntityData().removeTag("skip_tick_interval_save");
			} else {
				event.getEntity().getEntityData().setInteger("skip_tick", --tickCountdown);
				event.setCanceled(true);
			}
		} else {
			event.getEntity().getEntityData().setInteger("skip_tick_interval", --tickInterval);
		}
	}
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:25,代码来源:ModuleEffectTimeSlow.java

示例7: tickEntity

import net.minecraftforge.event.entity.living.LivingEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void tickEntity(LivingEvent.LivingUpdateEvent event) {
	if (event.getEntityLiving().getEntityData().hasKey("jump_timer")) {
		int x = event.getEntityLiving().getEntityData().getInteger("jump_timer");

		if (event.getEntityLiving().collidedVertically) {
			event.getEntityLiving().getEntityData().removeTag("jump_timer");
			event.getEntityLiving().getEntityData().removeTag("jump_count");
			return;
		}

		if (x <= 0) {
			event.getEntityLiving().getEntityData().removeTag("jump_timer");
			event.getEntityLiving().getEntityData().removeTag("jump_count");
		} else event.getEntityLiving().getEntityData().setInteger("jump_timer", x - 1);
	}
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:18,代码来源:ModuleEffectLeap.java

示例8: entityEvent

import net.minecraftforge.event.entity.living.LivingEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void entityEvent(LivingEvent.LivingUpdateEvent event)
{
    if (event.entity instanceof EntityPlayer)
    {
        if (((EntityPlayer) event.entity).getCurrentEquippedItem() != null)
        {
            canItemShowTess =
                    (RFUtilities.TE_LOADED && (/*(((EntityPlayer) event.entity).getCurrentEquippedItem().getItem() instanceof ItemToolBase ||
                    ((EntityPlayer) event.entity).getCurrentEquippedItem().getItem() instanceof ItemMultimeter)) ||
                    (*/(EntityPlayer) event.entity).getCurrentEquippedItem().getItem() instanceof ItemDialer);
        }
        else
        {
            canItemShowTess = false;
        }
    }
}
 
开发者ID:XFactHD,项目名称:RFUtilities,代码行数:19,代码来源:EventHandler.java

示例9: entityEvent

import net.minecraftforge.event.entity.living.LivingEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void entityEvent(LivingEvent.LivingUpdateEvent event)
{
    if (event.entity instanceof EntityPlayer)
    {
        if (((EntityPlayer) event.entity).getCurrentEquippedItem() != null)
        {
            canItemShowTess =
                    (RFUtilities.TE_LOADED && (((EntityPlayer) event.entity).getCurrentEquippedItem().getItem() instanceof ItemToolBase ||
                    ((EntityPlayer) event.entity).getCurrentEquippedItem().getItem() instanceof ItemMultimeter)) ||
                    ((EntityPlayer) event.entity).getCurrentEquippedItem().getItem() instanceof ItemDialer;
        }
        else
        {
            canItemShowTess = false;
        }
    }
}
 
开发者ID:XFactHD,项目名称:RFUtilities,代码行数:19,代码来源:EventHandler.java

示例10: onLivingUpdate

import net.minecraftforge.event.entity.living.LivingEvent; //导入方法依赖的package包/类
@SubscribeEvent
@SuppressWarnings("unused")
public void onLivingUpdate(LivingEvent.LivingUpdateEvent event) {
    EntityLivingBase entity = event.getEntityLiving();
    if(entity.getEntityWorld().isRemote) {
        return;
    }
    PotionTracker tracker = CapabilityPotionTracker.getPotionTracker(entity);
    if(tracker == null) {
        return;
    }
    Collection<PotionEffect> potions = entity.getActivePotionEffects();
    tracker.updatePotionEffects(potions.stream()
            .filter(p -> p.getPotion() instanceof ISpecialPotion)
            .map(PotionEffect::getPotion).collect(Collectors.toList()));
}
 
开发者ID:InfinityRaider,项目名称:InfinityLib,代码行数:17,代码来源:PotionEffectHandler.java

示例11: onSkeletonUpdate

import net.minecraftforge.event.entity.living.LivingEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onSkeletonUpdate(LivingEvent.LivingUpdateEvent event) {
    if (!(event.getEntityLiving() instanceof EntitySkeleton)) {
        return;
    }
    EntitySkeleton skeleton = (EntitySkeleton) event.getEntityLiving();
    EntityAITasks tasks = skeleton.tasks;
    boolean containsOld = false;
    Iterator<EntityAITasks.EntityAITaskEntry> itr = tasks.taskEntries.iterator();
    while (itr.hasNext()) {
        EntityAITasks.EntityAITaskEntry entry = itr.next();
        if (entry.action instanceof EntityAIAttackRangedBow) {
            itr.remove();
        }
        if (entry.action instanceof EntityAIAttackRanged) {
            containsOld = true;
        }
    }
    if (!containsOld) {
        tasks.addTask(4, new EntityAIAttackRanged(skeleton, 1.0D, 20, 15.0F));
    }
}
 
开发者ID:liachmodded,项目名称:UHC-Reloaded,代码行数:23,代码来源:EasierSkeleton.java

示例12: on

import net.minecraftforge.event.entity.living.LivingEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void on(LivingEvent.LivingUpdateEvent event) {
    if (event.entityLiving == null || !(event.entityLiving instanceof EntityPlayer)) return;
    EntityPlayer player = (EntityPlayer) event.entity;
    if ((event.entity.worldObj.provider.dimensionId == ModConfig.dimOuterId) && ((player.ticksExisted & 7) == 0) && ((player.capabilities.isFlying) || (Hover.getHover(player.getEntityId())))) {
        if(player.capabilities.isCreativeMode && MiscUtils.isANotApprovedOrMisunderstoodPersonFromMoreDoor(player)) return;
        player.capabilities.isFlying = false;
        Hover.setHover(player.getEntityId(), false);
        if (!((EntityPlayer) event.entityLiving).worldObj.isRemote) {
            String msg = StatCollector.translateToLocal("tc.break.fly");
            if (player.capabilities.isCreativeMode) {
                msg += " " + StatCollector.translateToLocal("gadomancy.eldritch.noflyCreative");
            }
            player.addChatMessage(new ChatComponentText(EnumChatFormatting.ITALIC + "" + EnumChatFormatting.GRAY + msg));
        }
    }
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:18,代码来源:EventHandlerEntity.java

示例13: entityUpdate

import net.minecraftforge.event.entity.living.LivingEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void entityUpdate(LivingEvent.LivingUpdateEvent event) {
    if (event.entity instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) event.entity;
        if (player.getHeldItem() != null && player.getHeldItem().getItem() == CPCItems.hiltBlack) {
            player.addPotionEffect(new PotionEffect(Potion.blindness.id, 50, 1));
            player.addPotionEffect(new PotionEffect(Potion.wither.id, 50, 1));
            World world = player.worldObj;
            if (world.isRemote) {
                world.spawnParticle("reddust", player.posX, player.posY - 0.4D, player.posZ, 0.0D, 0.0D, 0.0D);
                if ((new Random()).nextInt(100) < 25) {
                    world.spawnParticle("smoke", player.posX, player.posY - 0.4D, player.posZ, 0.0D, 0.0D, 0.0D);
                }
            }
        } else {
            player.removePotionEffect(Potion.wither.id);
            //player.removePotionEffect(Potion.blindness.id);
        }
    }
}
 
开发者ID:hanetzer,项目名称:CreepyPastaCraft,代码行数:21,代码来源:CPCHiltBlackHandler.java

示例14: playerUpdate

import net.minecraftforge.event.entity.living.LivingEvent; //导入方法依赖的package包/类
@ForgeSubscribe
public void playerUpdate(LivingEvent.LivingUpdateEvent event) {
    if (ticks > 16) {
        if (event.entityLiving != null && event.entityLiving instanceof EntityPlayer) {
            if (!event.entityLiving.worldObj.isRemote)
                return;

            EntityPlayer player = (EntityPlayer) event.entityLiving;
            String capeUrl = CapeHandler.getCapeUrl(player.username);
            if (capeUrl != null && !capeUrl.equals(player.cloakUrl)) {
                player.cloakUrl = capeUrl;
                FMLClientHandler.instance().getClient().renderEngine.obtainImageData(player.cloakUrl, null);
            }
        }
    ticks = 0;
    }
    ticks++;
}
 
开发者ID:sct,项目名称:HexxitGear,代码行数:19,代码来源:PlayerEventHandler.java

示例15: onLivingUpdate

import net.minecraftforge.event.entity.living.LivingEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onLivingUpdate(LivingEvent.LivingUpdateEvent event)
{
    if(!event.entityLiving.worldObj.isRemote && event.entityLiving instanceof EntityZombie)
    {
        EntityZombie zombie = (EntityZombie)event.entityLiving;
        boolean currentItemIsCamera = zombie.getHeldItem() != null && zombie.getHeldItem().getItem() instanceof ItemCamera;
        if(currentItemIsCamera)
        {
            if(zombie.getRNG().nextFloat() < 0.003F)
            {
                EntityPhotoreal photo = new EntityPhotoreal(zombie.worldObj);
                photo.setLocationAndAngles(zombie.posX, zombie.posY + 1.62D, zombie.posZ, zombie.rotationYaw, zombie.rotationPitch);
                photo.setup(zombie.posX, zombie.posY + 1.62D, zombie.posZ, zombie.rotationYaw, zombie.rotationPitch, 860, 480);

                event.entityLiving.worldObj.spawnEntityInWorld(photo);
            }
        }
    }
}
 
开发者ID:iChun,项目名称:Photoreal,代码行数:21,代码来源:EventHandler.java


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