Do not scroll inventory menu

This commit is contained in:
DBotThePony 2022-10-23 15:00:21 +07:00
parent b14b7467c9
commit 115cd1f027
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -8,6 +8,7 @@ import net.minecraft.network.FriendlyByteBuf
import net.minecraft.world.SimpleContainer import net.minecraft.world.SimpleContainer
import net.minecraft.world.entity.player.Player import net.minecraft.world.entity.player.Player
import net.minecraft.world.inventory.AbstractContainerMenu import net.minecraft.world.inventory.AbstractContainerMenu
import net.minecraft.world.inventory.InventoryMenu
import net.minecraft.world.inventory.Slot import net.minecraft.world.inventory.Slot
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Items import net.minecraft.world.item.Items
@ -174,6 +175,10 @@ class InventoryScrollPacket(val scroll: Int) : MatteryPacket {
fun play(player: Player) { fun play(player: Player) {
val containerMenu = player.containerMenu ?: return val containerMenu = player.containerMenu ?: return
if (containerMenu is InventoryMenu) {
return
}
menuConfigurations.computeIfAbsent(containerMenu) { menuConfigurations.computeIfAbsent(containerMenu) {
val originalSlots = Int2ObjectAVLTreeMap<Slot>() val originalSlots = Int2ObjectAVLTreeMap<Slot>()