Solved Create a villager inventory

Discussion in 'Plugin Development' started by Jogy34, May 22, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Jogy34

    I need to be able to create a villager inventory and be able to set all of the things in it then be able to show it to the player. Anyone know how to do this? I don't wan't to use an external API.
     
  2. Offline

    Technius

    You could do this by calling Bukkit.getServer().createInventory. Your InventoryType should be InventoryType.MERCHANT.
     
  3. Offline

    chasechocolate

    Create an inventory with InventoryType.MERCHANT I think.

    EDIT: Ninja'd by Technius
     
  4. Offline

    Jogy34

    Technius chasechocolate The problem with that is it doesn't allow me to put in exchanges like I want to be able to. All a MerchantInventroy is, is a normal inventory that was implemented by a different interface. Unless creating it with that InventoryType creates a different object.
     
  5. Offline

    coobro123

    I don't think there is much features in bukkit to let u edit villagers inventory's.
     
  6. Offline

    Jogy34

    I'm currently trying to use nms/craftbukkit code to do it but I am having a problem finding the correct things to create the inventory.
     
  7. Offline

    Technius

    Jogy34
    You could probably just get the handle of the Bukkit inventory.
     
  8. Offline

    Jogy34

    I figured out how to create one with NMS stuff. I'm just having a problem displaying any type of merchant inventory now.
     
  9. Offline

    Minnymin3

    Look at the MerchantAPI by Cybermaxke and see how he did it.
     
  10. Offline

    Jogy34

    I thought I had tried it the same way as him but I decided to look back at what was different between his class the implements IMerchant and mine. Turns out I just wasn't returning the player correctly in that class.
     
  11. Offline

    Minnymin3

    I should probably work on my own implementation of villager trading but his is so much easier...

    Decided to do it and now im happy because im using my own code
     
Thread Status:
Not open for further replies.

Share This Page