Update commands

This commit is contained in:
Sollace 2024-09-30 19:51:30 +01:00
parent 30eab4ee6a
commit 27cecead63
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
3 changed files with 7 additions and 10 deletions

View file

@ -69,7 +69,7 @@ public class ConfigCommand {
} }
private static <T> SuggestionProvider<ServerCommandSource> createSuggestion(CommandRegistryAccess registries, RegistryKey<Registry<T>> registryKey) { private static <T> SuggestionProvider<ServerCommandSource> createSuggestion(CommandRegistryAccess registries, RegistryKey<Registry<T>> registryKey) {
RegistryWrapper<T> wrapper = registries.createWrapper(registryKey); RegistryWrapper<T> wrapper = registries.getWrapperOrThrow(registryKey);
return (context, builder) -> CommandSource.suggestIdentifiers(wrapper.streamKeys().map(RegistryKey::getValue), builder); return (context, builder) -> CommandSource.suggestIdentifiers(wrapper.streamKeys().map(RegistryKey::getValue), builder);
} }

View file

@ -49,13 +49,13 @@ public class DisguiseCommand {
} }
private static ArgumentBuilder<ServerCommandSource, ?> buildEntityDisguise(Arg<ServerPlayerEntity> targetOp, CommandRegistryAccess registries) { private static ArgumentBuilder<ServerCommandSource, ?> buildEntityDisguise(Arg<ServerPlayerEntity> 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) .suggests(SuggestionProviders.SUMMONABLE_ENTITIES)
.executes(context -> disguise( .executes(context -> disguise(
context.getSource(), context.getSource(),
targetOp.apply(context), targetOp.apply(context),
loadEntity(context.getSource(), loadEntity(context.getSource(),
RegistryEntryArgumentType.getSummonableEntityType(context, "entity"), RegistryEntryReferenceArgumentType.getSummonableEntityType(context, "entity"),
new NbtCompound()))) new NbtCompound())))
.then( .then(
CommandManager.argument("nbt", NbtCompoundArgumentType.nbtCompound()) CommandManager.argument("nbt", NbtCompoundArgumentType.nbtCompound())
@ -63,7 +63,7 @@ public class DisguiseCommand {
context.getSource(), context.getSource(),
targetOp.apply(context), targetOp.apply(context),
loadEntity(context.getSource(), loadEntity(context.getSource(),
RegistryEntryArgumentType.getSummonableEntityType(context, "entity"), RegistryEntryReferenceArgumentType.getSummonableEntityType(context, "entity"),
NbtCompoundArgumentType.getNbtCompound(context, "nbt")))) NbtCompoundArgumentType.getNbtCompound(context, "nbt"))))
); );
} }

View file

@ -3,8 +3,6 @@ package com.minelittlepony.unicopia.compat.emi;
import java.util.List; import java.util.List;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;
import org.jetbrains.annotations.Nullable;
import com.minelittlepony.common.client.gui.Tooltip; import com.minelittlepony.common.client.gui.Tooltip;
import com.minelittlepony.unicopia.ability.magic.spell.trait.SpellTraits; import com.minelittlepony.unicopia.ability.magic.spell.trait.SpellTraits;
import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait; 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.MinecraftClient;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.tooltip.TooltipComponent; import net.minecraft.client.gui.tooltip.TooltipComponent;
import net.minecraft.component.ComponentChanges;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
@ -40,10 +38,9 @@ public class TraitEmiStack extends EmiStack {
return amount == 0; return amount == 0;
} }
@Nullable
@Override @Override
public NbtCompound getNbt() { public ComponentChanges getComponentChanges() {
return null; return ComponentChanges.EMPTY;
} }
@Override @Override