OSDN Git Service
(root)
/
automap
/
automap.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0fa1d15
)
Block pos Protocol buffer fix (workaround)
author
melchior
<melchior@users.osdn.me>
Sat, 19 Sep 2020 21:33:06 +0000
(17:33 -0400)
committer
melchior
<melchior@users.osdn.me>
Sat, 19 Sep 2020 21:33:06 +0000
(17:33 -0400)
Automap/Data/JSON/BlockPosJson.cs
patch
|
blob
|
history
diff --git
a/Automap/Data/JSON/BlockPosJson.cs
b/Automap/Data/JSON/BlockPosJson.cs
index
5bdb556
..
0dba6eb
100644
(file)
--- a/
Automap/Data/JSON/BlockPosJson.cs
+++ b/
Automap/Data/JSON/BlockPosJson.cs
@@
-8,25
+8,45
@@
using Vintagestory.API.MathTools;
namespace Automap
{
namespace Automap
{
+ //ProtocolBuffer does not actually INHERIT the base class without an extra attribute on it...'lovely, just freakin' lovely.'
+
[JsonConverter(typeof(BlockPosConverter))]
[JsonConverter(typeof(BlockPosConverter))]
- [ProtoContract]
+ [ProtoContract
(ImplicitFields = ImplicitFields.None)
]
public class BlockPosJson : BlockPos
{
public class BlockPosJson : BlockPos
{
- public BlockPosJson(
)
+ public BlockPosJson()
{
{
-
+
}
public BlockPosJson(BlockPos orig) : base(x: orig.X, y: orig.Y, z: orig.Z)
{
}
}
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>
}
/// <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)
{
{
public override bool CanConvert(Type objectType)
{