diff --git a/Commands/building/CmdMark.cs b/Commands/building/CmdMark.cs index ed9507336..1bfe4a74a 100644 --- a/Commands/building/CmdMark.cs +++ b/Commands/building/CmdMark.cs @@ -37,7 +37,10 @@ namespace MCGalaxy.Commands.Building { if (!p.HasBlockchange) { Player.Message(p, "Cannot mark, no selection or cuboid in progress."); return; } - p.ManualChange(P.X, P.Y, P.Z, 0, Block.rock, 0, false); + + byte heldExt = 0; + byte heldBlock = p.GetActualHeldBlock(out heldExt); + p.ManualChange(P.X, P.Y, P.Z, 0, heldBlock, heldExt, false); Player.Message(p, "Mark placed at &b({0}, {1}, {2})", P.X, P.Y, P.Z); } diff --git a/Commands/building/CmdPlace.cs b/Commands/building/CmdPlace.cs index 510aa3751..03947dfa3 100644 --- a/Commands/building/CmdPlace.cs +++ b/Commands/building/CmdPlace.cs @@ -27,17 +27,16 @@ namespace MCGalaxy.Commands.Building { public CmdPlace() { } public override void Use(Player p, string message) { - int block = -1; byte extBlock = 0; + int block = p.GetActualHeldBlock(out extBlock); ushort x = p.pos[0], y = (ushort)(p.pos[1] - 32), z = p.pos[2]; try { string[] parts = message.Split(' '); switch (parts.Length) { - case 1: block = message == "" ? Block.rock : + case 1: block = message == "" ? block : DrawCmd.GetBlock(p, parts[0], out extBlock); break; case 3: - block = Block.rock; x = (ushort)(Convert.ToUInt16(parts[0]) * 32); y = (ushort)(Convert.ToUInt16(parts[1]) * 32); z = (ushort)(Convert.ToUInt16(parts[2]) * 32); @@ -60,7 +59,7 @@ namespace MCGalaxy.Commands.Building { P.X /= 32; P.Y /= 32; P.Z /= 32; p.level.UpdateBlock(p, P.X, P.Y, P.Z, (byte)block, extBlock); - Player.Message(p, "A block was placed at ({0}, {1}, {2}).", P.X, P.Y, P.Z); + Player.Message(p, "{3} block was placed at ({0}, {1}, {2}).", P.X, P.Y, P.Z, Block.Name((byte)block)); } public override void Help(Player p) { diff --git a/Player/Player.CPE.cs b/Player/Player.CPE.cs index 09a506231..83042b95e 100644 --- a/Player/Player.CPE.cs +++ b/Player/Player.CPE.cs @@ -18,10 +18,8 @@ using System; using System.Drawing; -namespace MCGalaxy -{ - public partial class Player - { +namespace MCGalaxy { + public partial class Player { public int ClickDistance = 0; public int CustomBlocks = 0; public int HeldBlock = 0; @@ -47,10 +45,8 @@ namespace MCGalaxy public bool hasCustomBlocks, hasBlockDefs, hasTextColors, hasChangeModel, hasExtList; - public void AddExtension(string Extension, int version) - { - switch (Extension.Trim()) - { + public void AddExtension(string ext, int version) { + switch (ext.Trim()) { case CpeExt.ClickDistance: ClickDistance = version; break; case CpeExt.CustomBlocks: diff --git a/Player/Player.Fields.cs b/Player/Player.Fields.cs index 83ff4ba60..2b73ad6ff 100644 --- a/Player/Player.Fields.cs +++ b/Player/Player.Fields.cs @@ -232,7 +232,7 @@ namespace MCGalaxy { //Games public DateTime lastDeath = DateTime.UtcNow; - public byte modeType, RawHeldBlock = Block.stone; + public byte modeType, RawHeldBlock = Block.rock; public byte[] bindings = new byte[Block.CpeCount]; public string[] cmdBind = new string[10]; public string[] messageBind = new string[10]; diff --git a/Player/Player.Handlers.cs b/Player/Player.Handlers.cs index c4b95e6b9..83db6c476 100644 --- a/Player/Player.Handlers.cs +++ b/Player/Player.Handlers.cs @@ -281,7 +281,10 @@ namespace MCGalaxy { this.SendPos(0xFF, (ushort)(clippos[0] - 18), (ushort)(clippos[1] - 18), (ushort)(clippos[2] - 18), cliprot[0], cliprot[1]); return; }*/ - byte thisid = packet[1]; + byte heldBlock = packet[1]; + if (HasCpeExt(CpeExt.HeldBlock)) + RawHeldBlock = heldBlock; + ushort x = NetUtils.ReadU16(packet, 2); ushort y = NetUtils.ReadU16(packet, 4); ushort z = NetUtils.ReadU16(packet, 6);