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:
mexiscool 2020-11-08 23:39:07 +01:00 committed by GitHub
parent 2a7f0c7f16
commit 28f47cc532
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 186 additions and 1 deletions

View file

@ -220,7 +220,15 @@ namespace MinecraftClient
/// <param name="locked"></param>
/// <param name="iconcount"></param>
public virtual void OnMapData(int mapid, byte scale, bool trackingposition, bool locked, int iconcount) { }
/// <summary>
/// Called when tradeList is received from server
/// </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 virtual void OnTradeList(int windowID, List<VillagerTrade> trades, VillagerInfo villagerInfo) { }
/// <summary>
/// Called when received a title from the server
/// <param name="action"> 0 = set title, 1 = set subtitle, 3 = set action bar, 4 = set times and display, 4 = hide, 5 = reset</param>
@ -1225,6 +1233,15 @@ namespace MinecraftClient
{
return Handler.UpdateSign(location, line1, line2, line3, line4);
}
/// <summary>
/// Selects villager trade
/// </summary>
/// <param name="selectedSlot">Trade slot to select, starts at 0.</param>
protected bool SelectTrade(int selectedSlot)
{
return Handler.SelectTrade(selectedSlot);
}
/// <summary>
/// Update command block