GallowsDove / FoxyMachines

A Foxy Add-on.
GNU General Public License v3.0
4 stars 11 forks source link

Ghost blocks can be pushed away by explosions #53

Open ybw0014 opened 2 years ago

ybw0014 commented 2 years ago

Description (Required)

Ghost blocks are falling blocks, and they can be pushed away by explosions. When they hit the ground, they turn into real blocks.

This is an issue forwarded from our fork (https://github.com/SlimefunGuguProject/FoxyMachines/issues/6)

Steps to reproduce the Issue (Required)

Place a ghost block, and push it with any kind of explosion.
The ghost block hits the ground and turn into real blocks.

Expected behavior (Required)

Explosions will not push ghost blocks.

Server Log / Error Report

Environment (Required)

GallowsDove commented 2 years ago

I was already aware of this issue, however there is no event in Bukkit that can currently help solve this, at least as far as I know.

JasperChaseTOQ commented 2 years ago

i believe this is fixed i havent actually checked but i do know that ghost blocks load differently then they used too and more seamlessly into the block itself

Noobymen commented 1 year ago

the issue that i posted about is still not fixed in the latest foxymachines build and maybe i got something to add it looks like when ever a explosion happen close to a ghost block it teleports randomly in the air or something but it kinda looks like the same thing that the dragon egg is doing when you hit it in survival that it randomly teleports somewhere maybe if this is disabled or something this kinda event then the ghost block issue will also be fixed just something i wanted to say but i dont know if this works

GallowsDove commented 1 year ago

As I've said, I don't know how to fix this without a big performance impact, which I'd argue is does more harm than this harmless bug. Unless someone else is able to come up with a solution, or there are changes in bukkit, there is nothing I can do.

JustAHuman-xD commented 1 year ago

Can you use the entityexplosionevent? Get the entities it's damaging and if it is a ghost block prevent the damage. I do something similar in spirits unchained to stop some of the traits from damaging the player who used them and there is no real performance impact.

JustAHuman-xD commented 1 year ago

Just took a look, I use entitydamageevent and then check if the attacker has a key relating to the entity attacked. But I believe you could check if the entity from the event is a ghost block and then if it is, get the attacker and check if it's an instance of tnt or the other methods or creating explosions, or maybe another way entirely to check if it is explosion damage. And if so then cancel the event.

JustAHuman-xD commented 1 year ago

Looked into it a tad more and it looks like you could listen to the EntityDamageEvent, first I would check if the damage cause is either BlockExplosion, or EntityExplosion, if it is then check if the event's entity is a ghost block, if it is, cancel.

GallowsDove commented 1 year ago

Haven't thought about it since they are invincible, but that might work. Will look into it later.

GallowsDove commented 1 year ago

Still doesn't cancel the knockback, so unfortunately it doesn't work

JustAHuman-xD commented 1 year ago

Shucks

Noobymen commented 1 year ago

So this mean's that there is no possible way to fix this problem for ever?

JustAHuman-xD commented 1 year ago

Well no, there might be some way, just not one that we have thought of yet

J3fftw1 commented 1 year ago

You might just need to see if the velocity changes and set it to 0 each time