Target block not working as expected due to caching #4341
Labels
bug
An issue that needs to be fixed. Alternatively, a PR fixing an issue.
completed
The issue has been fully resolved and the change will be in the next Skript update.
enhancement
Feature request, an issue about something that could be improved, or a PR improving something.
priority: low
Issues that are not harmful to the experience but are related to useful changes or additions.
Skript/Server Version
Bug Description
Attempting to get the player's target block in a loop (specifically the distance, but that's irrelevant to the whole issue) will not update in a simple send effect or any expression when the player's rotation changes. I've been informed that this is likely caused because of Skript caching things such as blocks in the previous world tick in the main world only (???) if the world time is no longer ticking (i.e., daylight cycle is off). The two solutions I have found are to either enable the daylight cycle or to change
target block
tonew target block
oractual target block
.Expected Behavior
Expected behavior is to return the actual target block in this case and not one from cache.
Steps to Reproduce
Simply using a snippet like this and running the command with
doDaylightCycle
off in the main world and proceeding to look around reveals that the distance will not change through rotation (looking at blocks around you at different distances), but if you physically move around it will change, but it will still treat the target block as the one you originally looked at. Either changingdoDaylightCycle
to true or prefixingtarget block
withnew
oractual
will make it perform what is expected.Errors or Screenshots
No response
Other
Hopefully the way Skript caches things is fixed, I bet I'm not the first to encounter such behavior and having the
actual
part of target block not documented may be an issue.Agreement
The text was updated successfully, but these errors were encountered: