From 3761ebf8c7f25d20c33a44f53d167c1ca02ab1a3 Mon Sep 17 00:00:00 2001 From: creeper123123321 <7974274+creeper123123321@users.noreply.github.com> Date: Mon, 4 Nov 2019 17:36:16 -0300 Subject: [PATCH 01/36] Pot handler rewrite --- .../blockentities/FlowerPotHandler.java | 89 ++++++++++--------- 1 file changed, 46 insertions(+), 43 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/providers/blockentities/FlowerPotHandler.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/providers/blockentities/FlowerPotHandler.java index 244afae94..47fa806f9 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/providers/blockentities/FlowerPotHandler.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/providers/blockentities/FlowerPotHandler.java @@ -2,7 +2,6 @@ package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers.blockentiti import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import us.myles.ViaVersion.api.Pair; -import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers.BlockEntityProvider; @@ -10,62 +9,66 @@ 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> flowersNumberId = new ConcurrentHashMap<>(); + // Object -> string (id without namespace) or byte (numeric id) + private static final Map, Integer> flowers = new ConcurrentHashMap<>(); static { - 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); + register("air", (byte) 0, (byte) 0, 5265); + register("sapling", (byte) 6, (byte) 0, 5266); + register("sapling", (byte) 6, (byte) 1, 5267); + register("sapling", (byte) 6, (byte) 2, 5268); + register("sapling", (byte) 6, (byte) 3, 5269); + register("sapling", (byte) 6, (byte) 4, 5270); + register("sapling", (byte) 6, (byte) 5, 5271); + register("tallgrass", (byte) 31, (byte) 2, 5272); + register("yellow_flower", (byte) 37, (byte) 0, 5273); + register("red_flower", (byte) 38, (byte) 0, 5274); + register("red_flower", (byte) 38, (byte) 1, 5275); + register("red_flower", (byte) 38, (byte) 2, 5276); + register("red_flower", (byte) 38, (byte) 3, 5277); + register("red_flower", (byte) 38, (byte) 4, 5278); + register("red_flower", (byte) 38, (byte) 5, 5279); + register("red_flower", (byte) 38, (byte) 6, 5280); + register("red_flower", (byte) 38, (byte) 7, 5281); + register("red_flower", (byte) 38, (byte) 8, 5282); + register("red_mushroom", (byte) 40, (byte) 0, 5283); + register("brown_mushroom", (byte) 39, (byte) 0, 5284); + register("deadbush", (byte) 32, (byte) 0, 5285); + register("cactus", (byte) 81, (byte) 0, 5286); } 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); + flowers.put(new Pair<>(numbericBlockId, blockData), newId); } @Override public int transform(UserConnection user, CompoundTag tag) { - Object item = tag.get("Item").getValue(); - byte data = ((Number) tag.get("Data").getValue()).byteValue(); + Object item = tag.contains("Item") ? tag.get("Item").getValue() : null; + Object data = tag.contains("Data") ? tag.get("Data").getValue() : null; - Pair pair = item instanceof Number - ? new Pair<>(((Number) item).byteValue(), data) - : new Pair<>((String) item, data); - - // Return air on empty string - if (item instanceof String && ((String) item).isEmpty()) - return 5265; - else if (flowers.containsKey(pair)) { - return flowers.get(pair); - } else if (flowersNumberId.containsKey(pair)) { - return flowersNumberId.get(pair); + // Convert item to String without namespace or to Byte + if (item instanceof String) { + item = ((String) item).replace("minecraft:", ""); + } else if (item instanceof Number) { + item = ((Number) item).byteValue(); } else { - if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) { - Via.getPlatform().getLogger().warning("Could not find flowerpot content " + item + " for " + tag); - } + item = (byte) 0; } - return -1; + // Convert data to Byte + if (data instanceof Number) { + data = ((Number) data).byteValue(); + } else { + data = (byte) 0; + } + + Integer flower = flowers.get(new Pair<>(item, (byte) data)); + if (flower != null) return flower; + flower = flowers.get(new Pair<>(item, (byte) 0)); + if (flower != null) return flower; + + return 5265; // Fallback to empty pot } } From dc54551d0c98828eff6a892ffd26b8c2386b4318 Mon Sep 17 00:00:00 2001 From: Marco Date: Sun, 10 Nov 2019 16:36:36 +0100 Subject: [PATCH 02/36] fix area effect cloud add 1.14 particle type --- .../metadata/types/MetaType1_14.java | 2 +- .../us/myles/ViaVersion/api/type/Type.java | 3 ++ .../types/minecraft/Particle1_14Type.java | 46 +++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 common/src/main/java/us/myles/ViaVersion/api/type/types/minecraft/Particle1_14Type.java diff --git a/common/src/main/java/us/myles/ViaVersion/api/minecraft/metadata/types/MetaType1_14.java b/common/src/main/java/us/myles/ViaVersion/api/minecraft/metadata/types/MetaType1_14.java index 86a6418bb..013ee97e3 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/minecraft/metadata/types/MetaType1_14.java +++ b/common/src/main/java/us/myles/ViaVersion/api/minecraft/metadata/types/MetaType1_14.java @@ -24,7 +24,7 @@ public enum MetaType1_14 implements MetaType { OptUUID(12, Type.OPTIONAL_UUID), BlockID(13, Type.VAR_INT), NBTTag(14, Type.NBT), - PARTICLE(15, Protocol1_13_2To1_13_1.PARTICLE_TYPE), + PARTICLE(15, Type.PARTICLE_1_14), VillagerData(16, Type.VILLAGER_DATA), OptVarInt(17, Type.OPTIONAL_VAR_INT), Pose(18, Type.VAR_INT), diff --git a/common/src/main/java/us/myles/ViaVersion/api/type/Type.java b/common/src/main/java/us/myles/ViaVersion/api/type/Type.java index 25c6cd0ab..2262d7c05 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/type/Type.java +++ b/common/src/main/java/us/myles/ViaVersion/api/type/Type.java @@ -7,6 +7,7 @@ import us.myles.ViaVersion.api.minecraft.*; import us.myles.ViaVersion.api.minecraft.item.Item; import us.myles.ViaVersion.api.type.types.*; import us.myles.ViaVersion.api.type.types.minecraft.*; +import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.Particle; import java.util.UUID; @@ -76,6 +77,8 @@ public abstract class Type implements ByteBufReader, ByteBufWriter { public static final Type VILLAGER_DATA = new VillagerDataType(); + public static final Type PARTICLE_1_14 = new Particle1_14Type(); + /* 1.13 Flat Item (no data) */ public static final Type FLAT_ITEM = new FlatItemType(); public static final Type FLAT_VAR_INT_ITEM = new FlatVarIntItemType(); diff --git a/common/src/main/java/us/myles/ViaVersion/api/type/types/minecraft/Particle1_14Type.java b/common/src/main/java/us/myles/ViaVersion/api/type/types/minecraft/Particle1_14Type.java new file mode 100644 index 000000000..35dd30fa8 --- /dev/null +++ b/common/src/main/java/us/myles/ViaVersion/api/type/types/minecraft/Particle1_14Type.java @@ -0,0 +1,46 @@ +package us.myles.ViaVersion.api.type.types.minecraft; + +import io.netty.buffer.ByteBuf; +import us.myles.ViaVersion.api.type.Type; +import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.Particle; + +public class Particle1_14Type extends Type { + + public Particle1_14Type() { + super("Particle", Particle.class); + } + + @Override + public void write(ByteBuf buffer, Particle object) throws Exception { + Type.VAR_INT.write(buffer, object.getId()); + for (Particle.ParticleData data : object.getArguments()) + data.getType().write(buffer, data.getValue()); + } + + @Override + public Particle read(ByteBuf buffer) throws Exception { + int type = Type.VAR_INT.read(buffer); + Particle particle = new Particle(type); + + switch (type) { + // Block / Falling Dust / + case 3: + case 23: + particle.getArguments().add(new Particle.ParticleData(Type.VAR_INT, Type.VAR_INT.read(buffer))); // Flat Block + break; + // Dust + case 14: + particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.read(buffer))); // Red 0 - 1 + particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.read(buffer))); // Green 0 - 1 + particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.read(buffer))); // Blue 0 - 1 + particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.read(buffer)));// Scale 0.01 - 4 + break; + // Item + case 32: + particle.getArguments().add(new Particle.ParticleData(Type.FLAT_VAR_INT_ITEM, Type.FLAT_VAR_INT_ITEM.read(buffer))); // Flat item + break; + } + return particle; + } +} + From 000313ee9af971a48d9eec617fefb8cee774bd18 Mon Sep 17 00:00:00 2001 From: Marco Neuhaus Date: Mon, 11 Nov 2019 12:29:51 +0100 Subject: [PATCH 03/36] move particle type --- .../api/minecraft/metadata/types/MetaType1_14.java | 4 ++-- .../src/main/java/us/myles/ViaVersion/api/type/Type.java | 3 --- .../myles/ViaVersion/api/type/types/version/Types1_14.java | 7 +++++++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/api/minecraft/metadata/types/MetaType1_14.java b/common/src/main/java/us/myles/ViaVersion/api/minecraft/metadata/types/MetaType1_14.java index 013ee97e3..e268c6555 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/minecraft/metadata/types/MetaType1_14.java +++ b/common/src/main/java/us/myles/ViaVersion/api/minecraft/metadata/types/MetaType1_14.java @@ -4,7 +4,7 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; import us.myles.ViaVersion.api.minecraft.metadata.MetaType; import us.myles.ViaVersion.api.type.Type; -import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.Protocol1_13_2To1_13_1; +import us.myles.ViaVersion.api.type.types.version.Types1_14; @RequiredArgsConstructor @Getter @@ -24,7 +24,7 @@ public enum MetaType1_14 implements MetaType { OptUUID(12, Type.OPTIONAL_UUID), BlockID(13, Type.VAR_INT), NBTTag(14, Type.NBT), - PARTICLE(15, Type.PARTICLE_1_14), + PARTICLE(15, Types1_14.PARTICLE), VillagerData(16, Type.VILLAGER_DATA), OptVarInt(17, Type.OPTIONAL_VAR_INT), Pose(18, Type.VAR_INT), diff --git a/common/src/main/java/us/myles/ViaVersion/api/type/Type.java b/common/src/main/java/us/myles/ViaVersion/api/type/Type.java index 2262d7c05..25c6cd0ab 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/type/Type.java +++ b/common/src/main/java/us/myles/ViaVersion/api/type/Type.java @@ -7,7 +7,6 @@ import us.myles.ViaVersion.api.minecraft.*; import us.myles.ViaVersion.api.minecraft.item.Item; import us.myles.ViaVersion.api.type.types.*; import us.myles.ViaVersion.api.type.types.minecraft.*; -import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.Particle; import java.util.UUID; @@ -77,8 +76,6 @@ public abstract class Type implements ByteBufReader, ByteBufWriter { public static final Type VILLAGER_DATA = new VillagerDataType(); - public static final Type PARTICLE_1_14 = new Particle1_14Type(); - /* 1.13 Flat Item (no data) */ public static final Type FLAT_ITEM = new FlatItemType(); public static final Type FLAT_VAR_INT_ITEM = new FlatVarIntItemType(); diff --git a/common/src/main/java/us/myles/ViaVersion/api/type/types/version/Types1_14.java b/common/src/main/java/us/myles/ViaVersion/api/type/types/version/Types1_14.java index 161e78c9e..14238aa5b 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/type/types/version/Types1_14.java +++ b/common/src/main/java/us/myles/ViaVersion/api/type/types/version/Types1_14.java @@ -2,6 +2,8 @@ package us.myles.ViaVersion.api.type.types.version; import us.myles.ViaVersion.api.minecraft.metadata.Metadata; import us.myles.ViaVersion.api.type.Type; +import us.myles.ViaVersion.api.type.types.minecraft.Particle1_14Type; +import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.Particle; import java.util.List; @@ -15,4 +17,9 @@ public class Types1_14 { * Metadata type for 1.14 */ public static final Type METADATA = new Metadata1_14Type(); + + /** + * Particle type for 1.14 + */ + public static final Type PARTICLE = new Particle1_14Type(); } From 3b97f843cd505dd83ac69f4ea7ce18d00a5be4bb Mon Sep 17 00:00:00 2001 From: Marco Neuhaus Date: Wed, 13 Nov 2019 22:28:23 +0100 Subject: [PATCH 04/36] relocate classes --- .../api/minecraft/metadata/types/MetaType1_13.java | 4 ++-- .../api/minecraft/metadata/types/MetaType1_13_2.java | 4 ++-- .../data => api/type/types}/Particle.java | 2 +- .../api/type/types/minecraft/Particle1_14Type.java | 2 +- .../myles/ViaVersion/api/type/types/version/Types1_13.java | 7 +++++++ .../ViaVersion/api/type/types/version/Types1_13_2.java | 7 +++++++ .../myles/ViaVersion/api/type/types/version/Types1_14.java | 2 +- .../protocol1_13_2to1_13_1/Protocol1_13_2To1_13_1.java | 2 -- .../protocol1_13_2to1_13_1/types/Particle1_13_2Type.java | 2 +- .../protocols/protocol1_13to1_12_2/MetadataRewriter.java | 2 +- .../protocol1_13to1_12_2/Protocol1_13To1_12_2.java | 2 -- .../protocol1_13to1_12_2/data/ParticleRewriter.java | 1 + .../protocol1_13to1_12_2/packets/WorldPackets.java | 2 +- .../protocol1_13to1_12_2/types/Particle1_13Type.java | 2 +- .../protocols/protocol1_14to1_13_2/MetadataRewriter.java | 2 +- 15 files changed, 27 insertions(+), 16 deletions(-) rename common/src/main/java/us/myles/ViaVersion/{protocols/protocol1_13to1_12_2/data => api/type/types}/Particle.java (87%) diff --git a/common/src/main/java/us/myles/ViaVersion/api/minecraft/metadata/types/MetaType1_13.java b/common/src/main/java/us/myles/ViaVersion/api/minecraft/metadata/types/MetaType1_13.java index 7295201fe..d3594150f 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/minecraft/metadata/types/MetaType1_13.java +++ b/common/src/main/java/us/myles/ViaVersion/api/minecraft/metadata/types/MetaType1_13.java @@ -4,7 +4,7 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; import us.myles.ViaVersion.api.minecraft.metadata.MetaType; import us.myles.ViaVersion.api.type.Type; -import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2; +import us.myles.ViaVersion.api.type.types.version.Types1_13; @RequiredArgsConstructor @Getter @@ -24,7 +24,7 @@ public enum MetaType1_13 implements MetaType { OptUUID(12, Type.OPTIONAL_UUID), BlockID(13, Type.VAR_INT), NBTTag(14, Type.NBT), - PARTICLE(15, Protocol1_13To1_12_2.PARTICLE_TYPE), + PARTICLE(15, Types1_13.PARTICLE), Discontinued(99, null); private final int typeID; diff --git a/common/src/main/java/us/myles/ViaVersion/api/minecraft/metadata/types/MetaType1_13_2.java b/common/src/main/java/us/myles/ViaVersion/api/minecraft/metadata/types/MetaType1_13_2.java index a9646a8d0..e1b9fefa4 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/minecraft/metadata/types/MetaType1_13_2.java +++ b/common/src/main/java/us/myles/ViaVersion/api/minecraft/metadata/types/MetaType1_13_2.java @@ -4,7 +4,7 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; import us.myles.ViaVersion.api.minecraft.metadata.MetaType; import us.myles.ViaVersion.api.type.Type; -import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.Protocol1_13_2To1_13_1; +import us.myles.ViaVersion.api.type.types.version.Types1_13_2; @RequiredArgsConstructor @Getter @@ -24,7 +24,7 @@ public enum MetaType1_13_2 implements MetaType { OptUUID(12, Type.OPTIONAL_UUID), BlockID(13, Type.VAR_INT), NBTTag(14, Type.NBT), - PARTICLE(15, Protocol1_13_2To1_13_1.PARTICLE_TYPE), + PARTICLE(15, Types1_13_2.PARTICLE), Discontinued(99, null); private final int typeID; diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/data/Particle.java b/common/src/main/java/us/myles/ViaVersion/api/type/types/Particle.java similarity index 87% rename from common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/data/Particle.java rename to common/src/main/java/us/myles/ViaVersion/api/type/types/Particle.java index b6e786120..5a5013935 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/data/Particle.java +++ b/common/src/main/java/us/myles/ViaVersion/api/type/types/Particle.java @@ -1,4 +1,4 @@ -package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data; +package us.myles.ViaVersion.api.type.types; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/common/src/main/java/us/myles/ViaVersion/api/type/types/minecraft/Particle1_14Type.java b/common/src/main/java/us/myles/ViaVersion/api/type/types/minecraft/Particle1_14Type.java index 35dd30fa8..1510dd0fa 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/type/types/minecraft/Particle1_14Type.java +++ b/common/src/main/java/us/myles/ViaVersion/api/type/types/minecraft/Particle1_14Type.java @@ -2,7 +2,7 @@ package us.myles.ViaVersion.api.type.types.minecraft; import io.netty.buffer.ByteBuf; import us.myles.ViaVersion.api.type.Type; -import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.Particle; +import us.myles.ViaVersion.api.type.types.Particle; public class Particle1_14Type extends Type { diff --git a/common/src/main/java/us/myles/ViaVersion/api/type/types/version/Types1_13.java b/common/src/main/java/us/myles/ViaVersion/api/type/types/version/Types1_13.java index f8781f751..4bd78bbbf 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/type/types/version/Types1_13.java +++ b/common/src/main/java/us/myles/ViaVersion/api/type/types/version/Types1_13.java @@ -3,6 +3,8 @@ package us.myles.ViaVersion.api.type.types.version; import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection; import us.myles.ViaVersion.api.minecraft.metadata.Metadata; import us.myles.ViaVersion.api.type.Type; +import us.myles.ViaVersion.api.type.types.Particle; +import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types.Particle1_13Type; import java.util.List; @@ -18,4 +20,9 @@ public class Types1_13 { public static final Type METADATA = new Metadata1_13Type(); public static final Type CHUNK_SECTION = new ChunkSectionType1_13(); + + /** + * Particle type for 1.13 + */ + public static Type PARTICLE = new Particle1_13Type(); } diff --git a/common/src/main/java/us/myles/ViaVersion/api/type/types/version/Types1_13_2.java b/common/src/main/java/us/myles/ViaVersion/api/type/types/version/Types1_13_2.java index 643f2efb2..912ac6c95 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/type/types/version/Types1_13_2.java +++ b/common/src/main/java/us/myles/ViaVersion/api/type/types/version/Types1_13_2.java @@ -2,6 +2,8 @@ package us.myles.ViaVersion.api.type.types.version; import us.myles.ViaVersion.api.minecraft.metadata.Metadata; import us.myles.ViaVersion.api.type.Type; +import us.myles.ViaVersion.api.type.types.Particle; +import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.types.Particle1_13_2Type; import java.util.List; @@ -15,4 +17,9 @@ public class Types1_13_2 { * Metadata type for 1.13 */ public static final Type METADATA = new Metadata1_13_2Type(); + + /** + * Particle type for 1.13.2 + */ + public static Type PARTICLE = new Particle1_13_2Type(); } diff --git a/common/src/main/java/us/myles/ViaVersion/api/type/types/version/Types1_14.java b/common/src/main/java/us/myles/ViaVersion/api/type/types/version/Types1_14.java index 14238aa5b..9c091596c 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/type/types/version/Types1_14.java +++ b/common/src/main/java/us/myles/ViaVersion/api/type/types/version/Types1_14.java @@ -2,8 +2,8 @@ package us.myles.ViaVersion.api.type.types.version; import us.myles.ViaVersion.api.minecraft.metadata.Metadata; import us.myles.ViaVersion.api.type.Type; +import us.myles.ViaVersion.api.type.types.Particle; import us.myles.ViaVersion.api.type.types.minecraft.Particle1_14Type; -import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.Particle; import java.util.List; diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13_2to1_13_1/Protocol1_13_2To1_13_1.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13_2to1_13_1/Protocol1_13_2To1_13_1.java index b036dee34..166c3becf 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13_2to1_13_1/Protocol1_13_2To1_13_1.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13_2to1_13_1/Protocol1_13_2To1_13_1.java @@ -11,10 +11,8 @@ import us.myles.ViaVersion.packets.State; import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.packets.EntityPackets; import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.packets.InventoryPackets; import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.packets.WorldPackets; -import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.types.Particle1_13_2Type; public class Protocol1_13_2To1_13_1 extends Protocol { - public static final Particle1_13_2Type PARTICLE_TYPE = new Particle1_13_2Type(); @Override protected void registerPackets() { diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13_2to1_13_1/types/Particle1_13_2Type.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13_2to1_13_1/types/Particle1_13_2Type.java index 7f53c1b28..7cba75adf 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13_2to1_13_1/types/Particle1_13_2Type.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13_2to1_13_1/types/Particle1_13_2Type.java @@ -2,7 +2,7 @@ package us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.types; import io.netty.buffer.ByteBuf; import us.myles.ViaVersion.api.type.Type; -import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.Particle; +import us.myles.ViaVersion.api.type.types.Particle; public class Particle1_13_2Type extends Type { public Particle1_13_2Type() { diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/MetadataRewriter.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/MetadataRewriter.java index 6c8f8494f..58679a2c7 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/MetadataRewriter.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/MetadataRewriter.java @@ -6,7 +6,7 @@ import us.myles.ViaVersion.api.entities.Entity1_13Types; import us.myles.ViaVersion.api.minecraft.item.Item; import us.myles.ViaVersion.api.minecraft.metadata.Metadata; import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_13; -import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.Particle; +import us.myles.ViaVersion.api.type.types.Particle; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.ParticleRewriter; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.InventoryPackets; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.WorldPackets; diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/Protocol1_13To1_12_2.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/Protocol1_13To1_12_2.java index 9039c7168..bbcd6ebee 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/Protocol1_13To1_12_2.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/Protocol1_13To1_12_2.java @@ -32,7 +32,6 @@ import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.BlockConnectio import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.BlockStorage; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.EntityTracker; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.TabCompleteTracker; -import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types.Particle1_13Type; import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; import us.myles.ViaVersion.util.GsonUtil; @@ -41,7 +40,6 @@ import java.util.Map; // Development of 1.13 support! public class Protocol1_13To1_12_2 extends Protocol { - public static final Particle1_13Type PARTICLE_TYPE = new Particle1_13Type(); public static final PacketHandler POS_TO_3_INT = new PacketHandler() { @Override diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/data/ParticleRewriter.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/data/ParticleRewriter.java index e700ac779..bf1e78d77 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/data/ParticleRewriter.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/data/ParticleRewriter.java @@ -5,6 +5,7 @@ import lombok.RequiredArgsConstructor; import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.minecraft.item.Item; import us.myles.ViaVersion.api.type.Type; +import us.myles.ViaVersion.api.type.types.Particle; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.InventoryPackets; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.WorldPackets; diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java index a5b82467d..a7b9b98af 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java @@ -19,7 +19,7 @@ import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.blockconnections.Conne import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.blockconnections.ConnectionHandler; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.NamedSoundRewriter; -import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.Particle; +import us.myles.ViaVersion.api.type.types.Particle; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.ParticleRewriter; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers.BlockEntityProvider; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers.PaintingProvider; diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/types/Particle1_13Type.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/types/Particle1_13Type.java index 0002e4859..989474674 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/types/Particle1_13Type.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/types/Particle1_13Type.java @@ -2,7 +2,7 @@ package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types; import io.netty.buffer.ByteBuf; import us.myles.ViaVersion.api.type.Type; -import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.Particle; +import us.myles.ViaVersion.api.type.types.Particle; // TODO make future proof public class Particle1_13Type extends Type { diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/MetadataRewriter.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/MetadataRewriter.java index 6d9095d67..31685902b 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/MetadataRewriter.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/MetadataRewriter.java @@ -9,7 +9,7 @@ import us.myles.ViaVersion.api.minecraft.item.Item; import us.myles.ViaVersion.api.minecraft.metadata.Metadata; import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_14; import us.myles.ViaVersion.api.type.Type; -import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.Particle; +import us.myles.ViaVersion.api.type.types.Particle; import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.packets.InventoryPackets; import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.storage.EntityTracker; From 582e4a11d4529e258bc0e3d3f961ae51fcb732ad Mon Sep 17 00:00:00 2001 From: Gerrygames Date: Thu, 21 Nov 2019 18:34:29 +0100 Subject: [PATCH 05/36] 1.15 pre1 --- bukkit/pom.xml | 2 +- bungee/pom.xml | 2 +- common/pom.xml | 2 +- .../java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java | 2 +- jar/pom.xml | 2 +- pom.xml | 2 +- sponge-legacy/pom.xml | 2 +- sponge/pom.xml | 2 +- velocity/pom.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bukkit/pom.xml b/bukkit/pom.xml index 92805b96a..7d73e52f5 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-19w46b + 2.1.4-1.15-pre1 4.0.0 diff --git a/bungee/pom.xml b/bungee/pom.xml index 6e51f7da8..c62a82066 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-19w46b + 2.1.4-1.15-pre1 4.0.0 diff --git a/common/pom.xml b/common/pom.xml index 0f683e191..a690e1a7b 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-19w46b + 2.1.4-1.15-pre1 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 0cf8bef8b..c50c6ed0f 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 @@ -77,7 +77,7 @@ public class ProtocolVersion { register(v1_14_2 = new ProtocolVersion(485, "1.14.2")); register(v1_14_3 = new ProtocolVersion(490, "1.14.3")); register(v1_14_4 = new ProtocolVersion(498, "1.14.4")); - register(v1_15 = new ProtocolVersion(564, "1.15")); + register(v1_15 = new ProtocolVersion(565, "1.15")); register(unknown = new ProtocolVersion(-1, "UNKNOWN")); } diff --git a/jar/pom.xml b/jar/pom.xml index c84efb3ee..fc59aa779 100644 --- a/jar/pom.xml +++ b/jar/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-19w46b + 2.1.4-1.15-pre1 4.0.0 viaversion-jar diff --git a/pom.xml b/pom.xml index 84bf82c4d..2791ec029 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ us.myles viaversion-parent - 2.1.4-19w46b + 2.1.4-1.15-pre1 pom viaversion-parent diff --git a/sponge-legacy/pom.xml b/sponge-legacy/pom.xml index 92aba1c98..bbc2c690f 100644 --- a/sponge-legacy/pom.xml +++ b/sponge-legacy/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-19w46b + 2.1.4-1.15-pre1 4.0.0 diff --git a/sponge/pom.xml b/sponge/pom.xml index 398e415c8..8eaad8168 100644 --- a/sponge/pom.xml +++ b/sponge/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-19w46b + 2.1.4-1.15-pre1 4.0.0 diff --git a/velocity/pom.xml b/velocity/pom.xml index 03dd57a97..6abef6140 100644 --- a/velocity/pom.xml +++ b/velocity/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-19w46b + 2.1.4-1.15-pre1 4.0.0 From 907516eb71947b42b754c817cb4ccab1f38f6b98 Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Fri, 22 Nov 2019 22:00:41 +0100 Subject: [PATCH 06/36] Hold config values in fields --- .../bukkit/platform/BukkitViaConfig.java | 38 +++- .../bungee/platform/BungeeViaConfig.java | 38 ++-- .../myles/ViaVersion/AbstractViaConfig.java | 199 +++++++++++++----- .../ViaVersion/api/ViaVersionConfig.java | 4 +- .../java/us/myles/ViaVersion/util/Config.java | 2 +- .../sponge/platform/SpongeViaConfig.java | 21 -- .../velocity/platform/VelocityViaConfig.java | 38 ++-- 7 files changed, 215 insertions(+), 125 deletions(-) diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaConfig.java b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaConfig.java index 49d7cf670..74caf2949 100644 --- a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaConfig.java +++ b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaConfig.java @@ -1,7 +1,7 @@ package us.myles.ViaVersion.bukkit.platform; +import org.bukkit.plugin.Plugin; import us.myles.ViaVersion.AbstractViaConfig; -import us.myles.ViaVersion.ViaVersionPlugin; import us.myles.ViaVersion.api.Via; import java.io.File; @@ -12,13 +12,25 @@ import java.util.Map; public class BukkitViaConfig extends AbstractViaConfig { private static final List UNSUPPORTED = Arrays.asList("bungee-ping-interval", "bungee-ping-save", "bungee-servers", "velocity-ping-interval", "velocity-ping-save", "velocity-servers"); + private boolean antiXRay; + private boolean quickMoveActionFix; + private boolean hitboxFix1_9; + private boolean hitboxFix1_14; public BukkitViaConfig() { - super(new File(((ViaVersionPlugin) Via.getPlatform()).getDataFolder(), "config.yml")); - // Load config + super(new File(((Plugin) Via.getPlatform()).getDataFolder(), "config.yml")); reloadConfig(); } + @Override + protected void loadFields() { + super.loadFields(); + antiXRay = getBoolean("anti-xray-patch", true); + quickMoveActionFix = getBoolean("quick-move-action-fix", false); + hitboxFix1_9 = getBoolean("change-1_9-hitbox", false); + hitboxFix1_14 = getBoolean("change-1_14-hitbox", false); + } + @Override public URL getDefaultConfigURL() { return BukkitViaConfig.class.getClassLoader().getResource("assets/viaversion/config.yml"); @@ -28,6 +40,26 @@ public class BukkitViaConfig extends AbstractViaConfig { protected void handleConfig(Map config) { } + @Override + public boolean isAntiXRay() { + return antiXRay; + } + + @Override + public boolean is1_12QuickMoveActionFix() { + return quickMoveActionFix; + } + + @Override + public boolean is1_9HitboxFix() { + return hitboxFix1_9; + } + + @Override + public boolean is1_14HitboxFix() { + return hitboxFix1_14; + } + @Override public List getUnsupportedOptions() { return UNSUPPORTED; diff --git a/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeViaConfig.java b/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeViaConfig.java index 2484e07cf..603a270e7 100644 --- a/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeViaConfig.java +++ b/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeViaConfig.java @@ -10,13 +10,23 @@ import java.util.*; public class BungeeViaConfig extends AbstractViaConfig { private static final List UNSUPPORTED = Arrays.asList("nms-player-ticking", "item-cache", "anti-xray-patch", "quick-move-action-fix", "velocity-ping-interval", "velocity-ping-save", "velocity-servers", "blockconnection-method", "change-1_9-hitbox", "change-1_14-hitbox"); + private int bungeePingInterval; + private boolean bungeePingSave; + private Map bungeeServerProtocols; public BungeeViaConfig(File configFile) { super(new File(configFile, "config.yml")); - // Load config reloadConfig(); } + @Override + protected void loadFields() { + super.loadFields(); + bungeePingInterval = getInt("bungee-ping-interval", 60); + bungeePingSave = getBoolean("bungee-ping-save", true); + bungeeServerProtocols = get("bungee-servers", Map.class, new HashMap<>()); + } + @Override public URL getDefaultConfigURL() { return BungeeViaConfig.class.getClassLoader().getResource("assets/viaversion/config.yml"); @@ -59,11 +69,6 @@ public class BungeeViaConfig extends AbstractViaConfig { return UNSUPPORTED; } - @Override - public boolean isAntiXRay() { - return false; - } - @Override public boolean isItemCache() { return false; @@ -74,26 +79,11 @@ public class BungeeViaConfig extends AbstractViaConfig { return false; } - @Override - public boolean is1_12QuickMoveActionFix() { - return false; - } - @Override public String getBlockConnectionMethod() { return "packet"; } - @Override - public boolean is1_9HitboxFix() { - return false; - } - - @Override - public boolean is1_14HitboxFix() { - return false; - } - /** * What is the interval for checking servers via ping * -1 for disabled @@ -101,7 +91,7 @@ public class BungeeViaConfig extends AbstractViaConfig { * @return Ping interval in seconds */ public int getBungeePingInterval() { - return getInt("bungee-ping-interval", 60); + return bungeePingInterval; } /** @@ -110,7 +100,7 @@ public class BungeeViaConfig extends AbstractViaConfig { * @return True if it should save */ public boolean isBungeePingSave() { - return getBoolean("bungee-ping-save", true); + return bungeePingSave; } /** @@ -120,6 +110,6 @@ public class BungeeViaConfig extends AbstractViaConfig { * @return Map of String, Integer */ public Map getBungeeServerProtocols() { - return get("bungee-servers", Map.class, new HashMap<>()); + return bungeeServerProtocols; } } diff --git a/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java b/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java index 175093948..09caf8007 100644 --- a/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java +++ b/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java @@ -4,252 +4,351 @@ import us.myles.ViaVersion.api.ViaVersionConfig; import us.myles.ViaVersion.util.Config; import java.io.File; -import java.util.List; +import java.util.HashSet; +import java.util.Set; public abstract class AbstractViaConfig extends Config implements ViaVersionConfig { + private boolean checkForUpdates; + private boolean preventCollision; + private boolean useNewEffectIndicator; + private boolean useNewDeathmessages; + private boolean suppressMetadataErrors; + private boolean shieldBlocking; + private boolean hologramPatch; + private boolean pistonAnimationPatch; + private boolean bossbarPatch; + private boolean bossbarAntiFlicker; + private double hologramOffset; + private int maxPPS; + private String maxPPSKickMessage; + private int trackingPeriod; + private int warningPPS; + private int maxPPSWarnings; + private String maxPPSWarningsKickMessage; + private boolean sendSupportedVersions; + private boolean simulatePlayerTick; + private boolean itemCache; + private boolean nmsPlayerTicking; + private boolean replacePistons; + private int pistonReplacementId; + private boolean autoTeam; + private boolean forceJsonTransform; + private boolean nbtArrayFix; + private Set blockedProtocols; + private String blockedDisconnectMessage; + private String reloadDisconnectMessage; + private boolean suppress1_13ConversionErrors; + private boolean disable1_13TabComplete; + private boolean minimizeCooldown; + private boolean teamColourFix; + private boolean serversideBlockConnections; + private String blockConnectionMethod; + private boolean reduceBlockStorageMemory; + private boolean flowerStemWhenBlockAbove; + private boolean snowCollisionFix; + private int tabCompleteDelay; + private boolean truncate1_14Books; + private boolean leftHandedHandling; + private boolean fullBlockLightFix; + private boolean healthNaNFix; + private boolean instantRespawn; + protected AbstractViaConfig(File configFile) { super(configFile); } + @Override + public void reloadConfig() { + super.reloadConfig(); + loadFields(); + } + + protected void loadFields() { + checkForUpdates = getBoolean("checkforupdates", true); + preventCollision = getBoolean("prevent-collision", true); + useNewEffectIndicator = getBoolean("use-new-effect-indicator", true); + useNewDeathmessages = getBoolean("use-new-deathmessages", true); + suppressMetadataErrors = getBoolean("suppress-metadata-errors", false); + shieldBlocking = getBoolean("shield-blocking", true); + hologramPatch = getBoolean("hologram-patch", false); + pistonAnimationPatch = getBoolean("piston-animation-patch", false); + bossbarPatch = getBoolean("bossbar-patch", true); + bossbarAntiFlicker = getBoolean("bossbar-anti-flicker", false); + hologramOffset = getDouble("hologram-y", -0.96D); + maxPPS = getInt("max-pps", 800); + maxPPSKickMessage = getString("max-pps-kick-msg", "Sending packets too fast? lag?"); + trackingPeriod = getInt("tracking-period", 6); + warningPPS = getInt("tracking-warning-pps", 120); + maxPPSWarnings = getInt("tracking-max-warnings", 3); + maxPPSWarningsKickMessage = getString("tracking-max-kick-msg", "You are sending too many packets, :("); + sendSupportedVersions = getBoolean("send-supported-versions", false); + simulatePlayerTick = getBoolean("simulate-pt", true); + itemCache = getBoolean("item-cache", true); + nmsPlayerTicking = getBoolean("nms-player-ticking", true); + replacePistons = getBoolean("replace-pistons", false); + pistonReplacementId = getInt("replacement-piston-id", 0); + autoTeam = getBoolean("auto-team", true); + forceJsonTransform = getBoolean("force-json-transform", false); + nbtArrayFix = getBoolean("chat-nbt-fix", true); + blockedProtocols = new HashSet<>(getIntegerList("block-protocols")); + blockedDisconnectMessage = getString("block-disconnect-msg", "You are using an unsupported Minecraft version!"); + reloadDisconnectMessage = getString("reload-disconnect-msg", "Server reload, please rejoin!"); + suppress1_13ConversionErrors = getBoolean("minimize-cooldown", true); + disable1_13TabComplete = getBoolean("team-colour-fix", true); + minimizeCooldown = getBoolean("suppress-1_13-conversion-errors", false); + teamColourFix = getBoolean("disable-1_13-auto-complete", false); + serversideBlockConnections = getBoolean("serverside-blockconnections", false); + blockConnectionMethod = getString("blockconnection-method", "packet"); + reduceBlockStorageMemory = getBoolean("reduce-blockstorage-memory", false); + flowerStemWhenBlockAbove = getBoolean("flowerstem-when-block-above", false); + snowCollisionFix = getBoolean("fix-low-snow-collision", false); + tabCompleteDelay = getInt("1_13-tab-complete-delay", 0); + truncate1_14Books = getBoolean("truncate-1_14-books", false); + leftHandedHandling = getBoolean("left-handed-handling", true); + fullBlockLightFix = getBoolean("fix-non-full-blocklight", false); + healthNaNFix = getBoolean("fix-1_14-health-nan", true); + instantRespawn = getBoolean("use-1_15-instant-respawn", false); + } + @Override public boolean isCheckForUpdates() { - return getBoolean("checkforupdates", true); + return checkForUpdates; } @Override public boolean isPreventCollision() { - return getBoolean("prevent-collision", true); + return preventCollision; } @Override public boolean isNewEffectIndicator() { - return getBoolean("use-new-effect-indicator", true); + return useNewEffectIndicator; } @Override public boolean isShowNewDeathMessages() { - return getBoolean("use-new-deathmessages", true); + return useNewDeathmessages; } @Override public boolean isSuppressMetadataErrors() { - return getBoolean("suppress-metadata-errors", false); + return suppressMetadataErrors; } @Override public boolean isShieldBlocking() { - return getBoolean("shield-blocking", true); + return shieldBlocking; } @Override public boolean isHologramPatch() { - return getBoolean("hologram-patch", false); + return hologramPatch; } @Override public boolean isPistonAnimationPatch() { - return getBoolean("piston-animation-patch", false); + return pistonAnimationPatch; } @Override public boolean isBossbarPatch() { - return getBoolean("bossbar-patch", true); + return bossbarPatch; } @Override public boolean isBossbarAntiflicker() { - return getBoolean("bossbar-anti-flicker", false); + return bossbarAntiFlicker; } @Override public double getHologramYOffset() { - return getDouble("hologram-y", -0.96D); + return hologramOffset; } @Override public int getMaxPPS() { - return getInt("max-pps", 800); + return maxPPS; } @Override public String getMaxPPSKickMessage() { - return getString("max-pps-kick-msg", "Sending packets too fast? lag?"); + return maxPPSKickMessage; } @Override public int getTrackingPeriod() { - return getInt("tracking-period", 6); + return trackingPeriod; } @Override public int getWarningPPS() { - return getInt("tracking-warning-pps", 120); + return warningPPS; } @Override public int getMaxWarnings() { - return getInt("tracking-max-warnings", 3); + return maxPPSWarnings; } @Override public String getMaxWarningsKickMessage() { - return getString("tracking-max-kick-msg", "You are sending too many packets, :("); + return maxPPSWarningsKickMessage; } @Override public boolean isAntiXRay() { - return getBoolean("anti-xray-patch", true); + return false; } @Override public boolean isSendSupportedVersions() { - return getBoolean("send-supported-versions", false); + return sendSupportedVersions; } @Override public boolean isStimulatePlayerTick() { - return getBoolean("simulate-pt", true); + return simulatePlayerTick; } @Override public boolean isItemCache() { - return getBoolean("item-cache", true); + return itemCache; } @Override public boolean isNMSPlayerTicking() { - return getBoolean("nms-player-ticking", true); + return nmsPlayerTicking; } @Override public boolean isReplacePistons() { - return getBoolean("replace-pistons", false); + return replacePistons; } @Override public int getPistonReplacementId() { - return getInt("replacement-piston-id", 0); + return pistonReplacementId; } @Override public boolean isAutoTeam() { // Collision has to be enabled first - return isPreventCollision() && getBoolean("auto-team", true); + return isPreventCollision() && autoTeam; } @Override public boolean isForceJsonTransform() { - return getBoolean("force-json-transform", false); + return forceJsonTransform; } @Override public boolean is1_12NBTArrayFix() { - return getBoolean("chat-nbt-fix", true); + return nbtArrayFix; } @Override public boolean is1_12QuickMoveActionFix() { - return getBoolean("quick-move-action-fix", false); + return false; } @Override - public List getBlockedProtocols() { - return getIntegerList("block-protocols"); + public Set getBlockedProtocols() { + return blockedProtocols; } @Override public String getBlockedDisconnectMsg() { - return getString("block-disconnect-msg", "You are using an unsupported Minecraft version!"); + return blockedDisconnectMessage; } @Override public String getReloadDisconnectMsg() { - return getString("reload-disconnect-msg", "Server reload, please rejoin!"); + return reloadDisconnectMessage; } @Override public boolean isMinimizeCooldown() { - return getBoolean("minimize-cooldown", true); + return suppress1_13ConversionErrors; } @Override public boolean is1_13TeamColourFix() { - return getBoolean("team-colour-fix", true); + return disable1_13TabComplete; } @Override public boolean isSuppress1_13ConversionErrors() { - return getBoolean("suppress-1_13-conversion-errors", false); + return minimizeCooldown; } @Override public boolean isDisable1_13AutoComplete() { - return getBoolean("disable-1_13-auto-complete", false); + return teamColourFix; } @Override public boolean isServersideBlockConnections() { - return getBoolean("serverside-blockconnections", false); + return serversideBlockConnections; } @Override public String getBlockConnectionMethod() { - return getString("blockconnection-method", "packet"); + return blockConnectionMethod; } @Override public boolean isReduceBlockStorageMemory() { - return getBoolean("reduce-blockstorage-memory", false); + return reduceBlockStorageMemory; } @Override public boolean isStemWhenBlockAbove() { - return getBoolean("flowerstem-when-block-above", false); + return flowerStemWhenBlockAbove; } @Override public boolean isSnowCollisionFix() { - return getBoolean("fix-low-snow-collision", false); + return snowCollisionFix; } @Override public int get1_13TabCompleteDelay() { - return getInt("1_13-tab-complete-delay", 0); + return tabCompleteDelay; } @Override public boolean isTruncate1_14Books() { - return getBoolean("truncate-1_14-books", false); + return truncate1_14Books; } @Override public boolean isLeftHandedHandling() { - return getBoolean("left-handed-handling", true); + return leftHandedHandling; } @Override public boolean is1_9HitboxFix() { - return getBoolean("change-1_9-hitbox", false); + return false; } @Override public boolean is1_14HitboxFix() { - return getBoolean("change-1_14-hitbox", false); + return false; } @Override public boolean isNonFullBlockLightFix() { - return getBoolean("fix-non-full-blocklight", false); + return fullBlockLightFix; } @Override public boolean is1_14HealthNaNFix() { - return getBoolean("fix-1_14-health-nan", true); + return healthNaNFix; } @Override public boolean is1_15InstantRespawn() { - return getBoolean("use-1_15-instant-respawn", false); + return instantRespawn; } } diff --git a/common/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java b/common/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java index 3ef26d04d..b321698bf 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java +++ b/common/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java @@ -1,6 +1,6 @@ package us.myles.ViaVersion.api; -import java.util.List; +import java.util.Set; public interface ViaVersionConfig { @@ -213,7 +213,7 @@ public interface ViaVersionConfig { * * @return An Integer list */ - List getBlockedProtocols(); + Set getBlockedProtocols(); /** * Get the custom disconnect message diff --git a/common/src/main/java/us/myles/ViaVersion/util/Config.java b/common/src/main/java/us/myles/ViaVersion/util/Config.java index 0ad123812..522d18cfc 100644 --- a/common/src/main/java/us/myles/ViaVersion/util/Config.java +++ b/common/src/main/java/us/myles/ViaVersion/util/Config.java @@ -24,7 +24,7 @@ public abstract class Config implements ConfigurationProvider { private final CommentStore commentStore = new CommentStore('.', 2); private final File configFile; - private ConcurrentSkipListMap config; + private Map config; /** * Create a new Config instance, this will *not* load the config by default. diff --git a/sponge/src/main/java/us/myles/ViaVersion/sponge/platform/SpongeViaConfig.java b/sponge/src/main/java/us/myles/ViaVersion/sponge/platform/SpongeViaConfig.java index 5193ebe3e..1306b754b 100644 --- a/sponge/src/main/java/us/myles/ViaVersion/sponge/platform/SpongeViaConfig.java +++ b/sponge/src/main/java/us/myles/ViaVersion/sponge/platform/SpongeViaConfig.java @@ -18,7 +18,6 @@ public class SpongeViaConfig extends AbstractViaConfig { public SpongeViaConfig(PluginContainer pluginContainer, File configFile) { super(new File(configFile, "config.yml")); this.pluginContainer = pluginContainer; - // Load config reloadConfig(); } @@ -39,24 +38,4 @@ public class SpongeViaConfig extends AbstractViaConfig { public List getUnsupportedOptions() { return UNSUPPORTED; } - - @Override - public boolean isAntiXRay() { - return false; - } - - @Override - public boolean is1_12QuickMoveActionFix() { - return false; - } - - @Override - public boolean is1_9HitboxFix() { - return false; - } - - @Override - public boolean is1_14HitboxFix() { - return false; - } } diff --git a/velocity/src/main/java/us/myles/ViaVersion/velocity/platform/VelocityViaConfig.java b/velocity/src/main/java/us/myles/ViaVersion/velocity/platform/VelocityViaConfig.java index ff0489b68..378c00968 100644 --- a/velocity/src/main/java/us/myles/ViaVersion/velocity/platform/VelocityViaConfig.java +++ b/velocity/src/main/java/us/myles/ViaVersion/velocity/platform/VelocityViaConfig.java @@ -9,13 +9,23 @@ import java.util.*; public class VelocityViaConfig extends AbstractViaConfig { private static final List UNSUPPORTED = Arrays.asList("nms-player-ticking", "item-cache", "anti-xray-patch", "quick-move-action-fix", "bungee-ping-interval", "bungee-ping-save", "bungee-servers", "blockconnection-method", "change-1_9-hitbox", "change-1_14-hitbox"); + private int velocityPingInterval; + private boolean velocityPingSave; + private Map velocityServerProtocols; public VelocityViaConfig(File configFile) { super(new File(configFile, "config.yml")); - // Load config reloadConfig(); } + @Override + protected void loadFields() { + super.loadFields(); + velocityPingInterval = getInt("velocity-ping-interval", 60); + velocityPingSave = getBoolean("velocity-ping-save", true); + velocityServerProtocols = get("velocity-servers", Map.class, new HashMap<>()); + } + @Override public URL getDefaultConfigURL() { return getClass().getClassLoader().getResource("assets/viaversion/config.yml"); @@ -64,11 +74,6 @@ public class VelocityViaConfig extends AbstractViaConfig { return UNSUPPORTED; } - @Override - public boolean isAntiXRay() { - return false; - } - @Override public boolean isItemCache() { return false; @@ -79,26 +84,11 @@ public class VelocityViaConfig extends AbstractViaConfig { return false; } - @Override - public boolean is1_12QuickMoveActionFix() { - return false; - } - @Override public String getBlockConnectionMethod() { return "packet"; } - @Override - public boolean is1_9HitboxFix() { - return false; - } - - @Override - public boolean is1_14HitboxFix() { - return false; - } - /** * What is the interval for checking servers via ping * -1 for disabled @@ -106,7 +96,7 @@ public class VelocityViaConfig extends AbstractViaConfig { * @return Ping interval in seconds */ public int getVelocityPingInterval() { - return getInt("velocity-ping-interval", 60); + return velocityPingInterval; } /** @@ -115,7 +105,7 @@ public class VelocityViaConfig extends AbstractViaConfig { * @return True if it should save */ public boolean isVelocityPingSave() { - return getBoolean("velocity-ping-save", true); + return velocityPingSave; } /** @@ -125,6 +115,6 @@ public class VelocityViaConfig extends AbstractViaConfig { * @return Map of String, Integer */ public Map getVelocityServerProtocols() { - return get("velocity-servers", Map.class, new HashMap<>()); + return velocityServerProtocols; } } From 501adc503ced40d6dbfe04199ecdf31620512d74 Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Fri, 22 Nov 2019 22:39:34 +0100 Subject: [PATCH 07/36] Fix typo in simulatePlayerTick getter --- common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java | 2 +- .../src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java | 2 +- .../ViaVersion/protocols/protocol1_9to1_8/Protocol1_9To1_8.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java b/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java index 09caf8007..6df3f83bb 100644 --- a/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java +++ b/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java @@ -207,7 +207,7 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf } @Override - public boolean isStimulatePlayerTick() { + public boolean isSimulatePlayerTick() { return simulatePlayerTick; } diff --git a/common/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java b/common/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java index b321698bf..f4eb99c05 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java +++ b/common/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java @@ -150,7 +150,7 @@ public interface ViaVersionConfig { * * @return if true, enabled */ - boolean isStimulatePlayerTick(); + boolean isSimulatePlayerTick(); /** * Use the item cache to prevent high resource usage diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/Protocol1_9To1_8.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/Protocol1_9To1_8.java index d524fa93e..ac4cd7c77 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/Protocol1_9To1_8.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/Protocol1_9To1_8.java @@ -100,7 +100,7 @@ public class Protocol1_9To1_8 extends Protocol { providers.register(BossBarProvider.class, new BossBarProvider()); providers.register(MainHandProvider.class, new MainHandProvider()); providers.require(MovementTransmitterProvider.class); - if (Via.getConfig().isStimulatePlayerTick()) { + if (Via.getConfig().isSimulatePlayerTick()) { Via.getPlatform().runRepeatingSync(new ViaIdleThread(), 1L); } } From c478492227220ac5a0ae7b06490214995ea88120 Mon Sep 17 00:00:00 2001 From: Gerrygames Date: Sun, 24 Nov 2019 11:52:04 +0100 Subject: [PATCH 08/36] fix missing boss bar packet remap --- .../protocols/protocol1_15to1_14_4/Protocol1_15To1_14_4.java | 1 + 1 file changed, 1 insertion(+) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/Protocol1_15To1_14_4.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/Protocol1_15To1_14_4.java index efca9457e..826ebd5d4 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/Protocol1_15To1_14_4.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/Protocol1_15To1_14_4.java @@ -158,6 +158,7 @@ public class Protocol1_15To1_14_4 extends Protocol { registerOutgoing(State.PLAY, 0x08, 0x09); registerOutgoing(State.PLAY, 0x09, 0x0A); + registerOutgoing(State.PLAY, 0x0C, 0x0D); registerOutgoing(State.PLAY, 0x0D, 0x0E); registerOutgoing(State.PLAY, 0x0E, 0x0F); registerOutgoing(State.PLAY, 0x10, 0x11); From a8a33a3a2b487def4af795791f49bc16e92d6817 Mon Sep 17 00:00:00 2001 From: creeper123123321 <7974274+creeper123123321@users.noreply.github.com> Date: Sun, 24 Nov 2019 09:04:37 -0300 Subject: [PATCH 09/36] add exception for wrong protocol --- .../main/java/us/myles/ViaVersion/api/PacketWrapper.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/api/PacketWrapper.java b/common/src/main/java/us/myles/ViaVersion/api/PacketWrapper.java index 29f583064..950bbfac8 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/PacketWrapper.java +++ b/common/src/main/java/us/myles/ViaVersion/api/PacketWrapper.java @@ -18,10 +18,7 @@ import us.myles.ViaVersion.protocols.base.ProtocolInfo; import us.myles.ViaVersion.util.PipelineUtil; import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; +import java.util.*; public class PacketWrapper { public static final int PASSTHROUGH_ID = 1000; @@ -326,13 +323,14 @@ public class PacketWrapper { // Other way if outgoing Collections.reverse(protocols); } - int index = 0; + int index = -1; for (int i = 0; i < protocols.size(); i++) { if (protocols.get(i).getClass().equals(packetProtocol)) { index = skipCurrentPipeline ? (i + 1) : (i); break; } } + if (index == -1) throw new NoSuchElementException(packetProtocol.getCanonicalName()); // Reset reader before we start resetReader(); From 21cad97f3f6742a6b543851fe55581249dfedb31 Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Mon, 25 Nov 2019 18:34:55 +0100 Subject: [PATCH 10/36] Some fixes, move blockconnection method to bukkit config --- .../ViaVersion/bukkit/platform/BukkitViaConfig.java | 7 +++++++ .../ViaVersion/bungee/platform/BungeeViaConfig.java | 5 ----- .../java/us/myles/ViaVersion/AbstractViaConfig.java | 12 +++++------- .../velocity/platform/VelocityViaConfig.java | 5 ----- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaConfig.java b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaConfig.java index 74caf2949..febaded66 100644 --- a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaConfig.java +++ b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaConfig.java @@ -16,6 +16,7 @@ public class BukkitViaConfig extends AbstractViaConfig { private boolean quickMoveActionFix; private boolean hitboxFix1_9; private boolean hitboxFix1_14; + private String blockConnectionMethod; public BukkitViaConfig() { super(new File(((Plugin) Via.getPlatform()).getDataFolder(), "config.yml")); @@ -29,6 +30,7 @@ public class BukkitViaConfig extends AbstractViaConfig { quickMoveActionFix = getBoolean("quick-move-action-fix", false); hitboxFix1_9 = getBoolean("change-1_9-hitbox", false); hitboxFix1_14 = getBoolean("change-1_14-hitbox", false); + blockConnectionMethod = getString("blockconnection-method", "packet"); } @Override @@ -60,6 +62,11 @@ public class BukkitViaConfig extends AbstractViaConfig { return hitboxFix1_14; } + @Override + public String getBlockConnectionMethod() { + return blockConnectionMethod; + } + @Override public List getUnsupportedOptions() { return UNSUPPORTED; diff --git a/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeViaConfig.java b/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeViaConfig.java index 603a270e7..7729c8557 100644 --- a/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeViaConfig.java +++ b/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeViaConfig.java @@ -79,11 +79,6 @@ public class BungeeViaConfig extends AbstractViaConfig { return false; } - @Override - public String getBlockConnectionMethod() { - return "packet"; - } - /** * What is the interval for checking servers via ping * -1 for disabled diff --git a/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java b/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java index 6df3f83bb..dde19b06f 100644 --- a/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java +++ b/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java @@ -43,7 +43,6 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf private boolean minimizeCooldown; private boolean teamColourFix; private boolean serversideBlockConnections; - private String blockConnectionMethod; private boolean reduceBlockStorageMemory; private boolean flowerStemWhenBlockAbove; private boolean snowCollisionFix; @@ -94,12 +93,11 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf blockedProtocols = new HashSet<>(getIntegerList("block-protocols")); blockedDisconnectMessage = getString("block-disconnect-msg", "You are using an unsupported Minecraft version!"); reloadDisconnectMessage = getString("reload-disconnect-msg", "Server reload, please rejoin!"); - suppress1_13ConversionErrors = getBoolean("minimize-cooldown", true); - disable1_13TabComplete = getBoolean("team-colour-fix", true); - minimizeCooldown = getBoolean("suppress-1_13-conversion-errors", false); - teamColourFix = getBoolean("disable-1_13-auto-complete", false); + minimizeCooldown = getBoolean("minimize-cooldown", true); + teamColourFix = getBoolean("team-colour-fix", true); + suppress1_13ConversionErrors = getBoolean("suppress-1_13-conversion-errors", false); + disable1_13TabComplete = getBoolean("disable-1_13-auto-complete", false); serversideBlockConnections = getBoolean("serverside-blockconnections", false); - blockConnectionMethod = getString("blockconnection-method", "packet"); reduceBlockStorageMemory = getBoolean("reduce-blockstorage-memory", false); flowerStemWhenBlockAbove = getBoolean("flowerstem-when-block-above", false); snowCollisionFix = getBoolean("fix-low-snow-collision", false); @@ -294,7 +292,7 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf @Override public String getBlockConnectionMethod() { - return blockConnectionMethod; + return "packet"; } @Override diff --git a/velocity/src/main/java/us/myles/ViaVersion/velocity/platform/VelocityViaConfig.java b/velocity/src/main/java/us/myles/ViaVersion/velocity/platform/VelocityViaConfig.java index 378c00968..6e405df07 100644 --- a/velocity/src/main/java/us/myles/ViaVersion/velocity/platform/VelocityViaConfig.java +++ b/velocity/src/main/java/us/myles/ViaVersion/velocity/platform/VelocityViaConfig.java @@ -84,11 +84,6 @@ public class VelocityViaConfig extends AbstractViaConfig { return false; } - @Override - public String getBlockConnectionMethod() { - return "packet"; - } - /** * What is the interval for checking servers via ping * -1 for disabled From 08e145f831dd74b30bbc6dc1e5bae809d1b21547 Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Mon, 25 Nov 2019 19:37:02 +0100 Subject: [PATCH 11/36] 1.15-pre2 --- bukkit/pom.xml | 2 +- bungee/pom.xml | 2 +- common/pom.xml | 2 +- .../java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java | 2 +- jar/pom.xml | 2 +- pom.xml | 2 +- sponge-legacy/pom.xml | 2 +- sponge/pom.xml | 2 +- velocity/pom.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bukkit/pom.xml b/bukkit/pom.xml index 7d73e52f5..9a841d1e6 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre1 + 2.1.4-1.15-pre2 4.0.0 diff --git a/bungee/pom.xml b/bungee/pom.xml index c62a82066..8e829f675 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre1 + 2.1.4-1.15-pre2 4.0.0 diff --git a/common/pom.xml b/common/pom.xml index a690e1a7b..38274adb7 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre1 + 2.1.4-1.15-pre2 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 c50c6ed0f..ea69aa7e5 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 @@ -77,7 +77,7 @@ public class ProtocolVersion { register(v1_14_2 = new ProtocolVersion(485, "1.14.2")); register(v1_14_3 = new ProtocolVersion(490, "1.14.3")); register(v1_14_4 = new ProtocolVersion(498, "1.14.4")); - register(v1_15 = new ProtocolVersion(565, "1.15")); + register(v1_15 = new ProtocolVersion(566, "1.15")); register(unknown = new ProtocolVersion(-1, "UNKNOWN")); } diff --git a/jar/pom.xml b/jar/pom.xml index fc59aa779..684609f35 100644 --- a/jar/pom.xml +++ b/jar/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre1 + 2.1.4-1.15-pre2 4.0.0 viaversion-jar diff --git a/pom.xml b/pom.xml index 2791ec029..cf0ca7a48 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ us.myles viaversion-parent - 2.1.4-1.15-pre1 + 2.1.4-1.15-pre2 pom viaversion-parent diff --git a/sponge-legacy/pom.xml b/sponge-legacy/pom.xml index bbc2c690f..7b9565057 100644 --- a/sponge-legacy/pom.xml +++ b/sponge-legacy/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre1 + 2.1.4-1.15-pre2 4.0.0 diff --git a/sponge/pom.xml b/sponge/pom.xml index 8eaad8168..34d682358 100644 --- a/sponge/pom.xml +++ b/sponge/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre1 + 2.1.4-1.15-pre2 4.0.0 diff --git a/velocity/pom.xml b/velocity/pom.xml index 6abef6140..dc1265704 100644 --- a/velocity/pom.xml +++ b/velocity/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre1 + 2.1.4-1.15-pre2 4.0.0 From 48feee2bfc0c0f1fdc43b7e813d4d4e8cb4ef152 Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Mon, 25 Nov 2019 20:40:03 +0100 Subject: [PATCH 12/36] Destroy 1.15 entities --- .../protocols/protocol1_15to1_14_4/Protocol1_15To1_14_4.java | 1 - .../protocols/protocol1_15to1_14_4/packets/EntityPackets.java | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/Protocol1_15To1_14_4.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/Protocol1_15To1_14_4.java index aa121226f..07d2a8a10 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/Protocol1_15To1_14_4.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/Protocol1_15To1_14_4.java @@ -201,7 +201,6 @@ public class Protocol1_15To1_14_4 extends Protocol { registerOutgoing(State.PLAY, 0x34, 0x35); registerOutgoing(State.PLAY, 0x35, 0x36); registerOutgoing(State.PLAY, 0x36, 0x37); - registerOutgoing(State.PLAY, 0x37, 0x38); registerOutgoing(State.PLAY, 0x38, 0x39); registerOutgoing(State.PLAY, 0x39, 0x3A); registerOutgoing(State.PLAY, 0x3B, 0x3C); diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/EntityPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/EntityPackets.java index b91f6ad13..acbb83214 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/EntityPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/EntityPackets.java @@ -115,6 +115,8 @@ public class EntityPackets { // Metadata packet metadataRewriter.registerMetadataRewriter(0x43, 0x44, Types1_14.METADATA_LIST); + + metadataRewriter.registerEntityDestroy(0x37, 0x38); } public static int getNewEntityId(int oldId) { From 1b207251e8edbb204dc47ec428a53962eb463267 Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Mon, 25 Nov 2019 22:41:59 +0100 Subject: [PATCH 13/36] Add extra mappings constructor for VB --- .../us/myles/ViaVersion/api/data/Mappings.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/api/data/Mappings.java b/common/src/main/java/us/myles/ViaVersion/api/data/Mappings.java index 8c5998935..18cd4a737 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/data/Mappings.java +++ b/common/src/main/java/us/myles/ViaVersion/api/data/Mappings.java @@ -8,13 +8,17 @@ import java.util.Arrays; public class Mappings { protected final short[] oldToNew; + protected Mappings(short[] oldToNew) { + this.oldToNew = oldToNew; + } + /** * Maps old identifiers to the new ones. * If an old value cannot be found in the new mappings, the diffmapping will be checked for the given entry. * - * @param size set size of the underlying short array - * @param oldMapping mappings to map from - * @param newMapping mappings to map to + * @param size set size of the underlying short array + * @param oldMapping mappings to map from + * @param newMapping mappings to map to * @param diffMapping extra mappings that will be used/scanned when an entry cannot be found */ public Mappings(int size, JsonObject oldMapping, JsonObject newMapping, JsonObject diffMapping) { @@ -30,7 +34,7 @@ public class Mappings { /** * Maps old identifiers to the new ones. * - * @param size set size of the underlying short array + * @param size set size of the underlying short array * @param oldMapping mappings to map from * @param newMapping mappings to map to */ @@ -47,7 +51,7 @@ public class Mappings { /** * Maps old identifiers to the new ones. * - * @param size set size of the underlying short array + * @param size set size of the underlying short array * @param oldMapping mappings to map from * @param newMapping mappings to map to */ From 915258169ed0444c8a0c3fd7deb64e506e4ff73b Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Tue, 26 Nov 2019 13:51:37 +0100 Subject: [PATCH 14/36] Fix inverted array read check --- .../java/us/myles/ViaVersion/api/type/types/ByteArrayType.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/us/myles/ViaVersion/api/type/types/ByteArrayType.java b/common/src/main/java/us/myles/ViaVersion/api/type/types/ByteArrayType.java index 9b462f88f..e9a88124c 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/type/types/ByteArrayType.java +++ b/common/src/main/java/us/myles/ViaVersion/api/type/types/ByteArrayType.java @@ -18,7 +18,7 @@ public class ByteArrayType extends Type { @Override public byte[] read(ByteBuf buffer) throws Exception { int length = Type.VAR_INT.read(buffer); - Preconditions.checkArgument(!buffer.isReadable(length), "Length is fewer than readable bytes"); + Preconditions.checkArgument(buffer.isReadable(length), "Length is fewer than readable bytes"); byte[] array = new byte[length]; buffer.readBytes(array); return array; From bd9a1dda88afd7cf21ee7d33248518d5039bf818 Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Tue, 26 Nov 2019 18:22:33 +0100 Subject: [PATCH 15/36] Fix last config issues --- .../myles/ViaVersion/AbstractViaConfig.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java b/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java index dde19b06f..37440cb5f 100644 --- a/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java +++ b/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java @@ -267,24 +267,24 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf @Override public boolean isMinimizeCooldown() { - return suppress1_13ConversionErrors; - } - - @Override - public boolean is1_13TeamColourFix() { - return disable1_13TabComplete; - } - - @Override - public boolean isSuppress1_13ConversionErrors() { return minimizeCooldown; } @Override - public boolean isDisable1_13AutoComplete() { + public boolean is1_13TeamColourFix() { return teamColourFix; } + @Override + public boolean isSuppress1_13ConversionErrors() { + return suppress1_13ConversionErrors; + } + + @Override + public boolean isDisable1_13AutoComplete() { + return disable1_13TabComplete; + } + @Override public boolean isServersideBlockConnections() { return serversideBlockConnections; From da704539f0f9926c75c06b91b7d8d6da43be0b4a Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Tue, 26 Nov 2019 20:14:56 +0100 Subject: [PATCH 16/36] Rename suppress-warning config option --- .../us/myles/ViaVersion/AbstractViaConfig.java | 8 ++++---- .../us/myles/ViaVersion/api/ViaVersionConfig.java | 4 ++-- .../ViaVersion/api/data/MappingDataLoader.java | 6 +++--- .../packets/InventoryPackets.java | 14 +++++++------- .../protocol1_13to1_12_2/packets/WorldPackets.java | 8 ++++---- .../providers/blockentities/FlowerPotHandler.java | 2 +- .../main/resources/assets/viaversion/config.yml | 4 ++-- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java b/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java index 37440cb5f..2ee9bd131 100644 --- a/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java +++ b/common/src/main/java/us/myles/ViaVersion/AbstractViaConfig.java @@ -38,7 +38,7 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf private Set blockedProtocols; private String blockedDisconnectMessage; private String reloadDisconnectMessage; - private boolean suppress1_13ConversionErrors; + private boolean suppressConversionWarnings; private boolean disable1_13TabComplete; private boolean minimizeCooldown; private boolean teamColourFix; @@ -95,7 +95,7 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf reloadDisconnectMessage = getString("reload-disconnect-msg", "Server reload, please rejoin!"); minimizeCooldown = getBoolean("minimize-cooldown", true); teamColourFix = getBoolean("team-colour-fix", true); - suppress1_13ConversionErrors = getBoolean("suppress-1_13-conversion-errors", false); + suppressConversionWarnings = getBoolean("suppress-conversion-warnings", false); disable1_13TabComplete = getBoolean("disable-1_13-auto-complete", false); serversideBlockConnections = getBoolean("serverside-blockconnections", false); reduceBlockStorageMemory = getBoolean("reduce-blockstorage-memory", false); @@ -276,8 +276,8 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf } @Override - public boolean isSuppress1_13ConversionErrors() { - return suppress1_13ConversionErrors; + public boolean isSuppressConversionWarnings() { + return suppressConversionWarnings; } @Override diff --git a/common/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java b/common/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java index f4eb99c05..140ec6bf2 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java +++ b/common/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java @@ -231,11 +231,11 @@ public interface ViaVersionConfig { String getReloadDisconnectMsg(); /** - * Should we hide errors that occur when trying to converting to 1.13 data? + * Should we hide errors that occur when trying to convert block and item data over versions? * * @return True if enabled */ - boolean isSuppress1_13ConversionErrors(); + boolean isSuppressConversionWarnings(); /** * Should we disable the 1.13 auto-complete feature to stop spam kicks? (for any server lower than 1.13) diff --git a/common/src/main/java/us/myles/ViaVersion/api/data/MappingDataLoader.java b/common/src/main/java/us/myles/ViaVersion/api/data/MappingDataLoader.java index fa276b963..7261f9add 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/data/MappingDataLoader.java +++ b/common/src/main/java/us/myles/ViaVersion/api/data/MappingDataLoader.java @@ -31,7 +31,7 @@ public class MappingDataLoader { for (Map.Entry entry : oldIdentifiers.entrySet()) { Map.Entry value = findValue(newIdentifiers, entry.getValue().getAsString()); if (value == null) { - if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) { + if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) { Via.getPlatform().getLogger().warning("No key for " + entry.getValue() + " :( "); } continue; @@ -53,7 +53,7 @@ public class MappingDataLoader { value = findValue(newIdentifiers, diffIdentifiers.get(entry.getKey()).getAsString()); } if (value == null) { - if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) { + if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) { Via.getPlatform().getLogger().warning("No key for " + entry.getValue() + " :( "); } continue; @@ -68,7 +68,7 @@ public class MappingDataLoader { JsonElement v = oldIdentifiers.get(i); Integer index = findIndex(newIdentifiers, v.getAsString()); if (index == null) { - if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) { + if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) { Via.getPlatform().getLogger().warning("No key for " + v + " :( "); } continue; diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java index 3e2798296..42fcac91f 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java @@ -100,7 +100,7 @@ public class InventoryPackets { flags |= 1; Optional finalSource = SoundSource.findBySource(originalSource); if (!finalSource.isPresent()) { - if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) { + if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) { Via.getPlatform().getLogger().info("Could not handle unknown sound source " + originalSource + " falling back to default: master"); } finalSource = Optional.of(SoundSource.MASTER); @@ -147,7 +147,7 @@ public class InventoryPackets { String old = channel; channel = getNewPluginChannelId(channel); if (channel == null) { - if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) { + if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) { Via.getPlatform().getLogger().warning("Ignoring outgoing plugin message with channel: " + old); } wrapper.cancel(); @@ -159,7 +159,7 @@ public class InventoryPackets { String rewritten = getNewPluginChannelId(channels[i]); if (rewritten != null) { rewrittenChannels.add(rewritten); - } else if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) { + } else if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) { Via.getPlatform().getLogger().warning("Ignoring plugin channel in outgoing REGISTER: " + channels[i]); } } @@ -218,7 +218,7 @@ public class InventoryPackets { String old = channel; channel = getOldPluginChannelId(channel); if (channel == null) { - if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) { + if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) { Via.getPlatform().getLogger().warning("Ignoring incoming plugin message with channel: " + old); } wrapper.cancel(); @@ -230,7 +230,7 @@ public class InventoryPackets { String rewritten = getOldPluginChannelId(channels[i]); if (rewritten != null) { rewrittenChannels.add(rewritten); - } else if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) { + } else if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) { Via.getPlatform().getLogger().warning("Ignoring plugin channel in incoming REGISTER: " + channels[i]); } } @@ -431,7 +431,7 @@ public class InventoryPackets { } else if (MappingData.oldToNewItems.containsKey(rawId & ~0xF)) { rawId &= ~0xF; // Remove data } else { - if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) { + if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) { Via.getPlatform().getLogger().warning("Failed to get 1.13 item for " + item.getIdentifier()); } rawId = 16; // Stone @@ -518,7 +518,7 @@ public class InventoryPackets { } if (rawId == null) { - if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) { + if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) { Via.getPlatform().getLogger().warning("Failed to get 1.12 item for " + item.getIdentifier()); } rawId = 0x10000; // Stone diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java index 06cb00462..9e760c951 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java @@ -73,7 +73,7 @@ public class WorldPackets { Optional id = provider.getIntByIdentifier(motive); - if (!id.isPresent() && (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug())) { + if (!id.isPresent() && (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug())) { Via.getPlatform().getLogger().warning("Could not find painting motive: " + motive + " falling back to default (0)"); } wrapper.write(Type.VAR_INT, id.orElse(0)); @@ -374,7 +374,7 @@ public class WorldPackets { if (!validBiomes.contains(biome)) { if (biome != 255 // is it generated naturally? *shrug* && latestBiomeWarn != biome) { - if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) { + if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) { Via.getPlatform().getLogger().warning("Received invalid biome id " + biome); } latestBiomeWarn = biome; @@ -502,12 +502,12 @@ public class WorldPackets { } newId = MappingData.blockMappings.getNewId(oldId & ~0xF); // Remove data if (newId != -1) { - if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) { + if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) { Via.getPlatform().getLogger().warning("Missing block " + oldId); } return newId; } - if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) { + if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) { Via.getPlatform().getLogger().warning("Missing block completely " + oldId); } // Default stone diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/providers/blockentities/FlowerPotHandler.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/providers/blockentities/FlowerPotHandler.java index 059ec9673..c29917572 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/providers/blockentities/FlowerPotHandler.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/providers/blockentities/FlowerPotHandler.java @@ -61,7 +61,7 @@ public class FlowerPotHandler implements BlockEntityProvider.BlockEntityHandler } else if (flowersNumberId.containsKey(pair)) { return flowersNumberId.get(pair); } else { - if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) { + if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) { Via.getPlatform().getLogger().warning("Could not find flowerpot content " + item + " for " + tag); } } diff --git a/common/src/main/resources/assets/viaversion/config.yml b/common/src/main/resources/assets/viaversion/config.yml index 5394a40f7..08fa85858 100644 --- a/common/src/main/resources/assets/viaversion/config.yml +++ b/common/src/main/resources/assets/viaversion/config.yml @@ -22,6 +22,8 @@ block-disconnect-msg: "You are using an unsupported Minecraft version!" # (We don't suggest using reload either, use a plugin manager) # You can customise the message we kick people with if you use ProtocolLib here. reload-disconnect-msg: "Server reload, please rejoin!" +# We warn when there's a error converting item and block data over versions, should we suppress these? (Only suggested if spamming) +suppress-conversion-warnings: false # #----------------------------------------------------------# # BUNGEE OPTIONS # @@ -110,8 +112,6 @@ chat-nbt-fix: true quick-move-action-fix: false # Should we use prefix for team colour on 1.13 and above clients team-colour-fix: true -# We warn when there's a error converting from pre-1.13 to 1.13, should we suppress these? (Only suggested if spamming) -suppress-1_13-conversion-errors: false # 1.13 introduced new auto complete which can trigger "Kicked for spamming" for servers older than 1.13, the following option will disable it completely. disable-1_13-auto-complete: false # The following option will delay the tab complete request in x ticks if greater than 0, if other tab-complete is received, the previous is cancelled From bca5b43a2a5b7ca6699b797ab9e3a265917fab5e Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Tue, 26 Nov 2019 23:59:23 +0100 Subject: [PATCH 17/36] Fix entity type --- .../java/us/myles/ViaVersion/api/entities/Entity1_15Types.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_15Types.java b/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_15Types.java index 000dc7a97..61dd890e9 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_15Types.java +++ b/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_15Types.java @@ -104,7 +104,7 @@ public class Entity1_15Types { // Monsters ABSTRACT_MONSTER(-1, ABSTRACT_CREATURE), - BLAZE(4, ABSTRACT_MONSTER), + BLAZE(5, ABSTRACT_MONSTER), CREEPER(12, ABSTRACT_MONSTER), ENDERMITE(21, ABSTRACT_MONSTER), ENDERMAN(20, ABSTRACT_MONSTER), From bcb953a45a0b1f56912f03d5970031b912e9cd7e Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Wed, 27 Nov 2019 00:08:28 +0100 Subject: [PATCH 18/36] Fix 1.15 chunk read --- .../types/Chunk1_15Type.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/types/Chunk1_15Type.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/types/Chunk1_15Type.java index 780459f55..afeccc382 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/types/Chunk1_15Type.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/types/Chunk1_15Type.java @@ -31,6 +31,16 @@ public class Chunk1_15Type extends PartialType { boolean groundUp = input.readBoolean(); int primaryBitmask = Type.VAR_INT.read(input); CompoundTag heightMap = Type.NBT.read(input); + + int[] biomeData = groundUp ? new int[256] : null; + if (groundUp) { + //TODO Why 1024 ints? + for (int i = 0; i < 1024; i++) { + //biomeData[i] = input.readInt(); + input.readInt(); + } + } + Type.VAR_INT.read(input); BitSet usedSections = new BitSet(16); @@ -42,15 +52,6 @@ public class Chunk1_15Type extends PartialType { } } - int[] biomeData = groundUp ? new int[256] : null; - if (groundUp) { - //TODO Why 1024 ints? - for (int i = 0; i < 1024; i++) { - //biomeData[i] = input.readInt(); - input.readInt(); - } - } - // Read sections for (int i = 0; i < 16; i++) { if (!usedSections.get(i)) continue; // Section not set From 42efec6e2b9f077cea9c7707be2c6fbec4d1b58b Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Wed, 27 Nov 2019 00:55:33 +0100 Subject: [PATCH 19/36] Add version to entity type warning --- .../java/us/myles/ViaVersion/api/entities/Entity1_10Types.java | 2 +- .../java/us/myles/ViaVersion/api/entities/Entity1_11Types.java | 2 +- .../java/us/myles/ViaVersion/api/entities/Entity1_12Types.java | 2 +- .../java/us/myles/ViaVersion/api/entities/Entity1_13Types.java | 2 +- .../java/us/myles/ViaVersion/api/entities/Entity1_14Types.java | 2 +- .../java/us/myles/ViaVersion/api/entities/Entity1_15Types.java | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_10Types.java b/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_10Types.java index acc05fac7..618e53d9f 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_10Types.java +++ b/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_10Types.java @@ -20,7 +20,7 @@ public class Entity1_10Types { type = EntityType.findById(typeID); if (!type.isPresent()) { - Via.getPlatform().getLogger().severe("Could not find type id " + typeID + " isObject=" + isObject); + Via.getPlatform().getLogger().severe("Could not find 1.10 type id " + typeID + " isObject=" + isObject); return EntityType.ENTITY; // Fall back to the basic ENTITY } diff --git a/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_11Types.java b/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_11Types.java index 96d9be2d5..923f0814d 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_11Types.java +++ b/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_11Types.java @@ -20,7 +20,7 @@ public class Entity1_11Types { type = EntityType.findById(typeID); if (!type.isPresent()) { - Via.getPlatform().getLogger().severe("Could not find type id " + typeID + " isObject=" + isObject); + Via.getPlatform().getLogger().severe("Could not find 1.11 type id " + typeID + " isObject=" + isObject); return EntityType.ENTITY; // Fall back to the basic ENTITY } diff --git a/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_12Types.java b/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_12Types.java index cb6586ef4..d6e974ead 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_12Types.java +++ b/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_12Types.java @@ -30,7 +30,7 @@ public class Entity1_12Types { type = EntityType.findById(typeID); if (!type.isPresent()) { - Via.getPlatform().getLogger().severe("Could not find type id " + typeID + " isObject=" + isObject); + Via.getPlatform().getLogger().severe("Could not find 1.12 type id " + typeID + " isObject=" + isObject); return EntityType.ENTITY; // Fall back to the basic ENTITY } diff --git a/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_13Types.java b/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_13Types.java index 33e8b22a5..2de13717d 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_13Types.java +++ b/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_13Types.java @@ -20,7 +20,7 @@ public class Entity1_13Types { type = EntityType.findById(typeID); if (!type.isPresent()) { - Via.getPlatform().getLogger().severe("Could not find type id " + typeID + " isObject=" + isObject); + Via.getPlatform().getLogger().severe("Could not find 1.13 type id " + typeID + " isObject=" + isObject); return EntityType.ENTITY; // Fall back to the basic ENTITY } diff --git a/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_14Types.java b/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_14Types.java index 732ce68ed..020512298 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_14Types.java +++ b/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_14Types.java @@ -15,7 +15,7 @@ public class Entity1_14Types { Optional type = EntityType.findById(typeID); if (!type.isPresent()) { - Via.getPlatform().getLogger().severe("Could not find type id " + typeID); + Via.getPlatform().getLogger().severe("Could not find 1.14 type id " + typeID); return EntityType.ENTITY; // Fall back to the basic ENTITY } diff --git a/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_15Types.java b/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_15Types.java index 61dd890e9..062851d84 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_15Types.java +++ b/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_15Types.java @@ -15,7 +15,7 @@ public class Entity1_15Types { Optional type = EntityType.findById(typeID); if (!type.isPresent()) { - Via.getPlatform().getLogger().severe("Could not find type id " + typeID); + Via.getPlatform().getLogger().severe("Could not find 1.15 type id " + typeID); return EntityType.ENTITY; // Fall back to the basic ENTITY } From a68eac7cd2f1ba64702f4ad08c695683503ea8a3 Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Wed, 27 Nov 2019 12:56:20 +0100 Subject: [PATCH 20/36] Add set cooldown register in ItemRewriter --- .../ViaVersion/api/rewriters/ItemRewriter.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/common/src/main/java/us/myles/ViaVersion/api/rewriters/ItemRewriter.java b/common/src/main/java/us/myles/ViaVersion/api/rewriters/ItemRewriter.java index cf9b76b2d..8314c03a1 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/rewriters/ItemRewriter.java +++ b/common/src/main/java/us/myles/ViaVersion/api/rewriters/ItemRewriter.java @@ -85,6 +85,18 @@ public class ItemRewriter { }); } + public void registerSetCooldown(int oldPacketId, int newPacketId, ItemIdRewriteFunction itemIDRewriteFunction) { + protocol.registerOutgoing(State.PLAY, oldPacketId, newPacketId, new PacketRemapper() { + @Override + public void registerMap() { + handler(wrapper -> { + int itemId = wrapper.read(Type.VAR_INT); + wrapper.write(Type.VAR_INT, itemIDRewriteFunction.rewrite(itemId)); + }); + } + }); + } + // Only sent to the client public PacketHandler itemArrayHandler(Type type) { return wrapper -> { @@ -108,4 +120,10 @@ public class ItemRewriter { void rewrite(Item item); } + + @FunctionalInterface + public interface ItemIdRewriteFunction { + + int rewrite(int itemId); + } } From 5c7520f55290739831289016e95f329489c937ee Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Thu, 28 Nov 2019 20:10:19 +0100 Subject: [PATCH 21/36] 1.15-pre3 --- bukkit/pom.xml | 2 +- bungee/pom.xml | 2 +- common/pom.xml | 2 +- .../java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java | 2 +- jar/pom.xml | 2 +- pom.xml | 2 +- sponge-legacy/pom.xml | 2 +- sponge/pom.xml | 2 +- velocity/pom.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bukkit/pom.xml b/bukkit/pom.xml index 9a841d1e6..d5fa5b92e 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre2 + 2.1.4-1.15-pre3 4.0.0 diff --git a/bungee/pom.xml b/bungee/pom.xml index 8e829f675..bf743d8da 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre2 + 2.1.4-1.15-pre3 4.0.0 diff --git a/common/pom.xml b/common/pom.xml index 38274adb7..758e6fc3c 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre2 + 2.1.4-1.15-pre3 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 ea69aa7e5..ef4cd80ff 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 @@ -77,7 +77,7 @@ public class ProtocolVersion { register(v1_14_2 = new ProtocolVersion(485, "1.14.2")); register(v1_14_3 = new ProtocolVersion(490, "1.14.3")); register(v1_14_4 = new ProtocolVersion(498, "1.14.4")); - register(v1_15 = new ProtocolVersion(566, "1.15")); + register(v1_15 = new ProtocolVersion(567, "1.15")); register(unknown = new ProtocolVersion(-1, "UNKNOWN")); } diff --git a/jar/pom.xml b/jar/pom.xml index 684609f35..61c694e00 100644 --- a/jar/pom.xml +++ b/jar/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre2 + 2.1.4-1.15-pre3 4.0.0 viaversion-jar diff --git a/pom.xml b/pom.xml index cf0ca7a48..980b20ebc 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ us.myles viaversion-parent - 2.1.4-1.15-pre2 + 2.1.4-1.15-pre3 pom viaversion-parent diff --git a/sponge-legacy/pom.xml b/sponge-legacy/pom.xml index 7b9565057..a5e25336f 100644 --- a/sponge-legacy/pom.xml +++ b/sponge-legacy/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre2 + 2.1.4-1.15-pre3 4.0.0 diff --git a/sponge/pom.xml b/sponge/pom.xml index 34d682358..db944e388 100644 --- a/sponge/pom.xml +++ b/sponge/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre2 + 2.1.4-1.15-pre3 4.0.0 diff --git a/velocity/pom.xml b/velocity/pom.xml index dc1265704..e0b8ccc40 100644 --- a/velocity/pom.xml +++ b/velocity/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre2 + 2.1.4-1.15-pre3 4.0.0 From 2c95229cfc218eba9c72dc5e20ac4a6c4bac2848 Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Sat, 30 Nov 2019 19:22:36 +0100 Subject: [PATCH 22/36] Fix blaze remap and entity destroy in 1.15 Fixes #1542 --- .../api/entities/Entity1_15Types.java | 2 +- .../Protocol1_15To1_14_4.java | 2 +- .../packets/EntityPackets.java | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_15Types.java b/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_15Types.java index 2a5eb08b9..7f14b442a 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_15Types.java +++ b/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_15Types.java @@ -102,7 +102,7 @@ public class Entity1_15Types { // Monsters ABSTRACT_MONSTER(-1, ABSTRACT_CREATURE), - BLAZE(4, ABSTRACT_MONSTER), + BLAZE(5, ABSTRACT_MONSTER), CREEPER(12, ABSTRACT_MONSTER), ENDERMITE(21, ABSTRACT_MONSTER), ENDERMAN(20, ABSTRACT_MONSTER), diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/Protocol1_15To1_14_4.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/Protocol1_15To1_14_4.java index 826ebd5d4..b098fdb97 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/Protocol1_15To1_14_4.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/Protocol1_15To1_14_4.java @@ -199,7 +199,7 @@ public class Protocol1_15To1_14_4 extends Protocol { registerOutgoing(State.PLAY, 0x34, 0x35); registerOutgoing(State.PLAY, 0x35, 0x36); registerOutgoing(State.PLAY, 0x36, 0x37); - registerOutgoing(State.PLAY, 0x37, 0x38); + registerOutgoing(State.PLAY, 0x38, 0x39); registerOutgoing(State.PLAY, 0x39, 0x3A); registerOutgoing(State.PLAY, 0x3B, 0x3C); diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/EntityPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/EntityPackets.java index 57638ac2b..582a3d93f 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/EntityPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/EntityPackets.java @@ -128,6 +128,23 @@ public class EntityPackets { }); } }); + + // Destroy entities + protocol.registerOutgoing(State.PLAY, 0x37, 0x38, new PacketRemapper() { + @Override + public void registerMap() { + map(Type.VAR_INT_ARRAY); + handler(new PacketHandler() { + @Override + public void handle(PacketWrapper wrapper) throws Exception { + EntityTracker entityTracker = wrapper.user().get(EntityTracker.class); + for (int entity : wrapper.get(Type.VAR_INT_ARRAY, 0)) { + entityTracker.removeEntity(entity); + } + } + }); + } + }); } public static int getNewEntityId(int oldId) { From 762151f06778b8bae293990cdb761577824b9c37 Mon Sep 17 00:00:00 2001 From: Gerrygames Date: Tue, 3 Dec 2019 14:22:54 +0100 Subject: [PATCH 23/36] 1.15-rep4 --- bukkit/pom.xml | 2 +- bungee/pom.xml | 2 +- common/pom.xml | 2 +- .../us/myles/ViaVersion/api/protocol/ProtocolVersion.java | 2 +- .../protocol1_15to1_14_4/packets/WorldPackets.java | 6 +++--- jar/pom.xml | 2 +- pom.xml | 2 +- sponge-legacy/pom.xml | 2 +- sponge/pom.xml | 2 +- velocity/pom.xml | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bukkit/pom.xml b/bukkit/pom.xml index d5fa5b92e..9b8ee776a 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre3 + 2.1.4-1.15-pre4 4.0.0 diff --git a/bungee/pom.xml b/bungee/pom.xml index bf743d8da..7ba2b05fe 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre3 + 2.1.4-1.15-pre4 4.0.0 diff --git a/common/pom.xml b/common/pom.xml index 758e6fc3c..55e70aad0 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre3 + 2.1.4-1.15-pre4 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 ef4cd80ff..a71ba71bf 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 @@ -77,7 +77,7 @@ public class ProtocolVersion { register(v1_14_2 = new ProtocolVersion(485, "1.14.2")); register(v1_14_3 = new ProtocolVersion(490, "1.14.3")); register(v1_14_4 = new ProtocolVersion(498, "1.14.4")); - register(v1_15 = new ProtocolVersion(567, "1.15")); + register(v1_15 = new ProtocolVersion(569, "1.15")); register(unknown = new ProtocolVersion(-1, "UNKNOWN")); } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java index 05d8322ff..c1510c3f0 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java @@ -125,9 +125,9 @@ public class WorldPackets { public void registerMap() { map(Type.INT); // 0 - Particle ID map(Type.BOOLEAN); // 1 - Long Distance - map(Type.FLOAT); // 2 - X - map(Type.FLOAT); // 3 - Y - map(Type.FLOAT); // 4 - Z + map(Type.FLOAT, Type.DOUBLE); // 2 - X + map(Type.FLOAT, Type.DOUBLE); // 3 - Y + map(Type.FLOAT, Type.DOUBLE); // 4 - Z map(Type.FLOAT); // 5 - Offset X map(Type.FLOAT); // 6 - Offset Y map(Type.FLOAT); // 7 - Offset Z diff --git a/jar/pom.xml b/jar/pom.xml index 61c694e00..6761aec7b 100644 --- a/jar/pom.xml +++ b/jar/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre3 + 2.1.4-1.15-pre4 4.0.0 viaversion-jar diff --git a/pom.xml b/pom.xml index 980b20ebc..f41517080 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ us.myles viaversion-parent - 2.1.4-1.15-pre3 + 2.1.4-1.15-pre4 pom viaversion-parent diff --git a/sponge-legacy/pom.xml b/sponge-legacy/pom.xml index a5e25336f..5aa475c13 100644 --- a/sponge-legacy/pom.xml +++ b/sponge-legacy/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre3 + 2.1.4-1.15-pre4 4.0.0 diff --git a/sponge/pom.xml b/sponge/pom.xml index db944e388..887616b8b 100644 --- a/sponge/pom.xml +++ b/sponge/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre3 + 2.1.4-1.15-pre4 4.0.0 diff --git a/velocity/pom.xml b/velocity/pom.xml index e0b8ccc40..7496f8c66 100644 --- a/velocity/pom.xml +++ b/velocity/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre3 + 2.1.4-1.15-pre4 4.0.0 From a68fca9dda636b5863e8afc57dcc9d910a50a762 Mon Sep 17 00:00:00 2001 From: Gerrygames Date: Thu, 5 Dec 2019 15:03:45 +0100 Subject: [PATCH 24/36] 1.15-pre5 --- bukkit/pom.xml | 2 +- bungee/pom.xml | 2 +- common/pom.xml | 2 +- .../java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java | 2 +- jar/pom.xml | 2 +- pom.xml | 2 +- sponge-legacy/pom.xml | 2 +- sponge/pom.xml | 2 +- velocity/pom.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bukkit/pom.xml b/bukkit/pom.xml index 9b8ee776a..a9d0184fd 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre4 + 2.1.4-1.15-pre5 4.0.0 diff --git a/bungee/pom.xml b/bungee/pom.xml index 7ba2b05fe..760cfe2b3 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre4 + 2.1.4-1.15-pre5 4.0.0 diff --git a/common/pom.xml b/common/pom.xml index 55e70aad0..778f97de6 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre4 + 2.1.4-1.15-pre5 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 a71ba71bf..c451fc2c5 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 @@ -77,7 +77,7 @@ public class ProtocolVersion { register(v1_14_2 = new ProtocolVersion(485, "1.14.2")); register(v1_14_3 = new ProtocolVersion(490, "1.14.3")); register(v1_14_4 = new ProtocolVersion(498, "1.14.4")); - register(v1_15 = new ProtocolVersion(569, "1.15")); + register(v1_15 = new ProtocolVersion(570, "1.15")); register(unknown = new ProtocolVersion(-1, "UNKNOWN")); } diff --git a/jar/pom.xml b/jar/pom.xml index 6761aec7b..35c403f54 100644 --- a/jar/pom.xml +++ b/jar/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre4 + 2.1.4-1.15-pre5 4.0.0 viaversion-jar diff --git a/pom.xml b/pom.xml index f41517080..8a9447fad 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ us.myles viaversion-parent - 2.1.4-1.15-pre4 + 2.1.4-1.15-pre5 pom viaversion-parent diff --git a/sponge-legacy/pom.xml b/sponge-legacy/pom.xml index 5aa475c13..510271356 100644 --- a/sponge-legacy/pom.xml +++ b/sponge-legacy/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre4 + 2.1.4-1.15-pre5 4.0.0 diff --git a/sponge/pom.xml b/sponge/pom.xml index 887616b8b..721e13f6e 100644 --- a/sponge/pom.xml +++ b/sponge/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre4 + 2.1.4-1.15-pre5 4.0.0 diff --git a/velocity/pom.xml b/velocity/pom.xml index 7496f8c66..273c30dba 100644 --- a/velocity/pom.xml +++ b/velocity/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre4 + 2.1.4-1.15-pre5 4.0.0 From decb20d2d1274dafd0401e618de6961c325cf629 Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Mon, 2 Dec 2019 11:20:48 +0100 Subject: [PATCH 25/36] Convert biome data to 1.15 format --- .../api/minecraft/chunks/Chunk.java | 2 ++ .../packets/WorldPackets.java | 20 +++++++++++++++ .../types/Chunk1_15Type.java | 25 ++++++++----------- 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/api/minecraft/chunks/Chunk.java b/common/src/main/java/us/myles/ViaVersion/api/minecraft/chunks/Chunk.java index 690b45339..2a97adca5 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/minecraft/chunks/Chunk.java +++ b/common/src/main/java/us/myles/ViaVersion/api/minecraft/chunks/Chunk.java @@ -17,6 +17,8 @@ public interface Chunk { int[] getBiomeData(); + void setBiomeData(int[] biomeData); + CompoundTag getHeightMap(); void setHeightMap(CompoundTag heightMap); diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java index c1510c3f0..285e9d9bb 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java @@ -83,6 +83,26 @@ public class WorldPackets { Chunk chunk = wrapper.read(new Chunk1_14Type(clientWorld)); wrapper.write(new Chunk1_15Type(clientWorld), chunk); + if (chunk.isGroundUp()) { + int[] biomeData = chunk.getBiomeData(); + int[] newBiomeData = new int[1024]; + // Now in 4x4x4 areas (x, then z, then y) + // Set the x/z data + int i = 0; + for (int z = 1; z <= 16; z += 4) { + for (int x = 1; x <= 16; x += 4) { + int biome = biomeData[(x * z) - 1]; + // Extend it on the y axis + for (int y = 0; y < 1024; y += 16) { + newBiomeData[i + y] = biome; + } + i++; + } + } + + chunk.setBiomeData(newBiomeData); + } + for (int s = 0; s < 16; s++) { ChunkSection section = chunk.getSections()[s]; if (section == null) continue; diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/types/Chunk1_15Type.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/types/Chunk1_15Type.java index 780459f55..0de7355fe 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/types/Chunk1_15Type.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/types/Chunk1_15Type.java @@ -31,6 +31,14 @@ public class Chunk1_15Type extends PartialType { boolean groundUp = input.readBoolean(); int primaryBitmask = Type.VAR_INT.read(input); CompoundTag heightMap = Type.NBT.read(input); + + int[] biomeData = groundUp ? new int[1024] : null; + if (groundUp) { + for (int i = 0; i < 1024; i++) { + biomeData[i] = input.readInt(); + } + } + Type.VAR_INT.read(input); BitSet usedSections = new BitSet(16); @@ -42,15 +50,6 @@ public class Chunk1_15Type extends PartialType { } } - int[] biomeData = groundUp ? new int[256] : null; - if (groundUp) { - //TODO Why 1024 ints? - for (int i = 0; i < 1024; i++) { - //biomeData[i] = input.readInt(); - input.readInt(); - } - } - // Read sections for (int i = 0; i < 16; i++) { if (!usedSections.get(i)) continue; // Section not set @@ -84,13 +83,9 @@ public class Chunk1_15Type extends PartialType { // Write biome data if (chunk.isBiomeData()) { - //TODO Why 1024 ints? - for (int i = 0; i < 1024; i++) { - output.writeInt(0); + for (int value : chunk.getBiomeData()) { + output.writeInt(value); } - /*for (int value : chunk.getBiomeData()) { - output.writeInt(value & 0xFF); // This is a temporary workaround, we'll look into fixing this soon :) - }*/ } ByteBuf buf = output.alloc().buffer(); From 90e1d7236e97b6a742b0cb9547faf4083e744bc4 Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Sat, 7 Dec 2019 10:05:29 +0100 Subject: [PATCH 26/36] 1.15-pre6 --- bukkit/pom.xml | 2 +- bungee/pom.xml | 2 +- common/pom.xml | 2 +- .../java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java | 2 +- jar/pom.xml | 2 +- pom.xml | 2 +- sponge-legacy/pom.xml | 2 +- sponge/pom.xml | 2 +- velocity/pom.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bukkit/pom.xml b/bukkit/pom.xml index a9d0184fd..78aac38b2 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre5 + 2.1.4-1.15-pre6 4.0.0 diff --git a/bungee/pom.xml b/bungee/pom.xml index 760cfe2b3..258f0ed7e 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre5 + 2.1.4-1.15-pre6 4.0.0 diff --git a/common/pom.xml b/common/pom.xml index 778f97de6..e73ea1541 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre5 + 2.1.4-1.15-pre6 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 c451fc2c5..acc290e29 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 @@ -77,7 +77,7 @@ public class ProtocolVersion { register(v1_14_2 = new ProtocolVersion(485, "1.14.2")); register(v1_14_3 = new ProtocolVersion(490, "1.14.3")); register(v1_14_4 = new ProtocolVersion(498, "1.14.4")); - register(v1_15 = new ProtocolVersion(570, "1.15")); + register(v1_15 = new ProtocolVersion(571, "1.15")); register(unknown = new ProtocolVersion(-1, "UNKNOWN")); } diff --git a/jar/pom.xml b/jar/pom.xml index 35c403f54..41bee2049 100644 --- a/jar/pom.xml +++ b/jar/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre5 + 2.1.4-1.15-pre6 4.0.0 viaversion-jar diff --git a/pom.xml b/pom.xml index 8a9447fad..094dfa836 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ us.myles viaversion-parent - 2.1.4-1.15-pre5 + 2.1.4-1.15-pre6 pom viaversion-parent diff --git a/sponge-legacy/pom.xml b/sponge-legacy/pom.xml index 510271356..fbb08d199 100644 --- a/sponge-legacy/pom.xml +++ b/sponge-legacy/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre5 + 2.1.4-1.15-pre6 4.0.0 diff --git a/sponge/pom.xml b/sponge/pom.xml index 721e13f6e..3bf75f9fe 100644 --- a/sponge/pom.xml +++ b/sponge/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre5 + 2.1.4-1.15-pre6 4.0.0 diff --git a/velocity/pom.xml b/velocity/pom.xml index 273c30dba..7fa346a0c 100644 --- a/velocity/pom.xml +++ b/velocity/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre5 + 2.1.4-1.15-pre6 4.0.0 From 68a18df9698ab41bf85d5392e6cc0a8fad2e90f9 Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Sat, 7 Dec 2019 11:31:00 +0100 Subject: [PATCH 27/36] Take biome data from same indexes as Mojang ("middle" of 4x4x4 areas) --- .../packets/WorldPackets.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java index 285e9d9bb..081ca09d7 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java @@ -86,19 +86,19 @@ public class WorldPackets { if (chunk.isGroundUp()) { int[] biomeData = chunk.getBiomeData(); int[] newBiomeData = new int[1024]; - // Now in 4x4x4 areas (x, then z, then y) - // Set the x/z data - int i = 0; - for (int z = 1; z <= 16; z += 4) { - for (int x = 1; x <= 16; x += 4) { - int biome = biomeData[(x * z) - 1]; - // Extend it on the y axis - for (int y = 0; y < 1024; y += 16) { - newBiomeData[i + y] = biome; - } - i++; + // Now in 4x4x4 areas - take the biome of each "middle" + for (int i = 0; i < 4; ++i) { + for (int j = 0; j < 4; ++j) { + int x = (j << 2) + 2; + int z = (i << 2) + 2; + int oldIndex = (z << 4 | x); + newBiomeData[i << 2 | j] = biomeData[oldIndex]; } } + // ... and copy it to the new y layers + for (int i = 1; i < 64; ++i) { + System.arraycopy(newBiomeData, 0, newBiomeData, i * 16, 16); + } chunk.setBiomeData(newBiomeData); } From cfe073cd20f631bb41047d96d62aaf135d4128f3 Mon Sep 17 00:00:00 2001 From: Gerrygames Date: Mon, 9 Dec 2019 11:34:00 +0100 Subject: [PATCH 28/36] fix 1.15 entity type ids --- .../us/myles/ViaVersion/api/entities/Entity1_15Types.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_15Types.java b/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_15Types.java index 7f14b442a..710636b52 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_15Types.java +++ b/common/src/main/java/us/myles/ViaVersion/api/entities/Entity1_15Types.java @@ -37,11 +37,11 @@ public class Entity1_15Types { LLAMA_SPIT(40, ENTITY), TNT(59, ENTITY), SHULKER_BULLET(64, ENTITY), - FISHING_BOBBER(111, ENTITY), + FISHING_BOBBER(102, ENTITY), LIVINGENTITY(-1, ENTITY), ARMOR_STAND(1, LIVINGENTITY), - PLAYER(110, LIVINGENTITY), + PLAYER(101, LIVINGENTITY), ABSTRACT_INSENTIENT(-1, LIVINGENTITY), ENDER_DRAGON(19, ABSTRACT_INSENTIENT), From ea045e6c340edab8feb8610c4c987bb013e4552e Mon Sep 17 00:00:00 2001 From: Gerrygames Date: Mon, 9 Dec 2019 13:48:06 +0100 Subject: [PATCH 29/36] 1.15-pre7 --- bukkit/pom.xml | 2 +- bungee/pom.xml | 2 +- common/pom.xml | 2 +- .../java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java | 2 +- jar/pom.xml | 2 +- pom.xml | 2 +- sponge-legacy/pom.xml | 2 +- sponge/pom.xml | 2 +- velocity/pom.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bukkit/pom.xml b/bukkit/pom.xml index 78aac38b2..f4e3269f1 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre6 + 2.1.4-1.15-pre7 4.0.0 diff --git a/bungee/pom.xml b/bungee/pom.xml index 258f0ed7e..1120d443c 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre6 + 2.1.4-1.15-pre7 4.0.0 diff --git a/common/pom.xml b/common/pom.xml index e73ea1541..513b5a877 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre6 + 2.1.4-1.15-pre7 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 acc290e29..2b169d9af 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 @@ -77,7 +77,7 @@ public class ProtocolVersion { register(v1_14_2 = new ProtocolVersion(485, "1.14.2")); register(v1_14_3 = new ProtocolVersion(490, "1.14.3")); register(v1_14_4 = new ProtocolVersion(498, "1.14.4")); - register(v1_15 = new ProtocolVersion(571, "1.15")); + register(v1_15 = new ProtocolVersion(572, "1.15")); register(unknown = new ProtocolVersion(-1, "UNKNOWN")); } diff --git a/jar/pom.xml b/jar/pom.xml index 41bee2049..de788155c 100644 --- a/jar/pom.xml +++ b/jar/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre6 + 2.1.4-1.15-pre7 4.0.0 viaversion-jar diff --git a/pom.xml b/pom.xml index 094dfa836..1031dcb14 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ us.myles viaversion-parent - 2.1.4-1.15-pre6 + 2.1.4-1.15-pre7 pom viaversion-parent diff --git a/sponge-legacy/pom.xml b/sponge-legacy/pom.xml index fbb08d199..2f89d2671 100644 --- a/sponge-legacy/pom.xml +++ b/sponge-legacy/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre6 + 2.1.4-1.15-pre7 4.0.0 diff --git a/sponge/pom.xml b/sponge/pom.xml index 3bf75f9fe..5b23a7959 100644 --- a/sponge/pom.xml +++ b/sponge/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre6 + 2.1.4-1.15-pre7 4.0.0 diff --git a/velocity/pom.xml b/velocity/pom.xml index 7fa346a0c..f828b8e20 100644 --- a/velocity/pom.xml +++ b/velocity/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre6 + 2.1.4-1.15-pre7 4.0.0 From 44a3108982ce797b22559271f38a23b9317afbfd Mon Sep 17 00:00:00 2001 From: Gerrygames Date: Mon, 9 Dec 2019 19:24:18 +0100 Subject: [PATCH 30/36] fix wrong import - #1560 --- .../protocols/protocol1_15to1_14_4/packets/WorldPackets.java | 1 - 1 file changed, 1 deletion(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java index 081ca09d7..8af19e2b0 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java @@ -9,7 +9,6 @@ import us.myles.ViaVersion.api.remapper.PacketHandler; import us.myles.ViaVersion.api.remapper.PacketRemapper; import us.myles.ViaVersion.api.type.Type; import us.myles.ViaVersion.packets.State; -import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.packets.InventoryPackets; import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.types.Chunk1_14Type; import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.Protocol1_15To1_14_4; import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.types.Chunk1_15Type; From 9dae40f4555b170252f129ac079318178694d31c Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Mon, 9 Dec 2019 19:30:09 +0100 Subject: [PATCH 31/36] Fix trade list --- .../protocols/protocol1_15to1_14_4/packets/InventoryPackets.java | 1 + 1 file changed, 1 insertion(+) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/InventoryPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/InventoryPackets.java index efa714838..c85305fee 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/InventoryPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/InventoryPackets.java @@ -59,6 +59,7 @@ public class InventoryPackets { wrapper.passthrough(Type.INT); wrapper.passthrough(Type.INT); wrapper.passthrough(Type.FLOAT); + wrapper.passthrough(Type.INT); } wrapper.passthrough(Type.VAR_INT); From c85d4224ad8bfced3208563e32366bc2fb016af2 Mon Sep 17 00:00:00 2001 From: Myles Date: Tue, 10 Dec 2019 15:29:26 +0000 Subject: [PATCH 32/36] 1.15 protocol + 2.2.0 --- bukkit/pom.xml | 2 +- bungee/pom.xml | 2 +- common/pom.xml | 2 +- .../java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java | 2 +- jar/pom.xml | 2 +- pom.xml | 2 +- sponge-legacy/pom.xml | 2 +- sponge/pom.xml | 2 +- velocity/pom.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bukkit/pom.xml b/bukkit/pom.xml index f4e3269f1..1f0403bb9 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre7 + 2.2.0 4.0.0 diff --git a/bungee/pom.xml b/bungee/pom.xml index 1120d443c..56af38100 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre7 + 2.2.0 4.0.0 diff --git a/common/pom.xml b/common/pom.xml index 513b5a877..75d22ce8a 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre7 + 2.2.0 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 2b169d9af..b52793bcb 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 @@ -77,7 +77,7 @@ public class ProtocolVersion { register(v1_14_2 = new ProtocolVersion(485, "1.14.2")); register(v1_14_3 = new ProtocolVersion(490, "1.14.3")); register(v1_14_4 = new ProtocolVersion(498, "1.14.4")); - register(v1_15 = new ProtocolVersion(572, "1.15")); + register(v1_15 = new ProtocolVersion(573, "1.15")); register(unknown = new ProtocolVersion(-1, "UNKNOWN")); } diff --git a/jar/pom.xml b/jar/pom.xml index de788155c..8d2c4c9c6 100644 --- a/jar/pom.xml +++ b/jar/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre7 + 2.2.0 4.0.0 viaversion-jar diff --git a/pom.xml b/pom.xml index 1031dcb14..9af66df45 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ us.myles viaversion-parent - 2.1.4-1.15-pre7 + 2.2.0 pom viaversion-parent diff --git a/sponge-legacy/pom.xml b/sponge-legacy/pom.xml index 2f89d2671..0f181c313 100644 --- a/sponge-legacy/pom.xml +++ b/sponge-legacy/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre7 + 2.2.0 4.0.0 diff --git a/sponge/pom.xml b/sponge/pom.xml index 5b23a7959..ba691091b 100644 --- a/sponge/pom.xml +++ b/sponge/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre7 + 2.2.0 4.0.0 diff --git a/velocity/pom.xml b/velocity/pom.xml index f828b8e20..5d46e104f 100644 --- a/velocity/pom.xml +++ b/velocity/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.4-1.15-pre7 + 2.2.0 4.0.0 From 2c95a1e71c67fb678a8edc86ebd4ebcb132bcd6e Mon Sep 17 00:00:00 2001 From: Myles Date: Tue, 10 Dec 2019 15:29:52 +0000 Subject: [PATCH 33/36] README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8440ced50..50ced6ad7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ViaVersion 2.1.3 - Spigot, Sponge, BungeeCord, Velocity +# ViaVersion 2.2.0 - Spigot, Sponge, BungeeCord, Velocity [![Build Status](https://travis-ci.com/ViaVersion/ViaVersion.svg?branch=master)](https://travis-ci.com/ViaVersion/ViaVersion) [![Discord](https://img.shields.io/badge/chat-on%20discord-blue.svg)](https://viaversion.com/discord) From 68ac978d4580b1c038f83a153e83d7adaa1bc61c Mon Sep 17 00:00:00 2001 From: Myles Date: Tue, 10 Dec 2019 15:34:42 +0000 Subject: [PATCH 34/36] Back to SNAPSHOT --- bukkit/pom.xml | 2 +- bungee/pom.xml | 2 +- common/pom.xml | 2 +- jar/pom.xml | 2 +- pom.xml | 2 +- sponge-legacy/pom.xml | 2 +- sponge/pom.xml | 2 +- velocity/pom.xml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bukkit/pom.xml b/bukkit/pom.xml index 1f0403bb9..4ba8705a6 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.2.0 + 2.2.1-SNAPSHOT 4.0.0 diff --git a/bungee/pom.xml b/bungee/pom.xml index 56af38100..578e79a97 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.2.0 + 2.2.1-SNAPSHOT 4.0.0 diff --git a/common/pom.xml b/common/pom.xml index 75d22ce8a..d20e57b4a 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.2.0 + 2.2.1-SNAPSHOT 4.0.0 diff --git a/jar/pom.xml b/jar/pom.xml index 8d2c4c9c6..441b1ab7d 100644 --- a/jar/pom.xml +++ b/jar/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.2.0 + 2.2.1-SNAPSHOT 4.0.0 viaversion-jar diff --git a/pom.xml b/pom.xml index 9af66df45..1db37c004 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ us.myles viaversion-parent - 2.2.0 + 2.2.1-SNAPSHOT pom viaversion-parent diff --git a/sponge-legacy/pom.xml b/sponge-legacy/pom.xml index 0f181c313..a4c2c71a8 100644 --- a/sponge-legacy/pom.xml +++ b/sponge-legacy/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.2.0 + 2.2.1-SNAPSHOT 4.0.0 diff --git a/sponge/pom.xml b/sponge/pom.xml index ba691091b..6fd4222d3 100644 --- a/sponge/pom.xml +++ b/sponge/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.2.0 + 2.2.1-SNAPSHOT 4.0.0 diff --git a/velocity/pom.xml b/velocity/pom.xml index 5d46e104f..524b77df1 100644 --- a/velocity/pom.xml +++ b/velocity/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.2.0 + 2.2.1-SNAPSHOT 4.0.0 From 84624a488415787a957b3e623fcf67b6de138f91 Mon Sep 17 00:00:00 2001 From: Gerrygames Date: Wed, 11 Dec 2019 02:00:51 +0100 Subject: [PATCH 35/36] fix entity metadata in spawn packet being ignored --- .../packets/EntityPackets.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/EntityPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/EntityPackets.java index 582a3d93f..f546b710f 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/EntityPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/EntityPackets.java @@ -3,6 +3,7 @@ package us.myles.ViaVersion.protocols.protocol1_15to1_14_4.packets; import com.google.common.base.Optional; import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.entities.Entity1_15Types; +import us.myles.ViaVersion.api.minecraft.metadata.Metadata; import us.myles.ViaVersion.api.protocol.Protocol; import us.myles.ViaVersion.api.remapper.PacketHandler; import us.myles.ViaVersion.api.remapper.PacketRemapper; @@ -13,6 +14,7 @@ import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.MetadataRewriter; import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.Protocol1_15To1_14_4; import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.storage.EntityTracker; +import java.util.List; import java.util.UUID; public class EntityPackets { @@ -72,7 +74,6 @@ public class EntityPackets { map(Type.SHORT); // 9 - Velocity X map(Type.SHORT); // 10 - Velocity Y map(Type.SHORT); // 11 - Velocity Z - map(Types1_14.METADATA_LIST, Type.NOTHING); // removed - probably sent in an update packet? handler(new PacketHandler() { @Override @@ -82,6 +83,13 @@ public class EntityPackets { Entity1_15Types.EntityType entityType = Entity1_15Types.getTypeFromId(getNewEntityId(typeId)); wrapper.user().get(EntityTracker.class).addEntity(entityId, entityType); wrapper.set(Type.VAR_INT, 1, entityType.getId()); + + List metadata = wrapper.read(Types1_14.METADATA_LIST); + MetadataRewriter.handleMetadata(entityId, entityType, metadata, wrapper.user()); + PacketWrapper metadataUpdate = wrapper.create(0x44); + metadataUpdate.write(Type.VAR_INT, entityId); + metadataUpdate.write(Types1_14.METADATA_LIST, metadata); + metadataUpdate.send(Protocol1_15To1_14_4.class); } }); } @@ -98,15 +106,20 @@ public class EntityPackets { map(Type.DOUBLE); // 4 - Z map(Type.BYTE); // 5 - Yaw map(Type.BYTE); // 6 - Pitch - map(Types1_14.METADATA_LIST, Type.NOTHING); // removed - probably sent in an update packet? handler(new PacketHandler() { @Override public void handle(PacketWrapper wrapper) throws Exception { int entityId = wrapper.get(Type.VAR_INT, 0); - Entity1_15Types.EntityType entityType = Entity1_15Types.EntityType.PLAYER; wrapper.user().get(EntityTracker.class).addEntity(entityId, entityType); + + List metadata = wrapper.read(Types1_14.METADATA_LIST); + MetadataRewriter.handleMetadata(entityId, entityType, metadata, wrapper.user()); + PacketWrapper metadataUpdate = wrapper.create(0x44); + metadataUpdate.write(Type.VAR_INT, entityId); + metadataUpdate.write(Types1_14.METADATA_LIST, metadata); + metadataUpdate.send(Protocol1_15To1_14_4.class); } }); } From dfbe2e9739852e57f82822a7bf1effabbab9ecc7 Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Wed, 11 Dec 2019 09:30:51 +0100 Subject: [PATCH 36/36] Fix acknowledge digging Fixes #1564 --- .../Protocol1_15To1_14_4.java | 3 --- .../packets/WorldPackets.java | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/Protocol1_15To1_14_4.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/Protocol1_15To1_14_4.java index b098fdb97..80904747c 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/Protocol1_15To1_14_4.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/Protocol1_15To1_14_4.java @@ -233,9 +233,6 @@ public class Protocol1_15To1_14_4 extends Protocol { registerOutgoing(State.PLAY, 0x58, 0x59); registerOutgoing(State.PLAY, 0x59, 0x5A); - - - registerOutgoing(State.PLAY, 0x5C, 0x08); } public static int getNewSoundId(int id) { diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java index 8af19e2b0..77cd2cf22 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/WorldPackets.java @@ -17,6 +17,22 @@ import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; public class WorldPackets { public static void register(Protocol protocol) { + // Acknowledge player digging + protocol.registerOutgoing(State.PLAY, 0x5C, 0x08, new PacketRemapper() { + @Override + public void registerMap() { + map(Type.POSITION1_14); + map(Type.VAR_INT); + handler(new PacketHandler() { + @Override + public void handle(PacketWrapper wrapper) throws Exception { + int blockState = wrapper.get(Type.VAR_INT, 0); + wrapper.set(Type.VAR_INT, 0, Protocol1_15To1_14_4.getNewBlockStateId(blockState)); + } + }); + } + }); + // Block Action protocol.registerOutgoing(State.PLAY, 0x0A, 0x0B, new PacketRemapper() { @Override