Posts by yahwho

    Java
    System.out.println("Attempting world object insertion...");
    ModelInformation modelInfo = new ModelInformation(plugin, "path to object");
    ImageInformation imageInfo = new ImageInformation(plugin, "path to texture");
    World3DModel model = new World3DModel(modelInfo, imageInfo);
    model.setPosition(player.getPosition());
    model.setInteractable(true);
    model.setLightingEnabled(true);
    player.addWorldElement(model);

    Anyone got any ideas why this isn't working? I would have thought this code when called would spawn the custom model in the position of the player? (I'm not getting any console errors)

    I'm getting a lot of:



    Code
    ATTR FILL: 1
    ATTR FILL -> string string


    messages on my console output now whenever a custom item is in a players inventory.


    (string string being my own set attributes)

    however using item.getName() I simply get "apiitem"


    Hmm this is actually causing some roadblock for me. I can't work with the items I've added as I have no means to differentiate between them.


    The names, including definition name are all "apiitem" and the getTypeID are all the same at 890. =O


    Edit: I can't even hack around it using different max stack sizes as the event.getItem().getMaxStacksize() for all custom items return 1 even though that's not the set max stack size.

    Hmm just going to try this so don't know if it will work yet. . .



    Java
    //hack doesnt work
    //add 1 emerald with no animation
    inventory.insertNewCustomItem(EMERALD, 0, 1);
    //add 0 emeralds but with animation
    inventory.insertNewCustomItem(EMERALD, 0, 0, 0, Inventory.SlotType.Inventory);

    Sorry @red51 yet another message!


    The method:

    Java
    //method 1
    inventory.insertNewCustomItem(EMERALD, 0, 1);


    Work well for adding new custom items to the inventory (in the first available free slot or stacks if item already exists), however, it does not generate the nice inventory addition notification/animation on the lower right hand corner of the screen.



    The following method does generate a nice notification/animation on the lower right hand corner;



    Java
    //method 2
    inventory.insertNewCustomItem(EMERALD, 0, 1, 0, Inventory.SlotType.Inventory);


    However, the above second method requires that I specify a slot (in my examples case - slot 0) the result of which is the item already occupying the slot(0) gets deleted.


    Now I have tried writing some code to analyse the inventory (so I can use method 2) so I can allocate the correct slot (or stack if needed), however using item.getName() I simply get "apiitem" which isn't going to work.


    The ideal solution would be a notification/animation on method 1.


    Or, a new method like method 1;



    Java
    //method 3
    inventory.insertNewCustomItemWithGuiFeedback(EMERALD, 0, 1);




    :D

    Just to confirm, I tried again on a clean server restart (i.e. no reloadplugins command used). I found one Emerald then stopped (I actually went away and grabbed a coffee) I came back and continued mining and found a second Emerald. Although (correctly) I had one more added to my inventory the lower right hand corner notification said I had found 2x Emerald.


    This is the code snippet I am using to add custom item to inventory:


    Java
    Inventory inventory = player.getInventory();
    inventory.insertNewCustomItem(EMERALD, 1, 1, 1,
    Inventory.SlotType.Inventory);

    Hi @red51 I'm using this code to add gems to a players inventory:



    Java
    Inventory inventory = player.getInventory();
    inventory.insertNewCustomItem(EMERALD, 1, 1, 1,
    Inventory.SlotType.Inventory);

    When a player finds a gemstone and they currently do not have one in their inventory the notification shows correct ( 1x Emerald * )



    However, the second one found shows up at ( 2x Emerald * ) even though only one is added to the inventory (meaning they now have 2).


    A new hotfix will be available tomorrow


    Thanks for the heads up! Yep one gemstone down, 9 more to go. :thumbsup:



    People get minerals on your server?


    Yep, there have been gemstones for quite some time now but they were instantly sold. Red's new update makes it way more fun now as they go into your inventory instead. :saint:

    Hi @red51


    Custom items are bloody awesome addition <3 thank you! I'm sure the folk on Medieval Realms are going to love getting their gemstones in their inventory instead of instantly being converted to cash.


    One problem though, the stacks spit fine, but when you try to stack them back up they won't stack until you close the inventory down and re-open up. A wee bug I think?