@Override public void useRecipe(MerchantRecipe recipe) { recipe.incrementToolUses(); livingSoundTime = -getTalkInterval(); int i = 3 + rand.nextInt(4); if (recipe.getToolUses() == 1 || rand.nextInt(5) == 0) { // TODO Will need to come back to this, mating code got changed // TODO isWillingToMate = true; i += 5; } if (recipe.getItemToBuy() .getItem() == Items.EMERALD) { wealth += recipe.getItemToBuy() .getMaxStackSize(); } if (recipe.getRewardsExp()) { world.spawnEntity(new EntityXPOrb(world, posX, posY + 0.5D, posZ, i)); } }
@Override public void useRecipe(@Nonnull MerchantRecipe recipe) { if (entity != null && entity.isEntityAlive() && !entity.world.isRemote) { recipe.incrementToolUses(); if (existingList != null) { NBTTagCompound nbt = entity.getEntityData(); nbt.setTag("Stock", existingList.getRecipiesAsTags()); ItemStack toSell = recipe.getItemToSell(); ItemStack toBuy = recipe.getItemToBuy(); AnimalTradeEvent event = new AnimalTradeEvent(entity, customer, toBuy, toSell); MinecraftForge.EVENT_BUS.post(event); } entity.playLivingSound(); } }
if(!pstack.isEmpty() && recipes != null) for(MerchantRecipe recipe : recipes) if(recipe != null && !recipe.isRecipeDisabled() && (equalStacks(pstack, recipe.getItemToBuy()) || equalStacks(pstack, recipe.getItemToSell()))) { entIdBuilder.add(villager.getEntityId()); break;
public void useRecipe(MerchantRecipe recipe) { recipe.incrementToolUses(); this.livingSoundTime = -this.getTalkInterval(); if(this.getHive() != null && this.getCustomer() != null){ this.getHive().setWorld(this.world); this.getHive().modifyPlayerReputation(this.getCustomer().getUniqueID(), 2); } this.playSound(ModSounds.MYRMEX_IDLE, 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; if (this.buyingPlayer != null) { this.lastBuyingPlayer = this.buyingPlayer.getUniqueID(); } else { this.lastBuyingPlayer = null; } i += 5; } if (recipe.getItemToBuy().getItem() == ModItems.myrmex_desert_resin || recipe.getItemToBuy().getItem() == ModItems.myrmex_jungle_resin) { this.wealth += recipe.getItemToBuy().getCount(); } if (recipe.getRewardsExp()) { this.world.spawnEntity(new EntityXPOrb(this.world, this.posX, this.posY + 0.5D, this.posZ, i)); } }
rec = (MerchantRecipe) list.get(r); disabled = (rec.isRecipeDisabled()) ? "[x] " : ""; buy = rec.getItemToBuy(); buySecond = rec.getSecondItemToBuy(); sell = rec.getItemToSell();
MerchantRecipe merchantRecipe = (MerchantRecipe)merchantRecipeList.get(currentRecipeIndex); ItemStack buyingItemStack1 = merchantRecipe.getItemToBuy(); ItemStack buyingItemStack2 = merchantRecipe.getSecondItemToBuy();
private void updateTradingStackSizes(MerchantRecipeList recipeList) { if (recipeList != null) { for (Object obj : recipeList) { MerchantRecipe recipe = (MerchantRecipe) obj; ItemStack toSell = recipe.getItemToSell(); int stackSizeToSell = toSell.getCount(); ItemStack toBuy = recipe.getItemToBuy(); int stackSizeToBuy = toBuy.getCount(); ItemStack secondBuy = recipe.getSecondItemToBuy(); int stackSizeSecond = secondBuy.getCount(); if (stackSizeToSell > 1 && stackSizeToSell != MathHelper.floor(stackSizeToSell * 1.25F)) { stackSizeToSell = MathHelper.floor(stackSizeToSell * 1.25F); } else if (stackSizeToBuy > 1 && stackSizeToBuy != MathHelper.ceil(stackSizeToBuy / 1.25F)) { stackSizeToBuy = MathHelper.ceil(stackSizeToBuy / 1.25F); } else if (secondBuy != null && stackSizeSecond > 1 && stackSizeSecond != MathHelper.ceil(stackSizeSecond / 1.25F)) { stackSizeSecond = MathHelper.ceil(stackSizeSecond / 1.25F); } toSell.setCount(stackSizeToSell); toBuy.setCount(stackSizeToBuy); secondBuy.setCount(stackSizeSecond); } lastViewVillagerGui = true; } }
int y = this.y + 1; GlStateManager.pushMatrix(); ModCyclic.proxy.renderItemOnGui(r.getItemToBuy(), parent.itemRender, parent.fontRenderer, x, y); x += spacing; ModCyclic.proxy.renderItemOnGui(r.getSecondItemToBuy(), parent.itemRender, parent.fontRenderer, x, y);
return; ItemStack itemToBuy = trade.getItemToBuy().copy(); ItemStack itemSecondBuy = (trade.getSecondItemToBuy().isEmpty()) ? ItemStack.EMPTY : trade.getSecondItemToBuy().copy(); ItemStack firstItem = ItemStack.EMPTY;