Jump to content

Registering objects during runtime?


LousyLynx

Recommended Posts

This isn't possible right now, and most likely never will be, due to some restraints in the Minecraft code base.

 

Why do you want to register blocks at runtime?

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Runtime is not what you defined it to be.

http://stackoverflow.com/questions/3900549/what-is-runtime

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Well, I was thinking that it might open up possibility. Say we have one mod on the client, and the same mod on the server. Say this mod allowed custom "mods" that are sent over to the player when they join. Then servers could have entire modpacks running on just one mod on the client, and the player would be able to essentially switch modpacks without even having to restart the client. That is just one theoretical example. Is there anything that I don't know that could make this example invalid :P?

Link to comment
Share on other sites

By the way... If registering objects after the game is "not possible", how come I have done it here: https://github.com/LousyLynx/On-The-Fly. Video proof:

 

 

It may be just for a block, but I am sure it will work the same way with items... Entities I am not so sure about. When I said I wanted to make an API for this, I did not mean that I would load and unload entire mods. And if you thought that is what I mean, I guess that was a mistake on my part. I meant that mods would be built around this API. The API would fire the events, register blocks, etc.

 

Currently, the ID tables are stored with the world, so if you log out and back in, you won't get the block, but that is not something that should be built with my API(Or maybe I will make it an optional side part).

 

The code for the API: https://github.com/LousyLynx/On-The-Fly

Link to comment
Share on other sites

Although all of those things sound like things that could be fixed with a reasonable amount of time. Get the models to load at the beginning, and load those, have the server send the ID's to the client(Assuming that we could set the ID to a specific value), make a method to somehow calculate the ID for caches. Correct me if I am wrong, but couldn't pretty much any error produced be fixed?

Link to comment
Share on other sites

I guess that loading models at startup is kind of defeating the purpose. I will think of something.

 

Otherwise, thank you for your help. Now that I know I can do what I want to, I am quite happy.

 

By the way, I have a couple of ideas that could take use of this concept, that could get really popular. I guess we will just have to wait and see ;D

 

 

Link to comment
Share on other sites

I guess that loading models at startup is kind of defeating the purpose. I will think of something.

 

Otherwise, thank you for your help. Now that I know I can do what I want to, I am quite happy.

 

By the way, I have a couple of ideas that could take use of this concept, that could get really popular. I guess we will just have to wait and see ;D

There is one huge problem with this that I have. The blocks maybe started at the server, then a packet gets sent to the client and adds a block, ok ok. No problems yet. What if the block is supposed to have a custom function, that is where it gets iffy. How would you send the extra information? This is in case of your custom "mods".

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

If the blocks are purely decorative and the player just gets to assign a texture, then it can probably be done with a non-ticking TileEntity and a (very complicated) baked model or IStateMapper class.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I guess that loading models at startup is kind of defeating the purpose. I will think of something.

 

Otherwise, thank you for your help. Now that I know I can do what I want to, I am quite happy.

 

By the way, I have a couple of ideas that could take use of this concept, that could get really popular. I guess we will just have to wait and see ;D

There is one huge problem with this that I have. The blocks maybe started at the server, then a packet gets sent to the client and adds a block, ok ok. No problems yet. What if the block is supposed to have a custom function, that is where it gets iffy. How would you send the extra information? This is in case of your custom "mods".

 

What do you mean "What if the block is supposed to have a custom function"? If you are talking about the idea where the server could send the client information(1: you quoted the wrong message :P), I am not sure about how I would do that. I will get there when I get there, but as of now, I want to make the api.

Link to comment
Share on other sites

What do you mean "What if the block is supposed to have a custom function"?

 

Oh, anything from "be a chest" to "be a furnace" to "be gravel" to "be a liquid."  Stuff like that.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.