Jump to content

[1.9] Add custom teleporter registration to DimensionManager


Recommended Posts

Posted

Hi,

Currently, while looking through the code, neither vanilla or anything Forge adds takes into account custom dimension teleporters. See net.minecraft.world.WorldServer line 119:

 

this.worldTeleporter = new Teleporter(this); 

 

Whenever I want to teleport an entity, I have to create a new instance of my custom teleporter class. While this works fine, it's not really ideal, because the teleporter instances do not share a cached portal position list. (Thus, everytime something teleports, the teleporter has to search within a wide range of blocks for a matching portal). If Forge added the ability to register Teleporters (in DimensionManager?), then a system could be made in which only 1 teleporter instance is made for a WorldServer of a certain dimension (therefore the teleporter instance would not have to search for a portal everytime, reducing teleport time, which I'm sure everyone can agree is a good thing). At the moment, you can make the cache variable static and do manual removal checks, but I feel an actual alternative is better.

Just a thought - SH

Posted

OR, get this, You could NOT create a NEW instance of your Teleporter every time, and instead use a single instance that you manage for the world. Maybe... Naw that would make to much sense...

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

Yes, you could do that. However, because vanilla teleporter class requires a WorldServer instance in the constructor, it would have to be made either in a method that subscribes to the World.Load event or making a variable in the portal block that gets instated if (teleporter == null). Either way is fine, but I just figured that if Forge spent the time to write all the other dimension stuff, they might as well go the whole way and make things neat.

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.