mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Add submodule MinecraftProtocolLibrary
This commit is contained in:
parent
87026e1bfb
commit
3f1de66af3
62 changed files with 1093 additions and 450 deletions
|
|
@ -5,7 +5,7 @@ using Brigadier.NET.ArgumentTypes;
|
|||
using Brigadier.NET.Context;
|
||||
using Brigadier.NET.Exceptions;
|
||||
using Brigadier.NET.Suggestion;
|
||||
using MinecraftClient.Mapping;
|
||||
using MinecraftClient.EntityHandler;
|
||||
|
||||
namespace MinecraftClient.CommandHandler.ArgumentType
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,14 +21,20 @@ namespace MinecraftClient.CommandHandler.ArgumentType
|
|||
public override WindowActionType Parse(IStringReader reader)
|
||||
{
|
||||
reader.SkipWhitespace();
|
||||
string inputStr = reader.ReadString();
|
||||
foreach (var action in SupportActions)
|
||||
string inputStr = reader.ReadString().ToLower();
|
||||
return inputStr switch
|
||||
{
|
||||
string actionStr = action.ToString();
|
||||
if (string.Compare(inputStr, actionStr, true) == 0)
|
||||
return action;
|
||||
}
|
||||
throw CommandSyntaxException.BuiltInExceptions.LiteralIncorrect().CreateWithContext(reader, inputStr);
|
||||
"left" => WindowActionType.LeftClick,
|
||||
"leftclick" => WindowActionType.LeftClick,
|
||||
"right" => WindowActionType.RightClick,
|
||||
"rightclick" => WindowActionType.RightClick,
|
||||
"mid" => WindowActionType.MiddleClick,
|
||||
"middle" => WindowActionType.MiddleClick,
|
||||
"middleclick" => WindowActionType.MiddleClick,
|
||||
"shift" => WindowActionType.ShiftClick,
|
||||
"shiftclick" => WindowActionType.ShiftClick,
|
||||
_ => throw CommandSyntaxException.BuiltInExceptions.LiteralIncorrect().CreateWithContext(reader, inputStr)
|
||||
};
|
||||
}
|
||||
|
||||
public override Task<Suggestions> ListSuggestions<TSource>(CommandContext<TSource> context, SuggestionsBuilder builder)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using Brigadier.NET;
|
|||
using Brigadier.NET.ArgumentTypes;
|
||||
using Brigadier.NET.Context;
|
||||
using Brigadier.NET.Suggestion;
|
||||
using MinecraftClient.Mapping;
|
||||
using MinecraftClient.EntityHandler;
|
||||
|
||||
namespace MinecraftClient.CommandHandler.ArgumentType
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using Brigadier.NET.Context;
|
||||
using MinecraftClient.CommandHandler.ArgumentType;
|
||||
using MinecraftClient.EntityHandler;
|
||||
|
||||
namespace MinecraftClient.CommandHandler
|
||||
{
|
||||
|
|
@ -31,9 +32,9 @@ namespace MinecraftClient.CommandHandler
|
|||
return new EntityTypeArgumentType();
|
||||
}
|
||||
|
||||
public static Mapping.EntityType GetEntityType<TSource>(CommandContext<TSource> context, string name)
|
||||
public static EntityType GetEntityType<TSource>(CommandContext<TSource> context, string name)
|
||||
{
|
||||
return context.GetArgument<Mapping.EntityType>(name);
|
||||
return context.GetArgument<EntityType>(name);
|
||||
}
|
||||
|
||||
public static ItemTypeArgumentType ItemType()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue