mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-16 13:10:31 +00:00
2c59b9122b
We now call getLevel() when attaching the peripheral, so need the position to be available immediately. Fixes #1274. I /think/ the entity should always be present, as peripherals are only created on startup or when calling pocket.equipBack, both of which require a player.[^1] I suspect this was a little broken before (the level wouldn't be available if a modem received a message before the position had been set), but that would be much rarer. I'm not 100% convinced about the thread-safety of this code (the writes to level may not be immediately visible on other threads), so may need to think about that. [^1]: Note that when peripherals come to be /attached/ they may no longer have a player (as there's a gap between turning a computer on and it actually starting). However, the level/position will have been initialised by then, so this isn't a problem. |
||
---|---|---|
.. | ||
java/dan200/computercraft | ||
resources |