exopack curios inventory button
This commit is contained in:
parent
203f4e56c9
commit
027d6ef65f
@ -138,6 +138,7 @@ private fun misc(provider: MatteryLanguageProvider) {
|
||||
gui("exopack", "Exopack Inventory")
|
||||
gui("exopack.go_back", "Open vanilla inventory")
|
||||
gui("exopack.go_in", "Open Exopack inventory")
|
||||
gui("exopack.go_curios", "Open Curios inventory")
|
||||
gui("exopack.toggle_visibility", "Toggle Exopack visibility")
|
||||
|
||||
gui("exopack.probe1", "This little device feels unnatural to touch, it is almost certainly resilient to any possible attempt to break it open.")
|
||||
|
@ -146,6 +146,7 @@ private fun misc(provider: MatteryLanguageProvider) {
|
||||
gui("exopack", "Инвентарь Экзопака")
|
||||
gui("exopack.go_back", "Открыть обычный инвентарь")
|
||||
gui("exopack.go_in", "Открыть инвентарь экзопака")
|
||||
gui("exopack.go_curios", "Открыть инвентарь Curios")
|
||||
gui("exopack.toggle_visibility", "Переключить отображение Экзопака")
|
||||
|
||||
gui("exopack.probe1", "Данное маленькое устройство необычно на ощупь, а так же неприступно для любых попыток вскрыть.")
|
||||
|
@ -51,6 +51,7 @@ object Widgets18 {
|
||||
val CROSS = miscGrid.next()
|
||||
val FORWARD_SLASH = miscGrid.next()
|
||||
val RETURN_ARROW_LEFT = miscGrid.next()
|
||||
val CURIOS_INVENTORY = miscGrid.next()
|
||||
|
||||
private val slotBgGrid = WidgetLocation.SLOT_BACKGROUNDS.grid(4, 4)
|
||||
|
||||
|
@ -23,6 +23,8 @@ import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.TallHorizontalProfiledPowerGaugePanel
|
||||
import ru.dbotthepony.mc.otm.client.setMousePos
|
||||
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.network.ExoPackMenuOpen
|
||||
@ -235,7 +237,7 @@ class ExoPackInventoryScreen(menu: ExoPackInventoryMenu) : MatteryScreen<ExoPack
|
||||
scrollPanel.dock = Dock.RIGHT
|
||||
scrollPanel.setDockMargin(right = 3f)
|
||||
|
||||
LargeRectangleButtonPanel(this, frame, x = frame.width - 2f - LargeRectangleButtonPanel.SIZE, y = -LargeRectangleButtonPanel.SIZE - 2f, skinElement = Widgets18.RETURN_ARROW_LEFT, onPress = {
|
||||
val closeButtonPanel = LargeRectangleButtonPanel(this, frame, x = frame.width - 2f - LargeRectangleButtonPanel.SIZE, y = -LargeRectangleButtonPanel.SIZE - 2f, skinElement = Widgets18.RETURN_ARROW_LEFT, onPress = {
|
||||
shouldOpenVanillaInventory = true
|
||||
val minecraft = minecraft!!
|
||||
|
||||
@ -247,6 +249,12 @@ class ExoPackInventoryScreen(menu: ExoPackInventoryMenu) : MatteryScreen<ExoPack
|
||||
setMousePos(mouseX, mouseY)
|
||||
}).also { it.tooltips.add(TranslatableComponent("otm.gui.exopack.go_back")) }
|
||||
|
||||
if (isCuriosLoaded) {
|
||||
LargeRectangleButtonPanel(this, frame, x = closeButtonPanel.x - 2f - LargeRectangleButtonPanel.SIZE, y = closeButtonPanel.y, skinElement = Widgets18.CURIOS_INVENTORY, onPress = {
|
||||
openCuriosScreen(minecraft!!.player!!.containerMenu.carried)
|
||||
}).also { it.tooltips.add(TranslatableComponent("otm.gui.exopack.go_curios")) }
|
||||
}
|
||||
|
||||
makeInventoryRowsControls(frame, frame.width + 2f, frame.height.coerceAtMost(95f)) { movePixels ->
|
||||
frame.y += movePixels
|
||||
moveMousePosScaled(y = movePixels)
|
||||
|
@ -4,7 +4,10 @@ import com.google.common.collect.Streams
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.inventory.Slot
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraftforge.api.distmarker.Dist
|
||||
import net.minecraftforge.fml.ModList
|
||||
import net.minecraftforge.fml.loading.FMLEnvironment
|
||||
import net.minecraftforge.network.PacketDistributor
|
||||
import ru.dbotthepony.mc.otm.capability.MatteryCapability
|
||||
import ru.dbotthepony.mc.otm.capability.matteryPlayer
|
||||
import ru.dbotthepony.mc.otm.container.awareStream
|
||||
@ -16,6 +19,8 @@ import top.theillusivec4.curios.api.CuriosApi
|
||||
import top.theillusivec4.curios.api.event.SlotModifiersUpdatedEvent
|
||||
import top.theillusivec4.curios.common.inventory.CosmeticCurioSlot
|
||||
import top.theillusivec4.curios.common.inventory.CurioSlot
|
||||
import top.theillusivec4.curios.common.network.NetworkHandler
|
||||
import top.theillusivec4.curios.common.network.client.CPacketOpenCurios
|
||||
import java.util.stream.Stream
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
@ -28,6 +33,10 @@ fun onCuriosSlotModifiersUpdated(event: SlotModifiersUpdatedEvent) {
|
||||
event.entity.matteryPlayer?.recreateExoPackMenu()
|
||||
}
|
||||
|
||||
fun openCuriosScreen(carriedStack: ItemStack = ItemStack.EMPTY) {
|
||||
if (FMLEnvironment.dist.isClient) NetworkHandler.INSTANCE.send(PacketDistributor.SERVER.noArg(), CPacketOpenCurios(carriedStack))
|
||||
}
|
||||
|
||||
private fun Player.getCuriosSlotsImpl(): List<PlayerSlot<Slot, Slot>> {
|
||||
val handler = getCapability(MatteryCapability.CURIOS_INVENTORY).orNull() ?: return listOf()
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 815 B After Width: | Height: | Size: 826 B |
Binary file not shown.
Loading…
Reference in New Issue
Block a user