Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-27 08:30:12 +01:00
oh no my extensive debugging setup
Dieser Commit ist enthalten in:
Ursprung
746cd94dd1
Commit
0ca77233ed
@ -30,45 +30,11 @@ import org.geysermc.geyser.session.GeyserSession;
|
|||||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||||
import org.geysermc.geyser.translator.protocol.Translator;
|
import org.geysermc.geyser.translator.protocol.Translator;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Translator(packet = ClientboundUpdateTagsPacket.class)
|
@Translator(packet = ClientboundUpdateTagsPacket.class)
|
||||||
public class JavaUpdateTagsTranslator extends PacketTranslator<ClientboundUpdateTagsPacket> {
|
public class JavaUpdateTagsTranslator extends PacketTranslator<ClientboundUpdateTagsPacket> {
|
||||||
private final Map<String, Map<String, int[]>> previous = new HashMap<>();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(GeyserSession session, ClientboundUpdateTagsPacket packet) {
|
public void translate(GeyserSession session, ClientboundUpdateTagsPacket packet) {
|
||||||
for (Map.Entry<String, Map<String, int[]>> entry : packet.getTags().entrySet().stream().sorted(Map.Entry.comparingByKey()).toList()) {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
builder.append(entry.getKey()).append("={");
|
|
||||||
for (Map.Entry<String, int[]> tag : entry.getValue().entrySet().stream().sorted(Map.Entry.comparingByKey()).toList()) {
|
|
||||||
builder.append(tag.getKey()).append('=').append(Arrays.toString(tag.getValue())).append(", ");
|
|
||||||
}
|
|
||||||
System.out.println(builder.append("}").toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (previous.isEmpty()) {
|
|
||||||
previous.putAll(packet.getTags());
|
|
||||||
} else {
|
|
||||||
for (Map.Entry<String, Map<String, int[]>> entry : packet.getTags().entrySet()) {
|
|
||||||
Map<String, int[]> oldTags = previous.get(entry.getKey());
|
|
||||||
for (Map.Entry<String, int[]> newTag : entry.getValue().entrySet()) {
|
|
||||||
int[] oldValue = oldTags.get(newTag.getKey());
|
|
||||||
if (oldValue == null) {
|
|
||||||
System.out.println("Tag " + newTag.getKey() + " not found!!");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!Arrays.equals(Arrays.stream(oldValue).sorted().toArray(), Arrays.stream(newTag.getValue()).sorted().toArray())) {
|
|
||||||
System.out.println(entry.getKey() + ": " + newTag.getKey() + " has different values! " + Arrays.toString(Arrays.stream(oldValue).sorted().toArray()) + " " + Arrays.toString(Arrays.stream(newTag.getValue()).sorted().toArray()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
session.getTagCache().loadPacket(session, packet);
|
session.getTagCache().loadPacket(session, packet);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren