OSDN Git Service

Block pos Protocol buffer fix (workaround)
authormelchior <melchior@users.osdn.me>
Sat, 19 Sep 2020 21:33:06 +0000 (17:33 -0400)
committermelchior <melchior@users.osdn.me>
Sat, 19 Sep 2020 21:33:06 +0000 (17:33 -0400)
Automap/Data/JSON/BlockPosJson.cs

index 5bdb556..0dba6eb 100644 (file)
@@ -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; }
+               }
        }
 
        /// <summary>
        /// How JSON object conversion should be done for special formatting
        /// </summary>
-       public class BlockPosConverter : JsonConverter 
+       public class BlockPosConverter : JsonConverter
        {
                public override bool CanConvert(Type objectType)
                {