Skip to content
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

On teleport: Push entities away instead of removing them #1643

Open
BONNe opened this issue Jan 14, 2021 · 5 comments · May be fixed by #2122
Open

On teleport: Push entities away instead of removing them #1643

BONNe opened this issue Jan 14, 2021 · 5 comments · May be fixed by #2122
Assignees
Labels
Status: Under investigation Investigating the interest and the feasability of the issue. Type: Enhancement Improvement or modification which is usually a new feature.

Comments

@BONNe
Copy link
Member

BONNe commented Jan 14, 2021

Description

Is your feature request related to a problem?

Currently, BentoBox has an annoying feature, which removes entities from the world, if the player teleports to home, and they are too close.
Yes, it is toggleable and there is a whitelist that prevents removing entities with a specific type.
However, I would like to suggest a better solution.

Describe the solution you'd like us to implement.

Instead of removing entities from the world, BentoBox could just push them X blocks away from the player.
This solution would have a force field look.

This would also solve an issue with withers and other entities that are in the whitelist but still instantly kills the player when he teleports back to his island.

Even, if an entity is pushed over the void or pushed outside the island border, it would be a much better solution, than the current one, which just removes the entity from the world.

Additional context

I just really dislike an option, that some plugins can just remove the entity from the world at any cost.

Also, this would be awesome, if the force field effect could be increased/decreased in size. f.e. instead of 5 blocks, you could give some player permission or other ways, and increase it to 10, or someone decrease it to 0 or 1...

@tastybento tastybento added the Type: Enhancement Improvement or modification which is usually a new feature. label Apr 24, 2023
@tastybento
Copy link
Member

@BONNe I just revisited this and think it's a good idea. I was thinking that we'd move each hostile mob a certain distance away from the arrival location. But then I started to have questions -

  1. If there is a block in the way, should we stop moving the mob at that point, e.g., if the player is in a room, all the hostile mobs would stay in the room. Or should we teleport them away x blocks no matter what and if that puts them inside a block, tough luck on them. Right now we remove them, so maybe this isn't an issue.
  2. Could this be exploited? Again, we already remove some mobs, so maybe it won't be any benefit
  3. Move mob in 3 dimensions? E.g., if the mob is above the player, they move up a bit
  4. Could we do this by firing an special arrow at each mob that has zero damage, but high knockback strength and is shot from the player? e.g., using this API (https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/AbstractArrow.html) This could be a quick way to push back mobs from the player easily without having to do a lot of maths.

Thoughts?

@tastybento
Copy link
Member

Also, it looks like the color of an arrow can have an alpha component, so it might be possible to make the arrows invisible.

@tastybento tastybento self-assigned this Apr 25, 2023
@tastybento tastybento added the Status: Under investigation Investigating the interest and the feasability of the issue. label Apr 25, 2023
@BONNe
Copy link
Member Author

BONNe commented Apr 25, 2023

Agree with arrow implementation.
It could be even visible on player teleportation so they could see what is happening (force-field).
It could shoot arrows every second for 2 to 5 sec to all nearby hostile entities.

About exploitation and box situations:
Maybe we need something mixed, if entity is not moved far enough then it removes it. But it would be complicated to do.

@tastybento
Copy link
Member

I ran some experiments. Knock back seems to give damage no matter what. Or maybe it's the speed Im firing. I'm playing with making the arrow give instant health to counteract it but I haven't found a balance yet. I tried to make them invulnerable but then they don't get knocked back. Still trying though!

@tastybento tastybento linked a pull request Apr 26, 2023 that will close this issue
@tastybento
Copy link
Member

I did this using setVelocity() instead of arrows. See PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Under investigation Investigating the interest and the feasability of the issue. Type: Enhancement Improvement or modification which is usually a new feature.
Projects
Status: 👀 In review
Development

Successfully merging a pull request may close this issue.

2 participants