Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-04 23:30:24 +01:00
Merge remote-tracking branch 'origin/master' into dev
Dieser Commit ist enthalten in:
Commit
6cb2837d77
@ -27,8 +27,15 @@ public class TranslateRewriter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String value = hoverEvent.getAsJsonPrimitive("value").getAsString();
|
String textValue;
|
||||||
if (AchievementTranslationMapping.get(value) == null) {
|
JsonElement value = hoverEvent.get("value");
|
||||||
|
if (value.isJsonObject()) {
|
||||||
|
textValue = value.getAsJsonObject().get("text").getAsString();
|
||||||
|
} else {
|
||||||
|
textValue = value.getAsJsonPrimitive().getAsString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (AchievementTranslationMapping.get(textValue) == null) {
|
||||||
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");
|
||||||
@ -48,17 +55,17 @@ public class TranslateRewriter {
|
|||||||
baseArray.add(namePart);
|
baseArray.add(namePart);
|
||||||
baseArray.add(newLine);
|
baseArray.add(newLine);
|
||||||
baseArray.add(typePart);
|
baseArray.add(typePart);
|
||||||
if (value.startsWith("achievement")) {
|
if (textValue.startsWith("achievement")) {
|
||||||
namePart.addProperty("translate", value);
|
namePart.addProperty("translate", textValue);
|
||||||
namePart.addProperty("color", AchievementTranslationMapping.isSpecial(value) ? "dark_purple" : "green");
|
namePart.addProperty("color", AchievementTranslationMapping.isSpecial(textValue) ? "dark_purple" : "green");
|
||||||
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", value + ".desc");
|
||||||
baseArray.add(newLine);
|
baseArray.add(newLine);
|
||||||
baseArray.add(description);
|
baseArray.add(description);
|
||||||
} else if (value.startsWith("stat")) {
|
} else if (textValue.startsWith("stat")) {
|
||||||
namePart.addProperty("translate", value);
|
namePart.addProperty("translate", textValue);
|
||||||
namePart.addProperty("color", "gray");
|
namePart.addProperty("color", "gray");
|
||||||
typePart.addProperty("translate", "stats.tooltip.type.statistic");
|
typePart.addProperty("translate", "stats.tooltip.type.statistic");
|
||||||
typePart.addProperty("italic", true);
|
typePart.addProperty("italic", true);
|
||||||
|
@ -211,6 +211,7 @@ public class EntityPackets {
|
|||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
wrapper.passthrough(Type.VAR_INT);
|
wrapper.passthrough(Type.VAR_INT);
|
||||||
int size = wrapper.passthrough(Type.INT);
|
int size = wrapper.passthrough(Type.INT);
|
||||||
|
int actualSize = size;
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
// Attributes have been renamed and are now namespaced identifiers
|
// Attributes have been renamed and are now namespaced identifiers
|
||||||
String key = wrapper.read(Type.STRING);
|
String key = wrapper.read(Type.STRING);
|
||||||
@ -218,7 +219,10 @@ public class EntityPackets {
|
|||||||
if (attributeIdentifier == null) {
|
if (attributeIdentifier == null) {
|
||||||
attributeIdentifier = "minecraft:" + key;
|
attributeIdentifier = "minecraft:" + key;
|
||||||
if (!us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData.isValid1_13Channel(attributeIdentifier)) {
|
if (!us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData.isValid1_13Channel(attributeIdentifier)) {
|
||||||
|
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||||
Via.getPlatform().getLogger().warning("Invalid attribute: " + key);
|
Via.getPlatform().getLogger().warning("Invalid attribute: " + key);
|
||||||
|
}
|
||||||
|
actualSize--;
|
||||||
wrapper.read(Type.DOUBLE);
|
wrapper.read(Type.DOUBLE);
|
||||||
int modifierSize = wrapper.read(Type.VAR_INT);
|
int modifierSize = wrapper.read(Type.VAR_INT);
|
||||||
for (int j = 0; j < modifierSize; j++) {
|
for (int j = 0; j < modifierSize; j++) {
|
||||||
@ -240,6 +244,9 @@ public class EntityPackets {
|
|||||||
wrapper.passthrough(Type.BYTE);
|
wrapper.passthrough(Type.BYTE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (size != actualSize) {
|
||||||
|
wrapper.set(Type.INT, 0, actualSize);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren