@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(); } }
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)); } }