Add block placement/right click actions on client

This commit is contained in:
Drew DeVault 2015-09-30 20:17:20 -04:00
parent 75a39118a9
commit 9ccbf80ce5
2 changed files with 18 additions and 0 deletions

View File

@ -213,6 +213,12 @@ namespace TrueCraft.Client.Modules
BeginDigging(target); BeginDigging(target);
} }
return true; return true;
case MouseButton.Right:
var item = Game.Client.Inventory.Hotbar[Game.Client.HotbarSelection];
Game.Client.QueuePacket(new PlayerBlockPlacementPacket(
Game.HighlightedBlock.X, (sbyte)Game.HighlightedBlock.Y, Game.HighlightedBlock.Z,
Game.HighlightedBlockFace, item.ID, item.Count, item.Metadata));
return true;
} }
return false; return false;
} }

View File

@ -12,6 +12,18 @@ namespace TrueCraft.Core.Networking.Packets
{ {
public byte ID { get { return 0x0F; } } public byte ID { get { return 0x0F; } }
public PlayerBlockPlacementPacket(int x, sbyte y, int z, BlockFace face, short itemID,
sbyte? amount, short? metadata)
{
X = x;
Y = y;
Z = z;
Face = face;
ItemID = itemID;
Amount = amount;
Metadata = metadata;
}
public int X; public int X;
public sbyte Y; public sbyte Y;
public int Z; public int Z;