• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java INpc类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: matches

import net.minecraft.entity.INpc; //导入依赖的package包/类
@Override
protected boolean matches(EntityLivingBase entity) {
    if (type == BOSS) return !entity.isNonBoss();
    else if (!entity.isNonBoss()) return false;

    switch (type) {
        case ANIMAL:    return entity instanceof EntityAnimal;
        case MONSTER:   return entity instanceof IMob;
        case TAMEABLE:  return entity instanceof IEntityOwnable;
        case PLAYER:    return entity instanceof EntityPlayer;
        case WATER:     return entity instanceof EntityWaterMob || entity instanceof EntityGuardian;
        case NPC:       return entity instanceof INpc;
        case GOLEM:     return entity instanceof EntityGolem;
        default:        return false;
    }
}
 
开发者ID:joshiejack,项目名称:Progression,代码行数:17,代码来源:FilterEntityType.java


示例2: onLeftClickEntity

import net.minecraft.entity.INpc; //导入依赖的package包/类
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
	if (entity instanceof EntityNpcBarnes) {
		if (!player.worldObj.isRemote) {
			if (((EntityNpcBarnes) entity).addBombBagTrade()) {
				PlayerUtils.sendTranslatedChat(player, "chat.zss.trade.bomb.add");
			} else {
				PlayerUtils.sendTranslatedChat(player, "chat.zss.trade.bomb.careful");
			}
		}
		return true;
	} else if (entity instanceof INpc) {
		if (!player.worldObj.isRemote) {
			PlayerUtils.sendTranslatedChat(player, "chat.zss.trade.bomb.careful");
		}
		return true;
	}
	return super.onLeftClickEntity(stack, player, entity);
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:20,代码来源:ItemBomb.java


示例3: updateEntityWithOptionalForce

import net.minecraft.entity.INpc; //导入依赖的package包/类
/**
 * Will update the entity in the world if the chunk the entity is in is currently loaded or its forced to update.
 * Args: entity, forceUpdate
 */
