mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Update commands
This commit is contained in:
parent
30eab4ee6a
commit
27cecead63
3 changed files with 7 additions and 10 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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"))))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue