Open meridianrealms opened 3 months ago
This is because mule and chested horse have their inventory of type CHEST, but with a size of 17 (first item being the saddle, second is null? remaining 15 is the actual inventory. Working on a fix.
So the null slot would explain the items disappearing then. That's good to know. Thanks for looking in to this!
@meridianrealms hi, please check if this version fixed the issue for you. You need to unzip it first (Github requires uploading zips)
@meridianrealms can you check if it is working? so I can make a new release
@NewbieOrange I just checked with a local build including #22. For mules, the first slot of the inventory is skipped when sorting (top left). I suppose this is due to mules not having an armor slot, unlike regular horses.
@NewbieOrange I just checked with a local build including #22. For mules, the first slot of the inventory is skipped when sorting (top left). I suppose this is due to mules not having an armor slot, unlike regular horses.
Thanks for the quick fix! The whole horse-inventory thing is a bit confusing as Bukkit API doesn't seem to have anyway to know where is the saddle / armor slot (or if whether there is such a slot).
Spigot Wiki showed an image of donkey and horse inventory, which looks like both are 0=saddle, 1=armor (donkey have no armor, but the "slot" is still there). I am not sure why the first actual slot is skipped for Donkeys / Mules..
@NewbieOrange I just checked with a local build including #22. For mules, the first slot of the inventory is skipped when sorting (top left). I suppose this is due to mules not having an armor slot, unlike regular horses.
Thanks for the quick fix! The whole horse-inventory thing is a bit confusing as Bukkit API doesn't seem to have anyway to know where is the saddle / armor slot (or if whether there is such a slot).
Spigot Wiki showed an image of donkey and horse inventory, which looks like both are 0=saddle, 1=armor (donkey have no armor, but the "slot" is still there). I am not sure why the first actual slot is skipped for Donkeys / Mules..
I agree, this seems strange. I double checked and verified a few things:
[ClickSort] sortAndMerge: sortable = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], size = 16
.This seems like an API issue to me. I dug a bit in to the source and found this commit: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/c2ccc46ec3601b1805fab9d753d16cb5c5964ba3#src%2Fmain%2Fjava%2Forg%2Fbukkit%2Fcraftbukkit%2Fentity%2FCraftHorse.java It seems that body armor is internally stored as a separate thing now. Not sure about the saddle. I'm yet to completely understand if this is related, but it could explain the offset by 1.
Edit: Horse inventories (without chests) have a similar issue:
@minoneer The commit you refer to is committed at May 10. Not sure if it is something mojang changed during a version and spigot has to fix (the Bukkit API part).
If it is the case, should we just change the begin slot to slot 1 for (chested) horses, would that work? or would the last slot (rawSlot 16, slot 9 of the player inventory) be excluded from sorting? (in which case, perhaps you can submit a bug report to spigot)
@minoneer The commit you refer to is committed at May 10. Not sure if it is something mojang changed during a version and spigot has to fix (the Bukkit API part).
If it is the case, should we just change the begin slot to slot 1 for (chested) horses, would that work? or would the last slot (rawSlot 16, slot 9 of the player inventory) be excluded from sorting? (in which case, perhaps you can submit a bug report to spigot)
Yes, I believe Mojang changed how armor is stored internally.
Starting to sort from slot 1 should fix the actual sorting (slot 0 is saddle).
It might just sort the wrong inventory when clicking on the last slot - but I think we can live with that until Spigot fixes its mapping. We should create a bug report for that.
That's the theory at least - can't test right now.
Edit: it's pbl. a 1.20.5/6 change if you want to preserve backwards compatibility
@NewbieOrange It might be good to release an update, even if this mule inventory situation is unresolved (we could also temporarily disable any horse-related inventories until this has been fixed). People are already forking the plugin on the spigot forums due to a lack of update.
@NewbieOrange It might be good to release an update, even if this mule inventory situation is unresolved (we could also temporarily disable any horse-related inventories until this has been fixed). People are already forking the plugin on the spigot forums due to a lack of update.
Yeah, I will make a release today.
This may also affect other animals with inventories, I haven't tested. When sorting a mule's inventory it will put any item in the saddle slot and allow a player to control it as if a saddle were there. More importantly, sometimes it will erase items completely. There is no way currently I know of to disable sorting since it seems it's detected as a chest inventory type.