Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Fixed Antigravity Bubbles #14

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Fhoz
Copy link

@Fhoz Fhoz commented Mar 31, 2022

After a week of work, I finally managed to fix antigravity bubbles.

Current problem with them:
Each bubble checks what entities are in it's range on their own and they don't do it fully synchronized, due to this you are unable to fly if you have 2 antigravity bubbles out of each other's range.

How I fixed it:
Mostly all the antigravity bubbles do now for giving players flight-side is sending their block location to a task. This task is a SyncRepeatingTask from Bukkit that now gets executed every 60 ticks or 3 seconds (change this if it's too quick), every bubble location is stored in this class and deleted when the block is removed and every 3 seconds it will check the entities in a range for all the bubble locations. Doing this makes checking entities to give flight synchronized and actually function.

I do not know if my fix is proper coding, I learned Java on the go here, but at least they work now. Have fun!

@Fhoz Fhoz marked this pull request as draft April 1, 2022 12:29
@Fhoz Fhoz marked this pull request as ready for review April 1, 2022 16:48
@Fhoz
Copy link
Author

Fhoz commented Apr 1, 2022

Hey @Sefiraat , I did not know blocks could share variables (I didn't know what static variables did). I have applied your feedback. I got rid of the AntigravityBubbleTask and do everything in the AntigravityBubble itself now. I tested it with 3 Minecraft accounts (I'm never going to financially recover from this) and it all seems to work perfectly.

@Fhoz Fhoz requested a review from Sefiraat April 1, 2022 16:54
Copy link

@Auxority Auxority left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it, and it works. Great!

}
}
}

private void checkPlayer(UUID u) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ill look at this method when I'm back at my PC tomorrow and also give this a good general test

@Fhoz Fhoz requested a review from Sefiraat April 1, 2022 18:10
@Fhoz
Copy link
Author

Fhoz commented Apr 1, 2022

The energy consumption works properly now, I implemented the rest and everything seems to work perfectly (tested with 2 players in one bubble, 1 in another further away).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants