oh no my extensive debugging setup
@@ -30,45 +30,11 @@ import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.translator.protocol.PacketTranslator;
import org.geysermc.geyser.translator.protocol.Translator;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
@Translator(packet = ClientboundUpdateTagsPacket.class)
public class JavaUpdateTagsTranslator extends PacketTranslator<ClientboundUpdateTagsPacket> {
- private final Map<String, Map<String, int[]>> previous = new HashMap<>();
@Override
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);
-
-
}
}
