diff --git a/build.gradle.kts b/build.gradle.kts index cbf11166a..99cb3bf6c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -321,7 +321,6 @@ repositories { url = uri("https://maven.dbotthepony.ru") content { - includeGroup("top.theillusivec4.curios") includeGroup("yalter.mousetweaks") includeGroup("mekanism") includeGroup("lain.mods.cos") @@ -357,6 +356,14 @@ repositories { } } + maven { + url = uri("https://maven.theillusivec4.top/") + + content { + includeGroup("top.theillusivec4.curios") + } + } + // mavenCentral() } diff --git a/gradle.properties b/gradle.properties index 5890f6fe4..a17051611 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,7 +19,7 @@ mixin_version=0.8.5 jei_version=11.3.0.262 jupiter_version=5.8.2 mekanism_version=10.3.5.homebaked -curios_version=5.1.1.0 +curios_version=5.1.4.1 cosmetic_armor_reworked_version=v1 jade_id=4010505 configured_id=4011355 diff --git a/src/main/java/ru/dbotthepony/mc/otm/OverdriveThatMatters.java b/src/main/java/ru/dbotthepony/mc/otm/OverdriveThatMatters.java index 61fb44f29..ae34d147f 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/OverdriveThatMatters.java +++ b/src/main/java/ru/dbotthepony/mc/otm/OverdriveThatMatters.java @@ -34,6 +34,7 @@ import ru.dbotthepony.mc.otm.client.model.GravitationStabilizerModel; import ru.dbotthepony.mc.otm.client.model.TritaniumArmorModel; import ru.dbotthepony.mc.otm.client.render.ShockwaveRenderer; import ru.dbotthepony.mc.otm.client.render.WidgetAtlasHolder; +import ru.dbotthepony.mc.otm.compat.curios.CuriosCompatKt; import ru.dbotthepony.mc.otm.compat.mekanism.QIOKt; import ru.dbotthepony.mc.otm.compat.mekanism.TooltipsKt; import ru.dbotthepony.mc.otm.core.Decimal; @@ -197,6 +198,10 @@ public final class OverdriveThatMatters { EVENT_BUS.addGenericListener(BlockEntity.class, EventPriority.NORMAL, QIOKt::attachCapabilities); } + if (ModList.get().isLoaded("curios")) { + EVENT_BUS.addListener(EventPriority.NORMAL, CuriosCompatKt::onCuriosSlotModifiersUpdated); + } + OreGen.INSTANCE.register(); } 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 fd891abaa..caef7fa8f 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/MatteryPlayerCapability.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/MatteryPlayerCapability.kt @@ -165,6 +165,10 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial return _exoPackMenu!! } + fun recreateExoPackMenu() { + _exoPackMenu = ExoPackInventoryMenu(this) + } + private var shouldSendIteration = false var iteration = 0 private set diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/curios/CuriosCompat.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/curios/CuriosCompat.kt index ddda5ccb1..d2c2b3a2e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/curios/CuriosCompat.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/curios/CuriosCompat.kt @@ -6,20 +6,26 @@ import net.minecraft.world.inventory.Slot import net.minecraft.world.item.ItemStack import net.minecraftforge.fml.ModList import ru.dbotthepony.mc.otm.capability.MatteryCapability +import ru.dbotthepony.mc.otm.capability.matteryPlayer import ru.dbotthepony.mc.otm.container.awareStream import ru.dbotthepony.mc.otm.container.stream import ru.dbotthepony.mc.otm.core.AwareItemStack import ru.dbotthepony.mc.otm.core.orNull 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 java.util.* import java.util.stream.Stream val isCuriosLoaded by lazy { ModList.get().isLoaded(CuriosApi.MODID) } +fun onCuriosSlotModifiersUpdated(event: SlotModifiersUpdatedEvent) { + check(isCuriosLoaded) { "Curios is not loaded!" } + event.entity.matteryPlayer?.recreateExoPackMenu() +} + private fun Player.getCuriosSlotsImpl(): Collection> { val handler = getCapability(MatteryCapability.CURIOS_INVENTORY).orNull() ?: return listOf() @@ -28,9 +34,9 @@ private fun Player.getCuriosSlotsImpl(): Collection> { val sortedIdentifiers = ArrayList(handler.curios.keys.size) sortedIdentifiers.addAll(handler.curios.keys) - if (handler.curios !is LinkedHashMap) { - sortedIdentifiers.sort() - } + //if (handler.curios !is LinkedHashMap) { + // sortedIdentifiers.sort() + //} for (identifier in sortedIdentifiers) { val curio = handler.curios[identifier]!! @@ -69,7 +75,7 @@ val Player.curiosSlots: Collection> get() { private fun Player.curiosStreamImpl(includeCosmetics: Boolean): Stream { val handler = getCapability(MatteryCapability.CURIOS_INVENTORY).orNull() ?: return Stream.empty() - val result = LinkedList>() + val result = ArrayList>() for ((identifier, curio) in handler.curios) { result.add(curio.stacks.stream()) @@ -79,7 +85,7 @@ private fun Player.curiosStreamImpl(includeCosmetics: Boolean): Stream { @@ -93,7 +99,7 @@ fun Player.curiosStream(includeCosmetics: Boolean = true): Stream private fun Player.curiosAwareStreamImpl(includeCosmetics: Boolean): Stream { val handler = getCapability(MatteryCapability.CURIOS_INVENTORY).orNull() ?: return Stream.empty() - val result = LinkedList>() + val result = ArrayList>() for ((identifier, curio) in handler.curios) { result.add(curio.stacks.awareStream())