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


Java MerchantRecipe.increaseMaxTradeUses方法代码示例

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


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

示例1: updateAITasks

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
@Override
protected void updateAITasks() {
    if (!this.isTrading() && this.timeUntilReset > 0) {
        --this.timeUntilReset;

        if (this.timeUntilReset <= 0) {
            if (this.needsInitilization) {
                AOTA.logDebug("Initializing Tradeable entity " + hashCode());
                for (MerchantRecipe merchantrecipe : this.buyingList) {
                    if (merchantrecipe.isRecipeDisabled()) {
                        merchantrecipe.increaseMaxTradeUses(this.rand.nextInt(6) + this.rand.nextInt(6) + 2);
                    }
                }

                this.populateBuyingList();
                this.needsInitilization = false;

                if (this.lastBuyingPlayer != null) {
                    this.world.setEntityState(this, (byte) 14);
                }
            }

            this.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 200, 0));
        }
    }

    super.updateAITasks();
}
 
开发者ID:CountGrimhart,项目名称:Count-Armours,代码行数:29,代码来源:EntityTradeable.java

示例2: onEntityInteractEvent

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityInteractEvent(EntityInteract event) {
  if (event.getEntity() instanceof EntityPlayer == false) {
    return;
  }
  EntityPlayer player = (EntityPlayer) event.getEntity();
  //    ItemStack held = player.getHeldItemMainhand();
  ItemStack itemstack = event.getItemStack();
  if (itemstack != null && itemstack.getItem() instanceof ItemAppleEmerald && itemstack.getCount() > 0) {
    if (event.getTarget() instanceof EntityVillager) {
      EntityVillager villager = ((EntityVillager) event.getTarget());
      int count = 0;
      for (MerchantRecipe merchantrecipe : villager.getRecipes(player)) {
        if (merchantrecipe.isRecipeDisabled()) {
          //vanilla code as of 1.9.4 odes this (2d6+2) 
          merchantrecipe.increaseMaxTradeUses(villager.getEntityWorld().rand.nextInt(6) + villager.getEntityWorld().rand.nextInt(6) + 2);
          count++;
        }
      }
      if (count > 0) {
        UtilChat.addChatMessage(player, UtilChat.lang("item.apple_emerald.merchant") + count);
        consumeSelf(itemstack);
      }
      event.setCanceled(true);// stop the GUI inventory opening && horse mounting
    }
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:28,代码来源:ItemAppleEmerald.java

示例3: updateAITasks

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
@Override
@SuppressWarnings("rawtypes")
protected void updateAITasks() {

	if (!isTrading() && timeUntilReset > 0)
	{
		--timeUntilReset;

		if (timeUntilReset <= 0)
		{
			if (needsInitilization)
			{
				if (tradingList.size() > 1)
				{
					Iterator iterator = tradingList.iterator();

					while (iterator.hasNext())
					{
						MerchantRecipe merchantrecipe = (MerchantRecipe)iterator.next();

						if (merchantrecipe.isRecipeDisabled())
							merchantrecipe.increaseMaxTradeUses(rand.nextInt(6) + rand.nextInt(6) + 2);
					}
				}

				addDefaultEquipmentAndRecipies(1);
				needsInitilization = false;
			}

			addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 200, 0));
		}
	}

	super.updateAITasks();
}
 
开发者ID:Shinoow,项目名称:AbyssalCraft,代码行数:36,代码来源:EntityRemnant.java

