Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-27 16:40:10 +01:00
Merge branch 'refs/heads/dev' into preview
Dieser Commit ist enthalten in:
Commit
1bb85b11e9
@ -24,6 +24,7 @@ import com.viaversion.viaversion.api.Via;
|
|||||||
import com.viaversion.viaversion.protocols.protocol1_12to1_11_1.data.AchievementTranslationMapping;
|
import com.viaversion.viaversion.protocols.protocol1_12to1_11_1.data.AchievementTranslationMapping;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
||||||
import com.viaversion.viaversion.rewriter.ComponentRewriter;
|
import com.viaversion.viaversion.rewriter.ComponentRewriter;
|
||||||
|
import com.viaversion.viaversion.util.SerializerVersion;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class TranslateRewriter {
|
public class TranslateRewriter {
|
||||||
@ -45,13 +46,7 @@ public class TranslateRewriter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String textValue;
|
String textValue = SerializerVersion.V1_9.toComponent(hoverEvent.get("value")).asUnformattedString();
|
||||||
JsonElement value = hoverEvent.get("value");
|
|
||||||
if (value.isJsonObject()) {
|
|
||||||
textValue = value.getAsJsonObject().get("text").getAsString();
|
|
||||||
} else {
|
|
||||||
textValue = value.getAsJsonPrimitive().getAsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (AchievementTranslationMapping.get(textValue) == null) {
|
if (AchievementTranslationMapping.get(textValue) == null) {
|
||||||
JsonObject invalidText = new JsonObject();
|
JsonObject invalidText = new JsonObject();
|
||||||
@ -79,7 +74,7 @@ public class TranslateRewriter {
|
|||||||
typePart.addProperty("translate", "stats.tooltip.type.achievement");
|
typePart.addProperty("translate", "stats.tooltip.type.achievement");
|
||||||
JsonObject description = new JsonObject();
|
JsonObject description = new JsonObject();
|
||||||
typePart.addProperty("italic", true);
|
typePart.addProperty("italic", true);
|
||||||
description.addProperty("translate", value + ".desc");
|
description.addProperty("translate", textValue + ".desc");
|
||||||
baseArray.add(newLine);
|
baseArray.add(newLine);
|
||||||
baseArray.add(description);
|
baseArray.add(description);
|
||||||
} else if (textValue.startsWith("stat")) {
|
} else if (textValue.startsWith("stat")) {
|
||||||
@ -91,7 +86,9 @@ public class TranslateRewriter {
|
|||||||
hoverEvent.addProperty("action", "show_text");
|
hoverEvent.addProperty("action", "show_text");
|
||||||
hoverEvent.add("value", baseArray);
|
hoverEvent.add("value", baseArray);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Via.getPlatform().getLogger().log(Level.WARNING, "Error rewriting show_achievement: " + hoverEvent, e);
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
|
Via.getPlatform().getLogger().log(Level.WARNING, "Error rewriting show_achievement: " + hoverEvent, e);
|
||||||
|
}
|
||||||
JsonObject invalidText = new JsonObject();
|
JsonObject invalidText = new JsonObject();
|
||||||
invalidText.addProperty("text", "Invalid statistic/achievement!");
|
invalidText.addProperty("text", "Invalid statistic/achievement!");
|
||||||
invalidText.addProperty("color", "red");
|
invalidText.addProperty("color", "red");
|
||||||
@ -114,4 +111,4 @@ public class TranslateRewriter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -203,8 +203,10 @@ public class InventoryPackets extends ItemRewriter<ClientboundPackets1_15, Serve
|
|||||||
NumberTag leastTag = attribute.getNumberTag("UUIDLeast");
|
NumberTag leastTag = attribute.getNumberTag("UUIDLeast");
|
||||||
NumberTag mostTag = attribute.getNumberTag("UUIDMost");
|
NumberTag mostTag = attribute.getNumberTag("UUIDMost");
|
||||||
if (leastTag != null && mostTag != null) {
|
if (leastTag != null && mostTag != null) {
|
||||||
int[] uuidIntArray = UUIDUtil.toIntArray(leastTag.asLong(), mostTag.asLong());
|
int[] uuidIntArray = UUIDUtil.toIntArray(mostTag.asLong(), leastTag.asLong());
|
||||||
attribute.put("UUID", new IntArrayTag(uuidIntArray));
|
attribute.put("UUID", new IntArrayTag(uuidIntArray));
|
||||||
|
attribute.remove("UUIDLeast");
|
||||||
|
attribute.remove("UUIDMost");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -223,6 +225,7 @@ public class InventoryPackets extends ItemRewriter<ClientboundPackets1_15, Serve
|
|||||||
UUID uuid = UUIDUtil.fromIntArray(uuidTag.getValue());
|
UUID uuid = UUIDUtil.fromIntArray(uuidTag.getValue());
|
||||||
attribute.putLong("UUIDLeast", uuid.getLeastSignificantBits());
|
attribute.putLong("UUIDLeast", uuid.getLeastSignificantBits());
|
||||||
attribute.putLong("UUIDMost", uuid.getMostSignificantBits());
|
attribute.putLong("UUIDMost", uuid.getMostSignificantBits());
|
||||||
|
attribute.remove("UUID");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren