From 6448cdd36a4a25b4fd5f92e01212806514c74c5f Mon Sep 17 00:00:00 2001 From: ArkoSammy12 Date: Mon, 9 Dec 2024 22:30:47 -0500 Subject: [PATCH] Update to 1.21.4 --- build.gradle | 4 ++-- gradle.properties | 16 ++++++++-------- gradle/wrapper/gradle-wrapper.properties | 2 +- .../publicenderchest/PublicEnderChest.kt | 1 - .../inventory/InventoryManager.kt | 4 +--- .../inventory/PublicInventoryManager.kt | 15 +++++++-------- .../xd/arkosammy/publicenderchest/util/Events.kt | 4 +--- src/main/resources/fabric.mod.json | 4 ++-- 8 files changed, 22 insertions(+), 28 deletions(-) diff --git a/build.gradle b/build.gradle index a0f7a4d..56149e2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { - id 'fabric-loom' version '1.7-SNAPSHOT' + id 'fabric-loom' version '1.9-SNAPSHOT' id 'maven-publish' - id "org.jetbrains.kotlin.jvm" version "2.0.10" + id "org.jetbrains.kotlin.jvm" version "2.1.0" } version = project.mod_version diff --git a/gradle.properties b/gradle.properties index a538810..664ba08 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,21 +4,21 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.21 -yarn_mappings=1.21+build.9 -loader_version=0.16.0 +minecraft_version=1.21.4 +yarn_mappings=1.21.4+build.1 +loader_version=0.16.9 # Fabric API -fabric_version=0.102.1+1.21.1 +fabric_version=0.111.0+1.21.4 + +# Kotlin +fabric_kotlin_version=1.13.0+kotlin.2.1.0 # Mod Properties -mod_version=1.1.0 +mod_version=1.1.1 maven_group=xd.arkosammy archives_base_name=publicenderchest -# Fabric Kotlin version -fabric_kotlin_version=1.12.0+kotlin.2.0.10 - # Monkey Config monkey_config_version=0.1.2+1.21 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a441313..94113f2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/kotlin/xd/arkosammy/publicenderchest/PublicEnderChest.kt b/src/main/kotlin/xd/arkosammy/publicenderchest/PublicEnderChest.kt index dc9eeca..fef6f71 100644 --- a/src/main/kotlin/xd/arkosammy/publicenderchest/PublicEnderChest.kt +++ b/src/main/kotlin/xd/arkosammy/publicenderchest/PublicEnderChest.kt @@ -85,6 +85,5 @@ fun ItemStack.isEnderChest() : Boolean { return item.block is EnderChestBlock } -@JvmStatic fun formatInfoTextMetadata(syncId: Int, revision: Int) : String = "publicenderchest:CustomText[syncId=$syncId, revision=$revision]" diff --git a/src/main/kotlin/xd/arkosammy/publicenderchest/inventory/InventoryManager.kt b/src/main/kotlin/xd/arkosammy/publicenderchest/inventory/InventoryManager.kt index fe12f8b..1e99933 100644 --- a/src/main/kotlin/xd/arkosammy/publicenderchest/inventory/InventoryManager.kt +++ b/src/main/kotlin/xd/arkosammy/publicenderchest/inventory/InventoryManager.kt @@ -1,11 +1,9 @@ package xd.arkosammy.publicenderchest.inventory import net.minecraft.entity.player.PlayerEntity -import net.minecraft.item.ItemStack import net.minecraft.server.MinecraftServer import net.minecraft.util.ActionResult import net.minecraft.util.Hand -import net.minecraft.util.TypedActionResult import net.minecraft.util.hit.BlockHitResult import net.minecraft.world.World @@ -19,6 +17,6 @@ interface InventoryManager { fun onBlockInteractedListener(player: PlayerEntity, world: World, hand: Hand, hitResult: BlockHitResult) : ActionResult - fun onItemInteractedListener(player: PlayerEntity, world: World, hand: Hand): TypedActionResult + fun onItemInteractedListener(player: PlayerEntity, world: World, hand: Hand): ActionResult } \ No newline at end of file diff --git a/src/main/kotlin/xd/arkosammy/publicenderchest/inventory/PublicInventoryManager.kt b/src/main/kotlin/xd/arkosammy/publicenderchest/inventory/PublicInventoryManager.kt index dd98d80..1c5fbe8 100644 --- a/src/main/kotlin/xd/arkosammy/publicenderchest/inventory/PublicInventoryManager.kt +++ b/src/main/kotlin/xd/arkosammy/publicenderchest/inventory/PublicInventoryManager.kt @@ -9,7 +9,6 @@ import net.minecraft.server.MinecraftServer import net.minecraft.server.network.ServerPlayerEntity import net.minecraft.util.ActionResult import net.minecraft.util.Hand -import net.minecraft.util.TypedActionResult import net.minecraft.util.hit.BlockHitResult import net.minecraft.world.World import xd.arkosammy.publicenderchest.PublicEnderChest @@ -62,26 +61,26 @@ class PublicInventoryManager(inputPublicInventory: PublicInventory = PublicInven return ActionResult.SUCCESS } - override fun onItemInteractedListener(player: PlayerEntity, world: World, hand: Hand): TypedActionResult { + override fun onItemInteractedListener(player: PlayerEntity, world: World, hand: Hand): ActionResult { val heldStack: ItemStack = player.getStackInHand(hand) if (world.isClient() || player !is ServerPlayerEntity) { - return TypedActionResult.pass(heldStack) + return ActionResult.PASS } if (!heldStack.isEnderChest()) { - return TypedActionResult.pass(heldStack) + return ActionResult.PASS } val isUsingPublicInventory: Boolean = player.getAttached(PublicEnderChest.USING_PUBLIC_INVENTORY) ?: true if (!isUsingPublicInventory) { - return TypedActionResult.pass(heldStack) + return ActionResult.PASS } if (player.isSpectator) { - return TypedActionResult.pass(heldStack) + return ActionResult.PASS } if (!publicInventory.canPlayerUse(player)) { - return TypedActionResult.pass(heldStack) + return ActionResult.PASS } (player as ServerPlayerEntityDuck).`publicenderchest$openInventory`(PublicEnderChest.PUBLIC_INVENTORY_NAME, publicInventory) - return TypedActionResult.success(heldStack) + return ActionResult.SUCCESS_SERVER } companion object { diff --git a/src/main/kotlin/xd/arkosammy/publicenderchest/util/Events.kt b/src/main/kotlin/xd/arkosammy/publicenderchest/util/Events.kt index fcc3a1d..9f3a603 100644 --- a/src/main/kotlin/xd/arkosammy/publicenderchest/util/Events.kt +++ b/src/main/kotlin/xd/arkosammy/publicenderchest/util/Events.kt @@ -10,14 +10,12 @@ import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking.Context import net.minecraft.entity.player.PlayerEntity -import net.minecraft.item.ItemStack import net.minecraft.network.packet.CustomPayload import net.minecraft.server.MinecraftServer import net.minecraft.server.network.ServerPlayNetworkHandler import net.minecraft.server.network.ServerPlayerEntity import net.minecraft.util.ActionResult import net.minecraft.util.Hand -import net.minecraft.util.TypedActionResult import net.minecraft.util.hit.BlockHitResult import net.minecraft.world.World import xd.arkosammy.publicenderchest.PublicEnderChest @@ -51,7 +49,7 @@ object Events { return PublicEnderChest.INVENTORY_MANAGER.onBlockInteractedListener(player, world, hand, hitResult) } - private fun onItemInteracted(player: PlayerEntity, world: World, hand: Hand): TypedActionResult { + private fun onItemInteracted(player: PlayerEntity, world: World, hand: Hand): ActionResult { return PublicEnderChest.INVENTORY_MANAGER.onItemInteractedListener(player, world, hand) } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 26871bc..8d7fcb8 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -36,8 +36,8 @@ } ], "depends": { - "fabricloader": ">=0.16.0", - "minecraft": ">=1.21", + "fabricloader": ">=0.16.9", + "minecraft": ">=1.21.4", "java": ">=21", "fabric-api": "*", "fabric-language-kotlin": "*",