Search in sources :

Example 6 with PlayerProfile

use of net.glowstone.entity.meta.profile.PlayerProfile in project Glowstone by GlowstoneMC.

the class GlowClient method start.

public void start() {
    GLFWErrorCallback.createPrint(System.err).set();
    entity = new GlowClientEntity(server.getWorlds().get(0).getSpawnLocation(), new PlayerProfile("GlowClient", UUID.randomUUID()));
    if (!GLFW.glfwInit()) {
        throw new IllegalStateException("Unable to initialize GLFW");
    }
    GLFW.glfwWindowHint(GLFW.GLFW_RESIZABLE, GLFW.GLFW_TRUE);
    window = GLFW.glfwCreateWindow(1280, 720, "GlowClient", MemoryUtil.NULL, MemoryUtil.NULL);
    if (window == MemoryUtil.NULL) {
        throw new RuntimeException("Failed to create window");
    }
    GLFW.glfwSetKeyCallback(window, this::onInput);
    try (MemoryStack stack = MemoryStack.stackPush()) {
        IntBuffer pWidth = stack.mallocInt(1);
        IntBuffer pHeight = stack.mallocInt(1);
        GLFW.glfwGetWindowSize(window, pWidth, pHeight);
        GLFWVidMode vidmode = GLFW.glfwGetVideoMode(GLFW.glfwGetPrimaryMonitor());
        GLFW.glfwSetWindowPos(window, (vidmode.width() - pWidth.get(0)) / 2, (vidmode.height() - pHeight.get(0)) / 2);
    }
    GLFW.glfwMakeContextCurrent(window);
    GLFW.glfwSwapInterval(1);
}
Also used : PlayerProfile(net.glowstone.entity.meta.profile.PlayerProfile) MemoryStack(org.lwjgl.system.MemoryStack) IntBuffer(java.nio.IntBuffer) GLFWVidMode(org.lwjgl.glfw.GLFWVidMode)

Example 7 with PlayerProfile

use of net.glowstone.entity.meta.profile.PlayerProfile in project Glowstone by GlowstoneMC.

the class UuidListFile method getProfiles.

public List<PlayerProfile> getProfiles() {
    List<PlayerProfile> result = new ArrayList<>(entries.size());
    for (BaseEntry baseEntry : entries) {
        Entry entry = (Entry) baseEntry;
        PlayerProfile profile = ProfileCache.getProfile(entry.uuid);
        if (profile == null) {
            profile = new PlayerProfile(entry.fallbackName, entry.uuid);
        }
        result.add(profile);
    }
    return result;
}
Also used : PlayerProfile(net.glowstone.entity.meta.profile.PlayerProfile)

Aggregations

PlayerProfile (net.glowstone.entity.meta.profile.PlayerProfile)7 IntBuffer (java.nio.IntBuffer)1 UUID (java.util.UUID)1 Matcher (java.util.regex.Matcher)1 GlowPlayer (net.glowstone.entity.GlowPlayer)1 ProxyData (net.glowstone.net.ProxyData)1 EncryptionKeyRequestMessage (net.glowstone.net.message.login.EncryptionKeyRequestMessage)1 Player (org.bukkit.entity.Player)1 AsyncPlayerPreLoginEvent (org.bukkit.event.player.AsyncPlayerPreLoginEvent)1 BatchPacket (org.dragonet.net.packet.minecraft.BatchPacket)1 LoginPacket (org.dragonet.net.packet.minecraft.LoginPacket)1 LoginStatusPacket (org.dragonet.net.packet.minecraft.LoginStatusPacket)1 PEPacket (org.dragonet.net.packet.minecraft.PEPacket)1 BaseTranslator (org.dragonet.net.translator.BaseTranslator)1 GLFWVidMode (org.lwjgl.glfw.GLFWVidMode)1 MemoryStack (org.lwjgl.system.MemoryStack)1