xsun2001 / Applied-Energistics-2-Unofficial

Unofficial AE2 for 1.7.10 which is still supported,which is like the extraterrestrial technology.
Other
28 stars 13 forks source link

Add events in Formation/Anihillation planes #4

Closed Eufranio closed 7 years ago

Eufranio commented 7 years ago

They currently bypass anything that listens to the break/place event.

xsun2001 commented 7 years ago

I think that enderio update their pipe network every server tick, no by listening the break event.Formation/Anihillation planes do their work too fast to let enderio update network. I will do more test on my env. If firing those events can get more adventages, such as peotect the personal area, I will add it. But recently when I try to reproduce that dupe bug, it disappare. For detail, the Formation planes will not place the block any more. I dont know weather it is a another bug that I made or I set up the network incorrectly. I will do more work on it when I am free. I am sorry for ignoring the issue2 for a mouth and I am sorry for my English again.

I have pressed the wrong button.....

Eufranio commented 7 years ago

I'm not talking about EnderIO, I'm talking about any modern well-coded mod (that listens for events).

xsun2001 commented 7 years ago

eh......You.may be right. So should we just add the code for events, or use FakePlayer instead?

Eufranio commented 7 years ago

If you can, fake players ofc. Just caution with the amount of checks, since Formation/Anihillation planes works quickly, a high spam of permission checks would overhead the server/permission system. I suggest implement a cache for the fake player checks.

xsun2001 commented 7 years ago

Do you mean we should use cache for the blocks to check if it can be broken? Or the cache for FakePlayer?

Eufranio commented 7 years ago

Cache for the fake player permission checks, like a interval between each check. Let's say we have 30 Formation Planes loaded: they will be each tick (or 2, I'm unsure) trying to place a block, and AE2 would be requesting the permission check. The permission plugin would have to proccess EACH check, EACH tick, it could overhead.

I suggest you checking maybe 1 time per 20 ticks? If the first check is valid and true (if so the fake player can place the blocks), cache that check and always return true for the other 19 ticks. Once completed, make a new check, and etc.

xsun2001 commented 7 years ago

I think I have done this job. You can get the newest build from appveyor and check if you can stop the planes by cancelling its events. The fake player's name is '[AE2Player]'. I only added the cache for Annihilation Plane because another plane is not tickable, and it usually not be used very quickly. @Eufranio Thanks for report!

EDIT:If you find some problem with the events, such as it cannot prevent the planes working, you can open a new issue.