mirror of https://github.com/GeyserMC/Geyser.git
Compare commits
7 Commits
1002091fd2
...
aa66bfa8dd
Author | SHA1 | Date |
---|---|---|
rtm516 | aa66bfa8dd | |
gecko10000 | 6f4c29c834 | |
Camotoy | 96bfda2ed3 | |
gecko10000 | a780eeaae8 | |
chris | 35c57179bb | |
rtm516 | 57a9e5efc3 | |
rtm516 | 45e2547e62 |
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2024 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -39,15 +39,19 @@ public enum DeviceOs {
|
|||
OSX("macOS"),
|
||||
AMAZON("Amazon"),
|
||||
GEARVR("Gear VR"),
|
||||
HOLOLENS("Hololens"),
|
||||
@Deprecated HOLOLENS("Hololens"),
|
||||
UWP("Windows"),
|
||||
WIN32("Windows x86"),
|
||||
DEDICATED("Dedicated"),
|
||||
TVOS("Apple TV"),
|
||||
PS4("PS4"),
|
||||
@Deprecated TVOS("Apple TV"),
|
||||
/**
|
||||
* This is for all PlayStation platforms not just PS4
|
||||
*/
|
||||
PS4("PlayStation"),
|
||||
NX("Switch"),
|
||||
XBOX("Xbox One"),
|
||||
WINDOWS_PHONE("Windows Phone");
|
||||
XBOX("Xbox"),
|
||||
@Deprecated WINDOWS_PHONE("Windows Phone"),
|
||||
LINUX("Linux");
|
||||
|
||||
private static final DeviceOs[] VALUES = values();
|
||||
|
||||
|
|
|
@ -91,15 +91,11 @@ public class AdvancementsCache {
|
|||
builder.validResultHandler((response) -> {
|
||||
String id = rootAdvancementIds.get(response.clickedButtonId());
|
||||
if (!id.equals("")) {
|
||||
if (id.equals(currentAdvancementCategoryId)) {
|
||||
// The server thinks we are already on this tab
|
||||
buildAndShowListForm();
|
||||
} else {
|
||||
// Send a packet indicating that we intend to open this particular advancement window
|
||||
ServerboundSeenAdvancementsPacket packet = new ServerboundSeenAdvancementsPacket(id);
|
||||
session.sendDownstreamGamePacket(packet);
|
||||
// Wait for a response there
|
||||
}
|
||||
// Send a packet indicating that we are opening this particular advancement window
|
||||
ServerboundSeenAdvancementsPacket packet = new ServerboundSeenAdvancementsPacket(id);
|
||||
session.sendDownstreamGamePacket(packet);
|
||||
currentAdvancementCategoryId = id;
|
||||
buildAndShowListForm();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -190,6 +186,10 @@ public class AdvancementsCache {
|
|||
.content(content)
|
||||
.button(GeyserLocale.getPlayerLocaleString("gui.back", language))
|
||||
.validResultHandler((response) -> buildAndShowListForm())
|
||||
.closedResultHandler(() -> {
|
||||
// Indicate that we have closed the current advancement tab
|
||||
session.sendDownstreamGamePacket(new ServerboundSeenAdvancementsPacket());
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ package org.geysermc.geyser.session.cache;
|
|||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.GlobalPos;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.item.component.LodestoneTracker;
|
||||
|
@ -53,11 +52,13 @@ public final class LodestoneCache {
|
|||
private int id = 1;
|
||||
|
||||
public void cacheInventoryItem(GeyserItemStack itemStack, LodestoneTracker tracker) {
|
||||
GlobalPos position = tracker.getPos();
|
||||
if (!tracker.isTracked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
GlobalPos position = tracker.getPos();
|
||||
if (position == null) {
|
||||
GeyserImpl.getInstance().getLogger().error("Position is null. Find out why.");
|
||||
Thread.dumpStack();
|
||||
// As of 1.20.6, position can still be null even if tracking is enabled.
|
||||
return;
|
||||
}
|
||||
int x = position.getX();
|
||||
|
@ -84,13 +85,16 @@ public final class LodestoneCache {
|
|||
}
|
||||
|
||||
public int store(LodestoneTracker tracker) {
|
||||
GlobalPos position = tracker.getPos();
|
||||
|
||||
if (position == null) {
|
||||
GeyserImpl.getInstance().getLogger().error("Position is null. Find out why.");
|
||||
Thread.dumpStack();
|
||||
return -1;
|
||||
if (!tracker.isTracked()) {
|
||||
// No coordinates; nothing to convert
|
||||
return 0;
|
||||
}
|
||||
|
||||
GlobalPos position = tracker.getPos();
|
||||
if (position == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int x = position.getX();
|
||||
int y = position.getY();
|
||||
int z = position.getZ();
|
||||
|
|
Loading…
Reference in New Issue