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


Java MerchantRecipe.getItemToBuy方法代码示例

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


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

示例1: doTrade

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
private boolean doTrade(MerchantRecipe trade, ItemStack firstItem, ItemStack secondItem)
{
    ItemStack itemstack = trade.getItemToBuy();
    ItemStack itemstack1 = trade.getSecondItemToBuy();

    if (firstItem != null && firstItem.getItem() == itemstack.getItem())
    {
        if (itemstack1 != null && secondItem != null && itemstack1.getItem() == secondItem.getItem())
        {
            firstItem.stackSize -= itemstack.stackSize;
            secondItem.stackSize -= itemstack1.stackSize;
            return true;
        }

        if (itemstack1 == null && secondItem == null)
        {
            firstItem.stackSize -= itemstack.stackSize;
            return true;
        }
    }

    return false;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:24,代码来源:SlotMerchantResult.java

示例2: doTrade

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
private boolean doTrade(MerchantRecipe trade, ItemStack firstItem, ItemStack secondItem)
{
    ItemStack itemstack = trade.getItemToBuy();
    ItemStack itemstack1 = trade.getSecondItemToBuy();

    if (firstItem.getItem() == itemstack.getItem() && firstItem.func_190916_E() >= itemstack.func_190916_E())
    {
        if (!itemstack1.func_190926_b() && !secondItem.func_190926_b() && itemstack1.getItem() == secondItem.getItem() && secondItem.func_190916_E() >= itemstack1.func_190916_E())
        {
            firstItem.func_190918_g(itemstack.func_190916_E());
            secondItem.func_190918_g(itemstack1.func_190916_E());
            return true;
        }

        if (itemstack1.func_190926_b() && secondItem.func_190926_b())
        {
            firstItem.func_190918_g(itemstack.func_190916_E());
            return true;
        }
    }

    return false;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:24,代码来源:SlotMerchantResult.java

示例3: doTrade

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
private boolean doTrade(MerchantRecipe trade, ItemStack firstItem, ItemStack secondItem)
{
    ItemStack itemstack = trade.getItemToBuy();
    ItemStack itemstack1 = trade.getSecondItemToBuy();

    if (firstItem != null && firstItem.getItem() == itemstack.getItem() && firstItem.stackSize >= itemstack.stackSize)
    {
        if (itemstack1 != null && secondItem != null && itemstack1.getItem() == secondItem.getItem() && secondItem.stackSize >= itemstack1.stackSize)
        {
            firstItem.stackSize -= itemstack.stackSize;
            secondItem.stackSize -= itemstack1.stackSize;
            return true;
        }

        if (itemstack1 == null && secondItem == null)
        {
            firstItem.stackSize -= itemstack.stackSize;
            return true;
        }
    }

    return false;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:24,代码来源:SlotMerchantResult.java

示例4: useRecipe

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
public void useRecipe(MerchantRecipe par1MerchantRecipe)
{
    par1MerchantRecipe.incrementToolUses();
    this.livingSoundTime = -this.getTalkInterval();
    this.playSound("mob.villager.yes", this.getSoundVolume(), this.getSoundPitch());

    if (par1MerchantRecipe.hasSameIDsAs((MerchantRecipe)this.buyingList.get(this.buyingList.size() - 1)))
    {
        this.timeUntilReset = 40;
        this.needsInitilization = true;

        if (this.buyingPlayer != null)
        {
            this.lastBuyingPlayer = this.buyingPlayer.getCommandSenderName();
        }
        else
        {
            this.lastBuyingPlayer = null;
        }
    }

    if (par1MerchantRecipe.getItemToBuy().getItem() == Items.emerald)
    {
        this.wealth += par1MerchantRecipe.getItemToBuy().stackSize;
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:27,代码来源:EntityVillager.java

示例5: func_75230_a

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
private boolean func_75230_a(MerchantRecipe par1MerchantRecipe, ItemStack par2ItemStack, ItemStack par3ItemStack)
{
    ItemStack var4 = par1MerchantRecipe.getItemToBuy();
    ItemStack var5 = par1MerchantRecipe.getSecondItemToBuy();

    if (par2ItemStack != null && par2ItemStack.getItem() == var4.getItem())
    {
        if (var5 != null && par3ItemStack != null && var5.getItem() == par3ItemStack.getItem())
        {
            par2ItemStack.stackSize -= var4.stackSize;
            par3ItemStack.stackSize -= var5.stackSize;
            return true;
        }

        if (var5 == null && par3ItemStack == null)
        {
            par2ItemStack.stackSize -= var4.stackSize;
            return true;
        }
    }

    return false;
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:24,代码来源:SlotMerchantResult.java

示例6: useRecipe

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
public void useRecipe(MerchantRecipe p_70933_1_)
{
    p_70933_1_.incrementToolUses();
    this.livingSoundTime = -this.getTalkInterval();
    this.playSound("mob.villager.yes", this.getSoundVolume(), this.getSoundPitch());

    if (p_70933_1_.hasSameIDsAs((MerchantRecipe)this.buyingList.get(this.buyingList.size() - 1)))
    {
        this.timeUntilReset = 40;
        this.needsInitilization = true;

        if (this.buyingPlayer != null)
        {
            this.lastBuyingPlayer = this.buyingPlayer.getCommandSenderName();
        }
        else
        {
            this.lastBuyingPlayer = null;
        }
    }

    if (p_70933_1_.getItemToBuy().getItem() == Items.emerald)
    {
        this.wealth += p_70933_1_.getItemToBuy().stackSize;
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:27,代码来源:EntityVillager.java

示例7: func_75230_a

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
private boolean func_75230_a(MerchantRecipe p_75230_1_, ItemStack p_75230_2_, ItemStack p_75230_3_)
{
    ItemStack itemstack2 = p_75230_1_.getItemToBuy();
    ItemStack itemstack3 = p_75230_1_.getSecondItemToBuy();

    if (p_75230_2_ != null && p_75230_2_.getItem() == itemstack2.getItem())
    {
        if (itemstack3 != null && p_75230_3_ != null && itemstack3.getItem() == p_75230_3_.getItem())
        {
            p_75230_2_.stackSize -= itemstack2.stackSize;
            p_75230_3_.stackSize -= itemstack3.stackSize;
            return true;
        }

        if (itemstack3 == null && p_75230_3_ == null)
        {
            p_75230_2_.stackSize -= itemstack2.stackSize;
            return true;
        }
    }

    return false;
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:24,代码来源:SlotMerchantResult.java

示例8: useRecipe

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
public void useRecipe(MerchantRecipe par1MerchantRecipe)
{
    par1MerchantRecipe.incrementToolUses();

    if (par1MerchantRecipe.hasSameIDsAs((MerchantRecipe)this.buyingList.get(this.buyingList.size() - 1)))
    {
        this.timeUntilReset = 40;
        this.needsInitilization = true;

        if (this.buyingPlayer != null)
        {
            this.lastBuyingPlayer = this.buyingPlayer.getCommandSenderName();
        }
        else
        {
            this.lastBuyingPlayer = null;
        }
    }

    if (par1MerchantRecipe.getItemToBuy().itemID == Item.emerald.itemID)
    {
        this.wealth += par1MerchantRecipe.getItemToBuy().stackSize;
    }
}
 
开发者ID:Stormister,项目名称:Rediscovered-Mod-1.6.4,代码行数:25,代码来源:EntityGreenVillager.java

示例9: useRecipe

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
public void useRecipe(MerchantRecipe par1MerchantRecipe)
{
    par1MerchantRecipe.incrementToolUses();

    if (par1MerchantRecipe.hasSameIDsAs((MerchantRecipe)this.buyingList.get(this.buyingList.size() - 1)))
    {
        this.timeUntilReset = 40;
        this.needsInitilization = true;

        if (this.buyingPlayer != null)
        {
            this.lastBuyingPlayer = this.buyingPlayer.getCommandSenderName();
        }
        else
        {
            this.lastBuyingPlayer = null;
        }
    }

    if (par1MerchantRecipe.getItemToBuy().itemID == mod_Rediscovered.gemRuby.itemID)
    {
        this.wealth += par1MerchantRecipe.getItemToBuy().stackSize;
    }
}
 
开发者ID:Stormister,项目名称:Rediscovered-Mod-1.6.4,代码行数:25,代码来源:EntityPigman.java

示例10: haveSameTradeItems

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
/**
 * Returns true if all the items (to buy and sell) have matching item IDs and metadata
 * Does not care about stack size or NBT tags.
 */
public static boolean haveSameTradeItems(MerchantRecipe a, MerchantRecipe b) {
	ItemStack item1a = a.getItemToBuy();
	ItemStack item1b = b.getItemToBuy();
	ItemStack item2a = a.getItemToSell();
	ItemStack item2b = b.getItemToSell();
	ItemStack item3a = a.getSecondItemToBuy();
	ItemStack item3b = b.getSecondItemToBuy();
	if (item1a != null && item1b != null && item1a.getItem() == item1b.getItem() && item1a.getItemDamage() == item1b.getItemDamage()) {
		if (item2a != null && item2b != null && item2a.getItem() == item2b.getItem() && item2a.getItemDamage() == item2b.getItemDamage()) {
			return (item3a == null && item3b == null) || (item3a != null && item3b != null &&
					item3a.getItem() == item3b.getItem() && item3a.getItemDamage() == item3b.getItemDamage());
		}
	}

	return false;
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:21,代码来源:MerchantRecipeHelper.java

示例11: useRecipe

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
public void useRecipe(MerchantRecipe par1MerchantRecipe)
{
    par1MerchantRecipe.incrementToolUses();
    this.livingSoundTime = -this.getTalkInterval();
    this.playSound("mob.villager.yes", this.getSoundVolume(), this.getSoundPitch());

    if (par1MerchantRecipe.hasSameIDsAs((MerchantRecipe)this.buyingList.get(this.buyingList.size() - 1)))
    {
        this.timeUntilReset = 40;
        this.needsInitilization = true;

        if (this.buyingPlayer != null)
        {
            this.lastBuyingPlayer = this.buyingPlayer.getCommandSenderName();
        }
        else
        {
            this.lastBuyingPlayer = null;
        }
    }

    if (par1MerchantRecipe.getItemToBuy().itemID == Item.emerald.itemID)
    {
        this.wealth += par1MerchantRecipe.getItemToBuy().stackSize;
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:27,代码来源:EntityVillager.java

示例12: func_75230_a

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
private boolean func_75230_a(MerchantRecipe par1MerchantRecipe, ItemStack par2ItemStack, ItemStack par3ItemStack)
{
    ItemStack itemstack2 = par1MerchantRecipe.getItemToBuy();
    ItemStack itemstack3 = par1MerchantRecipe.getSecondItemToBuy();

    if (par2ItemStack != null && par2ItemStack.itemID == itemstack2.itemID)
    {
        if (itemstack3 != null && par3ItemStack != null && itemstack3.itemID == par3ItemStack.itemID)
        {
            par2ItemStack.stackSize -= itemstack2.stackSize;
            par3ItemStack.stackSize -= itemstack3.stackSize;
            return true;
        }

        if (itemstack3 == null && par3ItemStack == null)
        {
            par2ItemStack.stackSize -= itemstack2.stackSize;
            return true;
        }
    }

    return false;
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:24,代码来源:SlotMerchantResult.java

示例13: useRecipe

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
public void useRecipe(MerchantRecipe par1MerchantRecipe)
{
    par1MerchantRecipe.incrementToolUses();
    this.livingSoundTime = -this.getTalkInterval();
    this.playSound("mob.pig.say", this.getSoundVolume(), this.getSoundPitch());

    if (par1MerchantRecipe.hasSameIDsAs((MerchantRecipe)this.buyingList.get(this.buyingList.size() - 1)))
    {
        this.timeUntilReset = 40;
        this.needsInitilization = true;

        if (this.buyingPlayer != null)
        {
            this.lastBuyingPlayer = this.buyingPlayer.getCommandSenderName();
        }
        else
        {
            this.lastBuyingPlayer = null;
        }
    }

    if (par1MerchantRecipe.getItemToBuy().getItem() == mod_Rediscovered.gemRuby)
    {
        this.wealth += par1MerchantRecipe.getItemToBuy().stackSize;
    }
}
 
开发者ID:Stormister,项目名称:Rediscovered-Mod-1.7.10,代码行数:27,代码来源:EntityPigman.java

示例14: useRecipe

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
public void useRecipe(MerchantRecipe recipe)
{
    recipe.incrementToolUses();
    this.livingSoundTime = -this.getTalkInterval();
    this.playSound("mob.villager.yes", this.getSoundVolume(), this.getSoundPitch());
    int i = 3 + this.rand.nextInt(4);

    if (recipe.getToolUses() == 1 || this.rand.nextInt(5) == 0)
    {
        this.timeUntilReset = 40;
        this.needsInitilization = true;
        this.isWillingToMate = true;

        if (this.buyingPlayer != null)
        {
            this.lastBuyingPlayer = this.buyingPlayer.getName();
        }
        else
        {
            this.lastBuyingPlayer = null;
        }

        i += 5;
    }

    if (recipe.getItemToBuy().getItem() == Items.emerald)
    {
        this.wealth += recipe.getItemToBuy().stackSize;
    }

    if (recipe.getRewardsExp())
    {
        this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY + 0.5D, this.posZ, i));
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:36,代码来源:EntityVillager.java

示例15: useRecipe

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
public void useRecipe(MerchantRecipe recipe)
{
    recipe.incrementToolUses();
    this.livingSoundTime = -this.getTalkInterval();
    this.playSound(SoundEvents.ENTITY_VILLAGER_YES, this.getSoundVolume(), this.getSoundPitch());
    int i = 3 + this.rand.nextInt(4);

    if (recipe.getToolUses() == 1 || this.rand.nextInt(5) == 0)
    {
        this.timeUntilReset = 40;
        this.needsInitilization = true;
        this.isWillingToMate = true;

        if (this.buyingPlayer != null)
        {
            this.lastBuyingPlayer = this.buyingPlayer.getName();
        }
        else
        {
            this.lastBuyingPlayer = null;
        }

        i += 5;
    }

    if (recipe.getItemToBuy().getItem() == Items.EMERALD)
    {
        this.wealth += recipe.getItemToBuy().stackSize;
    }

    if (recipe.getRewardsExp())
    {
        this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY + 0.5D, this.posZ, i));
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:36,代码来源:EntityVillager.java


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