mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Fix unspecified Item slot ID
Item must have a slot ID when created
This commit is contained in:
parent
6929ae236a
commit
03023c8059
2 changed files with 14 additions and 23 deletions
|
|
@ -21,9 +21,10 @@ namespace MinecraftClient.Inventory
|
||||||
public int Count;
|
public int Count;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Slot ID in the parent inventory (-1 means not specified)
|
/// Slot ID in the parent inventory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int SlotID = -1;
|
/// <remarks>-1 means currently being dragged by mouse</remarks>
|
||||||
|
public int SlotID;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Item Metadata
|
/// Item Metadata
|
||||||
|
|
@ -37,12 +38,12 @@ namespace MinecraftClient.Inventory
|
||||||
/// <param name="Count">Item Count</param>
|
/// <param name="Count">Item Count</param>
|
||||||
/// <param name="SlotID">Item Slot ID in parent inventory</param>
|
/// <param name="SlotID">Item Slot ID in parent inventory</param>
|
||||||
/// <param name="NBT">Item Metadata</param>
|
/// <param name="NBT">Item Metadata</param>
|
||||||
public Item(int ID,int Count,int SlotID, Dictionary<string, object> NBT)
|
public Item(int id, int count, int slotID, Dictionary<string, object> nbt)
|
||||||
{
|
{
|
||||||
this.ID = ID;
|
this.ID = id;
|
||||||
this.Count = Count;
|
this.Count = count;
|
||||||
this.SlotID = SlotID;
|
this.SlotID = slotID;
|
||||||
this.NBT = NBT;
|
this.NBT = nbt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -51,22 +52,12 @@ namespace MinecraftClient.Inventory
|
||||||
/// <param name="ID">Item Type ID</param>
|
/// <param name="ID">Item Type ID</param>
|
||||||
/// <param name="Count">Item Count</param>
|
/// <param name="Count">Item Count</param>
|
||||||
/// <param name="SlotID">Item Slot ID in parent inventory</param>
|
/// <param name="SlotID">Item Slot ID in parent inventory</param>
|
||||||
public Item(int ID, int Count, int SlotID)
|
public Item(int id, int count, int slotID)
|
||||||
{
|
{
|
||||||
this.ID = ID;
|
this.ID = id;
|
||||||
this.Count = Count;
|
this.Count = count;
|
||||||
this.SlotID = SlotID;
|
this.SlotID = slotID;
|
||||||
}
|
this.NBT = new Dictionary<string, object>();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create an item with Type ID and Count
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="ID">Item Type ID</param>
|
|
||||||
/// <param name="Count">Item Count</param>
|
|
||||||
public Item(int ID, int Count)
|
|
||||||
{
|
|
||||||
this.ID = ID;
|
|
||||||
this.Count = Count;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -566,7 +566,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
byte itemCount = dataTypes.ReadNextByte(packetData);
|
byte itemCount = dataTypes.ReadNextByte(packetData);
|
||||||
dataTypes.ReadNextNbt(packetData);
|
dataTypes.ReadNextNbt(packetData);
|
||||||
|
|
||||||
Item item = new Item(itemID, itemCount);
|
Item item = new Item(itemID, itemCount, i);
|
||||||
itemsList.Add(i, item);
|
itemsList.Add(i, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue