From a4e907878bc5c12abdf72751241adfda272272cc Mon Sep 17 00:00:00 2001 From: Pyrofab Date: Tue, 18 May 2021 00:07:33 +0200 Subject: [PATCH] Register Locki's command argument types --- changelog.md | 6 ++++++ gradle.properties | 2 +- src/main/java/io/github/ladysnake/locki/Locki.java | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 6b41e55..ab8a229 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,9 @@ +------------------------------------------------------ +Version 0.1.1 +------------------------------------------------------ +**Fixes** +- Locki's command argument types are now properly registered + ------------------------------------------------------ Version 0.1.0 ------------------------------------------------------ diff --git a/gradle.properties b/gradle.properties index 6a73811..bf027cc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G loader_version=0.11.3 # Mod Properties - mod_version = 0.1.0 + mod_version = 0.1.1 maven_group = io.github.ladysnake archives_base_name = locki diff --git a/src/main/java/io/github/ladysnake/locki/Locki.java b/src/main/java/io/github/ladysnake/locki/Locki.java index a923e4b..01903b1 100644 --- a/src/main/java/io/github/ladysnake/locki/Locki.java +++ b/src/main/java/io/github/ladysnake/locki/Locki.java @@ -20,10 +20,14 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import io.github.ladysnake.locki.impl.LockiCommand; +import io.github.ladysnake.locki.impl.InventoryLockArgumentType; +import io.github.ladysnake.locki.impl.InventoryNodeArgumentType; import me.lucko.fabric.api.permissions.v0.PermissionCheckEvent; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback; import net.fabricmc.fabric.api.util.TriState; +import net.minecraft.command.argument.ArgumentTypes; +import net.minecraft.command.argument.serialize.ConstantArgumentSerializer; import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.server.command.ServerCommandSource; @@ -132,6 +136,8 @@ public static Stream streamNodeNames() { public void onInitialize() { DefaultInventoryNodes.init(); + ArgumentTypes.register("locki:inventory_lock", InventoryLockArgumentType.class, new ConstantArgumentSerializer<>(InventoryLockArgumentType::inventoryLock)); + ArgumentTypes.register("locki:inventory_node", InventoryNodeArgumentType.class, new ConstantArgumentSerializer<>(InventoryNodeArgumentType::inventoryNode)); CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> LockiCommand.register(dispatcher)); PermissionCheckEvent.EVENT.register((source, permission) -> { if (source instanceof ServerCommandSource && permission.startsWith("locki.access.")) {