diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs
index d0024e51..3276d86d 100644
--- a/TShockAPI/GetDataHandlers.cs
+++ b/TShockAPI/GetDataHandlers.cs
@@ -152,6 +152,7 @@ namespace TShockAPI
{ PacketTypes.PlayerHurtV2, HandlePlayerDamageV2 },
{ PacketTypes.PlayerDeathV2, HandlePlayerKillMeV2 },
{ PacketTypes.Emoji, HandleEmoji },
+ { PacketTypes.RequestTileEntityInteraction, HandleRequestTileEntityInteraction },
{ PacketTypes.SyncTilePicking, HandleSyncTilePicking },
{ PacketTypes.SyncRevengeMarker, HandleSyncRevengeMarker },
{ PacketTypes.LandGolfBallInCup, HandleLandGolfBallInCup },
@@ -1903,6 +1904,39 @@ namespace TShockAPI
return args.Handled;
}
+ /// For use in an OnRequestTileEntityInteraction event.
+ ///
+ public class RequestTileEntityInteractionEventArgs : GetDataHandledEventArgs
+ {
+ ///
+ /// The ID of the TileEntity that the player is requesting interaction with.
+ ///
+ public int TileEntityID { get; set; }
+ ///
+ /// The player index in the packet who requests interaction with the TileEntity.
+ ///
+ public byte PlayerIndex { get; set; }
+ }
+ ///
+ /// Called when a player requests interaction with a TileEntity.
+ ///
+ public static HandlerList RequestTileEntityInteraction = new HandlerList();
+ private static bool OnRequestTileEntityInteraction(TSPlayer player, MemoryStream data, int tileEntityID, byte playerIndex)
+ {
+ if (RequestTileEntityInteraction == null)
+ return false;
+
+ var args = new RequestTileEntityInteractionEventArgs
+ {
+ Player = player,
+ Data = data,
+ PlayerIndex = playerIndex,
+ TileEntityID = tileEntityID
+ };
+ RequestTileEntityInteraction.Invoke(null, args);
+ return args.Handled;
+ }
+
///
/// For use in a SyncTilePicking event.
///
@@ -3702,6 +3736,17 @@ namespace TShockAPI
return false;
}
+ private static bool HandleRequestTileEntityInteraction(GetDataHandlerArgs args)
+ {
+ int tileEntityID = args.Data.ReadInt32();
+ byte playerIndex = args.Data.ReadInt8();
+
+ if (OnRequestTileEntityInteraction(args.Player, args.Data, tileEntityID, playerIndex))
+ return true;
+
+ return false;
+ }
+
private static bool HandleSyncTilePicking(GetDataHandlerArgs args)
{
byte playerIndex = args.Data.ReadInt8();