mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
oh no my extensive debugging setup
This commit is contained in:
parent
746cd94dd1
commit
0ca77233ed
1 changed files with 0 additions and 34 deletions
|
@ -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);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue