Jump to content

Should I do mymod as a coremod or not


Perdog

Recommended Posts

Hey guys,

 

Basically I just need help figuring out if a coremod is necessary. In the mod, I need my own version of a chunk, and so I have 2 options of how I could approach the problem.

 

Option A

The way I was doing it when it was a plugin for bukkit. Because bukkit was server sided, my only option was to create my own class.

 

When a chunk was loaded for the first time, I'd grab the info from the chunk that I needed to 'link' my class with it (The X/Z/world values) and then add my class into a hashmap that was keyed with a string like so: "world:x:z". From then on, when I needed my class, I'd just search the hashmap with the info from the chunk a player was in.

 

I could easily do this again, or I could do...

 

Option B

In which I use ASM to insert the new variables that I want into the chunk class.

 

Option B seems like it would make things easier and reduce the mods impact (Because I wouldn't be storing a bunch of classes), but I don't know much about coremods, so I come to you guys for an opinion.

 

Some additional info:

  • The world is contained. The players can't just run around opening up infinite amounts of chunks, so the hashmap won't grow to an absurd size.
  • I only need to add 3 or 4 variables, and a few methods to manipulate them.
  • If done with option A, the hashmap saves to a new file on the server. This wouldn't be needed with option B as it'll be saved by minecraft itself in the region files.

 

So, what is the best way to deal with it?  Is this a good enough reason to modify a base class, or should I keep doing it my old way?

 

Thank in advance,

    Perdog

Link to comment
Share on other sites

The general recommendation is that if it can be done without a coremod, do so. This is because coremods can be very error prone and make it hard to debug and can lead to very confusing error reports. Plus coremods are really hard to make.

 

That's what I was starting to think after all the stuff I had read on them. Everyone seems to advice steering away from the whole idea.

Thank you!

 

Do option A. There are easy ways to do this. Use WorldSavedData and ChunkEvent, you wouldn't need your hashmap.

Coremod would only bring world data corruption for no obvious advantages.

 

How would I use 1 of those 2 events in place of the hashmap? I found the ChunkEvent last night while looking though events but I don't see how that could be used.

Link to comment
Share on other sites

I meant ChunkDataEvent, which give you the chunk NBTTagCompound, thus you can read/write some values to it.

 

Do NBT tags persist though? For some reason I think I read somewhere that added ones aren't saved in the files, or something... Or I could be making that up lol I feel like I've read that before though.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.