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