Fix a read bug on NetTiles that causes tiles to have junk data

This commit is contained in:
Chris 2020-05-29 17:12:46 +09:30
parent e10e9f76f3
commit 45e5773c23
2 changed files with 11 additions and 3 deletions

View file

@ -2316,6 +2316,14 @@ namespace TShockAPI
{ {
var player = args.Player; var player = args.Player;
var size = args.Data.ReadInt16(); var size = args.Data.ReadInt16();
var changeType = TileChangeType.None;
bool hasChangeType = ((size & 0x7FFF) & 0x8000) != 0;
if (hasChangeType)
{
changeType = (TileChangeType)args.Data.ReadInt8();
}
var tileX = args.Data.ReadInt16(); var tileX = args.Data.ReadInt16();
var tileY = args.Data.ReadInt16(); var tileY = args.Data.ReadInt16();
var data = args.Data; var data = args.Data;

View file

@ -30,7 +30,7 @@ namespace TShockAPI.Net
public short FrameX { get; set; } public short FrameX { get; set; }
public short FrameY { get; set; } public short FrameY { get; set; }
public bool Lighted { get; set; } public bool Lighted { get; set; }
public byte Wall { get; set; } public ushort Wall { get; set; }
public byte Liquid { get; set; } public byte Liquid { get; set; }
public byte LiquidType { get; set; } public byte LiquidType { get; set; }
public bool Wire { get; set; } public bool Wire { get; set; }
@ -179,7 +179,7 @@ namespace TShockAPI.Net
} }
if (HasWall) if (HasWall)
stream.WriteInt8(Wall); stream.WriteInt16((short)Wall);
if (HasLiquid) if (HasLiquid)
{ {
@ -223,7 +223,7 @@ namespace TShockAPI.Net
if (flags[2]) if (flags[2])
{ {
Wall = stream.ReadInt8(); Wall = stream.ReadUInt16();
} }
if (flags[3]) if (flags[3])