summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol_1_9.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2017-08-27 23:37:39 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2017-08-30 19:00:17 +0200
commit5481249d0f6025251e811f2e35daa79ee7c258aa (patch)
tree6f2bfd59cbf4d11b1236b8c24e1b1b7dd09077f5 /src/Protocol/Protocol_1_9.cpp
parentMerge pull request #3969 from peterbell10/cuboid (diff)
downloadcuberite-VillagerTrading.tar
cuberite-VillagerTrading.tar.gz
cuberite-VillagerTrading.tar.bz2
cuberite-VillagerTrading.tar.lz
cuberite-VillagerTrading.tar.xz
cuberite-VillagerTrading.tar.zst
cuberite-VillagerTrading.zip
Diffstat (limited to 'src/Protocol/Protocol_1_9.cpp')
-rw-r--r--src/Protocol/Protocol_1_9.cpp36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp
index 475047417..08f883102 100644
--- a/src/Protocol/Protocol_1_9.cpp
+++ b/src/Protocol/Protocol_1_9.cpp
@@ -1642,6 +1642,40 @@ void cProtocol_1_9_0::SendUseBed(const cEntity & a_Entity, int a_BlockX, int a_B
+void cProtocol_1_9_0::SendVillagerTradeList(const cWindow & TradeWindow, const std::vector<VillagerTradeOffer> & TradeOffers)
+{
+ ASSERT(m_State == 3); // In game mode?
+
+ cPacketizer Pkt(*this, 0x18); // Plugin message
+ Pkt.WriteString("MC|TrList");
+ Pkt.WriteBEInt32(static_cast<Int32>(TradeWindow.GetWindowID()));
+ Pkt.WriteBEUInt8(static_cast<UInt8>(TradeOffers.size()));
+
+ for (const auto & Trade : TradeOffers)
+ {
+ WriteItem(Pkt, Trade.PrimaryDesire);
+ WriteItem(Pkt, Trade.Recompense);
+
+ if (Trade.SecondaryDesire.IsEmpty())
+ {
+ Pkt.WriteBool(false);
+ }
+ else
+ {
+ Pkt.WriteBool(true);
+ WriteItem(Pkt, Trade.SecondaryDesire);
+ }
+
+ Pkt.WriteBool(Trade.IsTradeExhausted());
+ Pkt.WriteBEInt32(static_cast<Int32>(Trade.Transactions));
+ Pkt.WriteBEInt32(static_cast<Int32>(Trade.MaximumTransactions));
+ }
+}
+
+
+
+
+
void cProtocol_1_9_0::SendWeather(eWeather a_Weather)
{
ASSERT(m_State == 3); // In game mode?
@@ -4044,7 +4078,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
a_Pkt.WriteBEUInt8(12); // Index 12: Type
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
- a_Pkt.WriteVarInt32(static_cast<UInt32>(Villager.GetVilType()));
+ a_Pkt.WriteVarInt32(static_cast<UInt32>(cVillager::VillagerCareerToProfession(Villager.GetCareer())));
break;
} // case mtVillager