Jump to content

[1.9] Add custom teleporter registration to DimensionManager


Recommended Posts


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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now

  • Create New...

Important Information

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