Jump to content

[1.15.2] How to make a JSON reader


BlockyPenguin

Recommended Posts

Hi! So I'd like to add a new "type" of json file to modid/assets (EDIT: actually modid/data. Sorry). Obviously I know how to create folders and files, but how would I get my mod to read it? I've had a look at IRecipe, but I'm still not 100% sure how it gets called, etc.

Edited by BlockyPenguin

Today (22/10/20) I reached 100 posts!

I'm probably more excited than I should be for something so realistically minor...

Link to comment
Share on other sites

So I've created something that should work, but how exactly do I register it?

EDIT: Looking at other classes, I feel like I'd need to create my own registry. Am I correct?

Edited by BlockyPenguin

Today (22/10/20) I reached 100 posts!

I'm probably more excited than I should be for something so realistically minor...

Link to comment
Share on other sites

5 minutes ago, diesieben07 said:

To register the JsonReloadListener, you simply need to register it as a resource reload listener using addReloadListener.

Sorry if it's obvious, but what class does addReloadListener belong to?

Today (22/10/20) I reached 100 posts!

I'm probably more excited than I should be for something so realistically minor...

Link to comment
Share on other sites

9 minutes ago, diesieben07 said:

IReloadableReloadListener

That class doesn't exist... The closest I found is IReloadableResourceManager, which eclipse can't seem to see any methods in.

image.png.504f3ca80694d84d90534b1be05805ed.png

 

IReloadableResourceManager is an interface, so that would be why. What do I do?

 

EDIT: About the shortcuts, I'll have a look at mine ;)

Edited by BlockyPenguin

Today (22/10/20) I reached 100 posts!

I'm probably more excited than I should be for something so realistically minor...

Link to comment
Share on other sites

So, I've found
Minecraft.getInstance().getResourceManager(),
which returns resourceManager which is an IReloadableResourceManager. However,it returns it as an IResourceManager, which does not have the addReloadListener method. I've also found
MinecraftServer.getResourceManager(),
which does return an IReloadableResourceManager. I can get it using
Minecraft.getInstance().getIntegratedServer().getResourceManager().
Would this work on singleplayer though?

Edited by BlockyPenguin

Today (22/10/20) I reached 100 posts!

I'm probably more excited than I should be for something so realistically minor...

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.