Example: CustomItemLoader

A big new update is now available, introducing biomes, caves and much more!
Latest hotfix: 0.7.0.3 (2024-02-21)
  • Difficulty: Intermediate


    This plugin enables you to create new custom items (tools or melee weapons) easily. Just place all relevant item files (as well as a "ItemDefinition.txt" file) into a separate folder in the "Items" subfolder. This plugin contains a "baseball bat" example item.

  • Thanks for the example @red51


    It's working fine. Just one thing: I can NOT make a name for my item, when i try to use spaces in the name. Is this intended?
    Oh one more: is there a way to copy the text from the console?

  • Can we get some more documentation so we can add in food items, among other things? I would love to add candy which can be consumed like strawberries, and such. The way I can use these plugins is by reverse-engineering things in template form with seeing a similar pattern, I would use that template to do similar things. I need more documentation to look at so I can make sense of things.


    A list of animations currently in Rising World, and etc. How do we consume the candy, what animation do I use, and etc?

  • Can we get some more documentation so we can add in food items, among other things? I would love to add candy which can be consumed like strawberries, and such. The way I can use these plugins is by reverse-engineering things in template form with seeing a similar pattern, I would use that template to do similar things. I need more documentation to look at so I can make sense of things.


    A list of animations currently in Rising World, and etc. How do we consume the candy, what animation do I use, and etc?

    yes right and how can we add another bow,crossbow or rifle? Maybe new clothes too?

  • It's working fine. Just one thing: I can NOT make a name for my item, when i try to use spaces in the name. Is this intended?

    Yes and no. Basically this is just a limitation of the CustomItemLoader, to keep the code as simple as possible (since the main purpose of this plugin is to serve as an example plugin) ;) But if you create a custom plugin, you can change the name with this function (which supports spaces as well as multiple languages): CustomItem.setLocalizedNames()


    Oh one more: is there a way to copy the text from the console?

    Unfortunately that's not possible, however, if you want to copy the coordinates from the debugitem or debugplayerbody commands, you can just press Return (press Shift+Return to copy the rotation to clipboard) :)


    Can we get some more documentation so we can add in food items, among other things?

    Unfortunately this can't be done with the CustomItemLoader. This plugin only works for very basic tools and weapons. If you want to create food or more complex items, you have to create a new plugin for that. You could use the Backpacks plugin as a reference, since it works in a similar way (instead of opening the backpack, you just have to remove the food item from the inventory, update the health/hunger/thirst of the player and maybe play an eating sound effect).
    You can also check out the documentation, it also contains some example code: https://javadoc.rising-world.n…ts/custom/CustomItem.html


    A list of animations currently in Rising World, and etc. How do we consume the candy, what animation do I use, and etc?

    The CustomItemLoader plugin contains a list of all animations (as a txt file) ;) Alternatively you can find all animations here: https://javadoc.rising-world.n…/api/utils/Animation.html


    yes right and how can we add another bow,crossbow or rifle? Maybe new clothes too?

    Unfortunately clothes cannot be added through the API at the moment, since they would require some additional preparation (you have to set up proper rigging / skin weighting, which would only work if you have access to the player model skeleton)...
    However, if you want to add firearms, you can check out the potato cannon example plugin. Instead of firing a potato, you can use the World.spawnProjectile() method to fire an actual projectile ;)

  • you have to create a new plugin for that. You could use the Backpacks plugin as a reference, since it works in a similar way (instead of opening the backpack, you just have to remove the food item from the inventory, update the health/hunger/thirst of the player and maybe play an eating sound effect).
    You can also check out the documentation, it also contains some example code: javadoc.rising-world.net/net/r…ts/custom/CustomItem.html

    I may struggle horribly with this. When I gain a proper day off I may fiddle with this because I promised one person I'd make a Candy Factory with consumables so I have to see this through. I may have to ask for help though if it pains me to much, but thanks for helping me with what you could.


    Was hoping to use strawberries and corn to make candy, to then consume it, but I guess that may prove to be "difficult", or just "messy". Hopefully I can figure it out later..... :S

    The CustomItemLoader plugin contains a list of all animations (as a txt file)

    I probably should have noticed this earlier. Missing out on the obvious, or something. That should help. Thanks

  • Was hoping to use strawberries and corn to make candy, to then consume it, but I guess that may prove to be "difficult", or just "messy". Hopefully I can figure it out later....

    It's really not that complicated, basically it just requires a few lines of code. If you have any questions, don't hesitate to ask :) I can provide some example code if you want ;)

  • Hi, also ich würde mal um Hilfe bitten :D Ich habe jetzt das Waffen-Modell im Spiel und es ist über eine Werkbank craftbar.
    Die Position in den Händen stimmt auch und die Animationen funktionieren nun auch wunderbar. Über die Code zeilen von der potatogun konnte ich schon Kartoffeln mit veränderten werten sehr schnell schießen aber der Sound hat sich dabei aufgehangen.


    Ich möchte eine Automatik-Schnellfeuerwaffe haben die solange m14 Projektile schießt bis ich die linke Maustaste wieder los lasse (oder im Idealfall das Magazin leer ist) :whistling: . Kannst du mir @red51 oder jemand anderes vielleicht mal bei dem Teil an code helfen? :| Wäre sehr lieb :)

  • @_Joe_: Erstelle am besten einen separaten Thread dazu, weil es hierbei ja um ein eigenständiges Plugin gehen würde welches nicht direkt mit dem CustomItemLoader zusammenhängt ;) Grundsätzlich ist das Animations-Handling momentan etwas eingeschränkt, d.h. für ein durchgehendes Schießen ist momentan nur eine Loop-Animation geeignet (was bei der normalen M14 Animation leider nicht der Fall ist).

  • It's really not that complicated, basically it just requires a few lines of code. If you have any questions, don't hesitate to ask :) I can provide some example code if you want ;)

    Hi Red.....


    As I have just started work on my Prehistoric Rising World mod and I was wondering if you could show the code for using strawberries and corn to make Candy and then consume it.


    I could use the example code for things i have planned myself.

  • Hello all, new to all of this. trying to add a custom item sword. in the example ItemDefinitions file Hitdef: club. is there anywhere to view a list of hit definitions? Also is it possible to change an objects texture from one texture to another after the object is loaded? thanks for any help. The most ive coded is a few simple batch files so trying to get info before i do anything.

  • is there anywhere to view a list of hit definitions?

    Basically you can just enter the name of every melee weapon there. Alternatively you can find all hit definitions in the "commons.jar" file (in the data folder in the game directory). Just open it with a zip program, go to "commons/definitions" and open the "definitions.db" with an SQL editor. There is a table called "PickingInfo" which contains the information you're looking for ;)


    Also is it possible to change an objects texture from one texture to another after the object is loaded?

    If you want multiple versions of an item (e.g. a red sword, a blue sword, a green sword etc), you could just add different "variations": https://javadoc.rising-world.n…i.utils.ImageInformation-


    However, if you want to replace the current texture, you could try to use the setModel() function. Just remember to pass the original ModelInformation instance to that method again. I haven't tested this method yet, but basically it should work :monocle:

  • Basically you can just enter the name of every melee weapon there. Alternatively you can find all hit definitions in the "commons.jar" file (in the data folder in the game directory). Just open it with a zip program, go to "commons/definitions" and open the "definitions.db" with an SQL editor. There is a table called "PickingInfo" which contains the information you're looking for ;)


    If you want multiple versions of an item (e.g. a red sword, a blue sword, a green sword etc), you could just add different "variations": https://javadoc.rising-world.n…i.utils.ImageInformation-


    However, if you want to replace the current texture, you could try to use the setModel() function. Just remember to pass the original ModelInformation instance to that method again. I haven't tested this method yet, but basically it should work :monocle:

    Thank you for the reply. the setmodel() is what i am going to try as i need a weapon to change color while in hand when enemies are around. i needed the Swords tried it as hitdef: swords. got to looking around and noticed there were 10 differnt swords. set it to hitdef:sword4. will let you know how the setModel() works

  • i hope someone can explain this to me, i'm new to java in general and i have always learned by doing. i was looking threw the code learning how things work. my question has to do with how the code pulls the hitdef from the pickingorder.I was trying to create a masons hammer( like the sledgehammer) but with one hit to remove and retrieve the blocks. "Definitions.HitDamageDefinition damageDef = Definitions.getHitDamageDefinition(itemDef.hitDefinition);" i've looked all over to see how that line functions but cant figure it out. does the Definitions.getHitDamageDefinition(itemDef.hitDefinition) use the entire field(item_damage,player_damage) for an item and multiply that by the multiplier for each one or am i missing how it is calling just one damage(player_damage)? i see

    "getPlayerDamage()" in the api and i,m guessing that would call only player_damage. i have a few other items i would like to create (weed wacker with more range for example) but i feel i should start here. i've managed to figure out the workings of everything else just stumped on this one. hope i made sense with my question.

  • Unfortunately the behaviour of the sledgehammer (and crowbar) isn't determined by the HitDamageDefinition atm :| Currently the ability to remove blocks without destroying them is hard-coded. This will change in the new version though. Currently the only workaround would be to emulate this behaviour by modifying the world (and spawning the appropriate block) manually via API, but that's a bit tricky.


    However, the ability to cut grass is already exposed to the hit definition, so it should be possible to create a more powerful weed whacker, for example ;)

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!