Proper RequestNewEnchantTry InventoryUpdate logic.

Contributed by nasseka.
This commit is contained in:
MobiusDevelopment
2022-01-08 00:52:20 +00:00
parent 9f8122b1ea
commit f2e73c0030
21 changed files with 378 additions and 84 deletions

View File

@ -103,10 +103,6 @@ public class RequestNewEnchantTry implements IClientIncomingPacket
return;
}
final InventoryUpdate iu = new InventoryUpdate();
iu.addRemovedItem(itemOne);
iu.addRemovedItem(itemTwo);
if (player.destroyItem("Compound-Item-One", itemOne, 1, null, true) && player.destroyItem("Compound-Item-Two", itemTwo, 1, null, true))
{
final double random = (Rnd.nextDouble() * 100);
@ -123,7 +119,25 @@ public class RequestNewEnchantTry implements IClientIncomingPacket
}
}
final InventoryUpdate iu = new InventoryUpdate();
if (itemOne.isStackable() && (itemOne.getCount() > 0))
{
iu.addModifiedItem(itemOne);
}
else
{
iu.addRemovedItem(itemOne);
}
if (itemTwo.isStackable() && (itemTwo.getCount() > 0))
{
iu.addModifiedItem(itemTwo);
}
else
{
iu.addRemovedItem(itemTwo);
}
player.sendInventoryUpdate(iu);
player.removeRequest(request.getClass());
}
}