net.minecraft.entity.IMerchant Java Examples
The following examples show how to use
net.minecraft.entity.IMerchant.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CraftHumanEntity.java From Kettle with GNU General Public License v3.0 | 6 votes |
@Override public InventoryView openMerchant(Merchant merchant, boolean force) { Preconditions.checkNotNull(merchant, "merchant cannot be null"); if (!force && merchant.isTrading()) { return null; } else if (merchant.isTrading()) { // we're not supposed to have multiple people using the same merchant, so we have to close it. merchant.getTrader().closeInventory(); } IMerchant mcMerchant; if (merchant instanceof CraftVillager) { mcMerchant = ((CraftVillager) merchant).getHandle(); } else if (merchant instanceof CraftMerchant) { mcMerchant = ((CraftMerchant) merchant).getMerchant(); } else { throw new IllegalArgumentException("Can't open merchant " + merchant.toString()); } mcMerchant.setCustomer(this.getHandle()); this.getHandle().displayVillagerTradeGui(mcMerchant); return this.getHandle().inventoryContainer.getBukkitView(); }
Example #2
Source File: EntityRequest.java From HoloInventory with MIT License | 6 votes |
@Override public ResponseMessage onMessage(EntityRequest message, MessageContext ctx) { World world = DimensionManager.getWorld(message.dim); if (world == null) return null; Entity entity = world.getEntityByID(message.id); if (entity == null) return null; if (entity instanceof IInventory) return new PlainInventory(message.id, (IInventory) entity); else if (entity instanceof IMerchant) return new MerchantRecipes(message.id, (IMerchant) entity, ctx.getServerHandler().player); else if (entity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)) { return new PlainInventory(message.id, entity.getName(), entity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)); } return null; }
Example #3
Source File: TofuVillages.java From TofuCraftReload with MIT License | 5 votes |
@Override public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random) { //Buy recipeList.add(new MerchantRecipe(new ItemStack(ItemLoader.soybeans, 18 + random.nextInt(4)), new ItemStack(Items.EMERALD))); recipeList.add(new MerchantRecipe(new ItemStack(ItemLoader.tofu_food, 14 + random.nextInt(4),1), new ItemStack(Items.EMERALD))); recipeList.add(new MerchantRecipe(new ItemStack(ItemLoader.material, 6 + random.nextInt(4),5), new ItemStack(Items.EMERALD))); recipeList.add(new MerchantRecipe(new ItemStack(ItemLoader.material, 14 + random.nextInt(4),3), new ItemStack(Items.EMERALD))); //Sell }
Example #4
Source File: TofuVillages.java From TofuCraftReload with MIT License | 5 votes |
@Override public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random) { //Buy recipeList.add(new MerchantRecipe(new ItemStack(ItemLoader.material, 18 + random.nextInt(4),2), new ItemStack(Items.EMERALD))); //Sell recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD), new ItemStack(ItemLoader.tofu_food, 17 + random.nextInt(8),3))); recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD), new ItemStack(ItemLoader.tofu_food, 10 + random.nextInt(4),4))); recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD), new ItemStack(ItemLoader.tofu_food, 12 + random.nextInt(4),5))); }
Example #5
Source File: TofuVillages.java From TofuCraftReload with MIT License | 5 votes |
@Override public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random) { //Sell recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD), new ItemStack(ItemLoader.tofu_material, 2 + random.nextInt(2)))); recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD), new ItemStack(ItemLoader.tofu_material, 8 + random.nextInt(4),2))); recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, 6 + random.nextInt(4)), new ItemStack(ItemLoader.tofustick))); }
Example #6
Source File: VillagerTofu1.java From TofuCraftReload with MIT License | 4 votes |
public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random) { int i = price != null ? price.getPrice(random) : 1; recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, i, 0),item.copy())); }
Example #7
Source File: VillagerTofu1.java From TofuCraftReload with MIT License | 4 votes |
public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random) { int i = price != null ? price.getPrice(random) : 1; recipeList.add(new MerchantRecipe(item.copy(),new ItemStack(Items.EMERALD, i, 0))); }
Example #8
Source File: TofuVillages.java From TofuCraftReload with MIT License | 4 votes |
@Override public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random) { //Buy recipeList.add(new MerchantRecipe(new ItemStack(ItemLoader.rice, 16 + random.nextInt(8)), new ItemStack(Items.EMERALD))); }
Example #9
Source File: VillagerLoader.java From Sakura_mod with MIT License | 4 votes |
public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random) { int i = price != null ? price.getPrice(random) : 1; recipeList.add(new MerchantRecipe(new ItemStack(ItemLoader.MATERIAL, i, 50),item.copy())); }
Example #10
Source File: VillagerLoader.java From Sakura_mod with MIT License | 4 votes |
public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random) { int i = price != null ? price.getPrice(random) : 1; recipeList.add(new MerchantRecipe(item.copy(),new ItemStack(ItemLoader.MATERIAL, i, 50))); }
Example #11
Source File: CraftMerchant.java From Kettle with GNU General Public License v3.0 | 4 votes |
public CraftMerchant(IMerchant merchant) { this.merchant = merchant; }
Example #12
Source File: CraftMerchant.java From Kettle with GNU General Public License v3.0 | 4 votes |
public IMerchant getMerchant() { return merchant; }