Posts by yahwho

The official Rising World Soundtrack is available!
You can also get the Soundtrack on Steam

    Hi, just thought I would mention that the code;


    Java
    event.getPlayer().executeConsoleCommand();


    doesn't work for multiple commands of spawning a skeleton


    For example;


    Java
    event.getPlayer().executeConsoleCommand("spawnnpc pig");
    event.getPlayer().executeConsoleCommand("spawnnpc cow");


    Will spawn a pig and cow, and ;


    Java
    event.getPlayer().executeConsoleCommand("spawnnpc sheep");
    event.getPlayer().executeConsoleCommand("spawnnpc sheep");


    will spawn two sheep, but;




    Java
    event.getPlayer().executeConsoleCommand("spawnnpc skeleton");
    event.getPlayer().executeConsoleCommand("spawnnpc skeleton");


    Will only spawn one skeleton, a new skeleton can only be spawned with this command after a reboot.

    The latter, it's compiled and moved into the plugin directory.


    The object (j3o file) and texture (dds) both do work as they are linked with a custom object which can hold in the players hand and even drop on floor.


    I'll try again with the world generation of the object today and will update :)

    Sorry I know, me again.


    Code
    event.getPlayer().playSound(SOUND_FILE, true, 1.0f, 1.0f, 10.0f, 100.0f, player.getPosition());

    Is there a way to change the volume of a sound after the sound loop has been created?

    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);