public void updateEntityWithOptionalForce(Entity entityIn, boolean forceUpdate)
{
    if (!this.canSpawnAnimals() && (entityIn instanceof EntityAnimal || entityIn instanceof EntityWaterMob))
    {
        entityIn.setDead();
    }

    if (!this.canSpawnNPCs() && entityIn instanceof INpc)
    {
        entityIn.setDead();
    }

    super.updateEntityWithOptionalForce(entityIn, forceUpdate);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:19,代码来源:WorldServer.java


示例4: updateEntityWithOptionalForce

import net.minecraft.entity.INpc; //导入依赖的package包/类
/**
 * Updates the entity in the world if the chunk the entity is in is currently loaded or its forced to update.
 */
public void updateEntityWithOptionalForce(Entity entityIn, boolean forceUpdate)
{
    if (!this.canSpawnAnimals() && (entityIn instanceof EntityAnimal || entityIn instanceof EntityWaterMob))
    {
        entityIn.setDead();
    }

    if (!this.canSpawnNPCs() && entityIn instanceof INpc)
    {
        entityIn.setDead();
    }

    super.updateEntityWithOptionalForce(entityIn, forceUpdate);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:WorldServer.java


示例5: handle

import net.minecraft.entity.INpc; //导入依赖的package包/类
@Override
public void handle(Coord here) {
    for (ClassInheritanceMultiMap<Entity> list : here.getChunk().getEntityLists()) {
        for (Entity ent : list) {
            if (!(ent instanceof INpc)) continue;
            if (hashEnt(ent)) {
                satisfactory_villagers++;
            }
        }
    }
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:12,代码来源:TileEntityAnthroGen.java


示例6: updateEntityWithOptionalForce

import net.minecraft.entity.INpc; //导入依赖的package包/类
/**
 * Will update the entity in the world if the chunk the entity is in is
 * currently loaded or its forced to update. Args: entity, forceUpdate
 */
public void updateEntityWithOptionalForce(Entity entity, boolean forceUpdate) {
	if (!this.mcServer.getCanSpawnAnimals()
			&& (entity instanceof EntityAnimal || entity instanceof EntityWaterMob)) {
		entity.setDead();
	}

	if (!this.mcServer.getCanSpawnNPCs() && entity instanceof INpc) {
		entity.setDead();
	}

	super.updateEntityWithOptionalForce(entity, forceUpdate);
}
 
开发者ID:OreCruncher,项目名称:Jiffy,代码行数:17,代码来源:WorldServer.java


示例7: updateEntityWithOptionalForce

import net.minecraft.entity.INpc; //导入依赖的package包/类
/**
 * Will update the entity in the world if the chunk the entity is in is currently loaded or its forced to update.
 * Args: entity, forceUpdate
 */
public void updateEntityWithOptionalForce(Entity par1Entity, boolean par2)
{
    if (!this.mcServer.getCanSpawnAnimals() && (par1Entity instanceof EntityAnimal || par1Entity instanceof EntityWaterMob))
    {
        par1Entity.setDead();
    }

    if (!this.mcServer.getCanSpawnNPCs() && par1Entity instanceof INpc)
    {
        par1Entity.setDead();
    }

    super.updateEntityWithOptionalForce(par1Entity, par2);
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:19,代码来源:WorldServer.java


示例8: updateEntityWithOptionalForce

import net.minecraft.entity.INpc; //导入依赖的package包/类
public void updateEntityWithOptionalForce(Entity p_72866_1_, boolean p_72866_2_)
{
    if (!this.mcServer.getCanSpawnAnimals() && (p_72866_1_ instanceof EntityAnimal || p_72866_1_ instanceof EntityWaterMob))
    {
        p_72866_1_.setDead();
    }

    if (!this.mcServer.getCanSpawnNPCs() && p_72866_1_ instanceof INpc)
    {
        p_72866_1_.setDead();
    }

    super.updateEntityWithOptionalForce(p_72866_1_, p_72866_2_);
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:15,代码来源:WorldServer.java


示例9: onLeftClickEntity

import net.minecraft.entity.INpc; //导入依赖的package包/类
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
	if (player.worldObj.isRemote) {
		return true;
	} else if (entity instanceof EntityNpcMaskTrader && ((EntityNpcMaskTrader) entity).checkShopStatus(player, false, true)) {
		return true; // allows quest to complete without having to convert a villager if Salesman already in town
	} else if (entity instanceof EntityVillager && Result.DEFAULT == NpcHelper.convertVillager(player, (EntityVillager) entity, false)) {
		// villager not converted, try other treasure interactions (note that conversion handles beginnings of several quests)
		handleTrade(stack, player, entity, true);
	} else if (entity instanceof INpc) {
		handleTrade(stack, player, entity, true);
	}
	return true;
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:15,代码来源:ItemTreasure.java


示例10: handleTrade

import net.minecraft.entity.INpc; //导入依赖的package包/类
private boolean handleTrade(ItemStack stack, EntityPlayer player, Entity entity, boolean isLeftClick) {
	Treasures treasure = Treasures.byDamage(stack.getItemDamage());
	if (treasure.isBiggoronTrade()) {
		return handleBiggoronQuest(stack, player, entity, isLeftClick);
	} else if (entity instanceof EntityVillager) {
		if (treasure == Treasures.ZELDAS_LETTER) {
			PlayerUtils.sendTranslatedChat(player, "chat.zss.treasure." + treasure.name + (((EntityVillager) entity).isChild() ? ".child" : ".fail") + (isLeftClick ? ".give" : ".show"));
		} else if (!handleVillagerTrade(stack, player, (EntityVillager) entity, isLeftClick)) {
			PlayerUtils.sendTranslatedChat(player, "chat.zss.treasure." + treasure.uninterested + ".uninterested");
		}
		return true;
	} else if (entity instanceof INpc) {
		if (entity instanceof EntityAgeable && ((EntityAgeable) entity).isChild()) {
			handleChildTrade(stack, player, isLeftClick);
		} else if (treasure == Treasures.ZELDAS_LETTER && entity instanceof EntityNpcMaskTrader) {
			ZSSQuests quests = ZSSQuests.get(player);
			if (quests.hasCompleted(QuestMaskSales.class)) {
				PlayerUtils.sendTranslatedChat(player, "chat.zss.npc.mask_salesman.shop.open");
			} else {
				IQuest quest = quests.get(QuestMaskShop.class);
				if (quest != null) {
					IChatComponent hint = quest.getHint(player);
					if (hint != null) {
						player.addChatMessage(hint);
					}
				} else {
					PlayerUtils.sendTranslatedChat(player, "chat.zss.npc.mask_salesman.shop.hint." + itemRand.nextInt(4));
				}
			}
		} else if (treasure == Treasures.KNIGHTS_CREST && entity instanceof EntityNpcOrca) {
			PlayerUtils.sendTranslatedChat(player, "chat.zss.treasure." + treasure.uninterested + ".uninterested.orca");
		} else {
			PlayerUtils.sendTranslatedChat(player, "chat.zss.treasure." + treasure.uninterested + ".uninterested");
		}
		return true;
	}
	return false;
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:39,代码来源:ItemTreasure.java


示例11: onInteract

import net.minecraft.entity.INpc; //导入依赖的package包/类
/**
 * Called when the player right-clicks on an entity while wearing a mask
 * @return returning true will cancel the interact event (preventing trade
 * gui from opening for villagers, for example)
 */
public boolean onInteract(ItemStack stack, EntityPlayer player, Entity entity) {
	if (!player.worldObj.isRemote) {
		if (entity instanceof EntityVillager) {
			EntityVillager villager = (EntityVillager) entity;
			if (entity.getClass() == EntityVillager.class && this == ZSSVillagerInfo.get(villager).getMaskDesired()) {
				QuestMaskSales quest = (QuestMaskSales) ZSSQuests.get(player).get(QuestMaskSales.class);
				if (!quest.hasSold(this)) {
					new TimedChatDialogue(player,
							new ChatComponentTranslation("chat.zss.npc.mask_salesman.sales.buyer.0"),
							new ChatComponentTranslation("chat.zss.npc.mask_salesman.sales.buyer.1", getSellPrice()));
				} else { // player already sold this mask
					PlayerUtils.sendTranslatedChat(player, "chat.zss.npc.mask_salesman.sales.repeat." + player.worldObj.rand.nextInt(4));
				}
			} else {
				// Custom villager professions all use the same chat message
				int p = villager.getProfession();
				String s = (p < 0 || p > EnumVillager.values().length) ? "custom" : String.valueOf(p);
				PlayerUtils.sendTranslatedChat(player, "chat." + getUnlocalizedName().substring(5) + "." + s);
			}
		} else if (entity instanceof EntityNpcMaskTrader) {
			PlayerUtils.sendTranslatedChat(player, "chat." + getUnlocalizedName().substring(5) + ".salesman");
		} else if (entity instanceof INpc) {
			PlayerUtils.sendTranslatedChat(player, "chat." + getUnlocalizedName().substring(5) + ".custom");
		} else {
			return false;
		}
	}
	return true;
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:35,代码来源:ItemMask.java


示例12: onLeftClickEntity

import net.minecraft.entity.INpc; //导入依赖的package包/类
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
	if (!player.worldObj.isRemote && entity.getClass() == EntityVillager.class) {
		EntityVillager villager = (EntityVillager) entity;
		MerchantRecipeList trades = villager.getRecipes(player);
		if (villager.getProfession() == EnumVillager.BUTCHER.ordinal() && trades != null) {
			switch(WhipType.fromDamage(stack.getItemDamage())) {
			case WHIP_SHORT:
				MerchantRecipe trade = new MerchantRecipe(new ItemStack(this, 1, WhipType.WHIP_SHORT.ordinal()), new ItemStack(Items.emerald, 64), new ItemStack(this, 1, WhipType.WHIP_LONG.ordinal()));
				if (MerchantRecipeHelper.addUniqueTrade(trades, trade)) {
					PlayerUtils.sendTranslatedChat(player, "chat.zss.trade.whip.upgrade.new");
				} else {
					PlayerUtils.sendTranslatedChat(player, "chat.zss.trade.whip.upgrade.old");
				}
				break;
			case WHIP_LONG:
				PlayerUtils.sendTranslatedChat(player, "chat.zss.trade.whip.long");
				break;
			case WHIP_MAGIC:
				PlayerUtils.sendTranslatedChat(player, "chat.zss.trade.whip.magic");
				break;
			}
		} else {
			PlayerUtils.sendTranslatedChat(player, "chat.zss.trade.whip.sorry");
		}
	} else if (!player.worldObj.isRemote && entity instanceof INpc) {
		PlayerUtils.sendTranslatedChat(player, "chat.zss.trade.whip.sorry");
	}
	return true;
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:31,代码来源:ItemWhip.java


示例13: onInteract

import net.minecraft.entity.INpc; //导入依赖的package包/类
/**
 * This event fires on BOTH sides
 */
@SubscribeEvent
public void onInteract(EntityInteractEvent event) {
	ItemStack stack = event.entityPlayer.getHeldItem();
	if (event.target instanceof EntityVillager && Result.DEFAULT != NpcHelper.convertVillager(event.entityPlayer, (EntityVillager) event.target, true)) {
		event.setCanceled(true);
	}
	// Check if the held item has any special interaction upon right-clicking an entity
	if (!event.isCanceled() && stack != null && stack.getItem() instanceof IRightClickEntity) {
		event.setCanceled(((IRightClickEntity) stack.getItem()).onRightClickEntity(stack, event.entityPlayer, event.target));
	}
	// If the event is not yet canceled, check for Mask interactions
	if (!event.isCanceled() && event.target instanceof INpc) {
		ItemStack helm = event.entityPlayer.getCurrentArmor(ArmorIndex.WORN_HELM);
		if (helm != null && helm.getItem() instanceof ItemMask) {
			event.setCanceled(((ItemMask) helm.getItem()).onInteract(helm, event.entityPlayer, event.target));
		}
	}
	// Check for Lon Lon Milk cow interaction
	if (!event.isCanceled() && stack != null && stack.getItem() == Items.glass_bottle && event.target.getClass() == EntityCow.class) {
		event.setCanceled(ZSSPlayerSongs.get(event.entityPlayer).milkLonLonCow(event.entityPlayer, (EntityCow) event.target));
	}
	// Finally, check for interactions with the Cursed Man
	if (!event.isCanceled() && event.target.getClass() == EntityVillager.class && ("Cursed Man").equals(event.target.getCustomNameTag())) {
		EntityVillager villager = (EntityVillager) event.target;
		if (stack == null || (stack.getItem() != ZSSItems.skulltulaToken && stack.getItem() != Items.name_tag)) {
			int tokens = ZSSPlayerInfo.get(event.entityPlayer).getSkulltulaTokens();
			if (villager.worldObj.isRemote) {
				// don't send chat - will be sent from server
			} else if (villager.isChild()) {
				PlayerUtils.sendTranslatedChat(event.entityPlayer, "chat.zss.npc.cursed_man.child");
			} else if (tokens > 0) {
				PlayerUtils.sendTranslatedChat(event.entityPlayer, "chat.zss.npc.cursed_man.amount", tokens);
			} else {
				PlayerUtils.sendTranslatedChat(event.entityPlayer, "chat.zss.npc.cursed_man." + event.entity.worldObj.rand.nextInt(4));
			}
			event.setCanceled(true);
		}
	}
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:43,代码来源:ZSSEntityEvents.java


示例14: func_72866_a

import net.minecraft.entity.INpc; //导入依赖的package包/类
public void func_72866_a(Entity p_72866_1_, boolean p_72866_2_) {
   if(!this.field_73061_a.func_71268_U() && (p_72866_1_ instanceof EntityAnimal || p_72866_1_ instanceof EntityWaterMob)) {
      p_72866_1_.func_70106_y();
   }

   if(!this.field_73061_a.func_71220_V() && p_72866_1_ instanceof INpc) {
      p_72866_1_.func_70106_y();
   }

   super.func_72866_a(p_72866_1_, p_72866_2_);
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:12,代码来源:WorldServer.java


示例15: getEntityTypeNonCache

import net.minecraft.entity.INpc; //导入依赖的package包/类
private static String getEntityTypeNonCache(Entity e) {
	if (e instanceof EntityGolem) {
        return "Golem";
    } else if (e instanceof IBossDisplayData) {
    	return "Boss";
    } else if (e instanceof IAnimals) {
    	return "Animal";
    } else if (e instanceof IMob) {
    	return "Monster";
    } else if (e instanceof IProjectile) {
    	return "Projectile";
    } else if (e instanceof INpc) {
    	return "NPC";
    } else if (e instanceof EntityItem) {
    	return "Item";
    } else if (e instanceof EntityMob) {
    	return "Monster";
    } else if (e instanceof EntityPlayer) {
    	return "Player";
    } else if (e instanceof EntityFireball) {
    	return "Projectile";
    } else if (e instanceof EntityTNTPrimed) {
    	return "TNT";
    } else {
    	return "Unknown"; // e.getClass().getName();
    }
}
 
开发者ID:MyEssentials,项目名称:MyEssentials-Core,代码行数:28,代码来源:EntityUtils.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ListDialog类代码示例发布时间:2022-05-21
下一篇:
Java ComparisonTerm类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap