walterhiggins / ScriptCraft

Write Minecraft Plugins in JavaScript.
MIT License
1.84k stars 378 forks source link

how do you register a item #407

Closed AlgoRhythm-Technologies closed 5 years ago

AlgoRhythm-Technologies commented 5 years ago

I checked the book and read it thoroughly the book never said how to register an item. yes, there were the how to make an EnderBow chapter, but it never said how to register an item. It just registered a recipe that made a bow that was enchanted. what I want to do is make an item that has never existed in the game before like an emerald sword or something.

jwulf commented 5 years ago

You cannot make primitives that do not already exist in the game, only instances of things that exist, or new things that are novel combinations of already-existing primitives.

AlgoRhythm-Technologies commented 5 years ago

so would I have to make a duplicate of an already existing item then change the texture? Is the there some plugin that runs mods?

jwulf commented 5 years ago

You might be able to do it by examining the source code of this Bukkit mod: https://github.com/knokko/Custom-Items and reimplementing it in Scriptcraft.

Or simply by installing the mod: https://dev.bukkit.org/projects/custom-items-and-textures and using as a server admin.

If you want to script that plugin programatically from Scriptcraft, you can get an idea from here of how to interact with a loaded plugin from Scriptcraft, both directly through the plugin's API, and via invoking its commands for things that it doesn't publicly expose as an API: https://github.com/Magikcraft/magikcraft-core/blob/master/multiverse/multiverse-bukkit.ts

AlgoRhythm-Technologies commented 5 years ago

I noticed that mod earlier, but could not find the source code.