Add sublevel.getForces()#9
Conversation
| * Track "force requests" for sublevels because Sable be like "waaah no you cant request forces mid-tick" | ||
| */ | ||
| public class Physicker { | ||
| private static Map<ResourceLocation, Object> LOCKS = new HashMap(); |
There was a problem hiding this comment.
This could be a ConcurrentHashMap and thus locks and syncronization do not need to be explicitly handled by this class
There was a problem hiding this comment.
I can make it a ConcurrentHashMap but getLock is synchronized to prevent an evil style "race condition" where you can potentially create 2 seperate locks, but only one is stored in the Map, leaving a computer to wait for the (currently 2 ticks) lock timeout. (and from my understanding, a ConcurrentHashMap wouldn't change that?)
Or I just straight up don't understand where you want to go with this, please elaborate 🥺
There was a problem hiding this comment.
It took a minute but I think I found somewhat decent way to outsource concurrency back to Java, what do you think?
|
I've been informed that Correction: not nil. But the other forces disappear, which may as well be a nil... |
Closes #7
Adds
sublevel.getForces()Format:
{ "sable:force_name": { { "position": --[ vector ]--, "force": --[ vector ]-- } } }or just straight up null if something goes horribly wrong.
The cody is a bit funky but it should be fine, works on my machine! :p
(I didn't increment any versions)