version 0.1.1.4
This commit is contained in:
parent
30a3c9f1f5
commit
c855f39bf0
|
|
@ -12,7 +12,7 @@ mapping_version=2023.09.03-1.20.1
|
|||
mod_id=sccore
|
||||
mod_name=SnowyCrescentCore
|
||||
mod_license=GNU AGPL 3.0
|
||||
mod_version=1.20.1-0.1.1.3
|
||||
mod_version=1.20.1-0.1.1.4
|
||||
mod_group_id=com.linearpast
|
||||
mod_authors=LostInLinearPast
|
||||
mod_description=A lib about capability and player animator.
|
||||
|
|
|
|||
|
|
@ -6,13 +6,10 @@ import com.linearpast.sccore.animation.register.RawAnimationRegistry;
|
|||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.arguments.ArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.mojang.brigadier.exceptions.DynamicCommandExceptionType;
|
||||
import com.mojang.brigadier.suggestion.Suggestions;
|
||||
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
|
@ -28,9 +25,6 @@ import java.util.function.Supplier;
|
|||
|
||||
public class AnimationArgument implements ArgumentType<String> {
|
||||
private static final Supplier<Collection<String>> EXAMPLES = AnimationArgument::getAnimationNames;
|
||||
private static final DynamicCommandExceptionType UNKNOWN_TYPE = new DynamicCommandExceptionType(
|
||||
animation -> Component.literal("Unknow animation : " + animation.toString())
|
||||
);
|
||||
|
||||
private static Supplier<Set<String>> animationNames;
|
||||
public AnimationArgument() {
|
||||
|
|
@ -96,17 +90,12 @@ public class AnimationArgument implements ArgumentType<String> {
|
|||
return EXAMPLES.get();
|
||||
}
|
||||
|
||||
public String parse(StringReader reader) throws CommandSyntaxException {
|
||||
public String parse(StringReader reader) {
|
||||
int start = reader.getCursor();
|
||||
while (reader.canRead() && canRead(reader.peek())) {
|
||||
reader.skip();
|
||||
}
|
||||
String s = reader.getString().substring(start, reader.getCursor());
|
||||
if (!animationNames.get().contains(s)) {
|
||||
throw UNKNOWN_TYPE.create(s);
|
||||
} else {
|
||||
return s;
|
||||
}
|
||||
return reader.getString().substring(start, reader.getCursor());
|
||||
}
|
||||
|
||||
private static boolean canRead(char peek) {
|
||||
|
|
|
|||
|
|
@ -16,8 +16,5 @@
|
|||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
},
|
||||
"overwrites": {
|
||||
"requireAnnotations": true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user