mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-21 04:22:32 +00:00
Fix #1289 Trade station price can show a negative stack in catalog
This commit is contained in:
1 parent
a045c18a89
commit
f6786cd44a
4 files changed
+9
-7
No files matched your search
@@ -32,7 +32,7 @@ public class DataInputStreamForestry extends DataInputStream {
|
||||
|
||||
if (!itemName.isEmpty()) {
|
||||
Item item = ItemStackUtil.getItemFromRegistry(itemName);
|
||||
byte stackSize = readByte();
|
||||
int stackSize = readVarInt();
|
||||
int meta = readVarInt();
|
||||
itemstack = new ItemStack(item, stackSize, meta);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public class DataOutputStreamForestry extends DataOutputStream {
|
||||
writeUTF("");
|
||||
} else {
|
||||
writeUTF(ItemStackUtil.getItemNameFromRegistryAsString(itemstack.getItem()));
|
||||
writeByte(itemstack.stackSize);
|
||||
writeVarInt(itemstack.stackSize);
|
||||
writeVarInt(itemstack.getItemDamage());
|
||||
|
||||
if (itemstack.getItem().isDamageable() || itemstack.getItem().getShareTag()) {
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ContainerCatalogue extends Container implements IGuiSelectable, ILe
|
||||
// for display on client
|
||||
private int stationCount;
|
||||
|
||||
private boolean needsSynch = true;
|
||||
private boolean needsSync = true;
|
||||
private int currentFilter = 1;
|
||||
|
||||
private static final String[] FILTER_NAMES = new String[]{"all", "online", "offline"};
|
||||
@@ -158,7 +158,7 @@ public class ContainerCatalogue extends Container implements IGuiSelectable, ILe
|
||||
} else {
|
||||
setTradeInfo(null);
|
||||
}
|
||||
needsSynch = true;
|
||||
needsSync = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -178,7 +178,7 @@ public class ContainerCatalogue extends Container implements IGuiSelectable, ILe
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
if (needsSynch) {
|
||||
if (needsSync) {
|
||||
for (IContainerListener crafter : listeners) {
|
||||
crafter.sendProgressBarUpdate(this, 0, stationIndex);
|
||||
crafter.sendProgressBarUpdate(this, 1, stations.size());
|
||||
@@ -186,7 +186,7 @@ public class ContainerCatalogue extends Container implements IGuiSelectable, ILe
|
||||
}
|
||||
|
||||
Proxies.net.sendToPlayer(new PacketLetterInfoResponse(EnumAddressee.TRADER, currentTrade, null), player);
|
||||
needsSynch = false;
|
||||
needsSync = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,6 +225,6 @@ public class ContainerCatalogue extends Container implements IGuiSelectable, ILe
|
||||
break;
|
||||
}
|
||||
|
||||
needsSynch = true;
|
||||
needsSync = true;
|
||||
}
|
||||
}
|
||||
@@ -110,6 +110,8 @@ public class PacketLetterInfoResponse extends ForestryPacket implements IForestr
|
||||
}
|
||||
|
||||
type = EnumAddressee.fromString(data.readUTF());
|
||||
tradeInfo = null;
|
||||
address = null;
|
||||
|
||||
if (type == EnumAddressee.PLAYER) {
|
||||
if (data.readShort() < 0) {
|
||||
|
||||
Reference in new issue
Block a user