Skip to content

Commit

Permalink
Update to 1.21.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ArkoSammy12 committed Dec 10, 2024
1 parent ebd0247 commit 6448cdd
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 28 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]"
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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<ItemStack>
fun onItemInteractedListener(player: PlayerEntity, world: World, hand: Hand): ActionResult

}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -62,26 +61,26 @@ class PublicInventoryManager(inputPublicInventory: PublicInventory = PublicInven
return ActionResult.SUCCESS
}

override fun onItemInteractedListener(player: PlayerEntity, world: World, hand: Hand): TypedActionResult<ItemStack> {
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 {
Expand Down
4 changes: 1 addition & 3 deletions src/main/kotlin/xd/arkosammy/publicenderchest/util/Events.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<ItemStack> {
private fun onItemInteracted(player: PlayerEntity, world: World, hand: Hand): ActionResult {
return PublicEnderChest.INVENTORY_MANAGER.onItemInteractedListener(player, world, hand)
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*",
Expand Down

0 comments on commit 6448cdd

Please sign in to comment.