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


Java EntityPlayer.displayVillagerTradeGui方法代码示例

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


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

示例1: interact

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
 */
public boolean interact(EntityPlayer player)
{
    ItemStack itemstack = player.inventory.getCurrentItem();
    boolean flag = itemstack != null && itemstack.getItem() == Items.spawn_egg;

    if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild())
    {
        if (!this.worldObj.isRemote && (this.buyingList == null || this.buyingList.size() > 0))
        {
            this.setCustomer(player);
            player.displayVillagerTradeGui(this);
        }

        player.triggerAchievement(StatList.timesTalkedToVillagerStat);
        return true;
    }
    else
    {
        return super.interact(player);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:25,代码来源:EntityVillager.java

示例2: processInteract

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
	if (!(player.getHeldItemMainhand() != null
			&& player.getHeldItemMainhand().getItem() instanceof ItemMonsterPlacerPlus)
			&& this.getAttackTarget() == null && this.isEntityAlive() && !this.isTrading() && !this.isChild()
			&& !player.isSneaking()) {
		if (this.world.isRemote && player.getTeam() == null && !player.isCreative())
			ClientProxy.displayScreenJoinTeam();
		else if (!this.world.isRemote && (player.getTeam() != null || player.isCreative())
				&& (this.tradeOffers == null || !this.tradeOffers.isEmpty())) {
			this.setCustomer(player);
			player.displayVillagerTradeGui(this);
		}

		player.addStat(StatList.TALKED_TO_VILLAGER);
		return true;
	} else
		return super.processInteract(player, hand);
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:20,代码来源:EntitySaxtonHale.java

示例3: processInteract

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean processInteract(EntityPlayer player, EnumHand hand, @Nullable ItemStack stack)
{
    boolean flag = stack != null && stack.getItem() == Items.SPAWN_EGG;

    if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !player.isSneaking())
    {
        if (!this.worldObj.isRemote && (this.buyingList == null || !this.buyingList.isEmpty()))
        {
            this.setCustomer(player);
            player.displayVillagerTradeGui(this);
        }

        player.addStat(StatList.TALKED_TO_VILLAGER);
        return true;
    }
    else
    {
        return super.processInteract(player, hand, stack);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:EntityVillager.java

示例4: processInteract

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean processInteract(EntityPlayer player, EnumHand hand)
{
    ItemStack itemstack = player.getHeldItem(hand);
    boolean flag = itemstack.getItem() == Items.NAME_TAG;

    if (flag)
    {
        itemstack.interactWithEntity(player, this, hand);
        return true;
    }
    else if (!this.func_190669_a(itemstack, this.getClass()) && this.isEntityAlive() && !this.isTrading() && !this.isChild())
    {
        if (this.buyingList == null)
        {
            this.populateBuyingList();
        }

        if (hand == EnumHand.MAIN_HAND)
        {
            player.addStat(StatList.TALKED_TO_VILLAGER);
        }

        if (!this.world.isRemote && !this.buyingList.isEmpty())
        {
            this.setCustomer(player);
            player.displayVillagerTradeGui(this);
        }
        else if (this.buyingList.isEmpty())
        {
            return super.processInteract(player, hand);
        }

        return true;
    }
    else
    {
        return super.processInteract(player, hand);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:40,代码来源:EntityVillager.java


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