Get the visual position of a turtle while its moving #1865
Replies: 4 comments 3 replies
-
So strictly speaking you shouldn't be using any of this code, as it's non-API functionality. However, given you're on 1.19.2 you haven't much alternative, so probably fine. Just something to keep in mind up you update to never versions of the game. To answer your question, the frame value is only really needed on the client (as rendering happens more than once per tick). On the server (where you will be updating the entity's position), you can set it to 1.0f. |
Beta Was this translation helpful? Give feedback.
-
Currently I just hardcoded the turtle animation durations and calculate that by tick: |
Beta Was this translation helpful? Give feedback.
-
I tried both using frame 1.0f on the server side, as well as trying the hardcoded movement from adv peripherals, but they both seem to suffer from a sort of artificial "lag". I'm pretty sure the client is being strange, and not getting the most recent data from the server? I'm updating the position in the entity class's tick() !this.level.isClientSide, but I'm wondering if maybe that isn't the right place. I notice for the saddle peripheral, you're updating the entities position from the peripheral. Is there a specific reason for this, or was it just the neatest way to do it? Anyway, no pressure to response, I'll probably figure something out eventually. A video of the "lag", in case anyone was interested. What's strange is that the armour stand teleporting to the movement entity is smooth, but the contraption entity that rides the movement entity is jerky. |
Beta Was this translation helpful? Give feedback.
-
So at this point I've basically moved on from this mod because of this issue, and haven't tried re-visiting it in a while. I do wonder if it's perhaps just the client-side interpolation of my contraption entity that caused this jagged movement, but I'm too burnt out to try anything more. I did however wonder what you meant by having no alternatives on 1.19. Is there an alternative / better, api method, to do something like this on 1.20? Because if so, I could probably bother updating my mod to 1.20 if the CC api is definitely much better for this use case on that version. |
Beta Was this translation helpful? Give feedback.
-
For my turtle peripheral, I need to have an entity follow the turtles position even while its moving. I've done rotation, but the position is giving me some trouble. With
turtle.getPosition()
, the entity only moves to the new block the turtle is in, not its visual position. Then I foundturtle.getVisualPosition()
, however it needs a frame fraction. Is there any way of knowing what frame of the moving animation the turtle is currently on, or a better way to get its visual position? I've tried looking for uses ofgetVisualPosition()
, but it doesn't seem to be actually used anywhere? And its possibly just for calculating where the turtle should be per frame, and not where the turtle is at the moment. I'm using Forge 1.19.2, CC:Tweaked 1.101.3. Any help is appreciated!Beta Was this translation helpful? Give feedback.
All reactions