diff --git a/libs.versions.toml b/libs.versions.toml index 5ca202df..26ab10aa 100644 --- a/libs.versions.toml +++ b/libs.versions.toml @@ -1,7 +1,7 @@ [versions] minecraft = "1.21.3" yarn-mappings = "1.21.3+build.2" -fabric-loader = "0.16.7" +fabric-loader = "0.16.8" fabric-api = "0.107.0+1.21.3" diff --git a/src/main/kotlin/com/github/quiltservertools/ledger/actions/ItemChangeActionType.kt b/src/main/kotlin/com/github/quiltservertools/ledger/actions/ItemChangeActionType.kt index bd769989..9073733f 100644 --- a/src/main/kotlin/com/github/quiltservertools/ledger/actions/ItemChangeActionType.kt +++ b/src/main/kotlin/com/github/quiltservertools/ledger/actions/ItemChangeActionType.kt @@ -15,28 +15,19 @@ import net.minecraft.block.LecternBlock import net.minecraft.block.entity.ChestBlockEntity import net.minecraft.block.entity.LecternBlockEntity import net.minecraft.inventory.Inventory -import net.minecraft.item.BlockItem import net.minecraft.item.ItemStack import net.minecraft.item.Items -import net.minecraft.registry.Registries import net.minecraft.server.MinecraftServer import net.minecraft.server.command.ServerCommandSource import net.minecraft.server.network.ServerPlayerEntity import net.minecraft.server.world.ServerWorld import net.minecraft.text.HoverEvent import net.minecraft.text.Text -import net.minecraft.util.Util import net.minecraft.util.math.BlockPos abstract class ItemChangeActionType : AbstractActionType() { - override fun getTranslationType(): String { - val item = Registries.ITEM.get(objectIdentifier) - return if (item is BlockItem) { - "block" - } else { - "item" - } - } + // Not used + override fun getTranslationType(): String = "item" private fun getStack(server: MinecraftServer) = NbtUtils.itemFromProperties( extraData, @@ -48,12 +39,7 @@ abstract class ItemChangeActionType : AbstractActionType() { val stack = getStack(source.server) return "${stack.count} ".literal().append( - Text.translatable( - Util.createTranslationKey( - getTranslationType(), - objectIdentifier - ) - ) + stack.itemName ).setStyle(TextColorPallet.secondaryVariant).styled { it.withHoverEvent( HoverEvent( diff --git a/src/main/kotlin/com/github/quiltservertools/ledger/actions/ItemDropActionType.kt b/src/main/kotlin/com/github/quiltservertools/ledger/actions/ItemDropActionType.kt index ab76c865..6f939707 100644 --- a/src/main/kotlin/com/github/quiltservertools/ledger/actions/ItemDropActionType.kt +++ b/src/main/kotlin/com/github/quiltservertools/ledger/actions/ItemDropActionType.kt @@ -8,26 +8,18 @@ import com.github.quiltservertools.ledger.utility.literal import net.minecraft.entity.Entity import net.minecraft.entity.EntityType import net.minecraft.entity.ItemEntity -import net.minecraft.item.BlockItem import net.minecraft.nbt.StringNbtReader -import net.minecraft.registry.Registries import net.minecraft.server.MinecraftServer import net.minecraft.server.command.ServerCommandSource import net.minecraft.text.HoverEvent import net.minecraft.text.Text -import net.minecraft.util.Util +// TODO remove duplication from ItemPickUpActionType and ItemDropActionType open class ItemDropActionType : AbstractActionType() { override val identifier = "item-drop" - override fun getTranslationType(): String { - val item = Registries.ITEM.get(objectIdentifier) - return if (item is BlockItem) { - "block" - } else { - "item" - } - } + // Not used + override fun getTranslationType(): String = "item" private fun getStack(server: MinecraftServer) = NbtUtils.itemFromProperties( extraData, @@ -39,12 +31,7 @@ open class ItemDropActionType : AbstractActionType() { val stack = getStack(source.server) return "${stack.count} ".literal().append( - Text.translatable( - Util.createTranslationKey( - getTranslationType(), - objectIdentifier - ) - ) + stack.itemName ).setStyle(TextColorPallet.secondaryVariant).styled { it.withHoverEvent( HoverEvent( diff --git a/src/main/kotlin/com/github/quiltservertools/ledger/actions/ItemPickUpActionType.kt b/src/main/kotlin/com/github/quiltservertools/ledger/actions/ItemPickUpActionType.kt index 64444631..075ca8f4 100644 --- a/src/main/kotlin/com/github/quiltservertools/ledger/actions/ItemPickUpActionType.kt +++ b/src/main/kotlin/com/github/quiltservertools/ledger/actions/ItemPickUpActionType.kt @@ -8,26 +8,17 @@ import com.github.quiltservertools.ledger.utility.literal import net.minecraft.entity.Entity import net.minecraft.entity.EntityType import net.minecraft.entity.ItemEntity -import net.minecraft.item.BlockItem import net.minecraft.nbt.StringNbtReader -import net.minecraft.registry.Registries import net.minecraft.server.MinecraftServer import net.minecraft.server.command.ServerCommandSource import net.minecraft.text.HoverEvent import net.minecraft.text.Text -import net.minecraft.util.Util open class ItemPickUpActionType : AbstractActionType() { override val identifier = "item-pick-up" - override fun getTranslationType(): String { - val item = Registries.ITEM.get(objectIdentifier) - return if (item is BlockItem) { - "block" - } else { - "item" - } - } + // Not used + override fun getTranslationType(): String = "item" private fun getStack(server: MinecraftServer) = NbtUtils.itemFromProperties( extraData, @@ -39,12 +30,7 @@ open class ItemPickUpActionType : AbstractActionType() { val stack = getStack(source.server) return "${stack.count} ".literal().append( - Text.translatable( - Util.createTranslationKey( - getTranslationType(), - objectIdentifier - ) - ) + stack.itemName ).setStyle(TextColorPallet.secondaryVariant).styled { it.withHoverEvent( HoverEvent(