GlowstoneMC / Glowstone

A fast, customizable and compatible open source server for Minecraft: Java Edition
https://glowstone.net
Other
1.88k stars 271 forks source link

Portal Mechanics (Closes #130) #1024

Open heisluft opened 5 years ago

heisluft commented 5 years ago

This PR implements the creation of nether portals and implements the actual travelling to the nether via portal as well as generating portals in the nether. It also implements any Bukkit / Spigot / PaperSpigot Event related to Portals and their mechanics. This will fix one of Glowstone´s oldest issues while greatly expanding it´s functionality as a vanilla server.

What is implemented:

heisluft commented 5 years ago

This is where I'm at now State of development

VaiTon commented 5 years ago

This is where I'm at now State of development

Good job man!

heisluft commented 5 years ago

Next sneak peak (chance of zombie pigman spawning increased by 1000% to shorten video length :))

heisluft commented 5 years ago

My take on this is that each GlowWorld registers one TravelAgentImpl which then deals with portal implementation. This also would allow us to handle Portal gen in the overworld - as Overworlds need to register both a Nether and an EndTravelAgent. getTravelAgent() in Entity/PlayerPortalEvent is not strictly required to return a consistent travelAgent but two implementations would just increase complexity (as the actual porting method is the same in both nether and end portals). Of course we could define a shared superclass but managing 3 classes + different handlers in the World class looks cumbersome to me compared to one, capable-of-everything class which can be referred to by each world in the same manner. Let me know if I missed something important in my logic

mastercoms commented 5 years ago

@heisluft Is this still WIP or ready for review?

heisluft commented 5 years ago

I’m sorry, I kind of lost track of this PR. After loosing some of my work to faulty git usage of mine I lost motivation to actually finish this PR. There are still features to implement concerning the actual travel to the nether and I fear this PR is getting too big if I tried to mimic exact vanilla behavior.

Don’t get me wrong though, I will continue my work on this today in order to get it working, although it will be more of a quick and dirty hack as I would have to make changes to GlowKit and seemingly unrelated code making this PR too confusing and difficult to review.

I look, however, into making a follow-up PR to GlowKit and GlowStone fixing the shortcomings of my hacky implementation.

TL;DR: No, this PR is not yet ready for review, but I continue contributing and will request review as soon as I’m done

heisluft commented 5 years ago

Next (And probably last sneak peak). I decided not to check wheter the bounding box of the portal block intersects the one of the player for now, so players get Teleported even if they technically are not standing in a portal. This has no other reason than not having enough time today.

EDIT: Done

heisluft commented 5 years ago

Finished Work on this PR, ready for review

aramperes commented 5 years ago

This is some great work! I was hoping for more unit tests though, or at least setting up the ground work by separating the calculations into readable units.

mastercoms commented 3 years ago

@aramperes What's left for this?