本文整理汇总了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;
}
}
}
}
}
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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()));
}
示例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));
}
}
示例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));
}
}
}
示例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);
}
}
}
示例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++;
}
示例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);
}
}
}
}