示例4: refreshTradingList

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
@Override
protected void refreshTradingList() {
	for (ListIterator<MerchantRecipe> iterator = trades.listIterator(); iterator.hasNext();) {
		MerchantRecipe trade = iterator.next();
		// replace bomb trades so he can't ever become sold out
		if (isBombTrade(trade) && trade.getToolUses() > 49) {
			iterator.set(getRefreshedBombTrade(trade));
		} else if (trade.isRecipeDisabled()) {
			trade.increaseMaxTradeUses(rand.nextInt(6) + rand.nextInt(6) + 2);
		}
	}
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:13,代码来源:EntityNpcBarnes.java

示例5: refreshTradingList

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
/**
 * Called each time the trading list is refreshed. The default implementation
 * increases the max trade uses of any disabled recipes, just as vanilla does.
 */
protected void refreshTradingList() {
	for (Iterator<MerchantRecipe> iterator = trades.iterator(); iterator.hasNext();) {
		MerchantRecipe trade = iterator.next();
		if (trade.isRecipeDisabled()) {
			trade.increaseMaxTradeUses(rand.nextInt(6) + rand.nextInt(6) + 2);
		}
	}
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:13,代码来源:EntityNpcMerchantBase.java

示例6: updateAITasks

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
protected void updateAITasks()
{
    if (--this.randomTickDivider <= 0)
    {
        BlockPos blockpos = new BlockPos(this);
        this.worldObj.getVillageCollection().addToVillagerPositionList(blockpos);
        this.randomTickDivider = 70 + this.rand.nextInt(50);
        this.villageObj = this.worldObj.getVillageCollection().getNearestVillage(blockpos, 32);

        if (this.villageObj == null)
        {
            this.detachHome();
        }
        else
        {
            BlockPos blockpos1 = this.villageObj.getCenter();
            this.setHomePosAndDistance(blockpos1, (int)((float)this.villageObj.getVillageRadius() * 1.0F));

            if (this.isLookingForHome)
            {
                this.isLookingForHome = false;
                this.villageObj.setDefaultPlayerReputation(5);
            }
        }
    }

    if (!this.isTrading() && this.timeUntilReset > 0)
    {
        --this.timeUntilReset;

        if (this.timeUntilReset <= 0)
        {
            if (this.needsInitilization)
            {
                for (MerchantRecipe merchantrecipe : this.buyingList)
                {
                    if (merchantrecipe.isRecipeDisabled())
                    {
                        merchantrecipe.increaseMaxTradeUses(this.rand.nextInt(6) + this.rand.nextInt(6) + 2);
                    }
                }

                this.populateBuyingList();
                this.needsInitilization = false;

                if (this.villageObj != null && this.lastBuyingPlayer != null)
                {
                    this.worldObj.setEntityState(this, (byte)14);
                    this.villageObj.setReputationForPlayer(this.lastBuyingPlayer, 1);
                }
            }

            this.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, 0));
        }
    }

    super.updateAITasks();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:59,代码来源:EntityVillager.java

示例7: updateAITasks

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
protected void updateAITasks()
{
    if (--this.randomTickDivider <= 0)
    {
        BlockPos blockpos = new BlockPos(this);
        this.world.getVillageCollection().addToVillagerPositionList(blockpos);
        this.randomTickDivider = 70 + this.rand.nextInt(50);
        this.villageObj = this.world.getVillageCollection().getNearestVillage(blockpos, 32);

        if (this.villageObj == null)
        {
            this.detachHome();
        }
        else
        {
            BlockPos blockpos1 = this.villageObj.getCenter();
            this.setHomePosAndDistance(blockpos1, this.villageObj.getVillageRadius());

            if (this.isLookingForHome)
            {
                this.isLookingForHome = false;
                this.villageObj.setDefaultPlayerReputation(5);
            }
        }
    }

    if (!this.isTrading() && this.timeUntilReset > 0)
    {
        --this.timeUntilReset;

        if (this.timeUntilReset <= 0)
        {
            if (this.needsInitilization)
            {
                for (MerchantRecipe merchantrecipe : this.buyingList)
                {
                    if (merchantrecipe.isRecipeDisabled())
                    {
                        merchantrecipe.increaseMaxTradeUses(this.rand.nextInt(6) + this.rand.nextInt(6) + 2);
                    }
                }

                this.populateBuyingList();
                this.needsInitilization = false;

                if (this.villageObj != null && this.lastBuyingPlayer != null)
                {
                    this.world.setEntityState(this, (byte)14);
                    this.villageObj.modifyPlayerReputation(this.lastBuyingPlayer, 1);
                }
            }

            this.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 200, 0));
        }
    }

    super.updateAITasks();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:59,代码来源:EntityVillager.java

示例8: updateAITasks

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
protected void updateAITasks()
{
    if (--this.randomTickDivider <= 0)
    {
        BlockPos blockpos = new BlockPos(this);
        this.worldObj.getVillageCollection().addToVillagerPositionList(blockpos);
        this.randomTickDivider = 70 + this.rand.nextInt(50);
        this.villageObj = this.worldObj.getVillageCollection().getNearestVillage(blockpos, 32);

        if (this.villageObj == null)
        {
            this.detachHome();
        }
        else
        {
            BlockPos blockpos1 = this.villageObj.getCenter();
            this.setHomePosAndDistance(blockpos1, this.villageObj.getVillageRadius());

            if (this.isLookingForHome)
            {
                this.isLookingForHome = false;
                this.villageObj.setDefaultPlayerReputation(5);
            }
        }
    }

    if (!this.isTrading() && this.timeUntilReset > 0)
    {
        --this.timeUntilReset;

        if (this.timeUntilReset <= 0)
        {
            if (this.needsInitilization)
            {
                for (MerchantRecipe merchantrecipe : this.buyingList)
                {
                    if (merchantrecipe.isRecipeDisabled())
                    {
                        merchantrecipe.increaseMaxTradeUses(this.rand.nextInt(6) + this.rand.nextInt(6) + 2);
                    }
                }

                this.populateBuyingList();
                this.needsInitilization = false;

                if (this.villageObj != null && this.lastBuyingPlayer != null)
                {
                    this.worldObj.setEntityState(this, (byte)14);
                    this.villageObj.modifyPlayerReputation(this.lastBuyingPlayer, 1);
                }
            }

            this.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 200, 0));
        }
    }

    super.updateAITasks();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:59,代码来源:EntityVillager.java

