Faucet/Minecraft.Client/SDK.h
Soda Can 94999b1812 edited sdk to add new function: GetPlayerX, GetPlayerY, GetPlayerZ and GetPlayerPos
Call GetPlayerPos like this and get output

PlayerPos pos = SDK::GetPlayerPos();
SDK::Log(L"X: " + std::to_wstring(pos.x));
SDK::Log(L"Y: " + std::to_wstring(pos.y));
SDK::Log(L"Z: " + std::to_wstring(pos.z));

Call GetPlayerX or Y or Z like this and get output

double x = SDK::GetPlayerX();
double y = SDK::GetPlayerY();
double z = SDK::GetPlayerZ();
2026-03-10 15:04:38 +11:00

59 lines
1.7 KiB
C++

#pragma once
#include "ModExport.h"
#include <string>
#include <vector>
// Forward declarations - Tells the compiler these exist without loading their files
class Minecraft;
class MinecraftServer;
class ServerLevel;
class MultiPlayerLevel;
class PlayerList;
class ServerPlayer;
class MultiplayerLocalPlayer;
struct PlayerPos {
double x, y, z;
};
namespace SDK {
// Logging
MODAPI void Log(const std::wstring& message);
MODAPI void LogWarn(const std::wstring& message);
MODAPI void LogError(const std::wstring& message);
// Singletons
MODAPI MinecraftServer* GetServer();
MODAPI Minecraft* GetClient();
// Levels
MODAPI ServerLevel* GetServerLevel(int dimension = 0);
MODAPI MultiPlayerLevel* GetClientLevel(int dimension = 0);
// Players
MODAPI PlayerList* GetPlayerList();
// Use MultiplayerLocalPlayer (lowercase p) to match your Minecraft.h
MODAPI MultiplayerLocalPlayer* GetLocalPlayer(int index);
MODAPI MultiplayerLocalPlayer* GetLocalPlayer();
// Player Pos
MODAPI double GetPlayerX(int index = 0);
MODAPI double GetPlayerY(int index = 0);
MODAPI double GetPlayerZ(int index = 0);
MODAPI PlayerPos GetPlayerPos(int index = 0);
// Messaging
MODAPI void BroadcastMessage(const std::wstring& message);
MODAPI void SendMessageToPlayer(const std::wstring& playerName, const std::wstring& message);
// World Control
MODAPI void ExecuteCommand(const std::wstring& command);
MODAPI void SetTimeOfDay(__int64 time);
MODAPI void SaveAll(bool force = false);
// Rules
MODAPI bool IsPvpAllowed();
MODAPI void SetPvpAllowed(bool enabled);
MODAPI bool IsFlightAllowed();
MODAPI void SetFlightAllowed(bool enabled);
}