3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 00:00:41 +01:00
Dieser Commit ist enthalten in:
Camotoy 2024-05-21 20:37:18 -04:00
Ursprung a780eeaae8
Commit 96bfda2ed3
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F

Datei anzeigen

@ -28,7 +28,6 @@ package org.geysermc.geyser.session.cache;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.GlobalPos; import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.GlobalPos;
import org.geysermc.mcprotocollib.protocol.data.game.item.component.LodestoneTracker; import org.geysermc.mcprotocollib.protocol.data.game.item.component.LodestoneTracker;
@ -53,11 +52,13 @@ public final class LodestoneCache {
private int id = 1; private int id = 1;
public void cacheInventoryItem(GeyserItemStack itemStack, LodestoneTracker tracker) { public void cacheInventoryItem(GeyserItemStack itemStack, LodestoneTracker tracker) {
GlobalPos position = tracker.getPos(); if (!tracker.isTracked()) {
return;
}
GlobalPos position = tracker.getPos();
if (position == null) { if (position == null) {
GeyserImpl.getInstance().getLogger().error("Position is null. Find out why."); // As of 1.20.6, position can still be null even if tracking is enabled.
Thread.dumpStack();
return; return;
} }
int x = position.getX(); int x = position.getX();
@ -84,13 +85,16 @@ public final class LodestoneCache {
} }
public int store(LodestoneTracker tracker) { public int store(LodestoneTracker tracker) {
GlobalPos position = tracker.getPos(); if (!tracker.isTracked()) {
// No coordinates; nothing to convert
if (position == null) { return 0;
GeyserImpl.getInstance().getLogger().error("Position is null. Find out why.");
Thread.dumpStack();
return -1;
} }
GlobalPos position = tracker.getPos();
if (position == null) {
return 0;
}
int x = position.getX(); int x = position.getX();
int y = position.getY(); int y = position.getY();
int z = position.getZ(); int z = position.getZ();