示例9: updateAITasks

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
protected void updateAITasks()
{
    if (--this.randomTickDivider <= 0)
    {
        BlockPos blockpos = new BlockPos(this);
        this.worldObj.getVillageCollection().addToVillagerPositionList(blockpos);
        this.randomTickDivider = 70 + this.rand.nextInt(50);
        this.villageObj = this.worldObj.getVillageCollection().getNearestVillage(blockpos, 32);

        if (this.villageObj == null)
        {
            this.detachHome();
        }
        else
        {
            BlockPos blockpos1 = this.villageObj.getCenter();
            this.func_175449_a(blockpos1, (int)((float)this.villageObj.getVillageRadius() * 1.0F));

            if (this.isLookingForHome)
            {
                this.isLookingForHome = false;
                this.villageObj.setDefaultPlayerReputation(5);
            }
        }
    }

    if (!this.isTrading() && this.timeUntilReset > 0)
    {
        --this.timeUntilReset;

        if (this.timeUntilReset <= 0)
        {
            if (this.needsInitilization)
            {
                Iterator iterator = this.buyingList.iterator();

                while (iterator.hasNext())
                {
                    MerchantRecipe merchantrecipe = (MerchantRecipe)iterator.next();

                    if (merchantrecipe.isRecipeDisabled())
                    {
                        merchantrecipe.increaseMaxTradeUses(this.rand.nextInt(6) + this.rand.nextInt(6) + 2);
                    }
                }

                this.populateBuyingList();
                this.needsInitilization = false;

                if (this.villageObj != null && this.lastBuyingPlayer != null)
                {
                    this.worldObj.setEntityState(this, (byte)14);
                    this.villageObj.setReputationForPlayer(this.lastBuyingPlayer, 1);
                }
            }

            this.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, 0));
        }
    }

    super.updateAITasks();
}
 
开发者ID:Stormister,项目名称:Rediscovered-Mod-1.8,代码行数:63,代码来源:EntityGreenVillager.java

示例10: updateAITasks

import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
protected void updateAITasks()
{
    if (--this.randomTickDivider <= 0)
    {
        BlockPos blockpos = new BlockPos(this);
        this.worldObj.getVillageCollection().addToVillagerPositionList(blockpos);
        this.randomTickDivider = 70 + this.rand.nextInt(50);
        this.villageObj = this.worldObj.getVillageCollection().getNearestVillage(blockpos, 32);

        if (this.villageObj == null)
        {
            this.detachHome();
        }
        else
        {
            BlockPos blockpos1 = this.villageObj.getCenter();
            this.setHomePosAndDistance(blockpos1, (int)((float)this.villageObj.getVillageRadius() * 1.0F));

            if (this.isLookingForHome)
            {
                this.isLookingForHome = false;
                this.villageObj.setDefaultPlayerReputation(5);
            }
        }
    }

    if (!this.isTrading() && this.timeUntilReset > 0)
    {
        --this.timeUntilReset;

        if (this.timeUntilReset <= 0)
        {
            if (this.needsInitilization)
            {
                Iterator iterator = this.buyingList.iterator();

                while (iterator.hasNext())
                {
                    MerchantRecipe merchantrecipe = (MerchantRecipe)iterator.next();

                    if (merchantrecipe.isRecipeDisabled())
                    {
                        merchantrecipe.increaseMaxTradeUses(this.rand.nextInt(6) + this.rand.nextInt(6) + 2);
                    }
                }

                this.populateBuyingList();
                this.needsInitilization = false;

                if (this.villageObj != null && this.lastBuyingPlayer != null)
                {
                    this.worldObj.setEntityState(this, (byte)14);
                    this.villageObj.setReputationForPlayer(this.lastBuyingPlayer, 1);
                }
            }

            this.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, 0));
        }
    }

    super.updateAITasks();
}
 
开发者ID:Stormister,项目名称:Rediscovered-Mod-1.8.8,代码行数:63,代码来源:EntityGreenVillager.java


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