-
-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nether portals #1597
Nether portals #1597
Conversation
Currently defaulted on for testing. Ultimately, the game mode config can decide if the vanilla portal is used or not. Note that the end platform is just a set of obsidian blocks.
Nice, that was fast... But not working well with [spawn_here] signs in any dimension. It does not look right, that the first check location is the spawn point. I think it should be the location of the portal if this feature is enabled. Is there a way how to deal with 128 portal check radius? |
I had some free time. 😄
Aha, yes. I'll look at that.
|
Hmm, Spigot Java docs lists search radius and create radius for player portal event. |
That's useful! Hmm, in that case, the radius should be set if the location is close to the edge of the island protected zone, reducing to 1 if the portal is on the edge. Agree? |
I was thinking about it, and I think yes. But I agree, that if someone places a portal on the border with another island, it should do not search inside other player islands. |
BONNe reports:
If player uses End Exit portal, then he is not teleported back to his island. SafeSpotTeleport does not except PortalBlocks, so players can easilly be teleported inside portal, and back to overworld (if that would be fixed). |
It does not look like it was a bento box fault... I created a listener that should fix it and fire the event manually: However, I notice, that you used a movement event in detecting when a player enters into portal if nether and the end is disabled into server settings. I suggest using the same event - |
I made the change you suggested @BONNe . I need to test it with a system with nether and end disabled to confirm. |
The only thing that I currently do not like with this implementation, is that the spawn-point will be always chosen over the actual portal location. I would prefer it to be toggleable, or switched in the opposite order. As with the end, it is just not usable, due to the fact, that in the end, the spawn point will create an obsidian platform ... and it will always happen in the middle of the island without an ability to change it at all. Also, I would prefer to split these even catchers in 2 parts -> overworld-nether and nether-overworld.... it would improve readibility. |
Unfortunately, PlayerPortalEvent and EntityPortalEvent are not fraternal classes so there's no way to apply code to both except via this abstraction class. Tests fail.
I rewrote the code to be more generic and remove duplication. I also enabled entity teleporting. Notes:
Please clone it and try it. |
} | ||
// Custom portals | ||
e.setCancelled(true); | ||
// If this is from the island nether or end, then go to the same vector, otherwise try island home location |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment for the code below is telling different than the actual code. One of them is wrong.
The end portal platform generation is not working properly. It should not happen, and for the end, it should normalize portal location, f.e. always generate portal in the middle block of THE END enter portal. It looks like the latest changes with code refactoring break the Entities that enter the end portal, are teleported to the nether world :D It does not matter if it is an exit or enters portal. If BentoBox end islands are disabled, end portal handling should use default behavior, with no custom location calculations. Update: Update 2: |
Identify the teleport cause manually because there is no method. Teleports to the End happen but seem to be slightly different locations. Some entities will disappear, others will stick around. I don't know why.
I fixed some of the things you mentioned. I'll work on the others tomorrow. |
Okay, here's the status:
This is fixed. To get the location and make it the same every time I had to search for the portal blocks and then locate the corner block. I arbitrarily chose one of the corners as the reference point for speed. The next challenge was that players could "punch" through the portal either by dropping through the portal or rising up fast before the event fired, so I had to search in the y axis as well sometimes, so that the search became more complex. Anyway. it works. The server generates the obsidian platform based on the location given and it's the same no matter where you drop in the end portal or how fast you go through it.
No, actually this is because by disabling the nether or end you are switching off the vanilla teleporting behavior, so it does not teleport you. The option to use the vanilla teleporting approach is only compatible if the nether and end are enabled at the server level. Essentially, this PR is stepping aside and letting the server do the work of teleporting, generating the portals, searching for space, etc. etc. and if the configs switch off the nether or end then that codes does not run.
This was because the EntityTeleportEvent made me think it only applied to nether portals because it doesn't have a getCause() method, which is available in the PlayerTeleportEvent. As a result I have to search around the entity's location for a portal block and deduce what type of portal it entered. I only search 1 block in every direction and stop as soon as it's found for speed. The location given in the event is not a portal block so the search is necessary.
If end islands are disabled and there is a common end world then the teleport should just go to the world spawn location. Where else should it go?
The obsidian platform is made by the server if you use vanilla teleporting. Tell me more about this issue so I understand what should be done here.
Done. Anything can go through - however, weirdly, and I don't know why, some entities never pop out on the other side:
Entities that do:
I haven't tried everything, but I don't understand why they don't transfer. I'm only testing with one player, so maybe they get instantly removed... |
About end portal: About entities: Thanks for the progress. |
I can confirm, that the vanilla END spawn point is always at 100, 50, 0 unless someone changes them manually. So it means that we can use that location if end islands are disabled. It is very much hard coded thing. And about entities: And from end to overworld, players and entities appear in the default world spawn point. But it is a bug in a spigot, that they do not trigger events. Update: |
Right now, the teleportation code will teleport to the world spawn point. What that means is that the game modes should set the default spawn point for the the end to 100, 50, 0 if a new world is created. Like this for BSkyBlock:
I'll look at the entities right now. |
That should be noted in FAQ when you merge this into the main branch. |
@BONNe I actually managed to set the default spawn point in BentoBox so it doesn't need to be in the addons. It checks if there's a default spawn point set and changes it to what you said. It results in the obsidian platform being below the end island, which I assume is where it is supposed to be. |
I think this is implemented, however it could be awesome to support also #1632 as it is a similar usage. |
https://github.com/BentoBoxWorld/BentoBox.git into nether_portals Conflicts: src/test/java/world/bentobox/bentobox/listeners/PortalTeleportationListenerTest.java
I'm going to merge this so we can get some time using it before release. |
Closes #1595 when merged.
This adds two settings to WorldSettings (current set to true by default for testing), that will enable the use of default portals in game modes via a config.yml setting.
When a player goes through a nether portal in the overworld, they will be sent to the nether at the same coordinates as where they left. Normal vanilla rules apply as to where the portal is made but it's usually that location and will just overwrite any blocks that are currently in that location.
For the end portal - when players go through the end portal, the server will generate an obsidian platform for them. It will overwrite any blocks in that location.
I'm happy to include this option, but it has some known issues listed below.
Note that the current implementation in BentoBox was designed to avoid the endless obsidian exploit. Even if the obsidian blocks are valued at 0 by the level addon they are very good for creeper protection and can be given to others for portal creation or used to create massive portals for gold farming.
The current design does send players to an active portal if one exists in the nether. So that mechanic is the same as vanilla. The rest of the operations are essentially the same as vanilla except that the obsidian blocks are not made.
Known issues/exploits with this option