BentoBoxWorld / BentoBox

Expandable Minecraft server plugin for island-type games like SkyBlock or AcidIsland.

Home Page:https://bentobox.world

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mobs don't use Nether Portals correctly.

ToucanFacilities opened this issue · comments

Expected behavior

Mobs should just teleport from one linked portal to the other.

Observed/Actual behavior

Instead they seem to only teleport when there is a portal close to the island center and it is 4x5 (default) size. This issue does not seem to effect players, only mobs.

Steps/models to reproduce

When on 1.19 we were using this version:
image
Admins know this change would have done something since it is the only change related to portals.
bf87cca

This video is on 1.20.1 and shows the issue:
https://youtu.be/6zympxUtPmY?feature=shared

BentoBox version

bbox version
[17:11:21 INFO]: Running PAPER 1.20.1.
[17:11:21 INFO]: BentoBox version: 1.24.1
[17:11:21 INFO]: Database: SQLITE
[17:11:21 INFO]: Loaded Game Worlds:
[17:11:21 INFO]: bskyblock_world (BSkyBlock): Overworld, Nether, The End
[17:11:21 INFO]: Loaded Addons:
[17:11:21 INFO]: Bank 1.7.0 (DISABLED)
[17:11:21 INFO]: Biomes 2.1.1 (ENABLED)
[17:11:21 INFO]: Border 4.1.1 (ENABLED)
[17:11:21 INFO]: BSkyBlock 1.16.1 (ENABLED)
[17:11:21 INFO]: Challenges 1.2.0 (ENABLED)
[17:11:21 INFO]: Chat 1.1.4 (ENABLED)
[17:11:21 INFO]: ControlPanel 1.13.0 (ENABLED)
[17:11:21 INFO]: ExtraMobs 1.12 (ENABLED)
[17:11:21 INFO]: Level 2.11.0 (ENABLED)
[17:11:21 INFO]: Limits 1.19.1 (ENABLED)
[17:11:21 INFO]: Visit 1.6.0 (ENABLED)
[17:11:21 INFO]: Warps 1.13.0 (ENABLED)

Plugin list

plugins
[17:12:00 INFO]: Server Plugins (9):
[17:12:00 INFO]: Bukkit Plugins:
[17:12:00 INFO]: - BentoBox, BentoBox-Bank, BentoBox-Biomes, BentoBox-BSkyBlock, BentoBox-Challenges, BentoBox-Level, BentoBox-Limits, BentoBox-Visit, BentoBox-Warps

Other

I will post what I said to the other admins, not sure if it will be useful. But I will just post everything I know about the issue.

image

image

image

image

Few yes/no questions:

  • Is bskyblock_world your default world in server.properties?
  • Is allow-nether enabled in server.properties?
  • Is create-and-link-portals enabled in bskyblock config file?
  1. No it isn't the default world.
  2. Yes it is enabled.
  3. Yes it is enabled.

I think your observed behavior is close to what happens, but not exactly I assume that portal closest to island center in overworld is also a portal closest to world 0,0 coordinate.

What is happening:
In Minecraft nether is 8 times smaller then overworld, but in BentoBox nether has the same coordinate system as overworld.
As we use Minecraft entity teleportation mechanism to link portals (so we would not have to search for them ourself), the calculations for portal location does not exatly match what Mojang written, so the portal search algorithm tends to always pick portal closest to 0:0 due to how match is implemented.
To mitigate the issue we have config option in BentoBox config: safe spot search range.
By changing the value you should be able to force Minecraft finding portal closer to your original position, however overstricting it will lead to creating many unnecessary portals.

The only thing we could do, it to ditch Minecraft teleportation mechanism completely and search/create portals ourself, but I think it would decrease performance

I think your observed behavior is close to what happens, but not exactly I assume that portal closest to island center in overworld is also a portal closest to world 0,0 coordinate.

This could be partially true, however below you can see a screenshot. Portal 1 is the first portal I made, with no other portals on the island. I went through moving the portal until it finally spawned mobs. All of these portals used the exact same Nether Side Portal. So I think it does matter how close to the island center the portal is.

image

Increasing the safe-spot-search-range just made it increase the radius a origin portal can be at (so instead of stopping at portal 9, it would actually go to 1 now). This would be fine, however in the 1.19 version of BentoBox this did not occur, you could have multiple Nether Portals and each one would go to its Overworld counterpart without issue. Now it seems to only want to go to a single portal, the one closest to the island center, which means that in effect, players can only have a single Overworld Portal for mob transportation.

I just went back onto BentoBox version 1.20.0 on the exact same server and everything worked as intended, so it must be an issue with newer versions of BentoBox.

Hmm, portal logic from BentoBox side has not been changed since BentoBox 1.21.1 which was made for 1.19.2 and that was the first version that actually allowed teleport entities between worlds.
As before it was not possible do to it.

Since then, entity teleportation has not been changed. I checked the code.
It means, that something from Mojang's, or Spigot/Paper side has changed.

I will investigate it.

Hmm, portal logic from BentoBox side has not been changed since BentoBox 1.21.1 which was made for 1.19.2 and that was the first version that actually allowed teleport entities between worlds. As before it was not possible do to it.

Since then, entity teleportation has not been changed. I checked the code. It means, that something from Mojang's, or Spigot/Paper side has changed.

I will investigate it.

We have confirmed that it indeeds works before the rework of the portal logic (BentoBox V1.20.0) which is what we were using previously until we updated to most recent. We also tested version BentoBox V1.21.1 and we have confirmed it is broken by this. It is definitely something within the code as we have loaded BentoBox V1.20.0 on our 1.20.1 Server and it works as intended where entities can teleport (nether to overworld).

So we have limited the problems to specifically the ClosestSafeSpotTeleport.

Basically what is occurring is that it is handling all instances are being handled by the Builder, which is basically always going to choose the minimum of the settings provided.

this.range = Math.min(this.plugin.getSettings().getSafeSpotSearchRange(), (int) this.boundingBox.getWidthX() / 2);

As a result, all portals from the nether will always go to this portal, regardless of player or entity location and correspondence to that world. I'm not sure why it also requires for default nether portal sizes but anyway.

I tested this whilst using the different builder SafeSpotTeleport which accurately sends mobs to the "correct" portal and works regardless of portal sizes.

// Teleport to standard nether or end
ClosestSafeSpotTeleport.builder(this.plugin).
entity(event.getEntity()).
location(event.getTo()).
portal().
build();

// Else manually teleport entity
new SafeSpotTeleport.Builder(this.plugin).entity(event.getEntity()).location(event.getTo()).portal().build();

This is definitely something wrong with the processes of "ClosestSafeSpotTeleport" class. Additionally, I'm not sure why a SafeSpotTeleport isn't used here as ClosestSafeSpotTeleport would just break all vanilla portal linking.

I cannot reproduce this issue at all. Entities from the nether go to the correct location every time.
I cannot get a state where entities are stuck in the portal, as shown in the video.

The difference between ClosestSafeSpotTeleporet and SafeSpotTeleport is that the first one searches in a centrical manner from the starting position for a block, while the second one starts always from one corner.

So, which settings else are changed? Is it a vanilla nether or island nether?