Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

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.

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.

  • Author

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.

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

  • Author

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.