Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b2c3320ee | ||
|
|
ebdadf0774 | ||
|
|
5b09536dcf | ||
|
|
074af0e282 | ||
|
|
b6358cf83c | ||
|
|
f53a6928f2 | ||
|
|
78bb5f171f | ||
|
|
28219a3993 | ||
|
|
cae5122d04 | ||
|
|
0070485d2e | ||
|
|
4b6b904361 | ||
|
|
7e03da66d4 | ||
|
|
b209eb3c8b | ||
|
|
be31c705b5 | ||
|
|
13ee674d96 | ||
|
|
d31310ace8 | ||
|
|
1afed864b1 | ||
|
|
95d56c970c | ||
|
|
2dcd832a29 | ||
|
|
f54bb7923b | ||
|
|
1b862d084b | ||
|
|
fc7a7396ef | ||
|
|
be6e086aac | ||
|
|
5e70b54f08 | ||
|
|
f3d8b47add | ||
|
|
d3cadaf90f | ||
|
|
83a49a686a | ||
|
|
a4920a2c74 | ||
|
|
37170a2180 | ||
|
|
c6c5b9430e | ||
|
|
338b8792a9 | ||
|
|
7163d38ddf | ||
|
|
b0fc931ecd | ||
|
|
0ec1116a9e | ||
|
|
e45c82ee87 | ||
|
|
cb4c4b2141 | ||
|
|
acfdbc5494 | ||
|
|
70d08dfc6f | ||
|
|
dfc4652da7 | ||
|
|
a2ac867269 | ||
|
|
9c61135a73 | ||
|
|
f7951e7ef9 | ||
|
|
d37509224d | ||
|
|
7d0b7288dc | ||
|
|
53d22dcff7 |
No files matched your search
@@ -1,4 +1,5 @@
|
||||
# ViaVersion 3.0.1 - Spigot, Sponge, BungeeCord, Velocity
|
||||
# ViaVersion - Spigot, Sponge, BungeeCord, Velocity
|
||||
[](https://viaversion.com)
|
||||
[](https://travis-ci.com/ViaVersion/ViaVersion)
|
||||
[](https://viaversion.com/discord)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.1.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.1.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.1.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.1.1</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -95,8 +95,8 @@ public class ViaManager {
|
||||
platform.getLogger().warning("ViaVersion does not have any compatible versions for this server version!");
|
||||
platform.getLogger().warning("Please remember that ViaVersion only adds support for versions newer than the server version.");
|
||||
platform.getLogger().warning("If you need support for older versions you may need to use one or more ViaVersion addons too.");
|
||||
platform.getLogger().warning("In that case please read the ViaVersion resource page carefully, and if you're");
|
||||
platform.getLogger().warning("still unsure, feel free to join our Discord-Server for further assistance.");
|
||||
platform.getLogger().warning("In that case please read the ViaVersion resource page carefully or use https://jo0001.github.io/ViaSetup");
|
||||
platform.getLogger().warning("and if you're still unsure, feel free to join our Discord-Server for further assistance.");
|
||||
}
|
||||
}
|
||||
// Load Listeners / Tasks
|
||||
|
||||
@@ -65,6 +65,11 @@ import java.util.stream.IntStream;
|
||||
public CompoundTag compound() throws StringTagParseException {
|
||||
this.buffer.expect(Tokens.COMPOUND_BEGIN);
|
||||
final CompoundTag compoundTag = new CompoundTag("");
|
||||
if (this.buffer.peek() == Tokens.COMPOUND_END) {
|
||||
this.buffer.take();
|
||||
return compoundTag;
|
||||
}
|
||||
|
||||
while (this.buffer.hasMore()) {
|
||||
final String key = this.key();
|
||||
final Tag tag = this.tag();
|
||||
|
||||
@@ -411,34 +411,38 @@ public abstract class Protocol<C1 extends ClientboundPacketType, C2 extends Clie
|
||||
int oldId = packetWrapper.getId();
|
||||
int newId = direction == Direction.OUTGOING ? protocolPacket.getNewID() : protocolPacket.getOldID();
|
||||
packetWrapper.setId(newId);
|
||||
if (protocolPacket.getRemapper() == null) {
|
||||
return;
|
||||
|
||||
PacketRemapper remapper = protocolPacket.getRemapper();
|
||||
if (remapper != null) {
|
||||
try {
|
||||
remapper.remap(packetWrapper);
|
||||
} catch (InformativeException e) { // Catch InformativeExceptions, pass through CancelExceptions
|
||||
throwRemapError(direction, state, oldId, newId, e);
|
||||
return;
|
||||
}
|
||||
|
||||
if (packetWrapper.isCancelled()) {
|
||||
throw CancelException.generate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remap
|
||||
try {
|
||||
protocolPacket.getRemapper().remap(packetWrapper);
|
||||
} catch (InformativeException e) { // Catch InformativeExceptions, pass through CancelExceptions
|
||||
// Don't print errors during handshake
|
||||
if (state == State.HANDSHAKE) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
Class<? extends PacketType> packetTypeClass = state == State.PLAY ? (direction == Direction.OUTGOING ? oldClientboundPacketEnum : newServerboundPacketEnum) : null;
|
||||
if (packetTypeClass != null) {
|
||||
PacketType[] enumConstants = packetTypeClass.getEnumConstants();
|
||||
PacketType packetType = oldId < enumConstants.length && oldId >= 0 ? enumConstants[oldId] : null;
|
||||
Via.getPlatform().getLogger().warning("ERROR IN " + getClass().getSimpleName() + " IN REMAP OF " + packetType + " (" + toNiceHex(oldId) + ")");
|
||||
} else {
|
||||
Via.getPlatform().getLogger().warning("ERROR IN " + getClass().getSimpleName()
|
||||
+ " IN REMAP OF " + toNiceHex(oldId) + "->" + toNiceHex(newId));
|
||||
}
|
||||
private void throwRemapError(Direction direction, State state, int oldId, int newId, InformativeException e) throws InformativeException {
|
||||
// Don't print errors during handshake
|
||||
if (state == State.HANDSHAKE) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
if (packetWrapper.isCancelled()) {
|
||||
throw CancelException.generate();
|
||||
Class<? extends PacketType> packetTypeClass = state == State.PLAY ? (direction == Direction.OUTGOING ? oldClientboundPacketEnum : newServerboundPacketEnum) : null;
|
||||
if (packetTypeClass != null) {
|
||||
PacketType[] enumConstants = packetTypeClass.getEnumConstants();
|
||||
PacketType packetType = oldId < enumConstants.length && oldId >= 0 ? enumConstants[oldId] : null;
|
||||
Via.getPlatform().getLogger().warning("ERROR IN " + getClass().getSimpleName() + " IN REMAP OF " + packetType + " (" + toNiceHex(oldId) + ")");
|
||||
} else {
|
||||
Via.getPlatform().getLogger().warning("ERROR IN " + getClass().getSimpleName()
|
||||
+ " IN REMAP OF " + toNiceHex(oldId) + "->" + toNiceHex(newId));
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
private String toNiceHex(int id) {
|
||||
|
||||
@@ -65,7 +65,7 @@ public class ProtocolPipeline extends SimpleProtocol {
|
||||
protocolList.removeAll(toMove);
|
||||
protocolList.addAll(toMove);
|
||||
} else {
|
||||
throw new NullPointerException("Tried to add protocol to early");
|
||||
throw new NullPointerException("Tried to add protocol too early");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import us.myles.ViaVersion.protocols.protocol1_15_2to1_15_1.Protocol1_15_2To1_15
|
||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.Protocol1_15To1_14_4;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16_1to1_16.Protocol1_16_1To1_16;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.Protocol1_16_2To1_16_1;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16_3to1_16_2.Protocol1_16_3To1_16_2;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.Protocol1_9_1_2To1_9_3_4;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_1to1_9.Protocol1_9_1To1_9;
|
||||
@@ -113,6 +114,7 @@ public class ProtocolRegistry {
|
||||
registerProtocol(new Protocol1_16To1_15_2(), ProtocolVersion.v1_16, ProtocolVersion.v1_15_2);
|
||||
registerProtocol(new Protocol1_16_1To1_16(), ProtocolVersion.v1_16_1, ProtocolVersion.v1_16);
|
||||
registerProtocol(new Protocol1_16_2To1_16_1(), ProtocolVersion.v1_16_2, ProtocolVersion.v1_16_1);
|
||||
registerProtocol(new Protocol1_16_3To1_16_2(), ProtocolVersion.v1_16_3, ProtocolVersion.v1_16_2);
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
|
||||
@@ -42,6 +42,7 @@ public class ProtocolVersion {
|
||||
public static final ProtocolVersion v1_16;
|
||||
public static final ProtocolVersion v1_16_1;
|
||||
public static final ProtocolVersion v1_16_2;
|
||||
public static final ProtocolVersion v1_16_3;
|
||||
public static final ProtocolVersion unknown;
|
||||
|
||||
private final int id;
|
||||
@@ -85,6 +86,7 @@ public class ProtocolVersion {
|
||||
register(v1_16 = new ProtocolVersion(735, "1.16"));
|
||||
register(v1_16_1 = new ProtocolVersion(736, "1.16.1"));
|
||||
register(v1_16_2 = new ProtocolVersion(751, "1.16.2"));
|
||||
register(v1_16_3 = new ProtocolVersion(753, "1.16.3"));
|
||||
|
||||
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package us.myles.ViaVersion.api.rewriters;
|
||||
|
||||
public enum TagType {
|
||||
public enum RegistryType {
|
||||
|
||||
BLOCK,
|
||||
ITEM,
|
||||
@@ -0,0 +1,103 @@
|
||||
package us.myles.ViaVersion.api.rewriters;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
|
||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
|
||||
public class StatisticsRewriter {
|
||||
private final Protocol protocol;
|
||||
private final IdRewriteFunction blockRewriter;
|
||||
private final IdRewriteFunction itemRewriter;
|
||||
private final IdRewriteFunction entityRewriter;
|
||||
private final IdRewriteFunction statisticsIdRewriter;
|
||||
private final int customStatsCategory = 8; // Make this changeable if it differs in a future version
|
||||
|
||||
public StatisticsRewriter(Protocol protocol,
|
||||
@Nullable IdRewriteFunction blockRewriter, @Nullable IdRewriteFunction itemRewriter, @Nullable IdRewriteFunction entityRewriter,
|
||||
@Nullable IdRewriteFunction statisticsIdRewriter) {
|
||||
this.protocol = protocol;
|
||||
this.blockRewriter = blockRewriter;
|
||||
this.itemRewriter = itemRewriter;
|
||||
this.entityRewriter = entityRewriter;
|
||||
this.statisticsIdRewriter = statisticsIdRewriter;
|
||||
}
|
||||
|
||||
public StatisticsRewriter(Protocol protocol, @Nullable IdRewriteFunction blockRewriter, @Nullable IdRewriteFunction itemRewriter, @Nullable IdRewriteFunction entityRewriter) {
|
||||
this(protocol, blockRewriter, itemRewriter, entityRewriter, null);
|
||||
}
|
||||
|
||||
public void register(ClientboundPacketType packetType) {
|
||||
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
int size = wrapper.passthrough(Type.VAR_INT);
|
||||
int newSize = size;
|
||||
for (int i = 0; i < size; i++) {
|
||||
int categoryId = wrapper.read(Type.VAR_INT);
|
||||
int statisticId = wrapper.read(Type.VAR_INT);
|
||||
int value = wrapper.read(Type.VAR_INT);
|
||||
if (categoryId == customStatsCategory && statisticsIdRewriter != null) {
|
||||
// Rewrite custom statistics id
|
||||
statisticId = statisticsIdRewriter.rewrite(statisticId);
|
||||
if (statisticId == -1) {
|
||||
// Remove entry
|
||||
newSize--;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
// Rewrite the block/item/entity id
|
||||
RegistryType type = getRegistryTypeForStatistic(categoryId);
|
||||
IdRewriteFunction statisticsRewriter;
|
||||
if (type != null && (statisticsRewriter = getRewriter(type)) != null) {
|
||||
statisticId = statisticsRewriter.rewrite(statisticId);
|
||||
}
|
||||
}
|
||||
|
||||
wrapper.write(Type.VAR_INT, categoryId);
|
||||
wrapper.write(Type.VAR_INT, statisticId);
|
||||
wrapper.write(Type.VAR_INT, value);
|
||||
}
|
||||
|
||||
if (newSize != size) {
|
||||
wrapper.set(Type.VAR_INT, 0, newSize);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected IdRewriteFunction getRewriter(RegistryType type) {
|
||||
switch (type) {
|
||||
case BLOCK:
|
||||
return blockRewriter;
|
||||
case ITEM:
|
||||
return itemRewriter;
|
||||
case ENTITY:
|
||||
return entityRewriter;
|
||||
}
|
||||
throw new IllegalArgumentException("Unknown registry type in statistics packet: " + type);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public RegistryType getRegistryTypeForStatistic(int statisticsId) {
|
||||
switch (statisticsId) {
|
||||
case 0:
|
||||
return RegistryType.BLOCK;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
return RegistryType.ITEM;
|
||||
case 6:
|
||||
case 7:
|
||||
return RegistryType.ENTITY;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,18 +32,18 @@ public class TagRewriter {
|
||||
/**
|
||||
* Adds an empty tag (since the client crashes if a checked tag is not registered.)
|
||||
*/
|
||||
public void addEmptyTag(TagType tagType, String id) {
|
||||
public void addEmptyTag(RegistryType tagType, String id) {
|
||||
getNewTags(tagType).add(new TagData(id, EMPTY_ARRAY));
|
||||
}
|
||||
|
||||
public void addEmptyTags(TagType tagType, String... ids) {
|
||||
public void addEmptyTags(RegistryType tagType, String... ids) {
|
||||
List<TagData> tagList = getNewTags(tagType);
|
||||
for (String id : ids) {
|
||||
tagList.add(new TagData(id, EMPTY_ARRAY));
|
||||
}
|
||||
}
|
||||
|
||||
public void addTag(TagType tagType, String id, int... oldIds) {
|
||||
public void addTag(RegistryType tagType, String id, int... oldIds) {
|
||||
List<TagData> newTags = getNewTags(tagType);
|
||||
IdRewriteFunction rewriteFunction = getRewriter(tagType);
|
||||
for (int i = 0; i < oldIds.length; i++) {
|
||||
@@ -108,7 +108,7 @@ public class TagRewriter {
|
||||
}
|
||||
}
|
||||
|
||||
private List<TagData> getNewTags(TagType tagType) {
|
||||
private List<TagData> getNewTags(RegistryType tagType) {
|
||||
switch (tagType) {
|
||||
case BLOCK:
|
||||
return newBlockTags;
|
||||
@@ -122,7 +122,7 @@ public class TagRewriter {
|
||||
}
|
||||
}
|
||||
|
||||
private IdRewriteFunction getRewriter(TagType tagType) {
|
||||
private IdRewriteFunction getRewriter(RegistryType tagType) {
|
||||
switch (tagType) {
|
||||
case BLOCK:
|
||||
return blockRewriter;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class InformativeException extends Exception {
|
||||
@Override
|
||||
public String getMessage() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("Please post this error to http://github.com/ViaVersion/ViaVersion/issues\n{");
|
||||
builder.append("Please post this error to https://github.com/ViaVersion/ViaVersion/issues\n{");
|
||||
int i = 0;
|
||||
for (Map.Entry<String, Object> entry : info.entrySet()) {
|
||||
builder.append(i == 0 ? "" : ", ").append(entry.getKey()).append(": ").append(entry.getValue().toString());
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class ChatItemRewriter {
|
||||
private static final Pattern indexRemoval = Pattern.compile("\\d+:(?=([^\"\\\\]*(\\\\.|\"([^\"\\\\]*\\\\.)*[^\"\\\\]*\"))*[^\"]*$)");
|
||||
private static final Pattern indexRemoval = Pattern.compile("(?<![\\w-.+])\\d+:(?=([^\"\\\\]*(\\\\.|\"([^\"\\\\]*\\\\.)*[^\"\\\\]*\"))*[^\"]*$)");
|
||||
// Taken from https://stackoverflow.com/questions/6462578/alternative-to-regex-match-all-instances-not-inside-quotes
|
||||
|
||||
public static void toClient(JsonElement element, UserConnection user) {
|
||||
|
||||
+2
-5
@@ -81,12 +81,9 @@ public class Protocol1_12To1_11_1 extends Protocol<ClientboundPackets1_9_3, Clie
|
||||
if (!Via.getConfig().is1_12NBTArrayFix()) return;
|
||||
try {
|
||||
JsonElement obj = Protocol1_9To1_8.FIX_JSON.transform(null, wrapper.passthrough(Type.COMPONENT).toString());
|
||||
if (!TranslateRewriter.toClient(obj, wrapper.user())) {
|
||||
wrapper.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
TranslateRewriter.toClient(obj, wrapper.user());
|
||||
ChatItemRewriter.toClient(obj, wrapper.user());
|
||||
wrapper.set(Type.COMPONENT, 0, obj);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
+77
-3
@@ -1,19 +1,93 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_12to1_11_1;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.rewriters.ComponentRewriter;
|
||||
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.data.AchievementTranslationMapping;
|
||||
|
||||
public class TranslateRewriter {
|
||||
|
||||
public static boolean toClient(JsonElement element, UserConnection user) {
|
||||
private final static ComponentRewriter achievementTextRewriter = new ComponentRewriter() {
|
||||
@Override
|
||||
protected void handleTranslate(JsonObject object, String translate) {
|
||||
String text = AchievementTranslationMapping.get(translate);
|
||||
if (text != null) {
|
||||
object.addProperty("translate", text);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleHoverEvent(JsonObject hoverEvent) {
|
||||
String action = hoverEvent.getAsJsonPrimitive("action").getAsString();
|
||||
if (!action.equals("show_achievement")) {
|
||||
super.handleHoverEvent(hoverEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
String value = hoverEvent.getAsJsonPrimitive("value").getAsString();
|
||||
if (AchievementTranslationMapping.get(value) == null) {
|
||||
JsonObject invalidText = new JsonObject();
|
||||
invalidText.addProperty("text", "Invalid statistic/achievement!");
|
||||
invalidText.addProperty("color", "red");
|
||||
hoverEvent.addProperty("action", "show_text");
|
||||
hoverEvent.add("value", invalidText);
|
||||
super.handleHoverEvent(hoverEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
JsonObject newLine = new JsonObject();
|
||||
newLine.addProperty("text", "\n");
|
||||
JsonArray baseArray = new JsonArray();
|
||||
baseArray.add("");
|
||||
JsonObject namePart = new JsonObject();
|
||||
JsonObject typePart = new JsonObject();
|
||||
baseArray.add(namePart);
|
||||
baseArray.add(newLine);
|
||||
baseArray.add(typePart);
|
||||
if (value.startsWith("achievement")) {
|
||||
namePart.addProperty("translate", value);
|
||||
namePart.addProperty("color", AchievementTranslationMapping.isSpecial(value) ? "dark_purple" : "green");
|
||||
typePart.addProperty("translate", "stats.tooltip.type.achievement");
|
||||
JsonObject description = new JsonObject();
|
||||
typePart.addProperty("italic", true);
|
||||
description.addProperty("translate", value + ".desc");
|
||||
baseArray.add(newLine);
|
||||
baseArray.add(description);
|
||||
} else if (value.startsWith("stat")) {
|
||||
namePart.addProperty("translate", value);
|
||||
namePart.addProperty("color", "gray");
|
||||
typePart.addProperty("translate", "stats.tooltip.type.statistic");
|
||||
typePart.addProperty("italic", true);
|
||||
}
|
||||
hoverEvent.addProperty("action", "show_text");
|
||||
hoverEvent.add("value", baseArray);
|
||||
} catch (Exception e) {
|
||||
Via.getPlatform().getLogger().warning("Error rewriting show_achievement: " + hoverEvent);
|
||||
e.printStackTrace();
|
||||
JsonObject invalidText = new JsonObject();
|
||||
invalidText.addProperty("text", "Invalid statistic/achievement!");
|
||||
invalidText.addProperty("color", "red");
|
||||
hoverEvent.addProperty("action", "show_text");
|
||||
hoverEvent.add("value", invalidText);
|
||||
}
|
||||
super.handleHoverEvent(hoverEvent);
|
||||
}
|
||||
};
|
||||
|
||||
public static void toClient(JsonElement element, UserConnection user) {
|
||||
if (element instanceof JsonObject) {
|
||||
JsonObject obj = (JsonObject) element;
|
||||
JsonElement translate = obj.get("translate");
|
||||
if (translate != null) {
|
||||
return !translate.getAsString().equals("chat.type.achievement");
|
||||
if (translate.getAsString().startsWith("chat.type.achievement")) {
|
||||
achievementTextRewriter.processText(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+183
@@ -0,0 +1,183 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_12to1_11_1.data;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class AchievementTranslationMapping {
|
||||
|
||||
private static final Object2ObjectOpenHashMap<String, String> ACHIEVEMENTS = new Object2ObjectOpenHashMap<>(150, 1.0f);
|
||||
private static final Set<String> SPECIAL_ACHIEVEMENTS = new HashSet<>(10);
|
||||
|
||||
static {
|
||||
add("chat.type.achievement", "%s has just earned the achievement %s");
|
||||
add("chat.type.achievement.taken", "%s has lost the achievement %s");
|
||||
add("stats.tooltip.type.achievement", "Achievement");
|
||||
add("stats.tooltip.type.statistic", "Statistic");
|
||||
add("stat.generalButton", "General");
|
||||
add("stat.blocksButton", "Blocks");
|
||||
add("stat.itemsButton", "Items");
|
||||
add("stat.mobsButton", "Mobs");
|
||||
add("stat.used", "Times Used");
|
||||
add("stat.mined", "Times Mined");
|
||||
add("stat.depleted", "Times Depleted");
|
||||
add("stat.crafted", "Times Crafted");
|
||||
add("stat.entityKills", "You killed %s %s");
|
||||
add("stat.entityKilledBy", "%s killed you %s time(s)");
|
||||
add("stat.entityKills.none", "You have never killed %s");
|
||||
add("stat.entityKilledBy.none", "You have never been killed by %s");
|
||||
add("stat.startGame", "Times Played");
|
||||
add("stat.createWorld", "Worlds Created");
|
||||
add("stat.loadWorld", "Saves Loaded");
|
||||
add("stat.joinMultiplayer", "Multiplayer Joins");
|
||||
add("stat.leaveGame", "Games Quit");
|
||||
add("stat.playOneMinute", "Minutes Played");
|
||||
add("stat.timeSinceDeath", "Since Last Death");
|
||||
add("stat.sneakTime", "Sneak Time");
|
||||
add("stat.walkOneCm", "Distance Walked");
|
||||
add("stat.crouchOneCm", "Distance Crouched");
|
||||
add("stat.sprintOneCm", "Distance Sprinted");
|
||||
add("stat.fallOneCm", "Distance Fallen");
|
||||
add("stat.swimOneCm", "Distance Swum");
|
||||
add("stat.flyOneCm", "Distance Flown");
|
||||
add("stat.climbOneCm", "Distance Climbed");
|
||||
add("stat.diveOneCm", "Distance Dove");
|
||||
add("stat.minecartOneCm", "Distance by Minecart");
|
||||
add("stat.boatOneCm", "Distance by Boat");
|
||||
add("stat.pigOneCm", "Distance by Pig");
|
||||
add("stat.horseOneCm", "Distance by Horse");
|
||||
add("stat.aviateOneCm", "Distance by Elytra");
|
||||
add("stat.jump", "Jumps");
|
||||
add("stat.drop", "Items Dropped");
|
||||
add("stat.dropped", "Dropped");
|
||||
add("stat.pickup", "Picked Up");
|
||||
add("stat.damageDealt", "Damage Dealt");
|
||||
add("stat.damageTaken", "Damage Taken");
|
||||
add("stat.deaths", "Number of Deaths");
|
||||
add("stat.mobKills", "Mob Kills");
|
||||
add("stat.animalsBred", "Animals Bred");
|
||||
add("stat.playerKills", "Player Kills");
|
||||
add("stat.fishCaught", "Fish Caught");
|
||||
add("stat.treasureFished", "Treasure Fished");
|
||||
add("stat.junkFished", "Junk Fished");
|
||||
add("stat.talkedToVillager", "Talked to Villagers");
|
||||
add("stat.tradedWithVillager", "Traded with Villagers");
|
||||
add("stat.cakeSlicesEaten", "Cake Slices Eaten");
|
||||
add("stat.cauldronFilled", "Cauldrons Filled");
|
||||
add("stat.cauldronUsed", "Water Taken from Cauldron");
|
||||
add("stat.armorCleaned", "Armor Pieces Cleaned");
|
||||
add("stat.bannerCleaned", "Banners Cleaned");
|
||||
add("stat.brewingstandInteraction", "Interactions with Brewing Stand");
|
||||
add("stat.beaconInteraction", "Interactions with Beacon");
|
||||
add("stat.dropperInspected", "Droppers Searched");
|
||||
add("stat.hopperInspected", "Hoppers Searched");
|
||||
add("stat.dispenserInspected", "Dispensers Searched");
|
||||
add("stat.noteblockPlayed", "Note Blocks Played");
|
||||
add("stat.noteblockTuned", "Note Blocks Tuned");
|
||||
add("stat.flowerPotted", "Plants Potted");
|
||||
add("stat.trappedChestTriggered", "Trapped Chests Triggered");
|
||||
add("stat.enderchestOpened", "Ender Chests Opened");
|
||||
add("stat.itemEnchanted", "Items Enchanted");
|
||||
add("stat.recordPlayed", "Records Played");
|
||||
add("stat.furnaceInteraction", "Interactions with Furnace");
|
||||
add("stat.workbenchInteraction", "Interactions with Crafting Table");
|
||||
add("stat.chestOpened", "Chests Opened");
|
||||
add("stat.shulkerBoxOpened", "Shulker Boxes Opened");
|
||||
add("stat.sleepInBed", "Times Slept in a Bed");
|
||||
add("stat.mineBlock", "%1$s Mined");
|
||||
add("stat.craftItem", "%1$s Crafted");
|
||||
add("stat.useItem", "%1$s Used");
|
||||
add("stat.breakItem", "%1$s Depleted");
|
||||
add("achievement.get", "Achievement get!");
|
||||
add("achievement.taken", "Taken!");
|
||||
add("achievement.unknown", "???");
|
||||
add("achievement.requires", "Requires '%1$s'");
|
||||
add("achievement.openInventory", "Taking Inventory");
|
||||
add("achievement.openInventory.desc", "Press 'E' to open your inventory");
|
||||
add("achievement.mineWood", "Getting Wood");
|
||||
add("achievement.mineWood.desc", "Attack a tree until a block of wood pops out");
|
||||
add("achievement.buildWorkBench", "Benchmarking");
|
||||
add("achievement.buildWorkBench.desc", "Craft a workbench with four blocks of planks");
|
||||
add("achievement.buildPickaxe", "Time to Mine!");
|
||||
add("achievement.buildPickaxe.desc", "Use planks and sticks to make a pickaxe");
|
||||
add("achievement.buildFurnace", "Hot Topic");
|
||||
add("achievement.buildFurnace.desc", "Construct a furnace out of eight cobblestone blocks");
|
||||
add("achievement.acquireIron", "Acquire Hardware");
|
||||
add("achievement.acquireIron.desc", "Smelt an iron ingot");
|
||||
add("achievement.buildHoe", "Time to Farm!");
|
||||
add("achievement.buildHoe.desc", "Use planks and sticks to make a hoe");
|
||||
add("achievement.makeBread", "Bake Bread");
|
||||
add("achievement.makeBread.desc", "Turn wheat into bread");
|
||||
add("achievement.bakeCake", "The Lie");
|
||||
add("achievement.bakeCake.desc", "Wheat, sugar, milk and eggs!");
|
||||
add("achievement.buildBetterPickaxe", "Getting an Upgrade");
|
||||
add("achievement.buildBetterPickaxe.desc", "Construct a better pickaxe");
|
||||
addSpecial("achievement.overpowered", "Overpowered");
|
||||
add("achievement.overpowered.desc", "Eat a Notch apple");
|
||||
add("achievement.cookFish", "Delicious Fish");
|
||||
add("achievement.cookFish.desc", "Catch and cook fish!");
|
||||
addSpecial("achievement.onARail", "On A Rail");
|
||||
add("achievement.onARail.desc", "Travel by minecart at least 1 km from where you started");
|
||||
add("achievement.buildSword", "Time to Strike!");
|
||||
add("achievement.buildSword.desc", "Use planks and sticks to make a sword");
|
||||
add("achievement.killEnemy", "Monster Hunter");
|
||||
add("achievement.killEnemy.desc", "Attack and destroy a monster");
|
||||
add("achievement.killCow", "Cow Tipper");
|
||||
add("achievement.killCow.desc", "Harvest some leather");
|
||||
add("achievement.breedCow", "Repopulation");
|
||||
add("achievement.breedCow.desc", "Breed two cows with wheat");
|
||||
addSpecial("achievement.flyPig", "When Pigs Fly");
|
||||
add("achievement.flyPig.desc", "Fly a pig off a cliff");
|
||||
addSpecial("achievement.snipeSkeleton", "Sniper Duel");
|
||||
add("achievement.snipeSkeleton.desc", "Kill a skeleton with an arrow from more than 50 meters");
|
||||
add("achievement.diamonds", "DIAMONDS!");
|
||||
add("achievement.diamonds.desc", "Acquire diamonds with your iron tools");
|
||||
add("achievement.diamondsToYou", "Diamonds to you!");
|
||||
add("achievement.diamondsToYou.desc", "Throw diamonds at another player");
|
||||
add("achievement.portal", "We Need to Go Deeper");
|
||||
add("achievement.portal.desc", "Build a portal to the Nether");
|
||||
addSpecial("achievement.ghast", "Return to Sender");
|
||||
add("achievement.ghast.desc", "Destroy a Ghast with a fireball");
|
||||
add("achievement.blazeRod", "Into Fire");
|
||||
add("achievement.blazeRod.desc", "Relieve a Blaze of its rod");
|
||||
add("achievement.potion", "Local Brewery");
|
||||
add("achievement.potion.desc", "Brew a potion");
|
||||
addSpecial("achievement.theEnd", "The End?");
|
||||
add("achievement.theEnd.desc", "Locate the End");
|
||||
addSpecial("achievement.theEnd2", "The End.");
|
||||
add("achievement.theEnd2.desc", "Defeat the Ender Dragon");
|
||||
add("achievement.spawnWither", "The Beginning?");
|
||||
add("achievement.spawnWither.desc", "Spawn the Wither");
|
||||
add("achievement.killWither", "The Beginning.");
|
||||
add("achievement.killWither.desc", "Kill the Wither");
|
||||
addSpecial("achievement.fullBeacon", "Beaconator");
|
||||
add("achievement.fullBeacon.desc", "Create a full beacon");
|
||||
addSpecial("achievement.exploreAllBiomes", "Adventuring Time");
|
||||
add("achievement.exploreAllBiomes.desc", "Discover all biomes");
|
||||
add("achievement.enchantments", "Enchanter");
|
||||
add("achievement.enchantments.desc", "Use a book, obsidian and diamonds to construct an enchantment table");
|
||||
addSpecial("achievement.overkill", "Overkill");
|
||||
add("achievement.overkill.desc", "Deal nine hearts of damage in a single hit");
|
||||
add("achievement.bookcase", "Librarian");
|
||||
add("achievement.bookcase.desc", "Build some bookshelves to improve your enchantment table");
|
||||
}
|
||||
|
||||
private static void add(String key, String value) {
|
||||
ACHIEVEMENTS.put(key, value);
|
||||
}
|
||||
|
||||
private static void addSpecial(String key, String value) {
|
||||
add(key, value);
|
||||
SPECIAL_ACHIEVEMENTS.add(key);
|
||||
}
|
||||
|
||||
public static String get(String key) {
|
||||
return ACHIEVEMENTS.get(key);
|
||||
}
|
||||
|
||||
public static boolean isSpecial(String key) {
|
||||
return SPECIAL_ACHIEVEMENTS.contains(key);
|
||||
}
|
||||
|
||||
}
|
||||
+15
@@ -7,6 +7,7 @@ import us.myles.ViaVersion.api.protocol.Protocol;
|
||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.remapper.ValueTransformer;
|
||||
import us.myles.ViaVersion.api.rewriters.StatisticsRewriter;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13_1to1_13.metadata.MetadataRewriter1_13_1To1_13;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13_1to1_13.packets.EntityPackets;
|
||||
@@ -144,6 +145,20 @@ public class Protocol1_13_1To1_13 extends Protocol<ClientboundPackets1_13, Clien
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
new StatisticsRewriter(this, null, null, null, id -> {
|
||||
int newId = id;
|
||||
if (newId > 22) {
|
||||
newId += 2;
|
||||
}
|
||||
if (newId > 25) {
|
||||
newId += 3;
|
||||
}
|
||||
if (newId > 40) {
|
||||
newId++;
|
||||
}
|
||||
return newId;
|
||||
}).register(ClientboundPackets1_13.STATISTICS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
-27
@@ -16,7 +16,6 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class ChatRewriter {
|
||||
private static final Pattern URL = Pattern.compile("^(?:(https?)://)?([-\\w_.]{2,}\\.[a-z]{2,4})(/\\S*)?$");
|
||||
private static final BaseComponent[] EMPTY_COMPONENTS = new BaseComponent[0];
|
||||
private static final ComponentRewriter COMPONENT_REWRITER = new ComponentRewriter1_13();
|
||||
|
||||
@@ -25,7 +24,6 @@ public class ChatRewriter {
|
||||
List<BaseComponent> components = new ArrayList<>();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
TextComponent component = new TextComponent();
|
||||
Matcher matcher = URL.matcher(message);
|
||||
|
||||
for (int i = 0; i < message.length(); i++) {
|
||||
char c = message.charAt(i);
|
||||
@@ -83,31 +81,6 @@ public class ChatRewriter {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
int pos = message.indexOf(' ', i);
|
||||
if (pos == -1) {
|
||||
pos = message.length();
|
||||
}
|
||||
if (matcher.region(i, pos).find()) { //Web link handling
|
||||
|
||||
if (builder.length() > 0) {
|
||||
TextComponent old = component;
|
||||
component = new TextComponent(old);
|
||||
old.setText(builder.toString());
|
||||
builder = new StringBuilder();
|
||||
components.add(old);
|
||||
}
|
||||
|
||||
TextComponent old = component;
|
||||
component = new TextComponent(old);
|
||||
String urlString = message.substring(i, pos);
|
||||
component.setText(urlString);
|
||||
component.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL,
|
||||
urlString.startsWith("http") ? urlString : "http://" + urlString));
|
||||
components.add(component);
|
||||
i += pos - i - 1;
|
||||
component = old;
|
||||
continue;
|
||||
}
|
||||
builder.append(c);
|
||||
}
|
||||
|
||||
|
||||
+38
-15
@@ -1,6 +1,7 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_13to1_12_2;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.primitives.Ints;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
@@ -24,10 +25,7 @@ import us.myles.ViaVersion.protocols.protocol1_12_1to1_12.ServerboundPackets1_12
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.blockconnections.ConnectionData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.blockconnections.providers.BlockConnectionProvider;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.blockconnections.providers.PacketBlockConnectionProvider;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.BlockIdData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.RecipeData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.StatisticMappings;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.*;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.metadata.MetadataRewriter1_13To1_12_2;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.EntityPackets;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.InventoryPackets;
|
||||
@@ -41,9 +39,7 @@ import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.TabCompleteTra
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
import us.myles.ViaVersion.util.GsonUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
public class Protocol1_13To1_12_2 extends Protocol<ClientboundPackets1_12_1, ClientboundPackets1_13, ServerboundPackets1_12_1, ServerboundPackets1_13> {
|
||||
|
||||
@@ -189,18 +185,22 @@ public class Protocol1_13To1_12_2 extends Protocol<ClientboundPackets1_12_1, Cli
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
int size = wrapper.passthrough(Type.VAR_INT);
|
||||
int size = wrapper.read(Type.VAR_INT);
|
||||
List<StatisticData> remappedStats = new ArrayList<>();
|
||||
for (int i = 0; i < size; i++) {
|
||||
String name = wrapper.read(Type.STRING);
|
||||
String[] split = name.split("\\.");
|
||||
int categoryId = 0;
|
||||
int newId = 0;
|
||||
int newId = -1;
|
||||
int value = wrapper.read(Type.VAR_INT);
|
||||
if (split.length == 2) {
|
||||
// Custom types
|
||||
categoryId = 8;
|
||||
Integer newIdRaw = StatisticMappings.statistics.get(name);
|
||||
Integer newIdRaw = StatisticMappings.CUSTOM_STATS.get(name);
|
||||
if (newIdRaw != null) {
|
||||
newId = newIdRaw;
|
||||
} else {
|
||||
Via.getPlatform().getLogger().warning("Could not find 1.13 -> 1.12.2 statistic mapping for " + name);
|
||||
}
|
||||
} else {
|
||||
String category = split[1];
|
||||
@@ -232,10 +232,15 @@ public class Protocol1_13To1_12_2 extends Protocol<ClientboundPackets1_12_1, Cli
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (newId != -1)
|
||||
remappedStats.add(new StatisticData(categoryId, newId, value));
|
||||
}
|
||||
|
||||
wrapper.write(Type.VAR_INT, categoryId); // category id
|
||||
wrapper.write(Type.VAR_INT, newId); // statistics id
|
||||
wrapper.passthrough(Type.VAR_INT); // value
|
||||
wrapper.write(Type.VAR_INT, remappedStats.size()); // size
|
||||
for (StatisticData stat : remappedStats) {
|
||||
wrapper.write(Type.VAR_INT, stat.getCategoryId()); // category id
|
||||
wrapper.write(Type.VAR_INT, stat.getNewId()); // statistics id
|
||||
wrapper.write(Type.VAR_INT, stat.getValue()); // value
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -821,7 +826,17 @@ public class Protocol1_13To1_12_2 extends Protocol<ClientboundPackets1_12_1, Cli
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.BYTE); // Window id
|
||||
handler(wrapper -> wrapper.write(Type.VAR_INT, Integer.parseInt(wrapper.read(Type.STRING).substring(18))));
|
||||
|
||||
handler(wrapper -> {
|
||||
String s = wrapper.read(Type.STRING);
|
||||
Integer id;
|
||||
if (s.length() < 19 || (id = Ints.tryParse(s.substring(18))) == null) {
|
||||
wrapper.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
wrapper.write(Type.VAR_INT, id);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -836,7 +851,15 @@ public class Protocol1_13To1_12_2 extends Protocol<ClientboundPackets1_12_1, Cli
|
||||
int type = wrapper.get(Type.VAR_INT, 0);
|
||||
|
||||
if (type == 0) {
|
||||
wrapper.write(Type.INT, Integer.parseInt(wrapper.read(Type.STRING).substring(18)));
|
||||
String s = wrapper.read(Type.STRING);
|
||||
Integer id;
|
||||
// Custom recipes
|
||||
if (s.length() < 19 || (id = Ints.tryParse(s.substring(18))) == null) {
|
||||
wrapper.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
wrapper.write(Type.INT, id);
|
||||
}
|
||||
if (type == 1) {
|
||||
wrapper.passthrough(Type.BOOLEAN); // Crafting Recipe Book Open
|
||||
|
||||
+2
-3
@@ -39,10 +39,9 @@ public class ComponentRewriter1_13 extends ComponentRewriter {
|
||||
CompoundTag tag;
|
||||
try {
|
||||
tag = BinaryTagIO.readString(text);
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
Via.getPlatform().getLogger().warning("Error reading NBT in show_item:" + text);
|
||||
e.printStackTrace();
|
||||
return;
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
CompoundTag itemTag = tag.get("tag");
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data;
|
||||
|
||||
public class StatisticData {
|
||||
|
||||
private final int categoryId;
|
||||
private final int newId;
|
||||
private final int value;
|
||||
|
||||
public StatisticData(int categoryId, int newId, int value) {
|
||||
this.categoryId = categoryId;
|
||||
this.newId = newId;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getCategoryId() {
|
||||
return categoryId;
|
||||
}
|
||||
|
||||
public int getNewId() {
|
||||
return newId;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
+87
-52
@@ -5,58 +5,93 @@ import java.util.Map;
|
||||
|
||||
public class StatisticMappings {
|
||||
|
||||
public static final Map<String, Integer> statistics = new HashMap<>();
|
||||
|
||||
public static final Map<String, Integer> CUSTOM_STATS = new HashMap<>();
|
||||
|
||||
static {
|
||||
statistics.put("stat.jump", 17);
|
||||
statistics.put("stat.drop", 18);
|
||||
statistics.put("stat.deaths", 21);
|
||||
statistics.put("stat.mobKills", 22);
|
||||
statistics.put("stat.pigOneCm", 14);
|
||||
statistics.put("stat.flyOneCm", 10);
|
||||
statistics.put("stat.leaveGame", 0);
|
||||
statistics.put("stat.diveOneCm", 11);
|
||||
statistics.put("stat.swimOneCm", 7);
|
||||
statistics.put("stat.fallOneCm", 8);
|
||||
statistics.put("stat.walkOneCm", 4);
|
||||
statistics.put("stat.boatOneCm", 13);
|
||||
statistics.put("stat.sneakTime", 3);
|
||||
statistics.put("stat.horseOneCm", 15);
|
||||
statistics.put("stat.sleepInBed", 48);
|
||||
statistics.put("stat.fishCaught", 25);
|
||||
statistics.put("stat.climbOneCm", 9);
|
||||
statistics.put("stat.aviateOneCm", 16);
|
||||
statistics.put("stat.crouchOneCm", 5);
|
||||
statistics.put("stat.sprintOneCm", 6);
|
||||
statistics.put("stat.animalsBred", 23);
|
||||
statistics.put("stat.chestOpened", 47);
|
||||
statistics.put("stat.damageTaken", 20);
|
||||
statistics.put("stat.damageDealt", 19);
|
||||
statistics.put("stat.playerKills", 24);
|
||||
statistics.put("stat.armorCleaned", 31);
|
||||
statistics.put("stat.flowerPotted", 40);
|
||||
statistics.put("stat.recordPlayed", 44);
|
||||
statistics.put("stat.cauldronUsed", 30);
|
||||
statistics.put("stat.bannerCleaned", 32);
|
||||
statistics.put("stat.itemEnchanted", 43);
|
||||
statistics.put("stat.playOneMinute", 1);
|
||||
statistics.put("stat.minecartOneCm", 12);
|
||||
statistics.put("stat.timeSinceDeath", 2);
|
||||
statistics.put("stat.cauldronFilled", 29);
|
||||
statistics.put("stat.noteblockTuned", 39);
|
||||
statistics.put("stat.noteblockPlayed", 38);
|
||||
statistics.put("stat.cakeSlicesEaten", 28);
|
||||
statistics.put("stat.hopperInspected", 36);
|
||||
statistics.put("stat.shulkerBoxOpened", 49);
|
||||
statistics.put("stat.talkedToVillager", 26);
|
||||
statistics.put("stat.enderchestOpened", 42);
|
||||
statistics.put("stat.dropperInspected", 35);
|
||||
statistics.put("stat.beaconInteraction", 34);
|
||||
statistics.put("stat.furnaceInteraction", 45);
|
||||
statistics.put("stat.dispenserInspected", 37);
|
||||
statistics.put("stat.tradedWithVillager", 27);
|
||||
statistics.put("stat.trappedChestTriggered", 41);
|
||||
statistics.put("stat.brewingstandInteraction", 33);
|
||||
statistics.put("stat.craftingTableInteraction", 46);
|
||||
CUSTOM_STATS.put("stat.leaveGame", 0);
|
||||
CUSTOM_STATS.put("stat.playOneMinute", 1);
|
||||
CUSTOM_STATS.put("stat.timeSinceDeath", 2);
|
||||
CUSTOM_STATS.put("stat.sneakTime", 4);
|
||||
CUSTOM_STATS.put("stat.walkOneCm", 5);
|
||||
CUSTOM_STATS.put("stat.crouchOneCm", 6);
|
||||
CUSTOM_STATS.put("stat.sprintOneCm", 7);
|
||||
CUSTOM_STATS.put("stat.swimOneCm", 18);
|
||||
CUSTOM_STATS.put("stat.fallOneCm", 9);
|
||||
CUSTOM_STATS.put("stat.climbOneCm", 10);
|
||||
CUSTOM_STATS.put("stat.flyOneCm", 11);
|
||||
CUSTOM_STATS.put("stat.diveOneCm", 12);
|
||||
CUSTOM_STATS.put("stat.minecartOneCm", 13);
|
||||
CUSTOM_STATS.put("stat.boatOneCm", 14);
|
||||
CUSTOM_STATS.put("stat.pigOneCm", 15);
|
||||
CUSTOM_STATS.put("stat.horseOneCm", 16);
|
||||
CUSTOM_STATS.put("stat.aviateOneCm", 17);
|
||||
CUSTOM_STATS.put("stat.jump", 19);
|
||||
CUSTOM_STATS.put("stat.drop", 20);
|
||||
CUSTOM_STATS.put("stat.damageDealt", 21);
|
||||
CUSTOM_STATS.put("stat.damageTaken", 22);
|
||||
CUSTOM_STATS.put("stat.deaths", 23);
|
||||
CUSTOM_STATS.put("stat.mobKills", 24);
|
||||
CUSTOM_STATS.put("stat.animalsBred", 25);
|
||||
CUSTOM_STATS.put("stat.playerKills", 26);
|
||||
CUSTOM_STATS.put("stat.fishCaught", 27);
|
||||
CUSTOM_STATS.put("stat.talkedToVillager", 28);
|
||||
CUSTOM_STATS.put("stat.tradedWithVillage", 29);
|
||||
CUSTOM_STATS.put("stat.cakeSlicesEaten", 30);
|
||||
CUSTOM_STATS.put("stat.cauldronFilled", 31);
|
||||
CUSTOM_STATS.put("stat.cauldronUsed", 32);
|
||||
CUSTOM_STATS.put("stat.armorCleaned", 33);
|
||||
CUSTOM_STATS.put("stat.bannerCleaned", 34);
|
||||
CUSTOM_STATS.put("stat.brewingstandInter", 35);
|
||||
CUSTOM_STATS.put("stat.beaconInteraction", 36);
|
||||
CUSTOM_STATS.put("stat.dropperInspected", 37);
|
||||
CUSTOM_STATS.put("stat.hopperInspected", 38);
|
||||
CUSTOM_STATS.put("stat.dispenserInspecte", 39);
|
||||
CUSTOM_STATS.put("stat.noteblockPlayed", 40);
|
||||
CUSTOM_STATS.put("stat.noteblockTuned", 41);
|
||||
CUSTOM_STATS.put("stat.flowerPotted", 42);
|
||||
CUSTOM_STATS.put("stat.trappedChestTriggered", 43);
|
||||
CUSTOM_STATS.put("stat.enderchestOpened", 44);
|
||||
CUSTOM_STATS.put("stat.itemEnchanted", 45);
|
||||
CUSTOM_STATS.put("stat.recordPlayed", 46);
|
||||
CUSTOM_STATS.put("stat.furnaceInteraction", 47);
|
||||
CUSTOM_STATS.put("stat.craftingTableInteraction", 48);
|
||||
CUSTOM_STATS.put("stat.chestOpened", 49);
|
||||
CUSTOM_STATS.put("stat.sleepInBed", 50);
|
||||
CUSTOM_STATS.put("stat.shulkerBoxOpened", 51);
|
||||
CUSTOM_STATS.put("achievement.openInventory", -1);
|
||||
CUSTOM_STATS.put("achievement.mineWood", -1);
|
||||
CUSTOM_STATS.put("achievement.buildWorkBench", -1);
|
||||
CUSTOM_STATS.put("achievement.buildPickaxe", -1);
|
||||
CUSTOM_STATS.put("achievement.buildFurnace", -1);
|
||||
CUSTOM_STATS.put("achievement.acquireIron", -1);
|
||||
CUSTOM_STATS.put("achievement.buildHoe", -1);
|
||||
CUSTOM_STATS.put("achievement.makeBread", -1);
|
||||
CUSTOM_STATS.put("achievement.bakeCake", -1);
|
||||
CUSTOM_STATS.put("achievement.buildBetterPickaxe", -1);
|
||||
CUSTOM_STATS.put("achievement.cookFish", -1);
|
||||
CUSTOM_STATS.put("achievement.onARail", -1);
|
||||
CUSTOM_STATS.put("achievement.buildSword", -1);
|
||||
CUSTOM_STATS.put("achievement.killEnemy", -1);
|
||||
CUSTOM_STATS.put("achievement.killCow", -1);
|
||||
CUSTOM_STATS.put("achievement.flyPig", -1);
|
||||
CUSTOM_STATS.put("achievement.snipeSkeleton", -1);
|
||||
CUSTOM_STATS.put("achievement.diamonds", -1);
|
||||
CUSTOM_STATS.put("achievement.diamondsToYou", -1);
|
||||
CUSTOM_STATS.put("achievement.portal", -1);
|
||||
CUSTOM_STATS.put("achievement.ghast", -1);
|
||||
CUSTOM_STATS.put("achievement.blazeRod", -1);
|
||||
CUSTOM_STATS.put("achievement.potion", -1);
|
||||
CUSTOM_STATS.put("achievement.theEnd", -1);
|
||||
CUSTOM_STATS.put("achievement.theEnd2", -1);
|
||||
CUSTOM_STATS.put("achievement.enchantments", -1);
|
||||
CUSTOM_STATS.put("achievement.overkill", -1);
|
||||
CUSTOM_STATS.put("achievement.bookcase", -1);
|
||||
CUSTOM_STATS.put("achievement.breedCow", -1);
|
||||
CUSTOM_STATS.put("achievement.spawnWither", -1);
|
||||
CUSTOM_STATS.put("achievement.killWither", -1);
|
||||
CUSTOM_STATS.put("achievement.fullBeacon", -1);
|
||||
CUSTOM_STATS.put("achievement.exploreAllBiomes", -1);
|
||||
CUSTOM_STATS.put("achievement.overpowered", -1);
|
||||
}
|
||||
|
||||
}
|
||||
+8
@@ -43,6 +43,14 @@ public class MetadataRewriter1_13To1_12_2 extends MetadataRewriter {
|
||||
}
|
||||
}
|
||||
|
||||
// Remap held block to match new format for remapping to flat block
|
||||
if (type == Entity1_13Types.EntityType.ENDERMAN && metadata.getId() == 12) {
|
||||
int stateId = (int) metadata.getValue();
|
||||
int id = stateId & 4095;
|
||||
int data = stateId >> 12 & 15;
|
||||
metadata.setValue((id << 4) | (data & 0xF));
|
||||
}
|
||||
|
||||
// 1.13 changed item to flat item (no data)
|
||||
if (metadata.getMetaType() == MetaType1_13.Slot) {
|
||||
metadata.setMetaType(MetaType1_13.Slot);
|
||||
|
||||
+4
-1
@@ -8,6 +8,7 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.rewriters.ComponentRewriter;
|
||||
import us.myles.ViaVersion.api.rewriters.SoundRewriter;
|
||||
import us.myles.ViaVersion.api.rewriters.StatisticsRewriter;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ServerboundPackets1_13;
|
||||
@@ -29,7 +30,7 @@ public class Protocol1_14To1_13_2 extends Protocol<ClientboundPackets1_13, Clien
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
new MetadataRewriter1_14To1_13_2(this);
|
||||
MetadataRewriter1_14To1_13_2 metadataRewriter = new MetadataRewriter1_14To1_13_2(this);
|
||||
|
||||
InventoryPackets.register(this);
|
||||
EntityPackets.register(this);
|
||||
@@ -37,6 +38,8 @@ public class Protocol1_14To1_13_2 extends Protocol<ClientboundPackets1_13, Clien
|
||||
PlayerPackets.register(this);
|
||||
|
||||
new SoundRewriter(this, id -> MappingData.soundMappings.getNewId(id)).registerSound(ClientboundPackets1_13.SOUND);
|
||||
new StatisticsRewriter(this, Protocol1_14To1_13_2::getNewBlockId,
|
||||
InventoryPackets::getNewItemId, metadataRewriter::getNewEntityId, id -> MappingData.statisticsMappings.getNewId(id)).register(ClientboundPackets1_13.STATISTICS);
|
||||
|
||||
ComponentRewriter componentRewriter = new ComponentRewriter1_14(this);
|
||||
componentRewriter.registerChatMessage(ClientboundPackets1_13.CHAT_MESSAGE);
|
||||
|
||||
+2
@@ -18,6 +18,7 @@ public class MappingData {
|
||||
public static Mappings blockStateMappings;
|
||||
public static Mappings blockMappings;
|
||||
public static Mappings soundMappings;
|
||||
public static Mappings statisticsMappings;
|
||||
public static IntSet motionBlocking;
|
||||
public static IntSet nonFullBlocks;
|
||||
|
||||
@@ -31,6 +32,7 @@ public class MappingData {
|
||||
blockMappings = new Mappings(mapping1_13_2.getAsJsonObject("blocks"), mapping1_14.getAsJsonObject("blocks"));
|
||||
MappingDataLoader.mapIdentifiers(oldToNewItems, mapping1_13_2.getAsJsonObject("items"), mapping1_14.getAsJsonObject("items"));
|
||||
soundMappings = new Mappings(mapping1_13_2.getAsJsonArray("sounds"), mapping1_14.getAsJsonArray("sounds"));
|
||||
statisticsMappings = new Mappings(mapping1_13_2.getAsJsonArray("statistics"), mapping1_14.getAsJsonArray("statistics"));
|
||||
|
||||
JsonObject blockStates = mapping1_14.getAsJsonObject("blockstates");
|
||||
Map<String, Integer> blockStateMap = new HashMap<>(blockStates.entrySet().size());
|
||||
|
||||
+7
-3
@@ -4,9 +4,10 @@ import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.rewriters.RegistryType;
|
||||
import us.myles.ViaVersion.api.rewriters.SoundRewriter;
|
||||
import us.myles.ViaVersion.api.rewriters.StatisticsRewriter;
|
||||
import us.myles.ViaVersion.api.rewriters.TagRewriter;
|
||||
import us.myles.ViaVersion.api.rewriters.TagType;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
|
||||
@@ -28,7 +29,7 @@ public class Protocol1_15To1_14_4 extends Protocol<ClientboundPackets1_14, Clien
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
new MetadataRewriter1_15To1_14_4(this);
|
||||
MetadataRewriter1_15To1_14_4 metadataRewriter = new MetadataRewriter1_15To1_14_4(this);
|
||||
|
||||
EntityPackets.register(this);
|
||||
PlayerPackets.register(this);
|
||||
@@ -39,6 +40,9 @@ public class Protocol1_15To1_14_4 extends Protocol<ClientboundPackets1_14, Clien
|
||||
soundRewriter.registerSound(ClientboundPackets1_14.ENTITY_SOUND); // Entity Sound Effect (added somewhere in 1.14)
|
||||
soundRewriter.registerSound(ClientboundPackets1_14.SOUND);
|
||||
|
||||
new StatisticsRewriter(this, Protocol1_15To1_14_4::getNewBlockId, InventoryPackets::getNewItemId,
|
||||
metadataRewriter::getNewEntityId, id -> MappingData.statisticsMappings.getNewId(id)).register(ClientboundPackets1_14.STATISTICS);
|
||||
|
||||
registerIncoming(ServerboundPackets1_14.EDIT_BOOK, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
@@ -59,7 +63,7 @@ public class Protocol1_15To1_14_4 extends Protocol<ClientboundPackets1_14, Clien
|
||||
for (int i = 0; i < 17; i++) {
|
||||
shulkerBoxes[i] = shulkerBoxOffset + i;
|
||||
}
|
||||
tagRewriter.addTag(TagType.BLOCK, "minecraft:shulker_boxes", shulkerBoxes);
|
||||
tagRewriter.addTag(RegistryType.BLOCK, "minecraft:shulker_boxes", shulkerBoxes);
|
||||
}
|
||||
|
||||
public static int getNewBlockStateId(int id) {
|
||||
|
||||
+2
@@ -11,6 +11,7 @@ public class MappingData {
|
||||
public static Mappings blockMappings;
|
||||
public static Mappings blockStateMappings;
|
||||
public static Mappings soundMappings;
|
||||
public static Mappings statisticsMappings;
|
||||
|
||||
public static void init() {
|
||||
Via.getPlatform().getLogger().info("Loading 1.14.4 -> 1.15 mappings...");
|
||||
@@ -23,5 +24,6 @@ public class MappingData {
|
||||
blockMappings = new Mappings(mapping1_14.getAsJsonObject("blocks"), mapping1_15.getAsJsonObject("blocks"));
|
||||
MappingDataLoader.mapIdentifiers(oldToNewItems, mapping1_14.getAsJsonObject("items"), mapping1_15.getAsJsonObject("items"));
|
||||
soundMappings = new Mappings(mapping1_14.getAsJsonArray("sounds"), mapping1_15.getAsJsonArray("sounds"), false);
|
||||
statisticsMappings = new Mappings(mapping1_14.getAsJsonArray("statistics"), mapping1_15.getAsJsonArray("statistics"));
|
||||
}
|
||||
}
|
||||
+9
-5
@@ -4,9 +4,10 @@ import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.rewriters.RegistryType;
|
||||
import us.myles.ViaVersion.api.rewriters.SoundRewriter;
|
||||
import us.myles.ViaVersion.api.rewriters.StatisticsRewriter;
|
||||
import us.myles.ViaVersion.api.rewriters.TagRewriter;
|
||||
import us.myles.ViaVersion.api.rewriters.TagType;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.metadata.MetadataRewriter1_16_2To1_16_1;
|
||||
@@ -36,6 +37,9 @@ public class Protocol1_16_2To1_16_1 extends Protocol<ClientboundPackets1_16, Cli
|
||||
tagRewriter = new TagRewriter(this, Protocol1_16_2To1_16_1::getNewBlockId, InventoryPackets::getNewItemId, metadataRewriter::getNewEntityId);
|
||||
tagRewriter.register(ClientboundPackets1_16.TAGS);
|
||||
|
||||
new StatisticsRewriter(this, Protocol1_16_2To1_16_1::getNewBlockId, InventoryPackets::getNewItemId,
|
||||
metadataRewriter::getNewEntityId).register(ClientboundPackets1_16.STATISTICS);
|
||||
|
||||
SoundRewriter soundRewriter = new SoundRewriter(this, id -> MappingData.soundMappings.getNewId(id));
|
||||
soundRewriter.registerSound(ClientboundPackets1_16.SOUND);
|
||||
soundRewriter.registerSound(ClientboundPackets1_16.ENTITY_SOUND);
|
||||
@@ -76,14 +80,14 @@ public class Protocol1_16_2To1_16_1 extends Protocol<ClientboundPackets1_16, Cli
|
||||
protected void loadMappingData() {
|
||||
MappingData.init();
|
||||
|
||||
tagRewriter.addTag(TagType.ITEM, "minecraft:stone_crafting_materials", 14, 962);
|
||||
tagRewriter.addEmptyTag(TagType.BLOCK, "minecraft:mushroom_grow_block");
|
||||
tagRewriter.addTag(RegistryType.ITEM, "minecraft:stone_crafting_materials", 14, 962);
|
||||
tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:mushroom_grow_block");
|
||||
|
||||
// The client now wants ALL (previous) tags to be sent, sooooo :>
|
||||
tagRewriter.addEmptyTags(TagType.ITEM, "minecraft:soul_fire_base_blocks", "minecraft:furnace_materials", "minecraft:crimson_stems",
|
||||
tagRewriter.addEmptyTags(RegistryType.ITEM, "minecraft:soul_fire_base_blocks", "minecraft:furnace_materials", "minecraft:crimson_stems",
|
||||
"minecraft:gold_ores", "minecraft:piglin_loved", "minecraft:piglin_repellents", "minecraft:creeper_drop_music_discs",
|
||||
"minecraft:logs_that_burn", "minecraft:stone_tool_materials", "minecraft:warped_stems");
|
||||
tagRewriter.addEmptyTags(TagType.BLOCK, "minecraft:infiniburn_nether", "minecraft:crimson_stems",
|
||||
tagRewriter.addEmptyTags(RegistryType.BLOCK, "minecraft:infiniburn_nether", "minecraft:crimson_stems",
|
||||
"minecraft:wither_summon_base_blocks", "minecraft:infiniburn_overworld", "minecraft:piglin_repellents",
|
||||
"minecraft:hoglin_repellents", "minecraft:prevent_mob_spawning_inside", "minecraft:wart_blocks",
|
||||
"minecraft:stone_pressure_plates", "minecraft:nylium", "minecraft:gold_ores", "minecraft:pressure_plates",
|
||||
|
||||
+1
-2
@@ -11,14 +11,13 @@ import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.metadata.MetadataRewriter1_16_2To1_16_1;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.storage.EntityTracker1_16_2;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.ClientboundPackets1_16;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2;
|
||||
|
||||
public class EntityPackets {
|
||||
|
||||
public static void register(Protocol1_16_2To1_16_1 protocol) {
|
||||
MetadataRewriter1_16_2To1_16_1 metadataRewriter = protocol.get(MetadataRewriter1_16_2To1_16_1.class);
|
||||
|
||||
metadataRewriter.registerSpawnTrackerWithData(ClientboundPackets1_16.SPAWN_ENTITY, Entity1_16_2Types.EntityType.FALLING_BLOCK, Protocol1_16To1_15_2::getNewBlockStateId);
|
||||
metadataRewriter.registerSpawnTrackerWithData(ClientboundPackets1_16.SPAWN_ENTITY, Entity1_16_2Types.EntityType.FALLING_BLOCK, Protocol1_16_2To1_16_1::getNewBlockStateId);
|
||||
metadataRewriter.registerTracker(ClientboundPackets1_16.SPAWN_MOB);
|
||||
metadataRewriter.registerTracker(ClientboundPackets1_16.SPAWN_PLAYER, Entity1_16_2Types.EntityType.PLAYER);
|
||||
metadataRewriter.registerMetadataRewriter(ClientboundPackets1_16.ENTITY_METADATA, Types1_14.METADATA_LIST);
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_16_3to1_16_2;
|
||||
|
||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ServerboundPackets1_16_2;
|
||||
|
||||
public class Protocol1_16_3To1_16_2 extends Protocol<ClientboundPackets1_16_2, ClientboundPackets1_16_2, ServerboundPackets1_16_2, ServerboundPackets1_16_2> {
|
||||
}
|
||||
+26
-20
@@ -9,9 +9,10 @@ import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.rewriters.ComponentRewriter;
|
||||
import us.myles.ViaVersion.api.rewriters.RegistryType;
|
||||
import us.myles.ViaVersion.api.rewriters.SoundRewriter;
|
||||
import us.myles.ViaVersion.api.rewriters.StatisticsRewriter;
|
||||
import us.myles.ViaVersion.api.rewriters.TagRewriter;
|
||||
import us.myles.ViaVersion.api.rewriters.TagType;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.packets.State;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
|
||||
@@ -23,6 +24,7 @@ import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.packets.EntityPackets;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.packets.InventoryPackets;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.packets.WorldPackets;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.storage.EntityTracker1_16;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.storage.InventoryTracker1_16;
|
||||
import us.myles.ViaVersion.util.GsonUtil;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@@ -50,6 +52,9 @@ public class Protocol1_16To1_15_2 extends Protocol<ClientboundPackets1_15, Clien
|
||||
tagRewriter = new TagRewriter(this, Protocol1_16To1_15_2::getNewBlockId, InventoryPackets::getNewItemId, metadataRewriter::getNewEntityId);
|
||||
tagRewriter.register(ClientboundPackets1_15.TAGS);
|
||||
|
||||
new StatisticsRewriter(this, Protocol1_16To1_15_2::getNewBlockId, InventoryPackets::getNewItemId,
|
||||
metadataRewriter::getNewEntityId, id -> MappingData.statisticsMappings.getNewId(id)).register(ClientboundPackets1_15.STATISTICS);
|
||||
|
||||
// Login Success
|
||||
registerOutgoing(State.LOGIN, 0x02, 0x02, new PacketRemapper() {
|
||||
@Override
|
||||
@@ -219,32 +224,32 @@ public class Protocol1_16To1_15_2 extends Protocol<ClientboundPackets1_15, Clien
|
||||
wallPostOverrideTag[arrayIndex++] = i;
|
||||
}
|
||||
|
||||
tagRewriter.addTag(TagType.BLOCK, "minecraft:wall_post_override", wallPostOverrideTag);
|
||||
tagRewriter.addTag(TagType.BLOCK, "minecraft:beacon_base_blocks", 133, 134, 148, 265);
|
||||
tagRewriter.addTag(TagType.BLOCK, "minecraft:climbable", 160, 241, 658);
|
||||
tagRewriter.addTag(TagType.BLOCK, "minecraft:fire", 142);
|
||||
tagRewriter.addTag(TagType.BLOCK, "minecraft:campfires", 679);
|
||||
tagRewriter.addTag(TagType.BLOCK, "minecraft:fence_gates", 242, 467, 468, 469, 470, 471);
|
||||
tagRewriter.addTag(TagType.BLOCK, "minecraft:unstable_bottom_center", 242, 467, 468, 469, 470, 471);
|
||||
tagRewriter.addTag(TagType.BLOCK, "minecraft:wooden_trapdoors", 193, 194, 195, 196, 197, 198);
|
||||
tagRewriter.addTag(TagType.ITEM, "minecraft:wooden_trapdoors", 215, 216, 217, 218, 219, 220);
|
||||
tagRewriter.addTag(TagType.ITEM, "minecraft:beacon_payment_items", 529, 530, 531, 760);
|
||||
tagRewriter.addTag(TagType.ENTITY, "minecraft:impact_projectiles", 2, 72, 71, 37, 69, 79, 83, 15, 93);
|
||||
tagRewriter.addTag(RegistryType.BLOCK, "minecraft:wall_post_override", wallPostOverrideTag);
|
||||
tagRewriter.addTag(RegistryType.BLOCK, "minecraft:beacon_base_blocks", 133, 134, 148, 265);
|
||||
tagRewriter.addTag(RegistryType.BLOCK, "minecraft:climbable", 160, 241, 658);
|
||||
tagRewriter.addTag(RegistryType.BLOCK, "minecraft:fire", 142);
|
||||
tagRewriter.addTag(RegistryType.BLOCK, "minecraft:campfires", 679);
|
||||
tagRewriter.addTag(RegistryType.BLOCK, "minecraft:fence_gates", 242, 467, 468, 469, 470, 471);
|
||||
tagRewriter.addTag(RegistryType.BLOCK, "minecraft:unstable_bottom_center", 242, 467, 468, 469, 470, 471);
|
||||
tagRewriter.addTag(RegistryType.BLOCK, "minecraft:wooden_trapdoors", 193, 194, 195, 196, 197, 198);
|
||||
tagRewriter.addTag(RegistryType.ITEM, "minecraft:wooden_trapdoors", 215, 216, 217, 218, 219, 220);
|
||||
tagRewriter.addTag(RegistryType.ITEM, "minecraft:beacon_payment_items", 529, 530, 531, 760);
|
||||
tagRewriter.addTag(RegistryType.ENTITY, "minecraft:impact_projectiles", 2, 72, 71, 37, 69, 79, 83, 15, 93);
|
||||
|
||||
// The client crashes if we don't send all tags it may use
|
||||
tagRewriter.addEmptyTag(TagType.BLOCK, "minecraft:guarded_by_piglins");
|
||||
tagRewriter.addEmptyTag(TagType.BLOCK, "minecraft:soul_speed_blocks");
|
||||
tagRewriter.addEmptyTag(TagType.BLOCK, "minecraft:soul_fire_base_blocks");
|
||||
tagRewriter.addEmptyTag(TagType.BLOCK, "minecraft:non_flammable_wood");
|
||||
tagRewriter.addEmptyTag(TagType.ITEM, "minecraft:non_flammable_wood");
|
||||
tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:guarded_by_piglins");
|
||||
tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:soul_speed_blocks");
|
||||
tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:soul_fire_base_blocks");
|
||||
tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:non_flammable_wood");
|
||||
tagRewriter.addEmptyTag(RegistryType.ITEM, "minecraft:non_flammable_wood");
|
||||
|
||||
// The rest of not accessed tags added in older versions; #1830
|
||||
tagRewriter.addEmptyTags(TagType.BLOCK, "minecraft:bamboo_plantable_on", "minecraft:beds", "minecraft:bee_growables",
|
||||
tagRewriter.addEmptyTags(RegistryType.BLOCK, "minecraft:bamboo_plantable_on", "minecraft:beds", "minecraft:bee_growables",
|
||||
"minecraft:beehives", "minecraft:coral_plants", "minecraft:crops", "minecraft:dragon_immune", "minecraft:flowers",
|
||||
"minecraft:portals", "minecraft:shulker_boxes", "minecraft:small_flowers", "minecraft:tall_flowers", "minecraft:trapdoors",
|
||||
"minecraft:underwater_bonemeals", "minecraft:wither_immune", "minecraft:wooden_fences", "minecraft:wooden_trapdoors");
|
||||
tagRewriter.addEmptyTags(TagType.ENTITY, "minecraft:arrows", "minecraft:beehive_inhabitors", "minecraft:raiders", "minecraft:skeletons");
|
||||
tagRewriter.addEmptyTags(TagType.ITEM, "minecraft:beds", "minecraft:coals", "minecraft:fences", "minecraft:flowers",
|
||||
tagRewriter.addEmptyTags(RegistryType.ENTITY, "minecraft:arrows", "minecraft:beehive_inhabitors", "minecraft:raiders", "minecraft:skeletons");
|
||||
tagRewriter.addEmptyTags(RegistryType.ITEM, "minecraft:beds", "minecraft:coals", "minecraft:fences", "minecraft:flowers",
|
||||
"minecraft:lectern_books", "minecraft:music_discs", "minecraft:small_flowers", "minecraft:tall_flowers", "minecraft:trapdoors", "minecraft:walls", "minecraft:wooden_fences");
|
||||
}
|
||||
|
||||
@@ -269,5 +274,6 @@ public class Protocol1_16To1_15_2 extends Protocol<ClientboundPackets1_15, Clien
|
||||
@Override
|
||||
public void init(UserConnection userConnection) {
|
||||
userConnection.put(new EntityTracker1_16(userConnection));
|
||||
userConnection.put(new InventoryTracker1_16(userConnection));
|
||||
}
|
||||
}
|
||||
+2
@@ -14,6 +14,7 @@ public class MappingData {
|
||||
public static Mappings blockMappings;
|
||||
public static Mappings blockStateMappings;
|
||||
public static Mappings soundMappings;
|
||||
public static Mappings statisticsMappings;
|
||||
|
||||
public static void init() {
|
||||
Via.getPlatform().getLogger().info("Loading 1.15 -> 1.16 mappings...");
|
||||
@@ -26,6 +27,7 @@ public class MappingData {
|
||||
blockMappings = new Mappings(mapping1_15.getAsJsonObject("blocks"), mapping1_16.getAsJsonObject("blocks"));
|
||||
MappingDataLoader.mapIdentifiers(oldToNewItems, mapping1_15.getAsJsonObject("items"), mapping1_16.getAsJsonObject("items"), diffmapping.getAsJsonObject("items"));
|
||||
soundMappings = new Mappings(mapping1_15.getAsJsonArray("sounds"), mapping1_16.getAsJsonArray("sounds"), diffmapping.getAsJsonObject("sounds"));
|
||||
statisticsMappings = new Mappings(mapping1_15.getAsJsonArray("statistics"), mapping1_16.getAsJsonArray("statistics"));
|
||||
|
||||
attributeMappings.put("generic.maxHealth", "minecraft:generic.max_health");
|
||||
attributeMappings.put("zombie.spawnReinforcements", "minecraft:zombie.spawn_reinforcements");
|
||||
|
||||
+15
@@ -16,9 +16,11 @@ import us.myles.ViaVersion.api.type.types.version.Types1_14;
|
||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.ClientboundPackets1_16;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.ServerboundPackets1_16;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.metadata.MetadataRewriter1_16To1_15_2;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.storage.EntityTracker1_16;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.storage.InventoryTracker1_16;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -242,5 +244,18 @@ public class EntityPackets {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
protocol.registerIncoming(ServerboundPackets1_16.ANIMATION, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
InventoryTracker1_16 inventoryTracker = wrapper.user().get(InventoryTracker1_16.class);
|
||||
// Don't send an arm swing if the player is switching between inventories.
|
||||
if (inventoryTracker.getInventory() != -1) {
|
||||
wrapper.cancel();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+33
-4
@@ -17,6 +17,7 @@ import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.RecipeRewriter1_14;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.ServerboundPackets1_16;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.storage.InventoryTracker1_16;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -28,22 +29,38 @@ public class InventoryPackets {
|
||||
protocol.registerOutgoing(ClientboundPackets1_15.OPEN_WINDOW, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.VAR_INT);
|
||||
map(Type.VAR_INT);
|
||||
map(Type.COMPONENT);
|
||||
map(Type.VAR_INT); // Window Id
|
||||
map(Type.VAR_INT); // Window Type
|
||||
map(Type.COMPONENT); // Window Title
|
||||
|
||||
handler(wrapper -> {
|
||||
InventoryTracker1_16 inventoryTracker = wrapper.user().get(InventoryTracker1_16.class);
|
||||
int windowId = wrapper.get(Type.VAR_INT, 0);
|
||||
int windowType = wrapper.get(Type.VAR_INT, 1);
|
||||
if (windowType >= 20) { // smithing added with id 20
|
||||
wrapper.set(Type.VAR_INT, 1, ++windowType);
|
||||
}
|
||||
inventoryTracker.setInventory((short) windowId);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
protocol.registerOutgoing(ClientboundPackets1_15.CLOSE_WINDOW, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.UNSIGNED_BYTE);
|
||||
|
||||
handler(wrapper -> {
|
||||
InventoryTracker1_16 inventoryTracker = wrapper.user().get(InventoryTracker1_16.class);
|
||||
inventoryTracker.setInventory((short) -1);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
protocol.registerOutgoing(ClientboundPackets1_15.WINDOW_PROPERTY, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.UNSIGNED_BYTE); // Window id
|
||||
map(Type.UNSIGNED_BYTE); // Window Id
|
||||
map(Type.SHORT); // Property
|
||||
map(Type.SHORT); // Value
|
||||
|
||||
@@ -83,6 +100,18 @@ public class InventoryPackets {
|
||||
itemRewriter.registerClickWindow(ServerboundPackets1_16.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
|
||||
itemRewriter.registerCreativeInvAction(ServerboundPackets1_16.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
|
||||
|
||||
protocol.registerIncoming(ServerboundPackets1_16.CLOSE_WINDOW, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.UNSIGNED_BYTE);
|
||||
|
||||
handler(wrapper -> {
|
||||
InventoryTracker1_16 inventoryTracker = wrapper.user().get(InventoryTracker1_16.class);
|
||||
inventoryTracker.setInventory((short) -1);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
protocol.registerIncoming(ServerboundPackets1_16.EDIT_BOOK, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_16to1_15_2.storage;
|
||||
|
||||
import us.myles.ViaVersion.api.data.StoredObject;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
|
||||
public class InventoryTracker1_16 extends StoredObject {
|
||||
private short inventory = -1;
|
||||
|
||||
public InventoryTracker1_16(UserConnection user) {
|
||||
super(user);
|
||||
}
|
||||
|
||||
public short getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
public void setInventory(short inventory) {
|
||||
this.inventory = inventory;
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -42,10 +42,12 @@ public class Protocol1_9_1_2To1_9_3_4 extends Protocol<ClientboundPackets1_9_3,
|
||||
|
||||
wrapper.clearPacket(); //Clear the packet
|
||||
|
||||
wrapper.setId(0x46); //Update sign packet
|
||||
wrapper.setId(ClientboundPackets1_9.UPDATE_SIGN.ordinal()); //Update sign packet
|
||||
wrapper.write(Type.POSITION, position); // Position
|
||||
for (int i = 1; i < 5; i++)
|
||||
for (int i = 1; i < 5; i++) {
|
||||
// Should technically be written as COMPONENT, but left as String for simplification/to remove redundant wrapping for VR
|
||||
wrapper.write(Type.STRING, (String) tag.get("Text" + i).getValue()); // Sign line
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
+33
-33
@@ -41,10 +41,10 @@ public enum ClientboundPackets1_9 implements ClientboundPacketType {
|
||||
SPAWN_PARTICLE, // 0x22
|
||||
JOIN_GAME, // 0x23
|
||||
MAP_DATA, // 0x24
|
||||
ENTITY_POSITION, // 0x26
|
||||
ENTITY_POSITION_AND_ROTATION, // 0x27
|
||||
ENTITY_ROTATION, // 0x28
|
||||
ENTITY_MOVEMENT, // 0x25
|
||||
ENTITY_POSITION, // 0x25
|
||||
ENTITY_POSITION_AND_ROTATION, // 0x26
|
||||
ENTITY_ROTATION, // 0x27
|
||||
ENTITY_MOVEMENT, // 0x28
|
||||
VEHICLE_MOVE, // 0x29
|
||||
OPEN_SIGN_EDITOR, // 0x2A
|
||||
PLAYER_ABILITIES, // 0x2B
|
||||
@@ -52,33 +52,33 @@ public enum ClientboundPackets1_9 implements ClientboundPacketType {
|
||||
PLAYER_INFO, // 0x2D
|
||||
PLAYER_POSITION, // 0x2E
|
||||
USE_BED, // 0x2F
|
||||
DESTROY_ENTITIES, // 0x31
|
||||
REMOVE_ENTITY_EFFECT, // 0x32
|
||||
RESOURCE_PACK, // 0x33
|
||||
RESPAWN, // 0x34
|
||||
ENTITY_HEAD_LOOK, // 0x35
|
||||
WORLD_BORDER, // 0x37
|
||||
CAMERA, // 0x38
|
||||
HELD_ITEM_CHANGE, // 0x39
|
||||
DISPLAY_SCOREBOARD, // 0x3A
|
||||
ENTITY_METADATA, // 0x3B
|
||||
ATTACH_ENTITY, // 0x3C
|
||||
ENTITY_VELOCITY, // 0x3D
|
||||
ENTITY_EQUIPMENT, // 0x3E
|
||||
SET_EXPERIENCE, // 0x3F
|
||||
UPDATE_HEALTH, // 0x40
|
||||
SCOREBOARD_OBJECTIVE, // 0x41
|
||||
SET_PASSENGERS, // 0x42
|
||||
TEAMS, // 0x43
|
||||
UPDATE_SCORE, // 0x44
|
||||
SPAWN_POSITION, // 0x45
|
||||
TIME_UPDATE, // 0x46
|
||||
TITLE, // 0x47
|
||||
UPDATE_SIGN, // 0x48
|
||||
SOUND, // 0x49
|
||||
TAB_LIST, // 0x4A
|
||||
COLLECT_ITEM, // 0x4B
|
||||
ENTITY_TELEPORT, // 0x4C
|
||||
ENTITY_PROPERTIES, // 0x4D
|
||||
ENTITY_EFFECT, // 0x4E
|
||||
DESTROY_ENTITIES, // 0x30
|
||||
REMOVE_ENTITY_EFFECT, // 0x31
|
||||
RESOURCE_PACK, // 0x32
|
||||
RESPAWN, // 0x33
|
||||
ENTITY_HEAD_LOOK, // 0x34
|
||||
WORLD_BORDER, // 0x35
|
||||
CAMERA, // 0x36
|
||||
HELD_ITEM_CHANGE, // 0x37
|
||||
DISPLAY_SCOREBOARD, // 0x38
|
||||
ENTITY_METADATA, // 0x39
|
||||
ATTACH_ENTITY, // 0x3A
|
||||
ENTITY_VELOCITY, // 0x3B
|
||||
ENTITY_EQUIPMENT, // 0x3C
|
||||
SET_EXPERIENCE, // 0x3D
|
||||
UPDATE_HEALTH, // 0x3E
|
||||
SCOREBOARD_OBJECTIVE, // 0x3F
|
||||
SET_PASSENGERS, // 0x40
|
||||
TEAMS, // 0x41
|
||||
UPDATE_SCORE, // 0x42
|
||||
SPAWN_POSITION, // 0x43
|
||||
TIME_UPDATE, // 0x44
|
||||
TITLE, // 0x45
|
||||
UPDATE_SIGN, // 0x46
|
||||
SOUND, // 0x47
|
||||
TAB_LIST, // 0x48
|
||||
COLLECT_ITEM, // 0x49
|
||||
ENTITY_TELEPORT, // 0x4A
|
||||
ENTITY_PROPERTIES, // 0x4B
|
||||
ENTITY_EFFECT, // 0x4C
|
||||
}
|
||||
+2
-2
@@ -68,8 +68,8 @@ public enum MetaIndex {
|
||||
// villager
|
||||
VILLAGER_PROFESSION(VILLAGER, 16, MetaType1_8.Int, 12, MetaType1_9.VarInt),
|
||||
// enderman
|
||||
ENDERMAN_BLOCK(ENDERMAN, 16, MetaType1_8.Short, 11, MetaType1_9.BlockID), // special case
|
||||
ENDERMAN_BLOCKDATA(ENDERMAN, 17, MetaType1_8.Byte, 11, MetaType1_9.BlockID), // special case
|
||||
ENDERMAN_BLOCKSTATE(ENDERMAN, 16, MetaType1_8.Short, 11, MetaType1_9.BlockID),
|
||||
ENDERMAN_BLOCKDATA(ENDERMAN, 17, MetaType1_8.Byte, MetaType1_9.Discontinued), //always 0 when sent, never read by the client
|
||||
ENDERMAN_ISSCREAMING(ENDERMAN, 18, MetaType1_8.Byte, 12, MetaType1_9.Boolean),
|
||||
// zombie
|
||||
ZOMBIE_ISCHILD(ZOMBIE, 12, MetaType1_8.Byte, 11, MetaType1_9.Boolean),
|
||||
|
||||
+4
-13
@@ -39,19 +39,6 @@ public class MetadataRewriter1_9To1_8 extends MetadataRewriter {
|
||||
metadata.setId(metaIndex.getNewIndex());
|
||||
metadata.setMetaType(metaIndex.getNewType());
|
||||
|
||||
if (type == Entity1_10Types.EntityType.ENDERMAN && metaIndex.getNewType() == MetaType1_9.BlockID) {
|
||||
if (metaIndex.getOldType() == MetaType1_8.Short) {
|
||||
int id = (Short) metadata.getValue();
|
||||
Metadata meta = getMetaByIndex(17, metadatas);
|
||||
int data = meta != null ? (Byte) meta.getValue() : 0;
|
||||
int combined = (id << 4) | (data & 0xF);
|
||||
metadata.setValue(combined);
|
||||
} else {
|
||||
metadatas.remove(metadata);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Object value = metadata.getValue();
|
||||
switch (metaIndex.getNewType()) {
|
||||
case Byte:
|
||||
@@ -124,6 +111,10 @@ public class MetadataRewriter1_9To1_8 extends MetadataRewriter {
|
||||
value = Protocol1_9To1_8.fixJson(value.toString());
|
||||
metadata.setValue(value);
|
||||
break;
|
||||
case BlockID:
|
||||
// Convert from int, short, byte
|
||||
metadata.setValue(((Number) value).intValue());
|
||||
break;
|
||||
default:
|
||||
metadatas.remove(metadata);
|
||||
throw new Exception("Unhandled MetaDataType: " + metaIndex.getNewType());
|
||||
|
||||
+2
-2
@@ -246,12 +246,12 @@ public class EntityTracker1_9 extends EntityTracker {
|
||||
if (!teamExists) {
|
||||
wrapper.write(Type.BYTE, (byte) 0); // make team
|
||||
wrapper.write(Type.STRING, "viaversion");
|
||||
wrapper.write(Type.STRING, ""); // prefix
|
||||
wrapper.write(Type.STRING, "§f"); // prefix
|
||||
wrapper.write(Type.STRING, ""); // suffix
|
||||
wrapper.write(Type.BYTE, (byte) 0); // friendly fire
|
||||
wrapper.write(Type.STRING, ""); // nametags
|
||||
wrapper.write(Type.STRING, "never"); // collision rule :)
|
||||
wrapper.write(Type.BYTE, (byte) 0); // color
|
||||
wrapper.write(Type.BYTE, (byte) 15); // color
|
||||
} else {
|
||||
wrapper.write(Type.BYTE, (byte) 3);
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ flowerstem-when-block-above: false
|
||||
# Vines that are not connected to blocks will be mapped to air, else 1.13+ would still be able to climb up on them.
|
||||
vine-climb-fix: false
|
||||
#
|
||||
# Ignores incoming plugin channel messages of 1.16+ clients with channel names longer than 32 charatcers.
|
||||
# Ignores incoming plugin channel messages of 1.16+ clients with channel names longer than 32 characters.
|
||||
# CraftBukkit had this limit hardcoded until 1.16, so we have to assume any server/proxy might have this arbitrary check present.
|
||||
ignore-long-1_16-channel-names: true
|
||||
#
|
||||
|
||||
@@ -10655,5 +10655,65 @@
|
||||
"595": "cave_air",
|
||||
"596": "bubble_column",
|
||||
"597": "structure_block"
|
||||
}
|
||||
},
|
||||
"statistics": [
|
||||
"minecraft.leave_game",
|
||||
"minecraft.play_one_minute",
|
||||
"minecraft.time_since_death",
|
||||
"minecraft.time_since_rest",
|
||||
"minecraft.sneak_time",
|
||||
"minecraft.walk_one_cm",
|
||||
"minecraft.crouch_one_cm",
|
||||
"minecraft.sprint_one_cm",
|
||||
"minecraft.walk_on_water_one_cm",
|
||||
"minecraft.fall_one_cm",
|
||||
"minecraft.climb_one_cm",
|
||||
"minecraft.fly_one_cm",
|
||||
"minecraft.walk_under_water_one_cm",
|
||||
"minecraft.minecart_one_cm",
|
||||
"minecraft.boat_one_cm",
|
||||
"minecraft.pig_one_cm",
|
||||
"minecraft.horse_one_cm",
|
||||
"minecraft.aviate_one_cm",
|
||||
"minecraft.swim_one_cm",
|
||||
"minecraft.jump",
|
||||
"minecraft.drop",
|
||||
"minecraft.damage_dealt",
|
||||
"minecraft.damage_dealt_absorbed",
|
||||
"minecraft.damage_dealt_resisted",
|
||||
"minecraft.damage_taken",
|
||||
"minecraft.damage_blocked_by_shield",
|
||||
"minecraft.damage_absorbed",
|
||||
"minecraft.damage_resisted",
|
||||
"minecraft.deaths",
|
||||
"minecraft.mob_kills",
|
||||
"minecraft.animals_bred",
|
||||
"minecraft.player_kills",
|
||||
"minecraft.fish_caught",
|
||||
"minecraft.talked_to_villager",
|
||||
"minecraft.traded_with_villager",
|
||||
"minecraft.eat_cake_slice",
|
||||
"minecraft.fill_cauldron",
|
||||
"minecraft.use_cauldron",
|
||||
"minecraft.clean_armor",
|
||||
"minecraft.clean_banner",
|
||||
"minecraft.clean_shulker_box",
|
||||
"minecraft.interact_with_brewingstand",
|
||||
"minecraft.interact_with_beacon",
|
||||
"minecraft.inspect_dropper",
|
||||
"minecraft.inspect_hopper",
|
||||
"minecraft.inspect_dispenser",
|
||||
"minecraft.play_noteblock",
|
||||
"minecraft.tune_noteblock",
|
||||
"minecraft.pot_flower",
|
||||
"minecraft.trigger_trapped_chest",
|
||||
"minecraft.open_enderchest",
|
||||
"minecraft.enchant_item",
|
||||
"minecraft.play_record",
|
||||
"minecraft.interact_with_furnace",
|
||||
"minecraft.interact_with_crafting_table",
|
||||
"minecraft.open_chest",
|
||||
"minecraft.sleep_in_bed",
|
||||
"minecraft.open_shulker_box"
|
||||
]
|
||||
}
|
||||
@@ -10741,5 +10741,59 @@
|
||||
"31": "minecraft:channeling",
|
||||
"32": "minecraft:mending",
|
||||
"33": "minecraft:vanishing_curse"
|
||||
}
|
||||
},
|
||||
"statistics": [
|
||||
"minecraft.leave_game",
|
||||
"minecraft.play_one_minute",
|
||||
"minecraft.time_since_death",
|
||||
"minecraft.time_since_rest",
|
||||
"minecraft.sneak_time",
|
||||
"minecraft.walk_one_cm",
|
||||
"minecraft.crouch_one_cm",
|
||||
"minecraft.sprint_one_cm",
|
||||
"minecraft.walk_on_water_one_cm",
|
||||
"minecraft.fall_one_cm",
|
||||
"minecraft.climb_one_cm",
|
||||
"minecraft.fly_one_cm",
|
||||
"minecraft.walk_under_water_one_cm",
|
||||
"minecraft.minecart_one_cm",
|
||||
"minecraft.boat_one_cm",
|
||||
"minecraft.pig_one_cm",
|
||||
"minecraft.horse_one_cm",
|
||||
"minecraft.aviate_one_cm",
|
||||
"minecraft.swim_one_cm",
|
||||
"minecraft.jump",
|
||||
"minecraft.drop",
|
||||
"minecraft.damage_dealt",
|
||||
"minecraft.damage_taken",
|
||||
"minecraft.deaths",
|
||||
"minecraft.mob_kills",
|
||||
"minecraft.animals_bred",
|
||||
"minecraft.player_kills",
|
||||
"minecraft.fish_caught",
|
||||
"minecraft.talked_to_villager",
|
||||
"minecraft.traded_with_villager",
|
||||
"minecraft.eat_cake_slice",
|
||||
"minecraft.fill_cauldron",
|
||||
"minecraft.use_cauldron",
|
||||
"minecraft.clean_armor",
|
||||
"minecraft.clean_banner",
|
||||
"minecraft.interact_with_brewingstand",
|
||||
"minecraft.interact_with_beacon",
|
||||
"minecraft.inspect_dropper",
|
||||
"minecraft.inspect_hopper",
|
||||
"minecraft.inspect_dispenser",
|
||||
"minecraft.play_noteblock",
|
||||
"minecraft.tune_noteblock",
|
||||
"minecraft.pot_flower",
|
||||
"minecraft.trigger_trapped_chest",
|
||||
"minecraft.open_enderchest",
|
||||
"minecraft.enchant_item",
|
||||
"minecraft.play_record",
|
||||
"minecraft.interact_with_furnace",
|
||||
"minecraft.interact_with_crafting_table",
|
||||
"minecraft.open_chest",
|
||||
"minecraft.sleep_in_bed",
|
||||
"minecraft.open_shulker_box"
|
||||
]
|
||||
}
|
||||
@@ -13625,5 +13625,76 @@
|
||||
"entity.zombie_villager.death",
|
||||
"entity.zombie_villager.hurt",
|
||||
"entity.zombie_villager.step"
|
||||
],
|
||||
"statistics": [
|
||||
"minecraft.leave_game",
|
||||
"minecraft.play_one_minute",
|
||||
"minecraft.time_since_death",
|
||||
"minecraft.time_since_rest",
|
||||
"minecraft.sneak_time",
|
||||
"minecraft.walk_one_cm",
|
||||
"minecraft.crouch_one_cm",
|
||||
"minecraft.sprint_one_cm",
|
||||
"minecraft.walk_on_water_one_cm",
|
||||
"minecraft.fall_one_cm",
|
||||
"minecraft.climb_one_cm",
|
||||
"minecraft.fly_one_cm",
|
||||
"minecraft.walk_under_water_one_cm",
|
||||
"minecraft.minecart_one_cm",
|
||||
"minecraft.boat_one_cm",
|
||||
"minecraft.pig_one_cm",
|
||||
"minecraft.horse_one_cm",
|
||||
"minecraft.aviate_one_cm",
|
||||
"minecraft.swim_one_cm",
|
||||
"minecraft.jump",
|
||||
"minecraft.drop",
|
||||
"minecraft.damage_dealt",
|
||||
"minecraft.damage_dealt_absorbed",
|
||||
"minecraft.damage_dealt_resisted",
|
||||
"minecraft.damage_taken",
|
||||
"minecraft.damage_blocked_by_shield",
|
||||
"minecraft.damage_absorbed",
|
||||
"minecraft.damage_resisted",
|
||||
"minecraft.deaths",
|
||||
"minecraft.mob_kills",
|
||||
"minecraft.animals_bred",
|
||||
"minecraft.player_kills",
|
||||
"minecraft.fish_caught",
|
||||
"minecraft.talked_to_villager",
|
||||
"minecraft.traded_with_villager",
|
||||
"minecraft.eat_cake_slice",
|
||||
"minecraft.fill_cauldron",
|
||||
"minecraft.use_cauldron",
|
||||
"minecraft.clean_armor",
|
||||
"minecraft.clean_banner",
|
||||
"minecraft.clean_shulker_box",
|
||||
"minecraft.interact_with_brewingstand",
|
||||
"minecraft.interact_with_beacon",
|
||||
"minecraft.inspect_dropper",
|
||||
"minecraft.inspect_hopper",
|
||||
"minecraft.inspect_dispenser",
|
||||
"minecraft.play_noteblock",
|
||||
"minecraft.tune_noteblock",
|
||||
"minecraft.pot_flower",
|
||||
"minecraft.trigger_trapped_chest",
|
||||
"minecraft.open_enderchest",
|
||||
"minecraft.enchant_item",
|
||||
"minecraft.play_record",
|
||||
"minecraft.interact_with_furnace",
|
||||
"minecraft.interact_with_crafting_table",
|
||||
"minecraft.open_chest",
|
||||
"minecraft.sleep_in_bed",
|
||||
"minecraft.open_shulker_box",
|
||||
"minecraft.open_barrel",
|
||||
"minecraft.interact_with_blast_furnace",
|
||||
"minecraft.interact_with_smoker",
|
||||
"minecraft.interact_with_lectern",
|
||||
"minecraft.interact_with_campfire",
|
||||
"minecraft.interact_with_cartography_table",
|
||||
"minecraft.interact_with_loom",
|
||||
"minecraft.interact_with_stonecutter",
|
||||
"minecraft.bell_ring",
|
||||
"minecraft.raid_trigger",
|
||||
"minecraft.raid_win"
|
||||
]
|
||||
}
|
||||
@@ -13717,5 +13717,78 @@
|
||||
"entity.zombie_villager.death",
|
||||
"entity.zombie_villager.hurt",
|
||||
"entity.zombie_villager.step"
|
||||
],
|
||||
"statistics": [
|
||||
"minecraft.leave_game",
|
||||
"minecraft.play_one_minute",
|
||||
"minecraft.time_since_death",
|
||||
"minecraft.time_since_rest",
|
||||
"minecraft.sneak_time",
|
||||
"minecraft.walk_one_cm",
|
||||
"minecraft.crouch_one_cm",
|
||||
"minecraft.sprint_one_cm",
|
||||
"minecraft.walk_on_water_one_cm",
|
||||
"minecraft.fall_one_cm",
|
||||
"minecraft.climb_one_cm",
|
||||
"minecraft.fly_one_cm",
|
||||
"minecraft.walk_under_water_one_cm",
|
||||
"minecraft.minecart_one_cm",
|
||||
"minecraft.boat_one_cm",
|
||||
"minecraft.pig_one_cm",
|
||||
"minecraft.horse_one_cm",
|
||||
"minecraft.aviate_one_cm",
|
||||
"minecraft.swim_one_cm",
|
||||
"minecraft.jump",
|
||||
"minecraft.drop",
|
||||
"minecraft.damage_dealt",
|
||||
"minecraft.damage_dealt_absorbed",
|
||||
"minecraft.damage_dealt_resisted",
|
||||
"minecraft.damage_taken",
|
||||
"minecraft.damage_blocked_by_shield",
|
||||
"minecraft.damage_absorbed",
|
||||
"minecraft.damage_resisted",
|
||||
"minecraft.deaths",
|
||||
"minecraft.mob_kills",
|
||||
"minecraft.animals_bred",
|
||||
"minecraft.player_kills",
|
||||
"minecraft.fish_caught",
|
||||
"minecraft.talked_to_villager",
|
||||
"minecraft.traded_with_villager",
|
||||
"minecraft.eat_cake_slice",
|
||||
"minecraft.fill_cauldron",
|
||||
"minecraft.use_cauldron",
|
||||
"minecraft.clean_armor",
|
||||
"minecraft.clean_banner",
|
||||
"minecraft.clean_shulker_box",
|
||||
"minecraft.interact_with_brewingstand",
|
||||
"minecraft.interact_with_beacon",
|
||||
"minecraft.inspect_dropper",
|
||||
"minecraft.inspect_hopper",
|
||||
"minecraft.inspect_dispenser",
|
||||
"minecraft.play_noteblock",
|
||||
"minecraft.tune_noteblock",
|
||||
"minecraft.pot_flower",
|
||||
"minecraft.trigger_trapped_chest",
|
||||
"minecraft.open_enderchest",
|
||||
"minecraft.enchant_item",
|
||||
"minecraft.play_record",
|
||||
"minecraft.interact_with_furnace",
|
||||
"minecraft.interact_with_crafting_table",
|
||||
"minecraft.open_chest",
|
||||
"minecraft.sleep_in_bed",
|
||||
"minecraft.open_shulker_box",
|
||||
"minecraft.open_barrel",
|
||||
"minecraft.interact_with_blast_furnace",
|
||||
"minecraft.interact_with_smoker",
|
||||
"minecraft.interact_with_lectern",
|
||||
"minecraft.interact_with_campfire",
|
||||
"minecraft.interact_with_cartography_table",
|
||||
"minecraft.interact_with_loom",
|
||||
"minecraft.interact_with_stonecutter",
|
||||
"minecraft.bell_ring",
|
||||
"minecraft.raid_trigger",
|
||||
"minecraft.raid_win",
|
||||
"minecraft.interact_with_anvil",
|
||||
"minecraft.interact_with_grindstone"
|
||||
]
|
||||
}
|
||||
@@ -19833,5 +19833,81 @@
|
||||
"entity.zombie_villager.death",
|
||||
"entity.zombie_villager.hurt",
|
||||
"entity.zombie_villager.step"
|
||||
],
|
||||
"statistics": [
|
||||
"minecraft.leave_game",
|
||||
"minecraft.play_one_minute",
|
||||
"minecraft.time_since_death",
|
||||
"minecraft.time_since_rest",
|
||||
"minecraft.sneak_time",
|
||||
"minecraft.walk_one_cm",
|
||||
"minecraft.crouch_one_cm",
|
||||
"minecraft.sprint_one_cm",
|
||||
"minecraft.walk_on_water_one_cm",
|
||||
"minecraft.fall_one_cm",
|
||||
"minecraft.climb_one_cm",
|
||||
"minecraft.fly_one_cm",
|
||||
"minecraft.walk_under_water_one_cm",
|
||||
"minecraft.minecart_one_cm",
|
||||
"minecraft.boat_one_cm",
|
||||
"minecraft.pig_one_cm",
|
||||
"minecraft.horse_one_cm",
|
||||
"minecraft.aviate_one_cm",
|
||||
"minecraft.swim_one_cm",
|
||||
"minecraft.strider_one_cm",
|
||||
"minecraft.jump",
|
||||
"minecraft.drop",
|
||||
"minecraft.damage_dealt",
|
||||
"minecraft.damage_dealt_absorbed",
|
||||
"minecraft.damage_dealt_resisted",
|
||||
"minecraft.damage_taken",
|
||||
"minecraft.damage_blocked_by_shield",
|
||||
"minecraft.damage_absorbed",
|
||||
"minecraft.damage_resisted",
|
||||
"minecraft.deaths",
|
||||
"minecraft.mob_kills",
|
||||
"minecraft.animals_bred",
|
||||
"minecraft.player_kills",
|
||||
"minecraft.fish_caught",
|
||||
"minecraft.talked_to_villager",
|
||||
"minecraft.traded_with_villager",
|
||||
"minecraft.eat_cake_slice",
|
||||
"minecraft.fill_cauldron",
|
||||
"minecraft.use_cauldron",
|
||||
"minecraft.clean_armor",
|
||||
"minecraft.clean_banner",
|
||||
"minecraft.clean_shulker_box",
|
||||
"minecraft.interact_with_brewingstand",
|
||||
"minecraft.interact_with_beacon",
|
||||
"minecraft.inspect_dropper",
|
||||
"minecraft.inspect_hopper",
|
||||
"minecraft.inspect_dispenser",
|
||||
"minecraft.play_noteblock",
|
||||
"minecraft.tune_noteblock",
|
||||
"minecraft.pot_flower",
|
||||
"minecraft.trigger_trapped_chest",
|
||||
"minecraft.open_enderchest",
|
||||
"minecraft.enchant_item",
|
||||
"minecraft.play_record",
|
||||
"minecraft.interact_with_furnace",
|
||||
"minecraft.interact_with_crafting_table",
|
||||
"minecraft.open_chest",
|
||||
"minecraft.sleep_in_bed",
|
||||
"minecraft.open_shulker_box",
|
||||
"minecraft.open_barrel",
|
||||
"minecraft.interact_with_blast_furnace",
|
||||
"minecraft.interact_with_smoker",
|
||||
"minecraft.interact_with_lectern",
|
||||
"minecraft.interact_with_campfire",
|
||||
"minecraft.interact_with_cartography_table",
|
||||
"minecraft.interact_with_loom",
|
||||
"minecraft.interact_with_stonecutter",
|
||||
"minecraft.bell_ring",
|
||||
"minecraft.raid_trigger",
|
||||
"minecraft.raid_win",
|
||||
"minecraft.interact_with_anvil",
|
||||
"minecraft.interact_with_grindstone",
|
||||
"minecraft.target_hit",
|
||||
"minecraft.interact_with_smithing_table"
|
||||
]
|
||||
}
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.1.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.1.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<name>viaversion-jar</name>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>us.myles</groupId>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.1.1</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>viaversion-parent</name>
|
||||
@@ -143,7 +143,6 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Run any tests -->
|
||||
@@ -152,6 +151,20 @@
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<phase>deploy</phase>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.1.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.1.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.1.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
Reference in new issue
Block a user