Add block placement/right click actions on client
This commit is contained in:
parent
75a39118a9
commit
9ccbf80ce5
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
Reference in New Issue
Block a user