open creative inventory

Discussion in 'Plugin Development' started by guitargun, Mar 20, 2015.

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

    guitargun

    I wonder if it is possible to open a creative inventory or to mimic one.

    right now when you try to open a inventory with the type creative it gives a error. is there some NMS that can handle this or do I have to make a custom creative inventory?

    right now in my code you can add the items by first activating the list then go into creative and drag the items out that menu.
    source:
    https://bitbucket.org/guitargun/inv...r/stephen/Merchant/TradeAdding.java?at=master
     
  2. Offline

    mine-care

    I think you need to play with PacketPlayOutOpenWindow (Aka packet id 100 before the update) i will try to do this too, but no guarantee.
     
  3. Offline

    Zombie_Striker

    You could try to mimic the Inventory by filling a inventory with the blocks. and then once the player clicks a item, it will give the player that item. You may need to create over 3 inventories in order to give access to every item.

    Or, you could give the player Creative once they open their inventory, and then set it to survival once they close it.
     
  4. Offline

    guitargun

    @mine-care ok. I'll look into it and if you are done pls let me now.

    @Zombie_Striker I tried that approach but that didn't work it opened the survival inventory instead.
     
  5. Offline

    ImaTimelord7

    I could be wrong but what If:
    When the player opens inventory
    Give creative
    Close Inventory
    Open Inventory

    And then ofc when they close inventory
    Give survival

    Just make sure you do it in that order, might or might not work, just a suggestion ;)
    Tag me if this works.
     
  6. Offline

    guitargun

    @ImaTimelord7 doesn't work. I already said it wouldn't work. this is what happens instead
    [​IMG]
     
  7. Offline

    ImaTimelord7

  8. Offline

    guitargun

    @mine-care I just tried with packplayoutopenwindow but the problem is there isn't a id for the user inventory itself.
    http://wiki.vg/Inventory also I don't know what all of the things do, What I do know after fiddling with it:
    from left to right: ??, typeinventory, name inventory, numberofslots, ??
    PacketPlayOutOpenWindow(69, 0, "Creative", 9, true);
     
  9. Packet packet = ...;
    ((CraftPlayer)p).getHandle().playerconnection.sendPacket(packet);
     
  10. Offline

    guitargun

    @FisheyLP I already know that I have to use packets problem is the packet I need to use doesn't support it or there is another packet I don't know of.

    what I have
    Code:
            PacketPlayOutOpenWindow packet = new PacketPlayOutOpenWindow(69, 0, "Creative", 9, true);
            EntityPlayer p = ((CraftPlayer) player).getHandle();
            p.playerConnection.sendPacket(packet);
     
  11. Offline

    guitargun

    Does someone know another packet for this??
     
Thread Status:
Not open for further replies.

Share This Page