1919
2020import dev .terminalmc .clientsort .compat .itemlocks .ItemLocksWrapper ;
2121import dev .terminalmc .clientsort .inventory .ContainerScreenHelper ;
22- import dev .terminalmc .clientsort .main .network .SortPayload ;
22+ import dev .terminalmc .clientsort .main .network .ServerboundSortPacket ;
2323import dev .terminalmc .clientsort .network .InteractionManager ;
2424import dev .terminalmc .clientsort .platform .Services ;
2525import dev .terminalmc .clientsort .util .SoundManager ;
@@ -95,7 +95,7 @@ private void combineStacks() {
9595 stack = stacks [i ];
9696 if (stack .isEmpty ()) continue ;
9797 int stackSize = stack .getCount ();
98- if (stackSize >= stack .getItem ().getDefaultMaxStackSize ()) continue ;
98+ if (stackSize >= stack .getItem ().getMaxStackSize ()) continue ;
9999 // Partial stack found, pick it up
100100 clickEvents .add (screenHelper .createClickEvent (
101101 inventorySlots [i ], 0 , ClickType .PICKUP , false ));
@@ -104,15 +104,15 @@ private void combineStacks() {
104104 for (int j = 0 ; j < i ; j ++) {
105105 ItemStack target = stacks [j ];
106106 if (target .isEmpty ()) continue ;
107- if (target .getCount () >= target .getItem ().getDefaultMaxStackSize ()) continue ;
108- if (ItemStack .isSameItemSameComponents (stack , target )) {
107+ if (target .getCount () >= target .getItem ().getMaxStackSize ()) continue ;
108+ if (ItemStack .isSameItemSameTags (stack , target )) {
109109 // Matching partial stack found, click on it to place as
110110 // much of the carried stack as possible
111111 clickEvents .add (screenHelper .createClickEvent (
112112 inventorySlots [j ], 0 , ClickType .PICKUP , false ));
113113 // Check how many items would be placed by the click, and
114114 // update logical record
115- int delta = target .getItem ().getDefaultMaxStackSize () - target .getCount ();
115+ int delta = target .getItem ().getMaxStackSize () - target .getCount ();
116116 delta = Math .min (delta , stackSize );
117117 stackSize -= delta ;
118118 target .setCount (target .getCount () + delta );
@@ -165,7 +165,8 @@ public void sort(SortOrder sortOrder) {
165165 SortContext context = new SortContext (containerScreen , Arrays .asList (inventorySlots ));
166166 sortIds = sortOrder .sort (sortIds , stacks , context );
167167
168- if (options ().serverAcceleratedSorting && Services .PLATFORM .canSendToServer (SortPayload .TYPE )) {
168+ if (options ().serverAcceleratedSorting
169+ && Services .PLATFORM .canSendToServer (ServerboundSortPacket .ID )) {
169170 // Send the key off to the server
170171 sortOnServer (sortIds );
171172 } else {
@@ -192,8 +193,8 @@ protected void sortOnServer(int[] sortedIds) {
192193
193194 // Send the instructions to the server
194195 InteractionManager .push (() -> {
195- Services .PLATFORM .sendToServer (
196- new SortPayload ( containerScreen .getMenu ().containerId , slotMapping ));
196+ Services .PLATFORM .sendToServer (ServerboundSortPacket . ID , new ServerboundSortPacket (
197+ containerScreen .getMenu ().containerId , slotMapping ));
197198 return InteractionManager .TICK_WAITER ;
198199 });
199200 }
@@ -301,7 +302,7 @@ protected void sortOnClient(int[] sortedIds, boolean playSound) {
301302 if (
302303 stacks [id ].getItem () == currentStack .getItem ()
303304 && !doneOrEmpty .get (slotCount + id )
304- && ItemStack .isSameItemSameComponents (stacks [id ], currentStack )
305+ && ItemStack .isSameItemSameTags (stacks [id ], currentStack )
305306 ) {
306307 // If the current stack and the target stack are completely
307308 // equal, then we can skip this step in the chain
0 commit comments