diff --git a/bukkit/pom.xml b/bukkit/pom.xml
index 592e87676..b77f6ea56 100644
--- a/bukkit/pom.xml
+++ b/bukkit/pom.xml
@@ -5,7 +5,7 @@
viaversion-parent
us.myles
- 1.4.0-1.13-pre9
+ 1.4.0-1.13-pre10
4.0.0
diff --git a/bungee/pom.xml b/bungee/pom.xml
index 52b38a35c..15aa94fef 100644
--- a/bungee/pom.xml
+++ b/bungee/pom.xml
@@ -5,7 +5,7 @@
viaversion-parent
us.myles
- 1.4.0-1.13-pre9
+ 1.4.0-1.13-pre10
4.0.0
diff --git a/common/pom.xml b/common/pom.xml
index 02a158aff..8eb581109 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -5,7 +5,7 @@
viaversion-parent
us.myles
- 1.4.0-1.13-pre9
+ 1.4.0-1.13-pre10
4.0.0
diff --git a/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java b/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java
index 6fb3db92c..855eff31c 100644
--- a/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java
+++ b/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java
@@ -62,7 +62,7 @@ public class ProtocolVersion {
register(v1_12 = new ProtocolVersion(335, "1.12"));
register(v1_12_1 = new ProtocolVersion(338, "1.12.1"));
register(v1_12_2 = new ProtocolVersion(340, "1.12.2"));
- register(v1_13 = new ProtocolVersion(391, "1.13-pre9"));
+ register(v1_13 = new ProtocolVersion(392, "1.13-pre10"));
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
}
diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/ProtocolSnapshotTo1_12_2.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/ProtocolSnapshotTo1_12_2.java
index d6b2923c5..a5934fc5a 100644
--- a/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/ProtocolSnapshotTo1_12_2.java
+++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/ProtocolSnapshotTo1_12_2.java
@@ -49,6 +49,56 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
}
};
+ public static final PacketHandler SEND_DECLARE_COMMANDS_AND_TAGS = new PacketHandler() { // *insert here a good name*
+ @Override
+ public void handle(PacketWrapper w) throws Exception {
+ // Send fake declare commands
+ w.create(0x11, new ValueCreator() {
+ @Override
+ public void write(PacketWrapper wrapper) {
+ wrapper.write(Type.VAR_INT, 2); // Size
+ // Write root node
+ wrapper.write(Type.VAR_INT, 0); // Mark as command
+ wrapper.write(Type.VAR_INT, 1); // 1 child
+ wrapper.write(Type.VAR_INT, 1); // Child is at 1
+
+ // Write arg node
+ wrapper.write(Type.VAR_INT, 0x02 | 0x04 | 0x10); // Mark as command
+ wrapper.write(Type.VAR_INT, 0); // No children
+ // Extra data
+ wrapper.write(Type.STRING, "args"); // Arg name
+ wrapper.write(Type.STRING, "brigadier:string");
+ wrapper.write(Type.VAR_INT, 2); // Greedy
+ wrapper.write(Type.STRING, "minecraft:ask_server"); // Ask server
+
+ wrapper.write(Type.VAR_INT, 0); // Root node index
+ }
+ }).send(ProtocolSnapshotTo1_12_2.class);
+
+ // Send tags packet
+ w.create(0x55, new ValueCreator() {
+ @Override
+ public void write(PacketWrapper wrapper) throws Exception {
+ wrapper.write(Type.VAR_INT, MappingData.blockTags.size()); // block tags
+ for (Map.Entry tag : MappingData.blockTags.entrySet()) {
+ wrapper.write(Type.STRING, tag.getKey());
+ wrapper.write(Type.VAR_INT_ARRAY, tag.getValue().clone());
+ }
+ wrapper.write(Type.VAR_INT, MappingData.itemTags.size()); // item tags
+ for (Map.Entry tag : MappingData.itemTags.entrySet()) {
+ wrapper.write(Type.STRING, tag.getKey());
+ wrapper.write(Type.VAR_INT_ARRAY, tag.getValue().clone());
+ }
+ wrapper.write(Type.VAR_INT, MappingData.fluidTags.size()); // fluid tags
+ for (Map.Entry tag : MappingData.fluidTags.entrySet()) {
+ wrapper.write(Type.STRING, tag.getKey());
+ wrapper.write(Type.VAR_INT_ARRAY, tag.getValue().clone());
+ }
+ }
+ }).send(ProtocolSnapshotTo1_12_2.class);
+ }
+ };
+
static {
MappingData.init();
}
@@ -165,53 +215,9 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
ClientWorld clientChunks = wrapper.user().get(ClientWorld.class);
int dimensionId = wrapper.get(Type.INT, 1);
clientChunks.setEnvironment(dimensionId);
-
- // Send fake declare commands
- wrapper.create(0x11, new ValueCreator() {
- @Override
- public void write(PacketWrapper wrapper) {
- wrapper.write(Type.VAR_INT, 2); // Size
- // Write root node
- wrapper.write(Type.VAR_INT, 0); // Mark as command
- wrapper.write(Type.VAR_INT, 1); // 1 child
- wrapper.write(Type.VAR_INT, 1); // Child is at 1
-
- // Write arg node
- wrapper.write(Type.VAR_INT, 0x02 | 0x04 | 0x10); // Mark as command
- wrapper.write(Type.VAR_INT, 0); // No children
- // Extra data
- wrapper.write(Type.STRING, "args"); // Arg name
- wrapper.write(Type.STRING, "brigadier:string");
- wrapper.write(Type.VAR_INT, 2); // Greedy
- wrapper.write(Type.STRING, "minecraft:ask_server"); // Ask server
-
- wrapper.write(Type.VAR_INT, 0); // Root node index
- }
- }).send(ProtocolSnapshotTo1_12_2.class);
-
- // Send tags packet
- wrapper.create(0x55, new ValueCreator() {
- @Override
- public void write(PacketWrapper wrapper) throws Exception {
- wrapper.write(Type.VAR_INT, MappingData.blockTags.size()); // block tags
- for (Map.Entry tag : MappingData.blockTags.entrySet()) {
- wrapper.write(Type.STRING, tag.getKey());
- wrapper.write(Type.VAR_INT_ARRAY, tag.getValue().clone());
- }
- wrapper.write(Type.VAR_INT, MappingData.itemTags.size()); // item tags
- for (Map.Entry tag : MappingData.itemTags.entrySet()) {
- wrapper.write(Type.STRING, tag.getKey());
- wrapper.write(Type.VAR_INT_ARRAY, tag.getValue().clone());
- }
- wrapper.write(Type.VAR_INT, MappingData.fluidTags.size()); // fluid tags
- for (Map.Entry tag : MappingData.fluidTags.entrySet()) {
- wrapper.write(Type.STRING, tag.getKey());
- wrapper.write(Type.VAR_INT_ARRAY, tag.getValue().clone());
- }
- }
- }).send(ProtocolSnapshotTo1_12_2.class);
}
});
+ handler(SEND_DECLARE_COMMANDS_AND_TAGS);
}
});
@@ -296,6 +302,7 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
clientWorld.setEnvironment(dimensionId);
}
});
+ handler(SEND_DECLARE_COMMANDS_AND_TAGS);
}
});
diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/providers/BlockEntityProvider.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/providers/BlockEntityProvider.java
index c495721c1..8256294f0 100644
--- a/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/providers/BlockEntityProvider.java
+++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/providers/BlockEntityProvider.java
@@ -42,7 +42,7 @@ public class BlockEntityProvider implements Provider {
String id = (String) tag.get("id").getValue();
if (!handlers.containsKey(id)) {
- System.out.println("Unhandled BlockEntity " + id + " full tag: " + tag);
+ //System.out.println("Unhandled BlockEntity " + id + " full tag: " + tag);
return -1;
}
diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/providers/blockentities/FlowerPotHandler.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/providers/blockentities/FlowerPotHandler.java
index fa740b7dc..79ac4807d 100644
--- a/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/providers/blockentities/FlowerPotHandler.java
+++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/providers/blockentities/FlowerPotHandler.java
@@ -9,47 +9,53 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class FlowerPotHandler implements BlockEntityProvider.BlockEntityHandler {
- private static final Map, Integer> flowers = new ConcurrentHashMap<>();
+ private static final Map, Integer> flowers = new ConcurrentHashMap<>();
+ private static final Map, Integer> flowersNumberId = new ConcurrentHashMap<>();
static {
- register("minecraft:air", 0, 5265);
- register("minecraft:sapling", 0, 5266);
- register("minecraft:sapling", 1, 5267);
- register("minecraft:sapling", 2, 5268);
- register("minecraft:sapling", 3, 5269);
- register("minecraft:sapling", 4, 5270);
- register("minecraft:sapling", 5, 5271);
- register("minecraft:tallgrass", 2, 5272);
- register("minecraft:yellow_flower", 0, 5273);
- register("minecraft:red_flower", 0, 5274);
- register("minecraft:red_flower", 1, 5275);
- register("minecraft:red_flower", 2, 5276);
- register("minecraft:red_flower", 3, 5277);
- register("minecraft:red_flower", 4, 5278);
- register("minecraft:red_flower", 5, 5279);
- register("minecraft:red_flower", 6, 5280);
- register("minecraft:red_flower", 7, 5281);
- register("minecraft:red_flower", 8, 5282);
- register("minecraft:red_mushroom", 0, 5283);
- register("minecraft:brown_mushroom", 0, 5284);
- register("minecraft:deadbush", 0, 5285);
- register("minecraft:cactus", 0, 5286);
+ register("minecraft:air", (byte) 0, (byte) 0, 5265);
+ register("minecraft:sapling", (byte) 6, (byte) 0, 5266);
+ register("minecraft:sapling", (byte) 6, (byte) 1, 5267);
+ register("minecraft:sapling", (byte) 6, (byte) 2, 5268);
+ register("minecraft:sapling", (byte) 6, (byte) 3, 5269);
+ register("minecraft:sapling", (byte) 6, (byte) 4, 5270);
+ register("minecraft:sapling", (byte) 6, (byte) 5, 5271);
+ register("minecraft:tallgrass", (byte) 31, (byte) 2, 5272);
+ register("minecraft:yellow_flower", (byte) 37, (byte) 0, 5273);
+ register("minecraft:red_flower", (byte) 38, (byte) 0, 5274);
+ register("minecraft:red_flower", (byte) 38, (byte) 1, 5275);
+ register("minecraft:red_flower", (byte) 38, (byte) 2, 5276);
+ register("minecraft:red_flower", (byte) 38, (byte) 3, 5277);
+ register("minecraft:red_flower", (byte) 38, (byte) 4, 5278);
+ register("minecraft:red_flower", (byte) 38, (byte) 5, 5279);
+ register("minecraft:red_flower", (byte) 38, (byte) 6, 5280);
+ register("minecraft:red_flower", (byte) 38, (byte) 7, 5281);
+ register("minecraft:red_flower", (byte) 38, (byte) 8, 5282);
+ register("minecraft:red_mushroom", (byte) 40, (byte) 0, 5283);
+ register("minecraft:brown_mushroom", (byte) 39, (byte) 0, 5284);
+ register("minecraft:deadbush", (byte) 32, (byte) 0, 5285);
+ register("minecraft:cactus", (byte) 81, (byte) 0, 5286);
}
- public static void register(String identifier, int blockData, int newId) {
+ public static void register(String identifier, byte numbericBlockId, byte blockData, int newId) {
flowers.put(new Pair<>(identifier, blockData), newId);
+ flowersNumberId.put(new Pair<>(numbericBlockId, blockData), newId);
}
@Override
public int transform(UserConnection user, CompoundTag tag) {
- String item = (String) tag.get("Item").getValue();
- int data = (int) tag.get("Data").getValue();
+ Object item = tag.get("Item").getValue();
+ byte data = ((Number) tag.get("Data").getValue()).byteValue();
- Pair pair = new Pair<>(item, data);
+ Pair, Byte> pair = item instanceof Number
+ ? new Pair<>(((Number) item).byteValue(), data)
+ : new Pair<>((String) item, data);
if (flowers.containsKey(pair)) {
return flowers.get(pair);
+ } else if (flowersNumberId.containsKey(pair)) {
+ return flowersNumberId.get(pair);
} else {
System.out.println("Could not find flowerpot content " + item + " for " + tag);
}
diff --git a/jar/pom.xml b/jar/pom.xml
index 5d8f89d98..6d57b8b20 100644
--- a/jar/pom.xml
+++ b/jar/pom.xml
@@ -5,7 +5,7 @@
viaversion-parent
us.myles
- 1.4.0-1.13-pre9
+ 1.4.0-1.13-pre10
4.0.0
viaversion-jar
diff --git a/pom.xml b/pom.xml
index 3d09f4fcb..d6fc8f267 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
us.myles
viaversion-parent
- 1.4.0-1.13-pre9
+ 1.4.0-1.13-pre10
pom
viaversion-parent
diff --git a/sponge-legacy/pom.xml b/sponge-legacy/pom.xml
index 8cda8f1bc..ab1ab0284 100644
--- a/sponge-legacy/pom.xml
+++ b/sponge-legacy/pom.xml
@@ -5,7 +5,7 @@
viaversion-parent
us.myles
- 1.4.0-1.13-pre9
+ 1.4.0-1.13-pre10
4.0.0
diff --git a/sponge/pom.xml b/sponge/pom.xml
index 7e862548e..c9e2d0040 100644
--- a/sponge/pom.xml
+++ b/sponge/pom.xml
@@ -5,7 +5,7 @@
viaversion-parent
us.myles
- 1.4.0-1.13-pre9
+ 1.4.0-1.13-pre10
4.0.0