@Mod(HifiMC.MOD_ID)
public class HifiMC {
// ...
@SubscribeEvent
public void onRenderTickEvent(RenderTickEvent event) {
if (event.phase != TickEvent.Phase.START) {
return;
}
@SuppressWarnings("resource")
ClientPlayerEntity player = Minecraft.getInstance().player;
if (player != null) {
Vector3d pos = player.getEyePosition(event.renderTickTime);
float yaw = player.getRotationYawHead();
LocationDataWebSocket.x = pos.x;
LocationDataWebSocket.y = pos.y;
LocationDataWebSocket.z = pos.z;
LocationDataWebSocket.yaw = (-yaw + 180.0) % 360.0;
}
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter