ScriptCraft

ScriptCraft

14.6k Downloads

Can I make my mod with scripcraft?

Noxid86 opened this issue ยท 2 comments

commented

So I have wanted to make a mod for quite a while now but do not speak Java. This last year I have been learning JavaScript and node so I and really excited about this but am having trouble figuring out the limitations. The mod that I would like to make, or at least the simplest form of it looks like this...

Building a special bed spawns an NPC called a citizen. That NPC can be assigned a roll like Miner lumberjack or Courier. That NPC will then perform that task as long as it has bread in its inventory.

There are a ton of other features that would love to add but I am trying to get a handle on the limitations of scripcraft

So I now know that I cannot add blocks as that requires modifying the client, but I wonder how hard it is to only learn enough Java to add my custom blocks in a different package and then script off of those blocks with scripcraft?

I am imagining that NPC Behavior would be mimicked with the Drone. For example, if I can script an NPC to walk to a given location I can then spawn a drone on top of that NPC and have it checked blocks and break them according to the miner script. Does scripcraft have access to NPC spawning and behaviors?

commented

do not speak Java | kek

Yes, you can reuse Vanilla Blocks and let special things happen when players (try to) break/interact with them. Making Player/Mob NPC's and then letting them do Stuff should also be possible, but pretty hard from scratch.

commented

You are correct about Scriptcraft beeing server-side only.

but I wonder how hard it is to only learn enough Java to add my custom blocks in a different package and then script off of those blocks with scripcraft?

I don't know enough about java client side modding to help you, but from my understanding it's usually done with forge (or whatever the latest flavour is), which requires a forge server (as the modification needs to be known both server-side and client-side). And a forge server is mostly incompatible with a spigot server, so you won't be able to use Scriptcraft. (I know there is Sponge to do forge + spigot at the same time, but I haven't personally tried it)

In short, I wouldn't recommend it :)

Does scripcraft have access to NPC spawning and behaviors?

Scriptcraft have full access to spigot API (and minecraft server API, but it's much less usable), so technically yes. However the main features (imo) of Scriptcraft are :

  • Fast code/execute/feedback loop (because you don't have to recompile + reload your plugin + possibly restart server, but simply save your js file)
  • Easy exploration of complex objects by using the console + tab completion to find all available methods/parameters : you don't have to dig through multiples javadoc file, if you are looking to change simple things (changing an entity's health, making it invulnerable ...)
  • It's JS, so widely known, and you can plug cool stuff around it, like Blockly to program visually for young people (which is awesome to do)
  • Nice abstractions in JS so the development is much easier. For example, the drone (and blocks) module allow one to put blocks in the world without ever wondering about getting the correct Material with the proper (meta)data, making sure you have the right Java type, and an easy way to move your constructions around.

In your case, since there is no abstraction for NPC, you would need to develop your own, which means using (sometimes) directly Java packages, and does require at least some understanding of Java (mainly the type system). It's definitively not impossible, but it's relatively harder than regular JS programmation.