mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Adds support for villager trading (#1316)
* adds villager trading support Adds handler for tradeList packet and selectTrade packet * added extra line at end * removed tab; removed size and hasSecondItem removed a mistakenly added tab instead of 4 spaces. SelectTrade was already added in 1.13. Removed unnecessary size and hasSecondItem from trade dataType. * Added VillagerInfo class and capitalized vars in Trade class * Update VillagerInfo.cs * Small formatting/naming adjustments Co-authored-by: ORelio <ORelio@users.noreply.github.com>
This commit is contained in:
parent
2a7f0c7f16
commit
28f47cc532
11 changed files with 186 additions and 1 deletions
|
|
@ -1449,6 +1449,15 @@ namespace MinecraftClient
|
|||
// TODO Open sign editor first https://wiki.vg/Protocol#Open_Sign_Editor
|
||||
return handler.SendUpdateSign(location, line1, line2, line3, line4);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Select villager trade
|
||||
/// </summary>
|
||||
/// <param name="selectedSlot">The slot of the trade, starts at 0.</param>
|
||||
public bool SelectTrade(int selectedSlot)
|
||||
{
|
||||
return handler.SelectTrade(selectedSlot);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update command block
|
||||
|
|
@ -2246,6 +2255,18 @@ namespace MinecraftClient
|
|||
DispatchBotEvent(bot => bot.OnEntityMetadata(entity, metadata));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when tradeList is recieved after interacting with villager
|
||||
/// </summary>
|
||||
/// <param name="windowID">Window ID</param>
|
||||
/// <param name="trades">List of trades.</param>
|
||||
/// <param name="villagerInfo">Contains Level, Experience, IsRegularVillager and CanRestock .</param>
|
||||
public void OnTradeList(int windowID, List<VillagerTrade> trades, VillagerInfo villagerInfo)
|
||||
{
|
||||
DispatchBotEvent(bot => bot.OnTradeList(windowID, trades, villagerInfo));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue