-
Notifications
You must be signed in to change notification settings - Fork 2
Fixed Antigravity Bubbles #14
base: master
Are you sure you want to change the base?
Conversation
src/main/java/me/profelements/dynatech/items/electric/AntigravityBubble.java
Outdated
Show resolved
Hide resolved
src/main/java/me/profelements/dynatech/tasks/AntigravityBubbleTask.java
Outdated
Show resolved
Hide resolved
src/main/java/me/profelements/dynatech/items/electric/AntigravityBubble.java
Show resolved
Hide resolved
src/main/java/me/profelements/dynatech/items/electric/AntigravityBubble.java
Show resolved
Hide resolved
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. |
There was a problem hiding this 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!
src/main/java/me/profelements/dynatech/items/electric/AntigravityBubble.java
Outdated
Show resolved
Hide resolved
src/main/java/me/profelements/dynatech/items/electric/AntigravityBubble.java
Outdated
Show resolved
Hide resolved
} | ||
} | ||
} | ||
|
||
private void checkPlayer(UUID u) { |
There was a problem hiding this comment.
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
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). |
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!