From e964af94346cbe9807c0c1c5ba6f59049eb104ee Mon Sep 17 00:00:00 2001 From: melchior Date: Sat, 19 Sep 2020 17:33:06 -0400 Subject: [PATCH] Block pos Protocol buffer fix (workaround) --- Automap/Data/JSON/BlockPosJson.cs | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/Automap/Data/JSON/BlockPosJson.cs b/Automap/Data/JSON/BlockPosJson.cs index 5bdb556..0dba6eb 100644 --- a/Automap/Data/JSON/BlockPosJson.cs +++ b/Automap/Data/JSON/BlockPosJson.cs @@ -8,25 +8,45 @@ using Vintagestory.API.MathTools; namespace Automap { + //ProtocolBuffer does not actually INHERIT the base class without an extra attribute on it...'lovely, just freakin' lovely.' + [JsonConverter(typeof(BlockPosConverter))] - [ProtoContract] + [ProtoContract(ImplicitFields = ImplicitFields.None)] public class BlockPosJson : BlockPos { - public BlockPosJson( ) + public BlockPosJson() { - + } public BlockPosJson(BlockPos orig) : base(x: orig.X, y: orig.Y, z: orig.Z) { } + + [ProtoMember(1)] + public new int X { + get { return base.X; } + set { base.X = value; } + } + + [ProtoMember(2)] + public new int Y { + get { return base.Y; } + set { base.Y = value; } + } + + [ProtoMember(3)] + public int Z { + get { return base.Z; } + set { base.Z = value; } + } } /// /// How JSON object conversion should be done for special formatting /// - public class BlockPosConverter : JsonConverter + public class BlockPosConverter : JsonConverter { public override bool CanConvert(Type objectType) { -- 2.11.0