Fix /highlight.

This commit is contained in:
UnknownShadow200 2016-06-28 00:02:03 +10:00
parent 4afcd47c92
commit 62a17002a4
4 changed files with 10 additions and 10 deletions

View File

@ -144,13 +144,13 @@ namespace MCGalaxy.Util {
} }
} }
protected static void HighlightBlock(Player p, Level lvl, byte type, ushort x, ushort y, ushort z) { protected static void HighlightBlock(Player p, Level lvl, byte type, byte newType,
byte lvlTile = lvl.GetTile(x, y, z); ushort x, ushort y, ushort z) {
if (lvlTile == type || Block.Convert(lvlTile) == Block.water || Block.Convert(lvlTile) == Block.lava) { byte block = (newType == Block.air
byte block = (lvlTile == Block.air || Block.Convert(lvlTile) == Block.water || Block.Convert(type) == Block.water || type == Block.waterstill
|| Block.Convert(lvlTile) == Block.lava) ? Block.red : Block.green; || Block.Convert(type) == Block.lava || type == Block.lavastill)
p.SendBlockchange(x, y, z, block); ? Block.red : Block.green;
} p.SendBlockchange(x, y, z, block);
} }
public static void CreateDefaultDirectories() { public static void CreateDefaultDirectories() {

View File

@ -133,7 +133,7 @@ namespace MCGalaxy.Util {
DateTime time = chunk.BaseTime.AddTicks(U16(temp, offset + 0) * TimeSpan.TicksPerSecond); DateTime time = chunk.BaseTime.AddTicks(U16(temp, offset + 0) * TimeSpan.TicksPerSecond);
if (time < start) return false; if (time < start) return false;
ushort x = U16(temp, offset + 2), y = U16(temp, offset + 4), z = U16(temp, offset + 6); ushort x = U16(temp, offset + 2), y = U16(temp, offset + 4), z = U16(temp, offset + 6);
HighlightBlock(p, lvl, temp[offset + 10], x, y, z); HighlightBlock(p, lvl, temp[offset + 8], temp[offset + 10], x, y, z);
} }
} }
} }

View File

@ -217,7 +217,7 @@ namespace MCGalaxy.Util {
ushort x = (ushort)(index % chunk.Width); ushort x = (ushort)(index % chunk.Width);
ushort y = (ushort)((index / chunk.Width) / chunk.Length); ushort y = (ushort)((index / chunk.Width) / chunk.Length);
ushort z = (ushort)((index / chunk.Width) % chunk.Length); ushort z = (ushort)((index / chunk.Width) % chunk.Length);
HighlightBlock(p, lvl, temp[offset + 7], x, y, z); HighlightBlock(p, lvl, temp[offset + 6], temp[offset + 7], x, y, z);
} }
} }
} }

View File

@ -117,7 +117,7 @@ namespace MCGalaxy.Util {
ushort x = Convert.ToUInt16(lines[(i * 7) - 6]); ushort x = Convert.ToUInt16(lines[(i * 7) - 6]);
ushort y = Convert.ToUInt16(lines[(i * 7) - 5]); ushort y = Convert.ToUInt16(lines[(i * 7) - 5]);
ushort z = Convert.ToUInt16(lines[(i * 7) - 4]); ushort z = Convert.ToUInt16(lines[(i * 7) - 4]);
HighlightBlock(p, lvl, Convert.ToByte(lines[(i * 7) - 1]), x, y, z); HighlightBlock(p, lvl, Convert.ToByte(lines[(i * 7) - 2]), Convert.ToByte(lines[(i * 7) - 1]), x, y, z);
} catch { } } catch { }
} }
return true; return true;