diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/MatteryPlayerCapability.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/MatteryPlayerCapability.kt index 24e571422..d8c72c869 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/MatteryPlayerCapability.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/MatteryPlayerCapability.kt @@ -96,7 +96,7 @@ import ru.dbotthepony.mc.otm.core.util.Savetables import ru.dbotthepony.mc.otm.core.util.TickList import ru.dbotthepony.mc.otm.core.util.UUIDValueCodec import ru.dbotthepony.mc.otm.core.util.VarIntValueCodec -import ru.dbotthepony.mc.otm.menu.ExoPackInventoryMenu +import ru.dbotthepony.mc.otm.menu.ExopackInventoryMenu import ru.dbotthepony.mc.otm.network.* import ru.dbotthepony.mc.otm.network.synchronizer.FieldSynchronizer import ru.dbotthepony.mc.otm.registry.AndroidFeatures @@ -309,7 +309,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial } }).property - private var _exoPackMenu: ExoPackInventoryMenu? = null + private var _exoPackMenu: ExopackInventoryMenu? = null set(value) { if (field == ply.containerMenu) { ply.closeContainer() } field?.actuallyRemoved() @@ -317,19 +317,19 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial } /** - * [ExoPackInventoryMenu] which player will see when pressing inventory key + * [ExopackInventoryMenu] which player will see when pressing inventory key */ - val exoPackMenu: ExoPackInventoryMenu + val exoPackMenu: ExopackInventoryMenu get() { if (_exoPackMenu == null) { - _exoPackMenu = ExoPackInventoryMenu(this) + _exoPackMenu = ExopackInventoryMenu(this) } return _exoPackMenu!! } fun recreateExoPackMenu() { - _exoPackMenu = ExoPackInventoryMenu(this) + _exoPackMenu = ExopackInventoryMenu(this) } private var shouldSendIteration = false diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt index f271be043..10cdb96b9 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt @@ -18,7 +18,7 @@ import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.capability.matteryPlayer import ru.dbotthepony.mc.otm.client.render.UVWindingOrder import ru.dbotthepony.mc.otm.client.render.Widgets18 -import ru.dbotthepony.mc.otm.client.screen.ExoPackInventoryScreen +import ru.dbotthepony.mc.otm.client.screen.ExopackInventoryScreen import ru.dbotthepony.mc.otm.client.screen.MatteryScreen import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel import ru.dbotthepony.mc.otm.client.screen.panels.util.DiscreteScrollBarPanel @@ -95,7 +95,7 @@ private fun inventoryLogic(event: ScreenEvent.Init.Post) { val mouseY = minecraft.mouseHandler.ypos() event.screen.onClose() - minecraft.setScreen(ExoPackInventoryScreen(player.exoPackMenu)) + minecraft.setScreen(ExopackInventoryScreen(player.exoPackMenu)) InputConstants.grabOrReleaseMouse(minecraft.window.window, 212993, mouseX, mouseY) }).also { it.tooltips.add(TranslatableComponent("otm.gui.exopack.go_in")) }) @@ -250,6 +250,6 @@ fun onScreenOpen(event: ScreenEvent.Opening) { val player = minecraft.player?.matteryPlayer ?: return if (player.hasExopack && event.newScreen is InventoryScreen) { - event.newScreen = ExoPackInventoryScreen(player.exoPackMenu) + event.newScreen = ExopackInventoryScreen(player.exoPackMenu) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/ExoPackInventoryScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/ExopackInventoryScreen.kt similarity index 95% rename from src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/ExoPackInventoryScreen.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/ExopackInventoryScreen.kt index d90871dd4..018db7198 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/ExoPackInventoryScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/ExopackInventoryScreen.kt @@ -22,15 +22,15 @@ import ru.dbotthepony.mc.otm.client.shouldOpenVanillaInventory import ru.dbotthepony.mc.otm.compat.curios.isCuriosLoaded import ru.dbotthepony.mc.otm.compat.curios.openCuriosScreen import ru.dbotthepony.mc.otm.core.math.integerDivisionDown -import ru.dbotthepony.mc.otm.menu.ExoPackInventoryMenu +import ru.dbotthepony.mc.otm.menu.ExopackInventoryMenu import ru.dbotthepony.mc.otm.network.ExoPackMenuOpen import ru.dbotthepony.mc.otm.network.MatteryPlayerNetworkChannel import yalter.mousetweaks.api.MouseTweaksDisableWheelTweak @MouseTweaksDisableWheelTweak -class ExoPackInventoryScreen(menu: ExoPackInventoryMenu) : MatteryScreen(menu, TranslatableComponent("otm.gui.exopack")) { - private lateinit var mainInventoryLine: EditablePanel - private lateinit var scrollPanel: DiscreteScrollBarPanel +class ExopackInventoryScreen(menu: ExopackInventoryMenu) : MatteryScreen(menu, TranslatableComponent("otm.gui.exopack")) { + private lateinit var mainInventoryLine: EditablePanel + private lateinit var scrollPanel: DiscreteScrollBarPanel override fun updateInventoryRows(old: Int) { mainFrame!!.height = FRAME_BASE_HEIGHT + inventoryRows * AbstractSlotPanel.SIZE @@ -82,7 +82,7 @@ class ExoPackInventoryScreen(menu: ExoPackInventoryMenu) : MatteryScreen(this@ExoPackInventoryScreen, frame, height = AbstractSlotPanel.SIZE * inventoryRows) { + mainInventoryLine = object : EditablePanel(this@ExopackInventoryScreen, frame, height = AbstractSlotPanel.SIZE * inventoryRows) { override fun mouseScrolledInner(x: Double, y: Double, scroll: Double): Boolean { return scrollPanel.mouseScrolledInner(x, y, scroll) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt index 119f24699..fcae41d08 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt @@ -10,7 +10,7 @@ import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.capability.matteryPlayer import ru.dbotthepony.mc.otm.client.render.Widgets8 import ru.dbotthepony.mc.otm.client.render.sprites.sprite -import ru.dbotthepony.mc.otm.client.screen.ExoPackInventoryScreen +import ru.dbotthepony.mc.otm.client.screen.ExopackInventoryScreen import ru.dbotthepony.mc.otm.client.screen.MatteryScreen import ru.dbotthepony.mc.otm.client.screen.panels.button.ButtonPanel import ru.dbotthepony.mc.otm.client.screen.panels.button.CheckBoxLabelPanel @@ -199,7 +199,7 @@ class EntityRendererPanel @JvmOverloads constructor( } override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { - ExoPackInventoryScreen.ENTITY_RECTANGLE.render(graphics) + ExopackInventoryScreen.ENTITY_RECTANGLE.render(graphics) } companion object { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/JEIPlugin.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/JEIPlugin.kt index 6a7ace4cd..3c73c955c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/JEIPlugin.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/JEIPlugin.kt @@ -33,13 +33,12 @@ import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.screen.MatteryScreen import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.core.toImmutableList -import ru.dbotthepony.mc.otm.menu.ExoPackInventoryMenu +import ru.dbotthepony.mc.otm.menu.ExopackInventoryMenu import ru.dbotthepony.mc.otm.registry.MItems import ru.dbotthepony.mc.otm.registry.MRecipes import java.util.* import java.util.stream.Collectors import kotlin.collections.ArrayList -import kotlin.jvm.optionals.getOrNull import kotlin.properties.Delegates var isJeiLoaded = false @@ -87,13 +86,13 @@ class JEIPlugin : IModPlugin { override fun registerRecipeTransferHandlers(registration: IRecipeTransferRegistration) { val helper = registration.transferHelper - registration.addRecipeTransferHandler(object : IRecipeTransferHandler { - private val transfer = helper.createUnregisteredRecipeTransferHandler(object : IRecipeTransferInfo { - override fun getContainerClass(): Class { - return ExoPackInventoryMenu::class.java + registration.addRecipeTransferHandler(object : IRecipeTransferHandler { + private val transfer = helper.createUnregisteredRecipeTransferHandler(object : IRecipeTransferInfo { + override fun getContainerClass(): Class { + return ExopackInventoryMenu::class.java } - override fun getMenuType(): Optional> { + override fun getMenuType(): Optional> { return Optional.empty() } @@ -101,30 +100,30 @@ class JEIPlugin : IModPlugin { return RecipeTypes.CRAFTING } - override fun canHandle(container: ExoPackInventoryMenu, recipe: CraftingRecipe): Boolean { + override fun canHandle(container: ExopackInventoryMenu, recipe: CraftingRecipe): Boolean { return true } override fun getRecipeSlots( - container: ExoPackInventoryMenu, + container: ExopackInventoryMenu, recipe: CraftingRecipe ): List { return container.craftingSlots } override fun getInventorySlots( - container: ExoPackInventoryMenu, + container: ExopackInventoryMenu, recipe: CraftingRecipe ): List { return container.playerInventorySlots } }) - override fun getContainerClass(): Class { - return ExoPackInventoryMenu::class.java + override fun getContainerClass(): Class { + return ExopackInventoryMenu::class.java } - override fun getMenuType(): Optional> { + override fun getMenuType(): Optional> { return Optional.empty() } @@ -154,7 +153,7 @@ class JEIPlugin : IModPlugin { } override fun transferRecipe( - container: ExoPackInventoryMenu, + container: ExopackInventoryMenu, recipe: CraftingRecipe, recipeSlots: IRecipeSlotsView, player: Player, diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/ExoPackInventoryMenu.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/ExopackInventoryMenu.kt similarity index 91% rename from src/main/kotlin/ru/dbotthepony/mc/otm/menu/ExoPackInventoryMenu.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/menu/ExopackInventoryMenu.kt index 9194fc3c5..27810de27 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/ExoPackInventoryMenu.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/ExopackInventoryMenu.kt @@ -19,7 +19,7 @@ import ru.dbotthepony.mc.otm.network.ExoSuitMenuInitPacket import ru.dbotthepony.mc.otm.network.ExoSuitSlotPacket import ru.dbotthepony.mc.otm.network.MatteryPlayerNetworkChannel -class ExoPackInventoryMenu(val capability: MatteryPlayerCapability) : MatteryMenu(null, CONTAINER_ID, capability.ply.inventory) { +class ExopackInventoryMenu(val capability: MatteryPlayerCapability) : MatteryMenu(null, CONTAINER_ID, capability.ply.inventory) { val craftingGrid: CraftingContainer val craftingSlots: List @@ -207,35 +207,35 @@ class ExoPackInventoryMenu(val capability: MatteryPlayerCapability) : MatteryMen const val CONTAINER_ID: Int = 101 override fun sendInitialData(container: AbstractContainerMenu, itemStacks: NonNullList, carried: ItemStack, remoteDataSlots: IntArray) { - return sendInitialData(container as ExoPackInventoryMenu, itemStacks, carried, remoteDataSlots) + return sendInitialData(container as ExopackInventoryMenu, itemStacks, carried, remoteDataSlots) } override fun sendSlotChange(container: AbstractContainerMenu, slotId: Int, itemStack: ItemStack) { - return sendSlotChange(container as ExoPackInventoryMenu, slotId, itemStack) + return sendSlotChange(container as ExopackInventoryMenu, slotId, itemStack) } override fun sendCarriedChange(container: AbstractContainerMenu, itemStack: ItemStack) { - return sendCarriedChange(container as ExoPackInventoryMenu, itemStack) + return sendCarriedChange(container as ExopackInventoryMenu, itemStack) } override fun sendDataChange(container: AbstractContainerMenu, dataSlotId: Int, shortData: Int) { - return sendDataChange(container as ExoPackInventoryMenu, dataSlotId, shortData) + return sendDataChange(container as ExopackInventoryMenu, dataSlotId, shortData) } - fun sendInitialData(container: ExoPackInventoryMenu, itemStacks: NonNullList, carried: ItemStack, remoteDataSlots: IntArray) { + fun sendInitialData(container: ExopackInventoryMenu, itemStacks: NonNullList, carried: ItemStack, remoteDataSlots: IntArray) { MatteryPlayerNetworkChannel.send(container.ply as ServerPlayer, ExoSuitMenuInitPacket(itemStacks, carried, container.incrementStateId())) } - fun sendSlotChange(container: ExoPackInventoryMenu, slotId: Int, itemStack: ItemStack) { - if (container.slots[slotId].container != container.ply.inventory || container.ply.containerMenu is ExoPackInventoryMenu) + fun sendSlotChange(container: ExopackInventoryMenu, slotId: Int, itemStack: ItemStack) { + if (container.slots[slotId].container != container.ply.inventory || container.ply.containerMenu is ExopackInventoryMenu) MatteryPlayerNetworkChannel.send(container.ply as ServerPlayer, ExoSuitSlotPacket(slotId, itemStack, container.stateId)) } - fun sendCarriedChange(container: ExoPackInventoryMenu, itemStack: ItemStack) { + fun sendCarriedChange(container: ExopackInventoryMenu, itemStack: ItemStack) { MatteryPlayerNetworkChannel.send(container.ply as ServerPlayer, ExoSuitCarriedPacket(itemStack, container.stateId)) } - fun sendDataChange(container: ExoPackInventoryMenu, dataSlotId: Int, shortData: Int) { + fun sendDataChange(container: ExopackInventoryMenu, dataSlotId: Int, shortData: Int) { throw UnsupportedOperationException("This should never be called. Dumbass") } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/network/MatteryPlayerNetworkChannel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/network/MatteryPlayerNetworkChannel.kt index 9634b0b73..9015b11c4 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/network/MatteryPlayerNetworkChannel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/network/MatteryPlayerNetworkChannel.kt @@ -30,7 +30,7 @@ import ru.dbotthepony.mc.otm.container.set import ru.dbotthepony.mc.otm.core.math.RGBAColor import ru.dbotthepony.mc.otm.core.math.Vector import ru.dbotthepony.mc.otm.menu.tech.AndroidStationMenu -import ru.dbotthepony.mc.otm.menu.ExoPackInventoryMenu +import ru.dbotthepony.mc.otm.menu.ExopackInventoryMenu import ru.dbotthepony.mc.otm.registry.AndroidFeatures import ru.dbotthepony.mc.otm.registry.MRegistry import java.io.ByteArrayInputStream @@ -274,7 +274,7 @@ class ExoSuitSlotPacket(val slotId: Int, val itemStack: ItemStack, val container // don't duplicate data // really. - if (mattery.exoPackMenu.slots[slotId].container == minecraft.player?.inventory && minecraft.player?.containerMenu !is ExoPackInventoryMenu) + if (mattery.exoPackMenu.slots[slotId].container == minecraft.player?.inventory && minecraft.player?.containerMenu !is ExopackInventoryMenu) return@enqueueWork mattery.exoPackMenu.slots[slotId].set(itemStack) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/network/MenuNetworkChannel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/network/MenuNetworkChannel.kt index 5cd4aeabb..84a72b312 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/network/MenuNetworkChannel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/network/MenuNetworkChannel.kt @@ -10,7 +10,7 @@ import ru.dbotthepony.mc.otm.capability.matteryPlayer import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.compat.InventoryScrollPacket import ru.dbotthepony.mc.otm.container.ItemFilterSlotPacket -import ru.dbotthepony.mc.otm.menu.ExoPackInventoryMenu +import ru.dbotthepony.mc.otm.menu.ExopackInventoryMenu import ru.dbotthepony.mc.otm.menu.matter.CancelTaskPacket import ru.dbotthepony.mc.otm.menu.MatteryMenu import ru.dbotthepony.mc.otm.menu.matter.PatternsChangePacket @@ -36,7 +36,7 @@ class MenuFieldPacket(val containerId: Int, val bytes: ByteArray, val length: In context.packetHandled = true context.enqueueWork { - if (containerId == ExoPackInventoryMenu.CONTAINER_ID) { + if (containerId == ExopackInventoryMenu.CONTAINER_ID) { minecraft.player?.matteryPlayer?.exoPackMenu?.mSynchronizer?.read(ByteArrayInputStream(bytes, 0, length)) } else { val menu = minecraft.player?.containerMenu as? MatteryMenu ?: return@enqueueWork