22
33import net .evmodder .KeyBound .Main ;
44import net .evmodder .KeyBound .MapClickMoveNeighbors ;
5+ import net .minecraft .client .MinecraftClient ;
56import net .minecraft .client .gui .screen .Screen ;
67import net .minecraft .entity .player .PlayerEntity ;
78import net .minecraft .item .ItemStack ;
89import net .minecraft .registry .Registries ;
910import net .minecraft .screen .ScreenHandler ;
1011import net .minecraft .screen .slot .SlotActionType ;
12+ import net .minecraft .text .Text ;
1113import org .spongepowered .asm .mixin .Mixin ;
1214import org .spongepowered .asm .mixin .injection .At ;
1315import org .spongepowered .asm .mixin .injection .Inject ;
@@ -18,7 +20,11 @@ public abstract class MixinScreenHandler{
1820
1921 @ Inject (method = "internalOnSlotClick" , at = @ At ("TAIL" ))
2022 private void add_logic_for_bulk_move_maparts (int slotIndex , int button , SlotActionType actionType , PlayerEntity player , CallbackInfo ci ){
21- Main .inventoryUtils .addClick (actionType );
23+ if (Main .inventoryUtils .addClick (actionType ) > Main .inventoryUtils .MAX_CLICKS ){
24+ ci .cancel (); // Throw out clicks that exceed the limit!!
25+ Main .LOGGER .error ("Discarding click in internalOnSlotClick() due to exceeding MAX_CLICKS limit" );
26+ MinecraftClient .getInstance ().player .sendMessage (Text .literal ("Discarding unsafe clicks!! > LIMIT" ).copy ().withColor (/*&c=*/ 16733525 ), false );
27+ }
2228 //Main.LOGGER.info("MapMoveClick: click slot "+slotIndex);
2329 if (button != 0 || actionType != SlotActionType .PICKUP ) return ;
2430 //Main.LOGGER.info("MapMoveClick: PICKUP");
0 commit comments