From 27cecead630414aa03caaee06451f41db8a269d2 Mon Sep 17 00:00:00 2001 From: Sollace Date: Mon, 30 Sep 2024 19:51:30 +0100 Subject: [PATCH] Update commands --- .../minelittlepony/unicopia/command/ConfigCommand.java | 2 +- .../minelittlepony/unicopia/command/DisguiseCommand.java | 6 +++--- .../unicopia/compat/emi/TraitEmiStack.java | 9 +++------ 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/command/ConfigCommand.java b/src/main/java/com/minelittlepony/unicopia/command/ConfigCommand.java index fb9b5ab2..9fec2c69 100644 --- a/src/main/java/com/minelittlepony/unicopia/command/ConfigCommand.java +++ b/src/main/java/com/minelittlepony/unicopia/command/ConfigCommand.java @@ -69,7 +69,7 @@ public class ConfigCommand { } private static SuggestionProvider createSuggestion(CommandRegistryAccess registries, RegistryKey> registryKey) { - RegistryWrapper wrapper = registries.createWrapper(registryKey); + RegistryWrapper wrapper = registries.getWrapperOrThrow(registryKey); return (context, builder) -> CommandSource.suggestIdentifiers(wrapper.streamKeys().map(RegistryKey::getValue), builder); } diff --git a/src/main/java/com/minelittlepony/unicopia/command/DisguiseCommand.java b/src/main/java/com/minelittlepony/unicopia/command/DisguiseCommand.java index 5dba2c32..fcfe10ba 100644 --- a/src/main/java/com/minelittlepony/unicopia/command/DisguiseCommand.java +++ b/src/main/java/com/minelittlepony/unicopia/command/DisguiseCommand.java @@ -49,13 +49,13 @@ public class DisguiseCommand { } private static ArgumentBuilder buildEntityDisguise(Arg targetOp, CommandRegistryAccess registries) { - return CommandManager.argument("entity", RegistryEntryArgumentType.registryEntry(registries, RegistryKeys.ENTITY_TYPE)) + return CommandManager.argument("entity", RegistryEntryReferenceArgumentType.registryEntry(registries, RegistryKeys.ENTITY_TYPE)) .suggests(SuggestionProviders.SUMMONABLE_ENTITIES) .executes(context -> disguise( context.getSource(), targetOp.apply(context), loadEntity(context.getSource(), - RegistryEntryArgumentType.getSummonableEntityType(context, "entity"), + RegistryEntryReferenceArgumentType.getSummonableEntityType(context, "entity"), new NbtCompound()))) .then( CommandManager.argument("nbt", NbtCompoundArgumentType.nbtCompound()) @@ -63,7 +63,7 @@ public class DisguiseCommand { context.getSource(), targetOp.apply(context), loadEntity(context.getSource(), - RegistryEntryArgumentType.getSummonableEntityType(context, "entity"), + RegistryEntryReferenceArgumentType.getSummonableEntityType(context, "entity"), NbtCompoundArgumentType.getNbtCompound(context, "nbt")))) ); } diff --git a/src/main/java/com/minelittlepony/unicopia/compat/emi/TraitEmiStack.java b/src/main/java/com/minelittlepony/unicopia/compat/emi/TraitEmiStack.java index e2dd4081..c554b54e 100644 --- a/src/main/java/com/minelittlepony/unicopia/compat/emi/TraitEmiStack.java +++ b/src/main/java/com/minelittlepony/unicopia/compat/emi/TraitEmiStack.java @@ -3,8 +3,6 @@ package com.minelittlepony.unicopia.compat.emi; import java.util.List; import org.apache.commons.compress.utils.Lists; -import org.jetbrains.annotations.Nullable; - import com.minelittlepony.common.client.gui.Tooltip; import com.minelittlepony.unicopia.ability.magic.spell.trait.SpellTraits; import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait; @@ -16,9 +14,9 @@ import dev.emi.emi.api.stack.EmiStack; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.tooltip.TooltipComponent; +import net.minecraft.component.ComponentChanges; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; import net.minecraft.text.Text; import net.minecraft.util.Identifier; import net.minecraft.util.math.MathHelper; @@ -40,10 +38,9 @@ public class TraitEmiStack extends EmiStack { return amount == 0; } - @Nullable @Override - public NbtCompound getNbt() { - return null; + public ComponentChanges getComponentChanges() { + return ComponentChanges.EMPTY; } @Override