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