mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
commit
db6bc3d2e6
50 changed files with 4580 additions and 455 deletions
2
.github/workflows/build-and-release.yml
vendored
2
.github/workflows/build-and-release.yml
vendored
|
|
@ -26,7 +26,7 @@ jobs:
|
|||
submodules: 'true'
|
||||
|
||||
- name: Download translations from crowdin
|
||||
uses: crowdin/github-action@1.5.0
|
||||
uses: crowdin/github-action@1.6.0
|
||||
with:
|
||||
upload_sources: true
|
||||
upload_translations: false
|
||||
|
|
|
|||
6
.github/workflows/deploy-doc-only.yml
vendored
6
.github/workflows/deploy-doc-only.yml
vendored
|
|
@ -17,10 +17,10 @@ jobs:
|
|||
fetch-depth: 0
|
||||
submodules: 'true'
|
||||
|
||||
- name: Sync translations from crowdin
|
||||
uses: crowdin/github-action@1.5.0
|
||||
- name: Download translations from crowdin
|
||||
uses: crowdin/github-action@1.6.0
|
||||
with:
|
||||
upload_sources: true
|
||||
upload_sources: false
|
||||
upload_translations: false
|
||||
download_translations: true
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
name: Sync Translations
|
||||
name: Upload translation sources
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
|
@ -15,12 +15,12 @@ jobs:
|
|||
fetch-depth: 0
|
||||
submodules: 'true'
|
||||
|
||||
- name: Sync translations from crowdin
|
||||
uses: crowdin/github-action@1.5.0
|
||||
- name: Upload translation sources to crowdin
|
||||
uses: crowdin/github-action@1.6.0
|
||||
with:
|
||||
upload_sources: true
|
||||
upload_translations: false
|
||||
download_translations: true
|
||||
download_translations: false
|
||||
|
||||
localization_branch_name: l10n_master
|
||||
create_pull_request: false
|
||||
|
|
@ -100,7 +100,7 @@ namespace MinecraftClient.ChatBots
|
|||
private Double attackSpeed = 4;
|
||||
private Double attackCooldownSeconds;
|
||||
private readonly bool overrideAttackSpeed = false;
|
||||
private readonly int attackRange = 4;
|
||||
private readonly double attackRange = 4.0;
|
||||
private Double serverTPS;
|
||||
private float health = 100;
|
||||
private readonly bool attackHostile = true;
|
||||
|
|
|
|||
|
|
@ -344,10 +344,8 @@ namespace MinecraftClient.ChatBots
|
|||
private static void RenderInConsole(McMap map)
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
|
||||
int consoleWidth = Math.Max(Console.BufferWidth, Settings.Config.Main.Advanced.MinTerminalWidth) / 2;
|
||||
int consoleHeight = Math.Max(Console.BufferHeight, Settings.Config.Main.Advanced.MinTerminalHeight) - 1;
|
||||
|
||||
int scaleX = (map.Width + consoleWidth - 1) / consoleWidth;
|
||||
int scaleY = (map.Height + consoleHeight - 1) / consoleHeight;
|
||||
int scale = Math.Max(scaleX, scaleY);
|
||||
|
|
@ -356,11 +354,12 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
for (int base_y = 0; base_y < map.Height; base_y += scale)
|
||||
{
|
||||
int last_R = -1, last_G = -1, last_B = -1;
|
||||
string lastFg = string.Empty, lagtBg = string.Empty;
|
||||
for (int base_x = 0; base_x < map.Width; base_x += scale)
|
||||
{
|
||||
int RL = 0, GL = 0, BL = 0, RR = 0, GR = 0, BR = 0;
|
||||
double mid_dx = (double)(scale - 1) / 2;
|
||||
int RUL = 0, GUL = 0, BUL = 0, RUR = 0, GUR = 0, BUR = 0;
|
||||
int RDL = 0, GDL = 0, BDL = 0, RDR = 0, GDR = 0, BDR = 0;
|
||||
double mid = (double)(scale - 1) / 2;
|
||||
for (int dy = 0; dy < scale; ++dy)
|
||||
{
|
||||
for (int dx = 0; dx < scale; ++dx)
|
||||
|
|
@ -368,40 +367,57 @@ namespace MinecraftClient.ChatBots
|
|||
int x = Math.Min(base_x + dx, map.Width - 1);
|
||||
int y = Math.Min(base_y + dy, map.Height - 1);
|
||||
ColorRGBA color = MapColors.ColorByteToRGBA(map.Colors![x + y * map.Width]);
|
||||
if (dx <= mid_dx)
|
||||
if (dx <= mid)
|
||||
{
|
||||
RL += color.R; GL += color.G; BL += color.B;
|
||||
if (dy <= mid)
|
||||
{
|
||||
RUL += color.R; GUL += color.G; BUL += color.B;
|
||||
}
|
||||
if (dy >= mid)
|
||||
{
|
||||
RDL += color.R; GDL += color.G; BDL += color.B;
|
||||
}
|
||||
}
|
||||
if (dx >= mid_dx)
|
||||
if (dx >= mid)
|
||||
{
|
||||
RR += color.R; GR += color.G; BR += color.B;
|
||||
if (dy <= mid)
|
||||
{
|
||||
RUR += color.R; GUR += color.G; BUR += color.B;
|
||||
}
|
||||
if (dy >= mid)
|
||||
{
|
||||
RDR += color.R; GDR += color.G; BDR += color.B;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int pixel_cnt = ((scale + 1) / 2) * scale;
|
||||
RL = (int)Math.Round((double)RL / pixel_cnt);
|
||||
GL = (int)Math.Round((double)GL / pixel_cnt);
|
||||
BL = (int)Math.Round((double)BL / pixel_cnt);
|
||||
RR = (int)Math.Round((double)RR / pixel_cnt);
|
||||
GR = (int)Math.Round((double)GR / pixel_cnt);
|
||||
BR = (int)Math.Round((double)BR / pixel_cnt);
|
||||
int pixel_cnt = ((scale + 1) / 2) * ((scale + 1) / 2);
|
||||
RDL = (int)Math.Round((double)RDL / pixel_cnt);
|
||||
GDL = (int)Math.Round((double)GDL / pixel_cnt);
|
||||
BDL = (int)Math.Round((double)BDL / pixel_cnt);
|
||||
RDR = (int)Math.Round((double)RDR / pixel_cnt);
|
||||
GDR = (int)Math.Round((double)GDR / pixel_cnt);
|
||||
BDR = (int)Math.Round((double)BDR / pixel_cnt);
|
||||
|
||||
if (RL == last_R && GL == last_G && BL == last_B)
|
||||
sb.Append(' ');
|
||||
else
|
||||
{
|
||||
sb.Append(ColorHelper.GetColorEscapeCode((byte)RL, (byte)GL, (byte)BL, false)).Append(' ');
|
||||
last_R = RL; last_G = GL; last_B = BL;
|
||||
}
|
||||
RUL = (int)Math.Round((double)RUL / pixel_cnt);
|
||||
GUL = (int)Math.Round((double)GUL / pixel_cnt);
|
||||
BUL = (int)Math.Round((double)BUL / pixel_cnt);
|
||||
RUR = (int)Math.Round((double)RUR / pixel_cnt);
|
||||
GUR = (int)Math.Round((double)GUR / pixel_cnt);
|
||||
BUR = (int)Math.Round((double)BUR / pixel_cnt);
|
||||
|
||||
if (RR == last_R && GR == last_G && BR == last_B)
|
||||
sb.Append(' ');
|
||||
else
|
||||
{
|
||||
sb.Append(ColorHelper.GetColorEscapeCode((byte)RR, (byte)GR, (byte)BR, false)).Append(' ');
|
||||
last_R = RR; last_G = GR; last_B = BR;
|
||||
}
|
||||
string colorCode = ColorHelper.GetColorEscapeCode((byte)RUL, (byte)GUL, (byte)BUL, true);
|
||||
if (lastFg != colorCode) { sb.Append(colorCode); lastFg = colorCode; }
|
||||
colorCode = ColorHelper.GetColorEscapeCode((byte)RDL, (byte)GDL, (byte)BDL, false);
|
||||
if (lagtBg != colorCode) { sb.Append(colorCode); lagtBg = colorCode; }
|
||||
sb.Append('▀');
|
||||
|
||||
colorCode = ColorHelper.GetColorEscapeCode((byte)RUR, (byte)GUR, (byte)BUR, true);
|
||||
if (lastFg != colorCode) { sb.Append(colorCode); lastFg = colorCode; }
|
||||
colorCode = ColorHelper.GetColorEscapeCode((byte)RDR, (byte)GDR, (byte)BDR, false);
|
||||
if (lagtBg != colorCode) { sb.Append(colorCode); lagtBg = colorCode; }
|
||||
sb.Append('▀');
|
||||
}
|
||||
if (base_y >= map.Height - scale)
|
||||
sb.Append(ColorHelper.GetResetEscapeCode());
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using System.IO;
|
|||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using MinecraftClient.CommandHandler;
|
||||
using MinecraftClient.Scripting;
|
||||
|
||||
namespace MinecraftClient.ChatBots
|
||||
|
|
@ -85,7 +86,7 @@ namespace MinecraftClient.ChatBots
|
|||
public static bool LookForScript(ref string filename)
|
||||
{
|
||||
//Automatically look in subfolders and try to add ".txt" file extension
|
||||
char dir_slash = Path.DirectorySeparatorChar;
|
||||
char dir_slash = Path.DirectorySeparatorChar;
|
||||
string[] files = new string[]
|
||||
{
|
||||
filename,
|
||||
|
|
@ -210,11 +211,22 @@ namespace MinecraftClient.ChatBots
|
|||
sleepticks = ticks;
|
||||
break;
|
||||
default:
|
||||
if (!PerformInternalCommand(instruction_line))
|
||||
CmdResult response = new();
|
||||
if (PerformInternalCommand(instruction_line, ref response))
|
||||
{
|
||||
if (instruction_name.ToLower() != "log")
|
||||
{
|
||||
LogToConsole(instruction_line);
|
||||
}
|
||||
if (response.status != CmdResult.Status.Done || !string.IsNullOrWhiteSpace(response.result))
|
||||
{
|
||||
LogToConsole(response);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Update(); //Unknown command : process next line immediately
|
||||
}
|
||||
else if (instruction_name.ToLower() != "log") { LogToConsole(instruction_line); }
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using MinecraftClient.CommandHandler;
|
||||
using MinecraftClient.Scripting;
|
||||
using Tomlet.Attributes;
|
||||
using static MinecraftClient.ChatBots.ScriptScheduler.Configs;
|
||||
|
|
@ -191,7 +192,10 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
task.Trigger_On_Time_Already_Triggered = true;
|
||||
LogDebugToConsole(string.Format(Translations.bot_scriptScheduler_running_time, task.Action));
|
||||
PerformInternalCommand(task.Action);
|
||||
CmdResult response = new();
|
||||
PerformInternalCommand(task.Action, ref response);
|
||||
if (response.status != CmdResult.Status.Done || !string.IsNullOrWhiteSpace(response.result))
|
||||
LogToConsole(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -209,7 +213,10 @@ namespace MinecraftClient.ChatBots
|
|||
if (task.Trigger_On_Login || (firstlogin_done == false && task.Trigger_On_First_Login))
|
||||
{
|
||||
LogDebugToConsole(string.Format(Translations.bot_scriptScheduler_running_login, task.Action));
|
||||
PerformInternalCommand(task.Action);
|
||||
CmdResult response = new();
|
||||
PerformInternalCommand(task.Action, ref response);
|
||||
if (response.status != CmdResult.Status.Done || !string.IsNullOrWhiteSpace(response.result))
|
||||
LogToConsole(response);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -229,7 +236,10 @@ namespace MinecraftClient.ChatBots
|
|||
Settings.DoubleToTick(task.Trigger_On_Interval.MinTime), Settings.DoubleToTick(task.Trigger_On_Interval.MaxTime)
|
||||
);
|
||||
LogDebugToConsole(string.Format(Translations.bot_scriptScheduler_running_inverval, task.Action));
|
||||
PerformInternalCommand(task.Action);
|
||||
CmdResult response = new();
|
||||
PerformInternalCommand(task.Action, ref response);
|
||||
if (response.status != CmdResult.Status.Done || !string.IsNullOrWhiteSpace(response.result))
|
||||
LogToConsole(response);
|
||||
}
|
||||
else task.Trigger_On_Interval_Countdown--;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Brigadier.NET;
|
||||
using Brigadier.NET.ArgumentTypes;
|
||||
using Brigadier.NET.Context;
|
||||
using Brigadier.NET.Suggestion;
|
||||
|
||||
namespace MinecraftClient.CommandHandler.ArgumentType
|
||||
{
|
||||
public class ScriptNameArgumentType : ArgumentType<string>
|
||||
{
|
||||
public override string Parse(IStringReader reader)
|
||||
{
|
||||
string remaining = reader.Remaining;
|
||||
reader.Cursor += reader.RemainingLength;
|
||||
return remaining;
|
||||
}
|
||||
|
||||
public override Task<Suggestions> ListSuggestions<TSource>(CommandContext<TSource> context, SuggestionsBuilder builder)
|
||||
{
|
||||
try
|
||||
{
|
||||
string? dir = Path.GetDirectoryName(builder.Remaining);
|
||||
if (!string.IsNullOrEmpty(dir) && Path.Exists(dir))
|
||||
{
|
||||
foreach (string fileName in Directory.GetFiles(dir, "*.cs"))
|
||||
builder.Suggest(fileName);
|
||||
foreach (string fileName in Directory.GetFiles(dir, "*.txt"))
|
||||
builder.Suggest(fileName);
|
||||
}
|
||||
}
|
||||
catch (IOException) { }
|
||||
catch (ArgumentException) { }
|
||||
catch (UnauthorizedAccessException) { }
|
||||
|
||||
try
|
||||
{
|
||||
foreach (string fileName in Directory.GetFiles("." + Path.DirectorySeparatorChar, "*.cs"))
|
||||
builder.Suggest(fileName);
|
||||
foreach (string fileName in Directory.GetFiles("." + Path.DirectorySeparatorChar, "*.txt"))
|
||||
builder.Suggest(fileName);
|
||||
}
|
||||
catch (IOException) { }
|
||||
catch (ArgumentException) { }
|
||||
catch (UnauthorizedAccessException) { }
|
||||
|
||||
return builder.BuildFuture();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -110,5 +110,10 @@ namespace MinecraftClient.CommandHandler
|
|||
{
|
||||
return new HotbarSlotArgumentType();
|
||||
}
|
||||
|
||||
public static ScriptNameArgumentType ScriptName()
|
||||
{
|
||||
return new ScriptNameArgumentType();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,12 @@ namespace MinecraftClient.Commands
|
|||
|
||||
dispatcher.Register(l => l.Literal(CmdName)
|
||||
.Executes(r => DigLookAt(r.Source))
|
||||
.Then(l => l.Argument("Duration", Arguments.Double())
|
||||
.Executes(r => DigLookAt(r.Source, Arguments.GetDouble(r, "Duration"))))
|
||||
.Then(l => l.Argument("Location", MccArguments.Location())
|
||||
.Executes(r => DigAt(r.Source, MccArguments.GetLocation(r, "Location"))))
|
||||
.Executes(r => DigAt(r.Source, MccArguments.GetLocation(r, "Location")))
|
||||
.Then(l => l.Argument("Duration", Arguments.Double())
|
||||
.Executes(r => DigAt(r.Source, MccArguments.GetLocation(r, "Location"), Arguments.GetDouble(r, "Duration")))))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Executes(r => GetUsage(r.Source, string.Empty))
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||
|
|
@ -41,7 +45,7 @@ namespace MinecraftClient.Commands
|
|||
});
|
||||
}
|
||||
|
||||
private int DigAt(CmdResult r, Location blockToBreak)
|
||||
private int DigAt(CmdResult r, Location blockToBreak, double duration = 0)
|
||||
{
|
||||
McClient handler = CmdResult.currentHandler!;
|
||||
if (!handler.GetTerrainEnabled())
|
||||
|
|
@ -54,7 +58,7 @@ namespace MinecraftClient.Commands
|
|||
Block block = handler.GetWorld().GetBlock(blockToBreak);
|
||||
if (block.Type == Material.Air)
|
||||
return r.SetAndReturn(Status.Fail, Translations.cmd_dig_no_block);
|
||||
else if (handler.DigBlock(blockToBreak))
|
||||
else if (handler.DigBlock(blockToBreak, duration: duration))
|
||||
{
|
||||
blockToBreak = blockToBreak.ToCenter();
|
||||
return r.SetAndReturn(Status.Done, string.Format(Translations.cmd_dig_dig, blockToBreak.X, blockToBreak.Y, blockToBreak.Z, block.GetTypeString()));
|
||||
|
|
@ -63,7 +67,7 @@ namespace MinecraftClient.Commands
|
|||
return r.SetAndReturn(Status.Fail, Translations.cmd_dig_fail);
|
||||
}
|
||||
|
||||
private int DigLookAt(CmdResult r)
|
||||
private int DigLookAt(CmdResult r, double duration = 0)
|
||||
{
|
||||
McClient handler = CmdResult.currentHandler!;
|
||||
if (!handler.GetTerrainEnabled())
|
||||
|
|
@ -74,7 +78,7 @@ namespace MinecraftClient.Commands
|
|||
return r.SetAndReturn(Status.Fail, Translations.cmd_dig_too_far);
|
||||
else if (block.Type == Material.Air)
|
||||
return r.SetAndReturn(Status.Fail, Translations.cmd_dig_no_block);
|
||||
else if (handler.DigBlock(blockLoc, lookAtBlock: false))
|
||||
else if (handler.DigBlock(blockLoc, lookAtBlock: false, duration: duration))
|
||||
return r.SetAndReturn(Status.Done, string.Format(Translations.cmd_dig_dig, blockLoc.X, blockLoc.Y, blockLoc.Z, block.GetTypeString()));
|
||||
else
|
||||
return r.SetAndReturn(Status.Fail, Translations.cmd_dig_fail);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace MinecraftClient.Commands
|
|||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal(CmdName)
|
||||
.Then(l => l.Argument("Script", Arguments.GreedyString())
|
||||
.Then(l => l.Argument("Script", MccArguments.ScriptName())
|
||||
.Executes(r => DoExecuteScript(r.Source, Arguments.GetString(r, "Script"), null)))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Executes(r => GetUsage(r.Source, string.Empty))
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Security.Cryptography;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MinecraftClient.Crypto
|
||||
{
|
||||
|
|
|
|||
1204
MinecraftClient/Inventory/ItemPalettes/ItemPalette1193.cs
Normal file
1204
MinecraftClient/Inventory/ItemPalettes/ItemPalette1193.cs
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -20,6 +20,7 @@
|
|||
AcaciaDoor,
|
||||
AcaciaFence,
|
||||
AcaciaFenceGate,
|
||||
AcaciaHangingSign,
|
||||
AcaciaLeaves,
|
||||
AcaciaLog,
|
||||
AcaciaPlanks,
|
||||
|
|
@ -53,6 +54,23 @@
|
|||
AzureBluet,
|
||||
BakedPotato,
|
||||
Bamboo,
|
||||
BambooBlock,
|
||||
BambooButton,
|
||||
BambooChestRaft,
|
||||
BambooDoor,
|
||||
BambooFence,
|
||||
BambooFenceGate,
|
||||
BambooHangingSign,
|
||||
BambooMosaic,
|
||||
BambooMosaicSlab,
|
||||
BambooMosaicStairs,
|
||||
BambooPlanks,
|
||||
BambooPressurePlate,
|
||||
BambooRaft,
|
||||
BambooSign,
|
||||
BambooSlab,
|
||||
BambooStairs,
|
||||
BambooTrapdoor,
|
||||
Barrel,
|
||||
Barrier,
|
||||
Basalt,
|
||||
|
|
@ -74,6 +92,7 @@
|
|||
BirchDoor,
|
||||
BirchFence,
|
||||
BirchFenceGate,
|
||||
BirchHangingSign,
|
||||
BirchLeaves,
|
||||
BirchLog,
|
||||
BirchPlanks,
|
||||
|
|
@ -161,6 +180,7 @@
|
|||
Cactus,
|
||||
Cake,
|
||||
Calcite,
|
||||
CamelSpawnEgg,
|
||||
Campfire,
|
||||
Candle,
|
||||
Carrot,
|
||||
|
|
@ -182,6 +202,7 @@
|
|||
Chicken,
|
||||
ChickenSpawnEgg,
|
||||
ChippedAnvil,
|
||||
ChiseledBookshelf,
|
||||
ChiseledDeepslate,
|
||||
ChiseledNetherBricks,
|
||||
ChiseledPolishedBlackstone,
|
||||
|
|
@ -245,6 +266,7 @@
|
|||
CrimsonFence,
|
||||
CrimsonFenceGate,
|
||||
CrimsonFungus,
|
||||
CrimsonHangingSign,
|
||||
CrimsonHyphae,
|
||||
CrimsonNylium,
|
||||
CrimsonPlanks,
|
||||
|
|
@ -285,6 +307,7 @@
|
|||
DarkOakDoor,
|
||||
DarkOakFence,
|
||||
DarkOakFenceGate,
|
||||
DarkOakHangingSign,
|
||||
DarkOakLeaves,
|
||||
DarkOakLog,
|
||||
DarkOakPlanks,
|
||||
|
|
@ -384,6 +407,7 @@
|
|||
EndStoneBrickWall,
|
||||
EndStoneBricks,
|
||||
EnderChest,
|
||||
EnderDragonSpawnEgg,
|
||||
EnderEye,
|
||||
EnderPearl,
|
||||
EndermanSpawnEgg,
|
||||
|
|
@ -518,6 +542,7 @@
|
|||
IronBoots,
|
||||
IronChestplate,
|
||||
IronDoor,
|
||||
IronGolemSpawnEgg,
|
||||
IronHelmet,
|
||||
IronHoe,
|
||||
IronHorseArmor,
|
||||
|
|
@ -539,6 +564,7 @@
|
|||
JungleDoor,
|
||||
JungleFence,
|
||||
JungleFenceGate,
|
||||
JungleHangingSign,
|
||||
JungleLeaves,
|
||||
JungleLog,
|
||||
JunglePlanks,
|
||||
|
|
@ -639,6 +665,7 @@
|
|||
MangroveDoor,
|
||||
MangroveFence,
|
||||
MangroveFenceGate,
|
||||
MangroveHangingSign,
|
||||
MangroveLeaves,
|
||||
MangroveLog,
|
||||
MangrovePlanks,
|
||||
|
|
@ -729,6 +756,7 @@
|
|||
OakDoor,
|
||||
OakFence,
|
||||
OakFenceGate,
|
||||
OakHangingSign,
|
||||
OakLeaves,
|
||||
OakLog,
|
||||
OakPlanks,
|
||||
|
|
@ -776,6 +804,7 @@
|
|||
PigSpawnEgg,
|
||||
PiglinBannerPattern,
|
||||
PiglinBruteSpawnEgg,
|
||||
PiglinHead,
|
||||
PiglinSpawnEgg,
|
||||
PillagerSpawnEgg,
|
||||
PinkBanner,
|
||||
|
|
@ -970,6 +999,7 @@
|
|||
SmoothStoneSlab,
|
||||
Snow,
|
||||
SnowBlock,
|
||||
SnowGolemSpawnEgg,
|
||||
Snowball,
|
||||
SoulCampfire,
|
||||
SoulLantern,
|
||||
|
|
@ -989,6 +1019,7 @@
|
|||
SpruceDoor,
|
||||
SpruceFence,
|
||||
SpruceFenceGate,
|
||||
SpruceHangingSign,
|
||||
SpruceLeaves,
|
||||
SpruceLog,
|
||||
SprucePlanks,
|
||||
|
|
@ -1023,6 +1054,7 @@
|
|||
String,
|
||||
StrippedAcaciaLog,
|
||||
StrippedAcaciaWood,
|
||||
StrippedBambooBlock,
|
||||
StrippedBirchLog,
|
||||
StrippedBirchWood,
|
||||
StrippedCrimsonHyphae,
|
||||
|
|
@ -1085,6 +1117,7 @@
|
|||
WarpedFenceGate,
|
||||
WarpedFungus,
|
||||
WarpedFungusOnAStick,
|
||||
WarpedHangingSign,
|
||||
WarpedHyphae,
|
||||
WarpedNylium,
|
||||
WarpedPlanks,
|
||||
|
|
@ -1139,6 +1172,7 @@
|
|||
WitherRose,
|
||||
WitherSkeletonSkull,
|
||||
WitherSkeletonSpawnEgg,
|
||||
WitherSpawnEgg,
|
||||
WolfSpawnEgg,
|
||||
WoodenAxe,
|
||||
WoodenHoe,
|
||||
|
|
|
|||
1605
MinecraftClient/Mapping/BlockPalettes/Palette1193.cs
Normal file
1605
MinecraftClient/Mapping/BlockPalettes/Palette1193.cs
Normal file
File diff suppressed because it is too large
Load diff
137
MinecraftClient/Mapping/EntityPalettes/EntityPalette1193.cs
Normal file
137
MinecraftClient/Mapping/EntityPalettes/EntityPalette1193.cs
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Mapping.EntityPalettes
|
||||
{
|
||||
public class EntityPalette1193 : EntityPalette
|
||||
{
|
||||
private static readonly Dictionary<int, EntityType> mappings = new();
|
||||
|
||||
static EntityPalette1193()
|
||||
{
|
||||
mappings[0] = EntityType.Allay;
|
||||
mappings[1] = EntityType.AreaEffectCloud;
|
||||
mappings[2] = EntityType.ArmorStand;
|
||||
mappings[3] = EntityType.Arrow;
|
||||
mappings[4] = EntityType.Axolotl;
|
||||
mappings[5] = EntityType.Bat;
|
||||
mappings[6] = EntityType.Bee;
|
||||
mappings[7] = EntityType.Blaze;
|
||||
mappings[8] = EntityType.Boat;
|
||||
mappings[11] = EntityType.Camel;
|
||||
mappings[10] = EntityType.Cat;
|
||||
mappings[12] = EntityType.CaveSpider;
|
||||
mappings[9] = EntityType.ChestBoat;
|
||||
mappings[55] = EntityType.ChestMinecart;
|
||||
mappings[13] = EntityType.Chicken;
|
||||
mappings[14] = EntityType.Cod;
|
||||
mappings[56] = EntityType.CommandBlockMinecart;
|
||||
mappings[15] = EntityType.Cow;
|
||||
mappings[16] = EntityType.Creeper;
|
||||
mappings[17] = EntityType.Dolphin;
|
||||
mappings[18] = EntityType.Donkey;
|
||||
mappings[19] = EntityType.DragonFireball;
|
||||
mappings[20] = EntityType.Drowned;
|
||||
mappings[94] = EntityType.Egg;
|
||||
mappings[21] = EntityType.ElderGuardian;
|
||||
mappings[22] = EntityType.EndCrystal;
|
||||
mappings[23] = EntityType.EnderDragon;
|
||||
mappings[95] = EntityType.EnderPearl;
|
||||
mappings[24] = EntityType.Enderman;
|
||||
mappings[25] = EntityType.Endermite;
|
||||
mappings[26] = EntityType.Evoker;
|
||||
mappings[27] = EntityType.EvokerFangs;
|
||||
mappings[96] = EntityType.ExperienceBottle;
|
||||
mappings[28] = EntityType.ExperienceOrb;
|
||||
mappings[29] = EntityType.EyeOfEnder;
|
||||
mappings[30] = EntityType.FallingBlock;
|
||||
mappings[47] = EntityType.Fireball;
|
||||
mappings[31] = EntityType.FireworkRocket;
|
||||
mappings[118] = EntityType.FishingBobber;
|
||||
mappings[32] = EntityType.Fox;
|
||||
mappings[33] = EntityType.Frog;
|
||||
mappings[57] = EntityType.FurnaceMinecart;
|
||||
mappings[34] = EntityType.Ghast;
|
||||
mappings[35] = EntityType.Giant;
|
||||
mappings[36] = EntityType.GlowItemFrame;
|
||||
mappings[37] = EntityType.GlowSquid;
|
||||
mappings[38] = EntityType.Goat;
|
||||
mappings[39] = EntityType.Guardian;
|
||||
mappings[40] = EntityType.Hoglin;
|
||||
mappings[58] = EntityType.HopperMinecart;
|
||||
mappings[41] = EntityType.Horse;
|
||||
mappings[42] = EntityType.Husk;
|
||||
mappings[43] = EntityType.Illusioner;
|
||||
mappings[44] = EntityType.IronGolem;
|
||||
mappings[45] = EntityType.Item;
|
||||
mappings[46] = EntityType.ItemFrame;
|
||||
mappings[48] = EntityType.LeashKnot;
|
||||
mappings[49] = EntityType.LightningBolt;
|
||||
mappings[50] = EntityType.Llama;
|
||||
mappings[51] = EntityType.LlamaSpit;
|
||||
mappings[52] = EntityType.MagmaCube;
|
||||
mappings[53] = EntityType.Marker;
|
||||
mappings[54] = EntityType.Minecart;
|
||||
mappings[62] = EntityType.Mooshroom;
|
||||
mappings[61] = EntityType.Mule;
|
||||
mappings[63] = EntityType.Ocelot;
|
||||
mappings[64] = EntityType.Painting;
|
||||
mappings[65] = EntityType.Panda;
|
||||
mappings[66] = EntityType.Parrot;
|
||||
mappings[67] = EntityType.Phantom;
|
||||
mappings[68] = EntityType.Pig;
|
||||
mappings[69] = EntityType.Piglin;
|
||||
mappings[70] = EntityType.PiglinBrute;
|
||||
mappings[71] = EntityType.Pillager;
|
||||
mappings[117] = EntityType.Player;
|
||||
mappings[72] = EntityType.PolarBear;
|
||||
mappings[97] = EntityType.Potion;
|
||||
mappings[74] = EntityType.Pufferfish;
|
||||
mappings[75] = EntityType.Rabbit;
|
||||
mappings[76] = EntityType.Ravager;
|
||||
mappings[77] = EntityType.Salmon;
|
||||
mappings[78] = EntityType.Sheep;
|
||||
mappings[79] = EntityType.Shulker;
|
||||
mappings[80] = EntityType.ShulkerBullet;
|
||||
mappings[81] = EntityType.Silverfish;
|
||||
mappings[82] = EntityType.Skeleton;
|
||||
mappings[83] = EntityType.SkeletonHorse;
|
||||
mappings[84] = EntityType.Slime;
|
||||
mappings[85] = EntityType.SmallFireball;
|
||||
mappings[86] = EntityType.SnowGolem;
|
||||
mappings[87] = EntityType.Snowball;
|
||||
mappings[59] = EntityType.SpawnerMinecart;
|
||||
mappings[88] = EntityType.SpectralArrow;
|
||||
mappings[89] = EntityType.Spider;
|
||||
mappings[90] = EntityType.Squid;
|
||||
mappings[91] = EntityType.Stray;
|
||||
mappings[92] = EntityType.Strider;
|
||||
mappings[93] = EntityType.Tadpole;
|
||||
mappings[73] = EntityType.Tnt;
|
||||
mappings[60] = EntityType.TntMinecart;
|
||||
mappings[99] = EntityType.TraderLlama;
|
||||
mappings[98] = EntityType.Trident;
|
||||
mappings[100] = EntityType.TropicalFish;
|
||||
mappings[101] = EntityType.Turtle;
|
||||
mappings[102] = EntityType.Vex;
|
||||
mappings[103] = EntityType.Villager;
|
||||
mappings[104] = EntityType.Vindicator;
|
||||
mappings[105] = EntityType.WanderingTrader;
|
||||
mappings[106] = EntityType.Warden;
|
||||
mappings[107] = EntityType.Witch;
|
||||
mappings[108] = EntityType.Wither;
|
||||
mappings[109] = EntityType.WitherSkeleton;
|
||||
mappings[110] = EntityType.WitherSkull;
|
||||
mappings[111] = EntityType.Wolf;
|
||||
mappings[112] = EntityType.Zoglin;
|
||||
mappings[113] = EntityType.Zombie;
|
||||
mappings[114] = EntityType.ZombieHorse;
|
||||
mappings[115] = EntityType.ZombieVillager;
|
||||
mappings[116] = EntityType.ZombifiedPiglin;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, EntityType> GetDict()
|
||||
{
|
||||
return mappings;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -23,6 +23,7 @@
|
|||
Bee,
|
||||
Blaze,
|
||||
Boat,
|
||||
Camel,
|
||||
Cat,
|
||||
CaveSpider,
|
||||
ChestBoat,
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
AcaciaDoor,
|
||||
AcaciaFence,
|
||||
AcaciaFenceGate,
|
||||
AcaciaHangingSign,
|
||||
AcaciaLeaves,
|
||||
AcaciaLog,
|
||||
AcaciaPlanks,
|
||||
|
|
@ -27,6 +28,7 @@
|
|||
AcaciaSlab,
|
||||
AcaciaStairs,
|
||||
AcaciaTrapdoor,
|
||||
AcaciaWallHangingSign,
|
||||
AcaciaWallSign,
|
||||
AcaciaWood,
|
||||
ActivatorRail,
|
||||
|
|
@ -46,7 +48,24 @@
|
|||
AzaleaLeaves,
|
||||
AzureBluet,
|
||||
Bamboo,
|
||||
BambooBlock,
|
||||
BambooButton,
|
||||
BambooDoor,
|
||||
BambooFence,
|
||||
BambooFenceGate,
|
||||
BambooHangingSign,
|
||||
BambooMosaic,
|
||||
BambooMosaicSlab,
|
||||
BambooMosaicStairs,
|
||||
BambooPlanks,
|
||||
BambooPressurePlate,
|
||||
BambooSapling,
|
||||
BambooSign,
|
||||
BambooSlab,
|
||||
BambooStairs,
|
||||
BambooTrapdoor,
|
||||
BambooWallHangingSign,
|
||||
BambooWallSign,
|
||||
Barrel,
|
||||
Barrier,
|
||||
Basalt,
|
||||
|
|
@ -62,6 +81,7 @@
|
|||
BirchDoor,
|
||||
BirchFence,
|
||||
BirchFenceGate,
|
||||
BirchHangingSign,
|
||||
BirchLeaves,
|
||||
BirchLog,
|
||||
BirchPlanks,
|
||||
|
|
@ -71,6 +91,7 @@
|
|||
BirchSlab,
|
||||
BirchStairs,
|
||||
BirchTrapdoor,
|
||||
BirchWallHangingSign,
|
||||
BirchWallSign,
|
||||
BirchWood,
|
||||
BlackBanner,
|
||||
|
|
@ -158,6 +179,7 @@
|
|||
ChainCommandBlock,
|
||||
Chest,
|
||||
ChippedAnvil,
|
||||
ChiseledBookshelf,
|
||||
ChiseledDeepslate,
|
||||
ChiseledNetherBricks,
|
||||
ChiseledPolishedBlackstone,
|
||||
|
|
@ -201,6 +223,7 @@
|
|||
CrimsonFence,
|
||||
CrimsonFenceGate,
|
||||
CrimsonFungus,
|
||||
CrimsonHangingSign,
|
||||
CrimsonHyphae,
|
||||
CrimsonNylium,
|
||||
CrimsonPlanks,
|
||||
|
|
@ -211,6 +234,7 @@
|
|||
CrimsonStairs,
|
||||
CrimsonStem,
|
||||
CrimsonTrapdoor,
|
||||
CrimsonWallHangingSign,
|
||||
CrimsonWallSign,
|
||||
CryingObsidian,
|
||||
CutCopper,
|
||||
|
|
@ -240,6 +264,7 @@
|
|||
DarkOakDoor,
|
||||
DarkOakFence,
|
||||
DarkOakFenceGate,
|
||||
DarkOakHangingSign,
|
||||
DarkOakLeaves,
|
||||
DarkOakLog,
|
||||
DarkOakPlanks,
|
||||
|
|
@ -249,6 +274,7 @@
|
|||
DarkOakSlab,
|
||||
DarkOakStairs,
|
||||
DarkOakTrapdoor,
|
||||
DarkOakWallHangingSign,
|
||||
DarkOakWallSign,
|
||||
DarkOakWood,
|
||||
DarkPrismarine,
|
||||
|
|
@ -413,6 +439,7 @@
|
|||
JungleDoor,
|
||||
JungleFence,
|
||||
JungleFenceGate,
|
||||
JungleHangingSign,
|
||||
JungleLeaves,
|
||||
JungleLog,
|
||||
JunglePlanks,
|
||||
|
|
@ -422,6 +449,7 @@
|
|||
JungleSlab,
|
||||
JungleStairs,
|
||||
JungleTrapdoor,
|
||||
JungleWallHangingSign,
|
||||
JungleWallSign,
|
||||
JungleWood,
|
||||
Kelp,
|
||||
|
|
@ -505,6 +533,7 @@
|
|||
MangroveDoor,
|
||||
MangroveFence,
|
||||
MangroveFenceGate,
|
||||
MangroveHangingSign,
|
||||
MangroveLeaves,
|
||||
MangroveLog,
|
||||
MangrovePlanks,
|
||||
|
|
@ -515,6 +544,7 @@
|
|||
MangroveSlab,
|
||||
MangroveStairs,
|
||||
MangroveTrapdoor,
|
||||
MangroveWallHangingSign,
|
||||
MangroveWallSign,
|
||||
MangroveWood,
|
||||
MediumAmethystBud,
|
||||
|
|
@ -557,6 +587,7 @@
|
|||
OakDoor,
|
||||
OakFence,
|
||||
OakFenceGate,
|
||||
OakHangingSign,
|
||||
OakLeaves,
|
||||
OakLog,
|
||||
OakPlanks,
|
||||
|
|
@ -566,6 +597,7 @@
|
|||
OakSlab,
|
||||
OakStairs,
|
||||
OakTrapdoor,
|
||||
OakWallHangingSign,
|
||||
OakWallSign,
|
||||
OakWood,
|
||||
Observer,
|
||||
|
|
@ -596,6 +628,8 @@
|
|||
PearlescentFroglight,
|
||||
Peony,
|
||||
PetrifiedOakSlab,
|
||||
PiglinHead,
|
||||
PiglinWallHead,
|
||||
PinkBanner,
|
||||
PinkBed,
|
||||
PinkCandle,
|
||||
|
|
@ -803,6 +837,7 @@
|
|||
SpruceDoor,
|
||||
SpruceFence,
|
||||
SpruceFenceGate,
|
||||
SpruceHangingSign,
|
||||
SpruceLeaves,
|
||||
SpruceLog,
|
||||
SprucePlanks,
|
||||
|
|
@ -812,6 +847,7 @@
|
|||
SpruceSlab,
|
||||
SpruceStairs,
|
||||
SpruceTrapdoor,
|
||||
SpruceWallHangingSign,
|
||||
SpruceWallSign,
|
||||
SpruceWood,
|
||||
StickyPiston,
|
||||
|
|
@ -827,6 +863,7 @@
|
|||
Stonecutter,
|
||||
StrippedAcaciaLog,
|
||||
StrippedAcaciaWood,
|
||||
StrippedBambooBlock,
|
||||
StrippedBirchLog,
|
||||
StrippedBirchWood,
|
||||
StrippedCrimsonHyphae,
|
||||
|
|
@ -875,6 +912,7 @@
|
|||
WarpedFence,
|
||||
WarpedFenceGate,
|
||||
WarpedFungus,
|
||||
WarpedHangingSign,
|
||||
WarpedHyphae,
|
||||
WarpedNylium,
|
||||
WarpedPlanks,
|
||||
|
|
@ -885,6 +923,7 @@
|
|||
WarpedStairs,
|
||||
WarpedStem,
|
||||
WarpedTrapdoor,
|
||||
WarpedWallHangingSign,
|
||||
WarpedWallSign,
|
||||
WarpedWartBlock,
|
||||
Water,
|
||||
|
|
|
|||
9
MinecraftClient/Mapping/MessageFilterType.cs
Normal file
9
MinecraftClient/Mapping/MessageFilterType.cs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
namespace MinecraftClient.Mapping
|
||||
{
|
||||
public enum MessageFilterType
|
||||
{
|
||||
PassThrough = 0,
|
||||
FullyFiltered,
|
||||
PartiallyFiltered
|
||||
}
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@ using MinecraftClient.Inventory;
|
|||
using MinecraftClient.Logger;
|
||||
using MinecraftClient.Mapping;
|
||||
using MinecraftClient.Protocol;
|
||||
using MinecraftClient.Protocol.Handlers;
|
||||
using MinecraftClient.Protocol.Handlers.Forge;
|
||||
using MinecraftClient.Protocol.Message;
|
||||
using MinecraftClient.Protocol.ProfileKey;
|
||||
|
|
@ -67,6 +68,7 @@ namespace MinecraftClient
|
|||
private double motionY;
|
||||
public enum MovementType { Sneak, Walk, Sprint }
|
||||
private int sequenceId; // User for player block synchronization (Aka. digging, placing blocks, etc..)
|
||||
private bool CanSendMessage = false;
|
||||
|
||||
private readonly string host;
|
||||
private readonly int port;
|
||||
|
|
@ -85,6 +87,10 @@ namespace MinecraftClient
|
|||
|
||||
private int playerEntityID;
|
||||
|
||||
private object DigLock = new();
|
||||
private Tuple<Location, Direction>? LastDigPosition;
|
||||
private int RemainingDiggingTime = 0;
|
||||
|
||||
// player health and hunger
|
||||
private float playerHealth;
|
||||
private int playerFoodSaturation;
|
||||
|
|
@ -290,6 +296,9 @@ namespace MinecraftClient
|
|||
/// </summary>
|
||||
private void TrySendMessageToServer()
|
||||
{
|
||||
if (!CanSendMessage)
|
||||
return;
|
||||
|
||||
while (chatQueue.Count > 0 && nextMessageSendTime < DateTime.Now)
|
||||
{
|
||||
string text = chatQueue.Dequeue();
|
||||
|
|
@ -375,6 +384,22 @@ namespace MinecraftClient
|
|||
taskToRun();
|
||||
}
|
||||
}
|
||||
|
||||
lock (DigLock)
|
||||
{
|
||||
if (RemainingDiggingTime > 0)
|
||||
{
|
||||
if (--RemainingDiggingTime == 0 && LastDigPosition != null)
|
||||
{
|
||||
handler.SendPlayerDigging(2, LastDigPosition.Item1, LastDigPosition.Item2, sequenceId++);
|
||||
Log.Info(string.Format(Translations.cmd_dig_end, LastDigPosition.Item1));
|
||||
}
|
||||
else
|
||||
{
|
||||
DoAnimation((int)Hand.MainHand);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Connection Lost and Disconnect from Server
|
||||
|
|
@ -1102,13 +1127,15 @@ namespace MinecraftClient
|
|||
/// <returns>Player info</returns>
|
||||
public PlayerInfo? GetPlayerInfo(Guid uuid)
|
||||
{
|
||||
lock (onlinePlayers)
|
||||
{
|
||||
if (onlinePlayers.ContainsKey(uuid))
|
||||
return onlinePlayers[uuid];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
if (onlinePlayers.TryGetValue(uuid, out PlayerInfo? player))
|
||||
return player;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public PlayerKeyPair? GetPlayerKeyPair()
|
||||
{
|
||||
return playerKeyPair;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -1292,7 +1319,7 @@ namespace MinecraftClient
|
|||
/// <returns>TRUE if the item was successfully used</returns>
|
||||
public bool UseItemOnHand()
|
||||
{
|
||||
return InvokeOnMainThread(() => handler.SendUseItem(0, sequenceId));
|
||||
return InvokeOnMainThread(() => handler.SendUseItem(0, sequenceId++));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1301,7 +1328,7 @@ namespace MinecraftClient
|
|||
/// <returns>TRUE if the item was successfully used</returns>
|
||||
public bool UseItemOnLeftHand()
|
||||
{
|
||||
return InvokeOnMainThread(() => handler.SendUseItem(1, sequenceId));
|
||||
return InvokeOnMainThread(() => handler.SendUseItem(1, sequenceId++));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -2186,7 +2213,7 @@ namespace MinecraftClient
|
|||
/// <returns>TRUE if successfully placed</returns>
|
||||
public bool PlaceBlock(Location location, Direction blockFace, Hand hand = Hand.MainHand)
|
||||
{
|
||||
return InvokeOnMainThread(() => handler.SendPlayerBlockPlacement((int)hand, location, blockFace, sequenceId));
|
||||
return InvokeOnMainThread(() => handler.SendPlayerBlockPlacement((int)hand, location, blockFace, sequenceId++));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -2195,26 +2222,44 @@ namespace MinecraftClient
|
|||
/// <param name="location">Location of block to dig</param>
|
||||
/// <param name="swingArms">Also perform the "arm swing" animation</param>
|
||||
/// <param name="lookAtBlock">Also look at the block before digging</param>
|
||||
public bool DigBlock(Location location, bool swingArms = true, bool lookAtBlock = true)
|
||||
public bool DigBlock(Location location, bool swingArms = true, bool lookAtBlock = true, double duration = 0)
|
||||
{
|
||||
if (!GetTerrainEnabled())
|
||||
return false;
|
||||
|
||||
if (InvokeRequired)
|
||||
return InvokeOnMainThread(() => DigBlock(location, swingArms, lookAtBlock));
|
||||
return InvokeOnMainThread(() => DigBlock(location, swingArms, lookAtBlock, duration));
|
||||
|
||||
// TODO select best face from current player location
|
||||
Direction blockFace = Direction.Down;
|
||||
|
||||
// Look at block before attempting to break it
|
||||
if (lookAtBlock)
|
||||
UpdateLocation(GetCurrentLocation(), location);
|
||||
lock (DigLock)
|
||||
{
|
||||
if (RemainingDiggingTime > 0 && LastDigPosition != null)
|
||||
{
|
||||
handler.SendPlayerDigging(1, LastDigPosition.Item1, LastDigPosition.Item2, sequenceId++);
|
||||
Log.Info(string.Format(Translations.cmd_dig_cancel, LastDigPosition.Item1));
|
||||
}
|
||||
|
||||
// Send dig start and dig end, will need to wait for server response to know dig result
|
||||
// See https://wiki.vg/How_to_Write_a_Client#Digging for more details
|
||||
return handler.SendPlayerDigging(0, location, blockFace, sequenceId)
|
||||
&& (!swingArms || DoAnimation((int)Hand.MainHand))
|
||||
&& handler.SendPlayerDigging(2, location, blockFace, sequenceId);
|
||||
// Look at block before attempting to break it
|
||||
if (lookAtBlock)
|
||||
UpdateLocation(GetCurrentLocation(), location);
|
||||
|
||||
// Send dig start and dig end, will need to wait for server response to know dig result
|
||||
// See https://wiki.vg/How_to_Write_a_Client#Digging for more details
|
||||
bool result = handler.SendPlayerDigging(0, location, blockFace, sequenceId++)
|
||||
&& (!swingArms || DoAnimation((int)Hand.MainHand));
|
||||
|
||||
if (duration <= 0)
|
||||
result &= handler.SendPlayerDigging(2, location, blockFace, sequenceId++);
|
||||
else
|
||||
{
|
||||
LastDigPosition = new(location, blockFace);
|
||||
RemainingDiggingTime = Settings.DoubleToTick(duration);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -2370,7 +2415,7 @@ namespace MinecraftClient
|
|||
/// <summary>
|
||||
/// Called when a server was successfully joined
|
||||
/// </summary>
|
||||
public void OnGameJoined()
|
||||
public void OnGameJoined(bool isOnlineMode)
|
||||
{
|
||||
string? bandString = Config.Main.Advanced.BrandInfo.ToBrandString();
|
||||
if (!String.IsNullOrWhiteSpace(bandString))
|
||||
|
|
@ -2386,6 +2431,12 @@ namespace MinecraftClient
|
|||
Config.MCSettings.Skin.GetByte(),
|
||||
(byte)Config.MCSettings.MainHand);
|
||||
|
||||
if (protocolversion >= Protocol18Handler.MC_1_19_3_Version
|
||||
&& playerKeyPair != null && isOnlineMode)
|
||||
handler.SendPlayerSession(playerKeyPair);
|
||||
|
||||
if (protocolversion < Protocol18Handler.MC_1_19_3_Version)
|
||||
CanSendMessage = true;
|
||||
|
||||
if (inventoryHandlingRequested)
|
||||
{
|
||||
|
|
@ -3431,6 +3482,11 @@ namespace MinecraftClient
|
|||
ConsoleIO.OnAutoCompleteDone(transactionId, result);
|
||||
}
|
||||
|
||||
public void OnDeclareCommands()
|
||||
{
|
||||
CanSendMessage = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send a click container button packet to the server.
|
||||
/// Used for Enchanting table, Lectern, stone cutter and loom
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace MinecraftClient
|
|||
|
||||
public const string Version = MCHighestVersion;
|
||||
public const string MCLowestVersion = "1.4.6";
|
||||
public const string MCHighestVersion = "1.19.2";
|
||||
public const string MCHighestVersion = "1.19.3";
|
||||
public static readonly string? BuildInfo = null;
|
||||
|
||||
private static Tuple<Thread, CancellationTokenSource>? offlinePrompt = null;
|
||||
|
|
@ -621,7 +621,16 @@ namespace MinecraftClient
|
|||
{
|
||||
HandleFailure(Translations.error_unsupported, true);
|
||||
}
|
||||
catch (Exception) { }
|
||||
catch (NotImplementedException)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ConsoleIO.WriteLine(e.Message);
|
||||
ConsoleIO.WriteLine(e.StackTrace ?? "");
|
||||
HandleFailure(); // Other error
|
||||
}
|
||||
}
|
||||
else HandleFailure(Translations.error_determine, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -240,6 +240,18 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
return ReadData(len, cache);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a byte array with given length from a cache of bytes and remove it from the cache
|
||||
/// </summary>
|
||||
/// <param name="cache">Cache of bytes to read from</param>
|
||||
/// <param name="length">Length of the bytes array</param>
|
||||
/// <returns>The byte array</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
public byte[] ReadNextByteArray(Queue<byte> cache, int length)
|
||||
{
|
||||
return ReadData(length, cache);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a length-prefixed array of unsigned long integers and removes it from the cache
|
||||
/// </summary>
|
||||
|
|
@ -579,6 +591,9 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
{
|
||||
int type = ReadNextVarInt(cache);
|
||||
|
||||
// Value's data type is depended on Type
|
||||
object? value = null;
|
||||
|
||||
// starting from 1.13, Optional Chat is inserted as number 5 in 1.13 and IDs after 5 got shifted.
|
||||
// Increase type ID by 1 if
|
||||
// - below 1.13
|
||||
|
|
@ -586,20 +601,29 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
if (protocolversion < Protocol18Handler.MC_1_13_Version)
|
||||
{
|
||||
if (type > 4)
|
||||
++type;
|
||||
}
|
||||
else if (protocolversion >= Protocol18Handler.MC_1_19_3_Version)
|
||||
{
|
||||
if (type == 2)
|
||||
{
|
||||
type += 1;
|
||||
value = ReadNextVarLong(cache);
|
||||
type = -1;
|
||||
}
|
||||
else if (type >= 3)
|
||||
{
|
||||
--type;
|
||||
}
|
||||
}
|
||||
|
||||
// Value's data type is depended on Type
|
||||
object? value = null;
|
||||
|
||||
// This is backward compatible since new type is appended to the end
|
||||
// Version upgrade note
|
||||
// - Check type ID got shifted or not
|
||||
// - Add new type if any
|
||||
switch (type)
|
||||
{
|
||||
case -1: // already readed
|
||||
break;
|
||||
case 0: // byte
|
||||
value = ReadNextByte(cache);
|
||||
break;
|
||||
|
|
@ -660,23 +684,73 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case 15: // Particle
|
||||
// Currecutly not handled. Reading data only
|
||||
int ParticleID = ReadNextVarInt(cache);
|
||||
switch (ParticleID)
|
||||
// Need to check the exact version where the change occurred!!!!!
|
||||
if (protocolversion >= Protocol18Handler.MC_1_19_3_Version)
|
||||
{
|
||||
case 3:
|
||||
ReadNextVarInt(cache);
|
||||
break;
|
||||
case 14:
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
break;
|
||||
case 23:
|
||||
ReadNextVarInt(cache);
|
||||
break;
|
||||
case 32:
|
||||
ReadNextItemSlot(cache, itemPalette);
|
||||
break;
|
||||
switch (ParticleID)
|
||||
{
|
||||
case 2:
|
||||
ReadNextVarInt(cache);
|
||||
break;
|
||||
case 3:
|
||||
ReadNextVarInt(cache);
|
||||
break;
|
||||
case 14:
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
break;
|
||||
case 15:
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
break;
|
||||
case 24:
|
||||
ReadNextVarInt(cache);
|
||||
break;
|
||||
case 35:
|
||||
ReadNextItemSlot(cache, itemPalette);
|
||||
break;
|
||||
case 36:
|
||||
string positionSourceType = ReadNextString(cache);
|
||||
if (positionSourceType == "minecraft:block")
|
||||
{
|
||||
ReadNextLocation(cache);
|
||||
}
|
||||
else if (positionSourceType == "minecraft:entity")
|
||||
{
|
||||
ReadNextVarInt(cache);
|
||||
ReadNextFloat(cache);
|
||||
}
|
||||
ReadNextVarInt(cache);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (ParticleID)
|
||||
{
|
||||
case 3:
|
||||
ReadNextVarInt(cache);
|
||||
break;
|
||||
case 14:
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
break;
|
||||
case 23:
|
||||
ReadNextVarInt(cache);
|
||||
break;
|
||||
case 32:
|
||||
ReadNextItemSlot(cache, itemPalette);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 16: // Villager Data (3x VarInt)
|
||||
|
|
@ -706,7 +780,10 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
if (protocolversion <= Protocol18Handler.MC_1_19_Version)
|
||||
value = ReadNextVarInt(cache);
|
||||
else
|
||||
value = null; // Dimension and blockPos, currently not in use
|
||||
{
|
||||
// Dimension and blockPos, currently not in use
|
||||
value = new Tuple<string, Location>(ReadNextString(cache), ReadNextLocation(cache));
|
||||
}
|
||||
break;
|
||||
case 22: // Painting Variant
|
||||
value = ReadNextVarInt(cache);
|
||||
|
|
@ -728,11 +805,17 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
{
|
||||
Item inputItem1 = ReadNextItemSlot(cache, itemPalette)!;
|
||||
Item outputItem = ReadNextItemSlot(cache, itemPalette)!;
|
||||
|
||||
Item? inputItem2 = null;
|
||||
if (ReadNextBool(cache)) //check if villager has second item
|
||||
{
|
||||
|
||||
if (protocolversion >= Protocol18Handler.MC_1_19_3_Version)
|
||||
inputItem2 = ReadNextItemSlot(cache, itemPalette);
|
||||
else
|
||||
{
|
||||
if (ReadNextBool(cache)) //check if villager has second item
|
||||
inputItem2 = ReadNextItemSlot(cache, itemPalette);
|
||||
}
|
||||
|
||||
bool tradeDisabled = ReadNextBool(cache);
|
||||
int numberOfTradeUses = ReadNextInt(cache);
|
||||
int maximumNumberOfTradeUses = ReadNextInt(cache);
|
||||
|
|
@ -917,7 +1000,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
/// </summary>
|
||||
/// <param name="paramInt">Integer to encode</param>
|
||||
/// <returns>Byte array for this integer</returns>
|
||||
public byte[] GetVarInt(int paramInt)
|
||||
public static byte[] GetVarInt(int paramInt)
|
||||
{
|
||||
List<byte> bytes = new();
|
||||
while ((paramInt & -128) != 0)
|
||||
|
|
@ -948,7 +1031,19 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
/// </summary>
|
||||
/// <param name="number">Long to process</param>
|
||||
/// <returns>Array ready to send</returns>
|
||||
public byte[] GetLong(long number)
|
||||
public static byte[] GetLong(long number)
|
||||
{
|
||||
byte[] theLong = BitConverter.GetBytes(number);
|
||||
Array.Reverse(theLong);
|
||||
return theLong;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get byte array representing a long integer
|
||||
/// </summary>
|
||||
/// <param name="number">Long to process</param>
|
||||
/// <returns>Array ready to send</returns>
|
||||
public static byte[] GetULong(ulong number)
|
||||
{
|
||||
byte[] theLong = BitConverter.GetBytes(number);
|
||||
Array.Reverse(theLong);
|
||||
|
|
@ -960,7 +1055,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
/// </summary>
|
||||
/// <param name="number">Integer to process</param>
|
||||
/// <returns>Array ready to send</returns>
|
||||
public byte[] GetInt(int number)
|
||||
public static byte[] GetInt(int number)
|
||||
{
|
||||
byte[] theInt = BitConverter.GetBytes(number);
|
||||
Array.Reverse(theInt);
|
||||
|
|
@ -1143,7 +1238,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
/// </summary>
|
||||
/// <param name="uuid">UUID of Player/Entity</param>
|
||||
/// <returns>UUID representation</returns>
|
||||
public byte[] GetUUID(Guid UUID)
|
||||
public static byte[] GetUUID(Guid UUID)
|
||||
{
|
||||
return UUID.ToBigEndianBytes();
|
||||
}
|
||||
|
|
@ -1188,11 +1283,11 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
{
|
||||
List<byte> fields = new();
|
||||
fields.AddRange(GetVarInt(msgList.entries.Length)); // Message list size
|
||||
foreach (Message.LastSeenMessageList.Entry entry in msgList.entries)
|
||||
foreach (Message.LastSeenMessageList.AcknowledgedMessage entry in msgList.entries)
|
||||
{
|
||||
fields.AddRange(entry.profileId.ToBigEndianBytes()); // UUID
|
||||
fields.AddRange(GetVarInt(entry.lastSignature.Length)); // Signature length
|
||||
fields.AddRange(entry.lastSignature); // Signature data
|
||||
fields.AddRange(GetVarInt(entry.signature.Length)); // Signature length
|
||||
fields.AddRange(entry.signature); // Signature data
|
||||
}
|
||||
return fields.ToArray();
|
||||
}
|
||||
|
|
@ -1214,8 +1309,8 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
{
|
||||
fields.AddRange(GetBool(true));
|
||||
fields.AddRange(ack.lastReceived.profileId.ToBigEndianBytes()); // Has last received message
|
||||
fields.AddRange(GetVarInt(ack.lastReceived.lastSignature.Length)); // Last received message signature length
|
||||
fields.AddRange(ack.lastReceived.lastSignature); // Last received message signature data
|
||||
fields.AddRange(GetVarInt(ack.lastReceived.signature.Length)); // Last received message signature length
|
||||
fields.AddRange(ack.lastReceived.signature); // Last received message signature data
|
||||
}
|
||||
return fields.ToArray();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ namespace MinecraftClient.Protocol.Handlers.packet.s2c
|
|||
private static int RootIdx;
|
||||
private static CommandNode[] Nodes = Array.Empty<CommandNode>();
|
||||
|
||||
public static void Read(DataTypes dataTypes, Queue<byte> packetData)
|
||||
public static void Read(DataTypes dataTypes, Queue<byte> packetData, int protocolVersion)
|
||||
{
|
||||
int count = dataTypes.ReadNextVarInt(packetData);
|
||||
Nodes = new CommandNode[count];
|
||||
|
|
@ -21,7 +21,7 @@ namespace MinecraftClient.Protocol.Handlers.packet.s2c
|
|||
for (int j = 0; j < childCount; ++j)
|
||||
childs[j] = dataTypes.ReadNextVarInt(packetData);
|
||||
|
||||
int redirectNode = ((flags & 0x08) > 0) ? dataTypes.ReadNextVarInt(packetData) : -1;
|
||||
int redirectNode = ((flags & 0x08) == 0x08) ? dataTypes.ReadNextVarInt(packetData) : -1;
|
||||
|
||||
string? name = ((flags & 0x03) == 1 || (flags & 0x03) == 2) ? dataTypes.ReadNextString(packetData) : null;
|
||||
|
||||
|
|
@ -29,28 +29,51 @@ namespace MinecraftClient.Protocol.Handlers.packet.s2c
|
|||
Paser? paser = null;
|
||||
if ((flags & 0x03) == 2)
|
||||
{
|
||||
paser = paserId switch
|
||||
{
|
||||
1 => new PaserFloat(dataTypes, packetData),
|
||||
2 => new PaserDouble(dataTypes, packetData),
|
||||
3 => new PaserInteger(dataTypes, packetData),
|
||||
4 => new PaserLong(dataTypes, packetData),
|
||||
5 => new PaserString(dataTypes, packetData),
|
||||
6 => new PaserEntity(dataTypes, packetData),
|
||||
8 => new PaserBlockPos(dataTypes, packetData),
|
||||
9 => new PaserColumnPos(dataTypes, packetData),
|
||||
10 => new PaserVec3(dataTypes, packetData),
|
||||
11 => new PaserVec2(dataTypes, packetData),
|
||||
18 => new PaserMessage(dataTypes, packetData),
|
||||
27 => new PaserRotation(dataTypes, packetData),
|
||||
29 => new PaserScoreHolder(dataTypes, packetData),
|
||||
43 => new PaserResourceOrTag(dataTypes, packetData),
|
||||
44 => new PaserResource(dataTypes, packetData),
|
||||
_ => new PaserEmpty(dataTypes, packetData),
|
||||
};
|
||||
if (protocolVersion <= Protocol18Handler.MC_1_19_2_Version)
|
||||
paser = paserId switch
|
||||
{
|
||||
1 => new PaserFloat(dataTypes, packetData),
|
||||
2 => new PaserDouble(dataTypes, packetData),
|
||||
3 => new PaserInteger(dataTypes, packetData),
|
||||
4 => new PaserLong(dataTypes, packetData),
|
||||
5 => new PaserString(dataTypes, packetData),
|
||||
6 => new PaserEntity(dataTypes, packetData),
|
||||
8 => new PaserBlockPos(dataTypes, packetData),
|
||||
9 => new PaserColumnPos(dataTypes, packetData),
|
||||
10 => new PaserVec3(dataTypes, packetData),
|
||||
11 => new PaserVec2(dataTypes, packetData),
|
||||
18 => new PaserMessage(dataTypes, packetData),
|
||||
27 => new PaserRotation(dataTypes, packetData),
|
||||
29 => new PaserScoreHolder(dataTypes, packetData),
|
||||
43 => new PaserResourceOrTag(dataTypes, packetData),
|
||||
44 => new PaserResource(dataTypes, packetData),
|
||||
_ => new PaserEmpty(dataTypes, packetData),
|
||||
};
|
||||
else // protocolVersion >= MC_1_19_3_Version
|
||||
paser = paserId switch
|
||||
{
|
||||
1 => new PaserFloat(dataTypes, packetData),
|
||||
2 => new PaserDouble(dataTypes, packetData),
|
||||
3 => new PaserInteger(dataTypes, packetData),
|
||||
4 => new PaserLong(dataTypes, packetData),
|
||||
5 => new PaserString(dataTypes, packetData),
|
||||
6 => new PaserEntity(dataTypes, packetData),
|
||||
8 => new PaserBlockPos(dataTypes, packetData),
|
||||
9 => new PaserColumnPos(dataTypes, packetData),
|
||||
10 => new PaserVec3(dataTypes, packetData),
|
||||
11 => new PaserVec2(dataTypes, packetData),
|
||||
18 => new PaserMessage(dataTypes, packetData),
|
||||
27 => new PaserRotation(dataTypes, packetData),
|
||||
29 => new PaserScoreHolder(dataTypes, packetData),
|
||||
41 => new PaserResourceOrTag(dataTypes, packetData),
|
||||
42 => new PaserResourceOrTag(dataTypes, packetData),
|
||||
43 => new PaserResource(dataTypes, packetData),
|
||||
44 => new PaserResource(dataTypes, packetData),
|
||||
_ => new PaserEmpty(dataTypes, packetData),
|
||||
};
|
||||
}
|
||||
|
||||
string? suggestionsType = ((flags & 0x10) > 0) ? dataTypes.ReadNextString(packetData) : null;
|
||||
string? suggestionsType = ((flags & 0x10) == 0x10) ? dataTypes.ReadNextString(packetData) : null;
|
||||
|
||||
Nodes[i] = new(flags, childs, redirectNode, name, paser, suggestionsType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{
|
||||
private readonly Dictionary<int, PacketTypesIn> typeIn = new()
|
||||
{
|
||||
{ 0x00, PacketTypesIn.SpawnEntity }, // Changed in 1.19 (Wiki name: Spawn Entity) - DONE
|
||||
{ 0x00, PacketTypesIn.SpawnEntity }, // Changed in 1.19 (Wiki name: Spawn Entity)
|
||||
{ 0x01, PacketTypesIn.SpawnExperienceOrb }, // (Wiki name: Spawn Exeprience Orb)
|
||||
{ 0x02, PacketTypesIn.SpawnPlayer }, //
|
||||
{ 0x03, PacketTypesIn.EntityAnimation }, // (Wiki name: Entity Animation (clientbound))
|
||||
{ 0x04, PacketTypesIn.Statistics }, // (Wiki name: Award Statistics)
|
||||
{ 0x05, PacketTypesIn.BlockChangedAck }, // Added 1.19 (Wiki name: Acknowledge Block Change) - DONE
|
||||
{ 0x05, PacketTypesIn.BlockChangedAck }, // Added 1.19 (Wiki name: Acknowledge Block Change)
|
||||
{ 0x06, PacketTypesIn.BlockBreakAnimation }, // (Wiki name: Set Block Destroy Stage)
|
||||
{ 0x07, PacketTypesIn.BlockEntityData }, //
|
||||
{ 0x08, PacketTypesIn.BlockAction }, //
|
||||
|
|
@ -28,10 +28,10 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x13, PacketTypesIn.SetSlot }, // (Wiki name: Set Container Slot)
|
||||
{ 0x14, PacketTypesIn.SetCooldown }, //
|
||||
{ 0x15, PacketTypesIn.PluginMessage }, // (Wiki name: Plugin Message (clientbound))
|
||||
{ 0x16, PacketTypesIn.NamedSoundEffect }, // Changed in 1.19 (Added "Speed" field) (Wiki name: Custom Sound Effect) - DONE (No need to be implemented)
|
||||
{ 0x16, PacketTypesIn.NamedSoundEffect }, // Changed in 1.19 (Added "Speed" field) (Wiki name: Custom Sound Effect) (No need to be implemented)
|
||||
{ 0x17, PacketTypesIn.Disconnect }, //
|
||||
{ 0x18, PacketTypesIn.EntityStatus }, // (Wiki name: Entity Event)
|
||||
{ 0x19, PacketTypesIn.Explosion }, // Changed in 1.19 (Location fields are now Double instead of Float) (Wiki name: Explosion) - DONE
|
||||
{ 0x19, PacketTypesIn.Explosion }, // Changed in 1.19 (Location fields are now Double instead of Float) (Wiki name: Explosion)
|
||||
{ 0x1A, PacketTypesIn.UnloadChunk }, // (Wiki name: Forget Chunk)
|
||||
{ 0x1B, PacketTypesIn.ChangeGameState }, // (Wiki name: Game Event)
|
||||
{ 0x1C, PacketTypesIn.OpenHorseWindow }, // (Wiki name: Horse Screen Open)
|
||||
|
|
@ -39,9 +39,9 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x1E, PacketTypesIn.KeepAlive }, //
|
||||
{ 0x1F, PacketTypesIn.ChunkData }, //
|
||||
{ 0x20, PacketTypesIn.Effect }, // (Wiki name: Level Event)
|
||||
{ 0x21, PacketTypesIn.Particle }, // Changed in 1.19 ("Particle Data" field is now "Max Speed", it's the same Float data type) (Wiki name: Level Particle) - DONE (No need to be implemented)
|
||||
{ 0x21, PacketTypesIn.Particle }, // Changed in 1.19 ("Particle Data" field is now "Max Speed", it's the same Float data type) (Wiki name: Level Particle) (No need to be implemented)
|
||||
{ 0x22, PacketTypesIn.UpdateLight }, // (Wiki name: Light Update)
|
||||
{ 0x23, PacketTypesIn.JoinGame }, // Changed in 1.19 (lot's of changes) (Wiki name: Login (play)) - DONE
|
||||
{ 0x23, PacketTypesIn.JoinGame }, // Changed in 1.19 (lot's of changes) (Wiki name: Login (play))
|
||||
{ 0x24, PacketTypesIn.MapData }, // (Wiki name: Map Item Data)
|
||||
{ 0x25, PacketTypesIn.TradeList }, // (Wiki name: Merchant Offers)
|
||||
{ 0x26, PacketTypesIn.EntityPosition }, // (Wiki name: Move Entity Position)
|
||||
|
|
@ -58,14 +58,14 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x31, PacketTypesIn.EndCombatEvent }, // (Wiki name: Player Combat End)
|
||||
{ 0x32, PacketTypesIn.EnterCombatEvent }, // (Wiki name: Player Combat Enter)
|
||||
{ 0x33, PacketTypesIn.DeathCombatEvent }, // (Wiki name: Player Combat Kill)
|
||||
{ 0x34, PacketTypesIn.PlayerInfo }, // Changed in 1.19 (Heavy changes) - DONE
|
||||
{ 0x34, PacketTypesIn.PlayerInfo }, // Changed in 1.19 (Heavy changes)
|
||||
{ 0x35, PacketTypesIn.FacePlayer }, // (Wiki name: Player Look At)
|
||||
{ 0x36, PacketTypesIn.PlayerPositionAndLook }, // (Wiki name: Player Position)
|
||||
{ 0x37, PacketTypesIn.UnlockRecipes }, // (Wiki name: Recipe)
|
||||
{ 0x38, PacketTypesIn.DestroyEntities }, // (Wiki name: Remove Entites)
|
||||
{ 0x39, PacketTypesIn.RemoveEntityEffect }, //
|
||||
{ 0x3A, PacketTypesIn.ResourcePackSend }, // (Wiki name: Resource Pack)
|
||||
{ 0x3B, PacketTypesIn.Respawn }, // Changed in 1.19 (Heavy changes) - DONE
|
||||
{ 0x3B, PacketTypesIn.Respawn }, // Changed in 1.19 (Heavy changes)
|
||||
{ 0x3C, PacketTypesIn.EntityHeadLook }, // (Wiki name: Rotate Head)
|
||||
{ 0x3D, PacketTypesIn.MultiBlockChange }, // (Wiki name: Sections Block Update)
|
||||
{ 0x3E, PacketTypesIn.SelectAdvancementTab }, //
|
||||
|
|
@ -99,7 +99,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x5A, PacketTypesIn.SetTitleText }, // (Wiki name: Set Title)
|
||||
{ 0x5B, PacketTypesIn.SetTitleTime }, // (Wiki name: Set Titles Animation)
|
||||
{ 0x5C, PacketTypesIn.EntitySoundEffect }, // (Wiki name: Sound Entity)
|
||||
{ 0x5D, PacketTypesIn.SoundEffect }, // Changed in 1.19 (Added "Seed" field) (Wiki name: Sound Effect) - DONE (No need to be implemented)
|
||||
{ 0x5D, PacketTypesIn.SoundEffect }, // Changed in 1.19 (Added "Seed" field) (Wiki name: Sound Effect) (No need to be implemented)
|
||||
{ 0x5E, PacketTypesIn.StopSound }, //
|
||||
{ 0x5F, PacketTypesIn.SystemChat }, // Added in 1.19 (Wiki name: System Chat Message)
|
||||
{ 0x60, PacketTypesIn.PlayerListHeaderAndFooter }, // (Wiki name: Tab List)
|
||||
|
|
@ -108,7 +108,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x63, PacketTypesIn.EntityTeleport }, // (Wiki name: Teleport Entity)
|
||||
{ 0x64, PacketTypesIn.Advancements }, // (Wiki name: Update Advancements)
|
||||
{ 0x65, PacketTypesIn.EntityProperties }, // (Wiki name: Update Attributes)
|
||||
{ 0x66, PacketTypesIn.EntityEffect }, // Changed in 1.19 (Added "Has Factor Data" and "Factor Codec" fields) (Wiki name: Entity Effect) - DONE
|
||||
{ 0x66, PacketTypesIn.EntityEffect }, // Changed in 1.19 (Added "Has Factor Data" and "Factor Codec" fields) (Wiki name: Entity Effect)
|
||||
{ 0x67, PacketTypesIn.DeclareRecipes }, // (Wiki name: Update Recipes)
|
||||
{ 0x68, PacketTypesIn.Tags }, // (Wiki name: Update Tags)
|
||||
};
|
||||
|
|
@ -118,9 +118,9 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x00, PacketTypesOut.TeleportConfirm }, // (Wiki name: Confirm Teleportation)
|
||||
{ 0x01, PacketTypesOut.QueryBlockNBT }, // (Wiki name: Query Block Entity Tag)
|
||||
{ 0x02, PacketTypesOut.SetDifficulty }, // (Wiki name: Change Difficutly)
|
||||
{ 0x03, PacketTypesOut.ChatCommand }, // Added in 1.19
|
||||
{ 0x04, PacketTypesOut.ChatMessage }, // Changed in 1.19 (Completely changed) (Wiki name: Chat)
|
||||
{ 0x05, PacketTypesOut.ChatPreview }, // Added in 1.19 (Wiki name: Chat Preview (serverbound))
|
||||
{ 0x03, PacketTypesOut.MessageAcknowledgment }, // TODO
|
||||
{ 0x04, PacketTypesOut.ChatCommand }, // Added in 1.19
|
||||
{ 0x05, PacketTypesOut.ChatMessage }, // Changed in 1.19 (Completely changed) (Wiki name: Chat)
|
||||
{ 0x06, PacketTypesOut.ClientStatus }, // (Wiki name: Client Command)
|
||||
{ 0x07, PacketTypesOut.ClientSettings }, // (Wiki name: Client Information)
|
||||
{ 0x08, PacketTypesOut.TabComplete }, // (Wiki name: Command Suggestions Request)
|
||||
|
|
@ -143,28 +143,29 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x19, PacketTypesOut.PickItem }, //
|
||||
{ 0x1A, PacketTypesOut.CraftRecipeRequest }, // (Wiki name: Place recipe)
|
||||
{ 0x1B, PacketTypesOut.PlayerAbilities }, //
|
||||
{ 0x1C, PacketTypesOut.PlayerDigging }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Player Action) - DONE
|
||||
{ 0x1C, PacketTypesOut.PlayerDigging }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Player Action)
|
||||
{ 0x1D, PacketTypesOut.EntityAction }, // (Wiki name: Player Command)
|
||||
{ 0x1E, PacketTypesOut.SteerVehicle }, // (Wiki name: Player Input)
|
||||
{ 0x1F, PacketTypesOut.Pong }, // (Wiki name: Pong (play))
|
||||
{ 0x20, PacketTypesOut.SetDisplayedRecipe }, // (Wiki name: Recipe Book Change Settings)
|
||||
{ 0x21, PacketTypesOut.SetRecipeBookState }, // (Wiki name: Recipe Book Seen Recipe)
|
||||
{ 0x22, PacketTypesOut.NameItem }, // (Wiki name: Rename Item)
|
||||
{ 0x23, PacketTypesOut.ResourcePackStatus }, // (Wiki name: Resource Pack (serverbound))
|
||||
{ 0x24, PacketTypesOut.AdvancementTab }, // (Wiki name: Seen Advancements)
|
||||
{ 0x25, PacketTypesOut.SelectTrade }, //
|
||||
{ 0x26, PacketTypesOut.SetBeaconEffect }, // Changed in 1.19 (Added a "Secondary Effect Present" and "Secondary Effect" fields) (Wiki name: Set Beacon) - DONE - (No need to be implemented)
|
||||
{ 0x27, PacketTypesOut.HeldItemChange }, // (Wiki name: Set Carried Item (serverbound))
|
||||
{ 0x28, PacketTypesOut.UpdateCommandBlock }, // (Wiki name: Set Command Block)
|
||||
{ 0x29, PacketTypesOut.UpdateCommandBlockMinecart }, //
|
||||
{ 0x2A, PacketTypesOut.CreativeInventoryAction }, // (Wiki name: Set Creative Mode Slot)
|
||||
{ 0x2B, PacketTypesOut.UpdateJigsawBlock }, // (Wiki name: Set Jigsaw Block)
|
||||
{ 0x2C, PacketTypesOut.UpdateStructureBlock }, // (Wiki name: Set Structure Block)
|
||||
{ 0x2D, PacketTypesOut.UpdateSign }, // (Wiki name: Sign Update)
|
||||
{ 0x2E, PacketTypesOut.Animation }, // (Wiki name: Swing)
|
||||
{ 0x2F, PacketTypesOut.Spectate }, // (Wiki name: Teleport To Entity)
|
||||
{ 0x30, PacketTypesOut.PlayerBlockPlacement }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item On) - DONE
|
||||
{ 0x31, PacketTypesOut.UseItem }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item) - DONE
|
||||
{ 0x20, PacketTypesOut.PlayerSession }, // Added in 1.19.3 TODO
|
||||
{ 0x21, PacketTypesOut.SetDisplayedRecipe }, // (Wiki name: Recipe Book Change Settings)
|
||||
{ 0x22, PacketTypesOut.SetRecipeBookState }, // (Wiki name: Recipe Book Seen Recipe)
|
||||
{ 0x23, PacketTypesOut.NameItem }, // (Wiki name: Rename Item)
|
||||
{ 0x24, PacketTypesOut.ResourcePackStatus }, // (Wiki name: Resource Pack (serverbound))
|
||||
{ 0x25, PacketTypesOut.AdvancementTab }, // (Wiki name: Seen Advancements)
|
||||
{ 0x26, PacketTypesOut.SelectTrade }, //
|
||||
{ 0x27, PacketTypesOut.SetBeaconEffect }, // Changed in 1.19 (Added a "Secondary Effect Present" and "Secondary Effect" fields) (Wiki name: Set Beacon) - (No need to be implemented)
|
||||
{ 0x28, PacketTypesOut.HeldItemChange }, // (Wiki name: Set Carried Item (serverbound))
|
||||
{ 0x29, PacketTypesOut.UpdateCommandBlock }, // (Wiki name: Set Command Block)
|
||||
{ 0x2A, PacketTypesOut.UpdateCommandBlockMinecart }, //
|
||||
{ 0x2B, PacketTypesOut.CreativeInventoryAction }, // (Wiki name: Set Creative Mode Slot)
|
||||
{ 0x2C, PacketTypesOut.UpdateJigsawBlock }, // (Wiki name: Set Jigsaw Block)
|
||||
{ 0x2D, PacketTypesOut.UpdateStructureBlock }, // (Wiki name: Set Structure Block)
|
||||
{ 0x2E, PacketTypesOut.UpdateSign }, // (Wiki name: Sign Update)
|
||||
{ 0x2F, PacketTypesOut.Animation }, // (Wiki name: Swing)
|
||||
{ 0x30, PacketTypesOut.Spectate }, // (Wiki name: Teleport To Entity)
|
||||
{ 0x31, PacketTypesOut.PlayerBlockPlacement }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item On)
|
||||
{ 0x32, PacketTypesOut.UseItem }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item)
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{
|
||||
private readonly Dictionary<int, PacketTypesIn> typeIn = new()
|
||||
{
|
||||
{ 0x00, PacketTypesIn.SpawnEntity }, // Changed in 1.19 (Wiki name: Spawn Entity) - DONE
|
||||
{ 0x00, PacketTypesIn.SpawnEntity }, // Changed in 1.19 (Wiki name: Spawn Entity)
|
||||
{ 0x01, PacketTypesIn.SpawnExperienceOrb }, // (Wiki name: Spawn Exeprience Orb)
|
||||
{ 0x02, PacketTypesIn.SpawnPlayer }, //
|
||||
{ 0x03, PacketTypesIn.EntityAnimation }, // (Wiki name: Entity Animation (clientbound))
|
||||
{ 0x04, PacketTypesIn.Statistics }, // (Wiki name: Award Statistics)
|
||||
{ 0x05, PacketTypesIn.BlockChangedAck }, // Added 1.19 (Wiki name: Acknowledge Block Change) - DONE
|
||||
{ 0x05, PacketTypesIn.BlockChangedAck }, // Added 1.19 (Wiki name: Acknowledge Block Change)
|
||||
{ 0x06, PacketTypesIn.BlockBreakAnimation }, // (Wiki name: Set Block Destroy Stage)
|
||||
{ 0x07, PacketTypesIn.BlockEntityData }, //
|
||||
{ 0x08, PacketTypesIn.BlockAction }, //
|
||||
|
|
@ -29,11 +29,11 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x14, PacketTypesIn.SetCooldown }, //
|
||||
{ 0x15, PacketTypesIn.ChatSuggestions }, // Added 1.19.1
|
||||
{ 0x16, PacketTypesIn.PluginMessage }, // (Wiki name: Plugin Message (clientbound))
|
||||
{ 0x17, PacketTypesIn.NamedSoundEffect }, // Changed in 1.19 (Added "Speed" field) (Wiki name: Custom Sound Effect) - DONE (No need to be implemented)
|
||||
{ 0x17, PacketTypesIn.NamedSoundEffect }, // Changed in 1.19 (Added "Speed" field) (Wiki name: Custom Sound Effect) (No need to be implemented)
|
||||
{ 0x18, PacketTypesIn.HideMessage }, // Added 1.19.1
|
||||
{ 0x19, PacketTypesIn.Disconnect }, //
|
||||
{ 0x1A, PacketTypesIn.EntityStatus }, // (Wiki name: Entity Event)
|
||||
{ 0x1B, PacketTypesIn.Explosion }, // Changed in 1.19 (Location fields are now Double instead of Float) (Wiki name: Explosion) - DONE
|
||||
{ 0x1B, PacketTypesIn.Explosion }, // Changed in 1.19 (Location fields are now Double instead of Float) (Wiki name: Explosion)
|
||||
{ 0x1C, PacketTypesIn.UnloadChunk }, // (Wiki name: Forget Chunk)
|
||||
{ 0x1D, PacketTypesIn.ChangeGameState }, // (Wiki name: Game Event)
|
||||
{ 0x1E, PacketTypesIn.OpenHorseWindow }, // (Wiki name: Horse Screen Open)
|
||||
|
|
@ -41,9 +41,9 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x20, PacketTypesIn.KeepAlive }, //
|
||||
{ 0x21, PacketTypesIn.ChunkData }, //
|
||||
{ 0x22, PacketTypesIn.Effect }, // (Wiki name: Level Event)
|
||||
{ 0x23, PacketTypesIn.Particle }, // Changed in 1.19 ("Particle Data" field is now "Max Speed", it's the same Float data type) (Wiki name: Level Particle) - DONE (No need to be implemented)
|
||||
{ 0x23, PacketTypesIn.Particle }, // Changed in 1.19 ("Particle Data" field is now "Max Speed", it's the same Float data type) (Wiki name: Level Particle) (No need to be implemented)
|
||||
{ 0x24, PacketTypesIn.UpdateLight }, // (Wiki name: Light Update)
|
||||
{ 0x25, PacketTypesIn.JoinGame }, // Changed in 1.19 (lot's of changes) (Wiki name: Login (play)) - DONE
|
||||
{ 0x25, PacketTypesIn.JoinGame }, // Changed in 1.19 (lot's of changes) (Wiki name: Login (play))
|
||||
{ 0x26, PacketTypesIn.MapData }, // (Wiki name: Map Item Data)
|
||||
{ 0x27, PacketTypesIn.TradeList }, // (Wiki name: Merchant Offers)
|
||||
{ 0x28, PacketTypesIn.EntityPosition }, // (Wiki name: Move Entity Position)
|
||||
|
|
@ -61,14 +61,14 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x34, PacketTypesIn.EndCombatEvent }, // (Wiki name: Player Combat End)
|
||||
{ 0x35, PacketTypesIn.EnterCombatEvent }, // (Wiki name: Player Combat Enter)
|
||||
{ 0x36, PacketTypesIn.DeathCombatEvent }, // (Wiki name: Player Combat Kill)
|
||||
{ 0x37, PacketTypesIn.PlayerInfo }, // Changed in 1.19 (Heavy changes) - DONE
|
||||
{ 0x37, PacketTypesIn.PlayerInfo }, // Changed in 1.19 (Heavy changes)
|
||||
{ 0x38, PacketTypesIn.FacePlayer }, // (Wiki name: Player Look At)
|
||||
{ 0x39, PacketTypesIn.PlayerPositionAndLook }, // (Wiki name: Player Position)
|
||||
{ 0x3A, PacketTypesIn.UnlockRecipes }, // (Wiki name: Recipe)
|
||||
{ 0x3B, PacketTypesIn.DestroyEntities }, // (Wiki name: Remove Entites)
|
||||
{ 0x3C, PacketTypesIn.RemoveEntityEffect }, //
|
||||
{ 0x3D, PacketTypesIn.ResourcePackSend }, // (Wiki name: Resource Pack)
|
||||
{ 0x3E, PacketTypesIn.Respawn }, // Changed in 1.19 (Heavy changes) - DONE
|
||||
{ 0x3E, PacketTypesIn.Respawn }, // Changed in 1.19 (Heavy changes)
|
||||
{ 0x3F, PacketTypesIn.EntityHeadLook }, // (Wiki name: Rotate Head)
|
||||
{ 0x40, PacketTypesIn.MultiBlockChange }, // (Wiki name: Sections Block Update)
|
||||
{ 0x41, PacketTypesIn.SelectAdvancementTab }, //
|
||||
|
|
@ -102,7 +102,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x5D, PacketTypesIn.SetTitleText }, // (Wiki name: Set Title)
|
||||
{ 0x5E, PacketTypesIn.SetTitleTime }, // (Wiki name: Set Titles Animation)
|
||||
{ 0x5F, PacketTypesIn.EntitySoundEffect }, // (Wiki name: Sound Entity)
|
||||
{ 0x60, PacketTypesIn.SoundEffect }, // Changed in 1.19 (Added "Seed" field) (Wiki name: Sound Effect) - DONE (No need to be implemented)
|
||||
{ 0x60, PacketTypesIn.SoundEffect }, // Changed in 1.19 (Added "Seed" field) (Wiki name: Sound Effect) (No need to be implemented)
|
||||
{ 0x61, PacketTypesIn.StopSound }, //
|
||||
{ 0x62, PacketTypesIn.SystemChat }, // Added in 1.19 (Wiki name: System Chat Message)
|
||||
{ 0x63, PacketTypesIn.PlayerListHeaderAndFooter }, // (Wiki name: Tab List)
|
||||
|
|
@ -111,7 +111,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x66, PacketTypesIn.EntityTeleport }, // (Wiki name: Teleport Entity)
|
||||
{ 0x67, PacketTypesIn.Advancements }, // (Wiki name: Update Advancements)
|
||||
{ 0x68, PacketTypesIn.EntityProperties }, // (Wiki name: Update Attributes)
|
||||
{ 0x69, PacketTypesIn.EntityEffect }, // Changed in 1.19 (Added "Has Factor Data" and "Factor Codec" fields) (Wiki name: Entity Effect) - DONE
|
||||
{ 0x69, PacketTypesIn.EntityEffect }, // Changed in 1.19 (Added "Has Factor Data" and "Factor Codec" fields) (Wiki name: Entity Effect)
|
||||
{ 0x6A, PacketTypesIn.DeclareRecipes }, // (Wiki name: Update Recipes)
|
||||
{ 0x6B, PacketTypesIn.Tags }, // (Wiki name: Update Tags)
|
||||
};
|
||||
|
|
@ -147,7 +147,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x1A, PacketTypesOut.PickItem }, //
|
||||
{ 0x1B, PacketTypesOut.CraftRecipeRequest }, // (Wiki name: Place recipe)
|
||||
{ 0x1C, PacketTypesOut.PlayerAbilities }, //
|
||||
{ 0x1D, PacketTypesOut.PlayerDigging }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Player Action) - DONE
|
||||
{ 0x1D, PacketTypesOut.PlayerDigging }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Player Action)
|
||||
{ 0x1E, PacketTypesOut.EntityAction }, // (Wiki name: Player Command)
|
||||
{ 0x1F, PacketTypesOut.SteerVehicle }, // (Wiki name: Player Input)
|
||||
{ 0x20, PacketTypesOut.Pong }, // (Wiki name: Pong (play))
|
||||
|
|
@ -157,7 +157,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x24, PacketTypesOut.ResourcePackStatus }, // (Wiki name: Resource Pack (serverbound))
|
||||
{ 0x25, PacketTypesOut.AdvancementTab }, // (Wiki name: Seen Advancements)
|
||||
{ 0x26, PacketTypesOut.SelectTrade }, //
|
||||
{ 0x27, PacketTypesOut.SetBeaconEffect }, // Changed in 1.19 (Added a "Secondary Effect Present" and "Secondary Effect" fields) (Wiki name: Set Beacon) - DONE - (No need to be implemented)
|
||||
{ 0x27, PacketTypesOut.SetBeaconEffect }, // Changed in 1.19 (Added a "Secondary Effect Present" and "Secondary Effect" fields) (Wiki name: Set Beacon) - (No need to be implemented)
|
||||
{ 0x28, PacketTypesOut.HeldItemChange }, // (Wiki name: Set Carried Item (serverbound))
|
||||
{ 0x29, PacketTypesOut.UpdateCommandBlock }, // (Wiki name: Set Command Block)
|
||||
{ 0x2A, PacketTypesOut.UpdateCommandBlockMinecart }, //
|
||||
|
|
@ -167,8 +167,8 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x2E, PacketTypesOut.UpdateSign }, // (Wiki name: Sign Update)
|
||||
{ 0x2F, PacketTypesOut.Animation }, // (Wiki name: Swing)
|
||||
{ 0x30, PacketTypesOut.Spectate }, // (Wiki name: Teleport To Entity)
|
||||
{ 0x31, PacketTypesOut.PlayerBlockPlacement }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item On) - DONE
|
||||
{ 0x32, PacketTypesOut.UseItem }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item) - DONE
|
||||
{ 0x31, PacketTypesOut.PlayerBlockPlacement }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item On)
|
||||
{ 0x32, PacketTypesOut.UseItem }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item)
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,183 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||
{
|
||||
public class PacketPalette1193 : PacketTypePalette
|
||||
{
|
||||
private readonly Dictionary<int, PacketTypesIn> typeIn = new()
|
||||
{
|
||||
{ 0x00, PacketTypesIn.SpawnEntity }, // Changed in 1.19 (Wiki name: Spawn Entity)
|
||||
{ 0x01, PacketTypesIn.SpawnExperienceOrb }, // (Wiki name: Spawn Exeprience Orb)
|
||||
{ 0x02, PacketTypesIn.SpawnPlayer }, //
|
||||
{ 0x03, PacketTypesIn.EntityAnimation }, // (Wiki name: Entity Animation (clientbound))
|
||||
{ 0x04, PacketTypesIn.Statistics }, // (Wiki name: Award Statistics)
|
||||
{ 0x05, PacketTypesIn.BlockChangedAck }, // Added 1.19 (Wiki name: Acknowledge Block Change)
|
||||
{ 0x06, PacketTypesIn.BlockBreakAnimation }, // (Wiki name: Set Block Destroy Stage)
|
||||
{ 0x07, PacketTypesIn.BlockEntityData }, //
|
||||
{ 0x08, PacketTypesIn.BlockAction }, //
|
||||
{ 0x09, PacketTypesIn.BlockChange }, // (Wiki name: Block Update)
|
||||
{ 0x0A, PacketTypesIn.BossBar }, //
|
||||
{ 0x0B, PacketTypesIn.ServerDifficulty }, // (Wiki name: Change Difficulty)
|
||||
{ 0x0C, PacketTypesIn.ClearTiles }, //
|
||||
{ 0x0D, PacketTypesIn.TabComplete }, // (Wiki name: Command Suggestions Response)
|
||||
{ 0x0E, PacketTypesIn.DeclareCommands }, // (Wiki name: Commands)
|
||||
{ 0x0F, PacketTypesIn.CloseWindow }, // (Wiki name: Close Container (clientbound))
|
||||
{ 0x10, PacketTypesIn.WindowItems }, // (Wiki name: Set Container Content)
|
||||
{ 0x11, PacketTypesIn.WindowProperty }, // (Wiki name: Set Container Property)
|
||||
{ 0x12, PacketTypesIn.SetSlot }, // (Wiki name: Set Container Slot)
|
||||
{ 0x13, PacketTypesIn.SetCooldown }, //
|
||||
{ 0x14, PacketTypesIn.ChatSuggestions }, // Added in 1.19.1
|
||||
{ 0x15, PacketTypesIn.PluginMessage }, // (Wiki name: Plugin Message (clientbound))
|
||||
{ 0x16, PacketTypesIn.HideMessage }, // Added in 1.19.1
|
||||
{ 0x17, PacketTypesIn.Disconnect }, //
|
||||
{ 0x18, PacketTypesIn.ProfilelessChatMessage }, // Added in 1.19.3 (Wiki name: Disguised Chat Message)
|
||||
{ 0x19, PacketTypesIn.EntityStatus }, // (Wiki name: Entity Event)
|
||||
{ 0x1A, PacketTypesIn.Explosion }, // Changed in 1.19 (Location fields are now Double instead of Float) (Wiki name: Explosion)
|
||||
{ 0x1B, PacketTypesIn.UnloadChunk }, // (Wiki name: Forget Chunk)
|
||||
{ 0x1C, PacketTypesIn.ChangeGameState }, // (Wiki name: Game Event)
|
||||
{ 0x1D, PacketTypesIn.OpenHorseWindow }, // (Wiki name: Horse Screen Open)
|
||||
{ 0x1E, PacketTypesIn.InitializeWorldBorder }, //
|
||||
{ 0x1F, PacketTypesIn.KeepAlive }, //
|
||||
{ 0x20, PacketTypesIn.ChunkData }, //
|
||||
{ 0x21, PacketTypesIn.Effect }, // (Wiki name: World Event)
|
||||
{ 0x22, PacketTypesIn.Particle }, // Changed in 1.19 ("Particle Data" field is now "Max Speed", it's the same Float data type) (Wiki name: Level Particle) (No need to be implemented)
|
||||
{ 0x23, PacketTypesIn.UpdateLight }, // (Wiki name: Light Update)
|
||||
{ 0x24, PacketTypesIn.JoinGame }, // Changed in 1.19 (lot's of changes) (Wiki name: Login (play))
|
||||
{ 0x25, PacketTypesIn.MapData }, // (Wiki name: Map Item Data)
|
||||
{ 0x26, PacketTypesIn.TradeList }, // (Wiki name: Merchant Offers)
|
||||
{ 0x27, PacketTypesIn.EntityPosition }, // (Wiki name: Move Entity Position)
|
||||
{ 0x28, PacketTypesIn.EntityPositionAndRotation }, // (Wiki name: Move Entity Position and Rotation)
|
||||
{ 0x29, PacketTypesIn.EntityRotation }, // (Wiki name: Move Entity Rotation)
|
||||
{ 0x2A, PacketTypesIn.VehicleMove }, // (Wiki name: Move Vehicle)
|
||||
{ 0x2B, PacketTypesIn.OpenBook }, //
|
||||
{ 0x2C, PacketTypesIn.OpenWindow }, // (Wiki name: Open Screen)
|
||||
{ 0x2D, PacketTypesIn.OpenSignEditor }, //
|
||||
{ 0x2E, PacketTypesIn.Ping }, // (Wiki name: Ping (play))
|
||||
{ 0x2F, PacketTypesIn.CraftRecipeResponse }, // (Wiki name: Place Ghost Recipe)
|
||||
{ 0x30, PacketTypesIn.PlayerAbilities }, //
|
||||
{ 0x31, PacketTypesIn.ChatMessage }, // Changed in 1.19 (Completely changed) (Wiki name: Player Chat Message) - TODO
|
||||
{ 0x32, PacketTypesIn.EndCombatEvent }, // (Wiki name: Player Combat End)
|
||||
{ 0x33, PacketTypesIn.EnterCombatEvent }, // (Wiki name: Player Combat Enter)
|
||||
{ 0x34, PacketTypesIn.DeathCombatEvent }, // (Wiki name: Player Combat Kill)
|
||||
{ 0x35, PacketTypesIn.PlayerRemove }, // Added in 1.19.3 (Not used)
|
||||
{ 0x36, PacketTypesIn.PlayerInfo }, // Changed in 1.19 (Heavy changes)
|
||||
{ 0x37, PacketTypesIn.FacePlayer }, // (Wiki name: Player Look At)
|
||||
{ 0x38, PacketTypesIn.PlayerPositionAndLook }, // (Wiki name: Player Position)
|
||||
{ 0x39, PacketTypesIn.UnlockRecipes }, // (Wiki name: Recipe)
|
||||
{ 0x3A, PacketTypesIn.DestroyEntities }, // (Wiki name: Remove Entites)
|
||||
{ 0x3B, PacketTypesIn.RemoveEntityEffect }, //
|
||||
{ 0x3C, PacketTypesIn.ResourcePackSend }, // (Wiki name: Resource Pack)
|
||||
{ 0x3D, PacketTypesIn.Respawn }, // Changed in 1.19 (Heavy changes)
|
||||
{ 0x3E, PacketTypesIn.EntityHeadLook }, // (Wiki name: Rotate Head)
|
||||
{ 0x3F, PacketTypesIn.MultiBlockChange }, // (Wiki name: Sections Block Update)
|
||||
{ 0x40, PacketTypesIn.SelectAdvancementTab }, //
|
||||
{ 0x41, PacketTypesIn.ServerData }, // Added in 1.19
|
||||
{ 0x42, PacketTypesIn.ActionBar }, // (Wiki name: Set Action Bar Text)
|
||||
{ 0x43, PacketTypesIn.WorldBorderCenter }, // (Wiki name: Set Border Center)
|
||||
{ 0x44, PacketTypesIn.WorldBorderLerpSize }, //
|
||||
{ 0x45, PacketTypesIn.WorldBorderSize }, // (Wiki name: Set World Border Size)
|
||||
{ 0x46, PacketTypesIn.WorldBorderWarningDelay }, // (Wiki name: Set World Border Warning Delay)
|
||||
{ 0x47, PacketTypesIn.WorldBorderWarningReach }, // (Wiki name: Set Border Warning Distance)
|
||||
{ 0x48, PacketTypesIn.Camera }, // (Wiki name: Set Camera)
|
||||
{ 0x49, PacketTypesIn.HeldItemChange }, // (Wiki name: Set Carried Item (clientbound))
|
||||
{ 0x4A, PacketTypesIn.UpdateViewPosition }, // (Wiki name: Set Chunk Cache Center)
|
||||
{ 0x4B, PacketTypesIn.UpdateViewDistance }, // (Wiki name: Set Chunk Cache Radius)
|
||||
{ 0x4C, PacketTypesIn.SpawnPosition }, // (Wiki name: Set Default Spawn Position)
|
||||
{ 0x4D, PacketTypesIn.DisplayScoreboard }, // (Wiki name: Set Display Objective)
|
||||
{ 0x4E, PacketTypesIn.EntityMetadata }, // (Wiki name: Set Entity Metadata)
|
||||
{ 0x4F, PacketTypesIn.AttachEntity }, // (Wiki name: Set Entity Link)
|
||||
{ 0x50, PacketTypesIn.EntityVelocity }, // (Wiki name: Set Entity Motion)
|
||||
{ 0x51, PacketTypesIn.EntityEquipment }, // (Wiki name: Set Equipment)
|
||||
{ 0x52, PacketTypesIn.SetExperience }, //
|
||||
{ 0x53, PacketTypesIn.UpdateHealth }, // (Wiki name: Set Health)
|
||||
{ 0x54, PacketTypesIn.ScoreboardObjective }, // (Wiki name: Set Objective)
|
||||
{ 0x55, PacketTypesIn.SetPassengers }, //
|
||||
{ 0x56, PacketTypesIn.Teams }, // (Wiki name: Set Player Team)
|
||||
{ 0x57, PacketTypesIn.UpdateScore }, // (Wiki name: Set Score)
|
||||
{ 0x58, PacketTypesIn.UpdateSimulationDistance }, // (Wiki name: Set Simulation Distance)
|
||||
{ 0x59, PacketTypesIn.SetTitleSubTitle }, // (Wiki name: Set Subtitle Test)
|
||||
{ 0x5A, PacketTypesIn.TimeUpdate }, // (Wiki name: Set Time)
|
||||
{ 0x5B, PacketTypesIn.SetTitleText }, // (Wiki name: Set Title)
|
||||
{ 0x5C, PacketTypesIn.SetTitleTime }, // (Wiki name: Set Titles Animation)
|
||||
{ 0x5D, PacketTypesIn.EntitySoundEffect }, // (Wiki name: Sound Entity)
|
||||
{ 0x5E, PacketTypesIn.SoundEffect }, // Changed in 1.19 (Added "Seed" field) (Wiki name: Sound Effect) (No need to be implemented)
|
||||
{ 0x5F, PacketTypesIn.StopSound }, //
|
||||
{ 0x60, PacketTypesIn.SystemChat }, // Added in 1.19 (Wiki name: System Chat Message)
|
||||
{ 0x61, PacketTypesIn.PlayerListHeaderAndFooter }, // (Wiki name: Tab List)
|
||||
{ 0x62, PacketTypesIn.NBTQueryResponse }, // (Wiki name: Tab Query)
|
||||
{ 0x63, PacketTypesIn.CollectItem }, // (Wiki name: Take Item Entity)
|
||||
{ 0x64, PacketTypesIn.EntityTeleport }, // (Wiki name: Teleport Entity)
|
||||
{ 0x65, PacketTypesIn.Advancements }, // (Wiki name: Update Advancements)
|
||||
{ 0x66, PacketTypesIn.EntityProperties }, // (Wiki name: Update Attributes)
|
||||
{ 0x67, PacketTypesIn.FeatureFlags }, // Added in 1.19.3 (Not yet clear what is the purpose of this packet)
|
||||
{ 0x68, PacketTypesIn.EntityEffect }, // Changed in 1.19 (Added "Has Factor Data" and "Factor Codec" fields) (Wiki name: Entity Effect)
|
||||
{ 0x69, PacketTypesIn.DeclareRecipes }, // (Wiki name: Update Recipes)
|
||||
{ 0x6A, PacketTypesIn.Tags }, // (Wiki name: Update Tags)
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, PacketTypesOut> typeOut = new()
|
||||
{
|
||||
{ 0x00, PacketTypesOut.TeleportConfirm }, // (Wiki name: Confirm Teleportation)
|
||||
{ 0x01, PacketTypesOut.QueryBlockNBT }, // (Wiki name: Query Block Entity Tag)
|
||||
{ 0x02, PacketTypesOut.SetDifficulty }, // (Wiki name: Change Difficutly)
|
||||
{ 0x03, PacketTypesOut.MessageAcknowledgment }, // Added in 1.19.1
|
||||
{ 0x04, PacketTypesOut.ChatCommand }, // Added in 1.19
|
||||
{ 0x05, PacketTypesOut.ChatMessage }, // Changed in 1.19 (Completely changed) (Wiki name: Chat)
|
||||
{ 0x06, PacketTypesOut.ClientStatus }, // (Wiki name: Client Command)
|
||||
{ 0x07, PacketTypesOut.ClientSettings }, // (Wiki name: Client Information)
|
||||
{ 0x08, PacketTypesOut.TabComplete }, // (Wiki name: Command Suggestions Request)
|
||||
{ 0x09, PacketTypesOut.ClickWindowButton }, // (Wiki name: Click Container Button)
|
||||
{ 0x0A, PacketTypesOut.ClickWindow }, // (Wiki name: Click Container)
|
||||
{ 0x0B, PacketTypesOut.CloseWindow }, // (Wiki name: Close Container (serverbound))
|
||||
{ 0x0C, PacketTypesOut.PluginMessage }, // (Wiki name: Plugin Message (serverbound))
|
||||
{ 0x0D, PacketTypesOut.EditBook }, //
|
||||
{ 0x0E, PacketTypesOut.EntityNBTRequest }, // (Wiki name: Query Entity Tag)
|
||||
{ 0x0F, PacketTypesOut.InteractEntity }, // (Wiki name: Interact)
|
||||
{ 0x10, PacketTypesOut.GenerateStructure }, // (Wiki name: Jigsaw Generate)
|
||||
{ 0x11, PacketTypesOut.KeepAlive }, //
|
||||
{ 0x12, PacketTypesOut.LockDifficulty }, //
|
||||
{ 0x13, PacketTypesOut.PlayerPosition }, // (Wiki name: Move Player Position)
|
||||
{ 0x14, PacketTypesOut.PlayerPositionAndRotation }, // (Wiki name: Set Player Position and Rotation)
|
||||
{ 0x15, PacketTypesOut.PlayerRotation }, // (Wiki name: Set Player Rotation)
|
||||
{ 0x16, PacketTypesOut.PlayerMovement }, // (Wiki name: Set Player On Ground)
|
||||
{ 0x17, PacketTypesOut.VehicleMove }, // (Wiki name: Move Vehicle (serverbound))
|
||||
{ 0x18, PacketTypesOut.SteerBoat }, // (Wiki name: Paddle Boat)
|
||||
{ 0x19, PacketTypesOut.PickItem }, //
|
||||
{ 0x1A, PacketTypesOut.CraftRecipeRequest }, // (Wiki name: Place recipe)
|
||||
{ 0x1B, PacketTypesOut.PlayerAbilities }, //
|
||||
{ 0x1C, PacketTypesOut.PlayerDigging }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Player Action)
|
||||
{ 0x1D, PacketTypesOut.EntityAction }, // (Wiki name: Player Command)
|
||||
{ 0x1E, PacketTypesOut.SteerVehicle }, // (Wiki name: Player Input)
|
||||
{ 0x1F, PacketTypesOut.Pong }, // (Wiki name: Pong (play))
|
||||
{ 0x20, PacketTypesOut.PlayerSession }, // Added in 1.19.3
|
||||
{ 0x21, PacketTypesOut.SetDisplayedRecipe }, // (Wiki name: Recipe Book Change Settings)
|
||||
{ 0x22, PacketTypesOut.SetRecipeBookState }, // (Wiki name: Recipe Book Seen Recipe)
|
||||
{ 0x23, PacketTypesOut.NameItem }, // (Wiki name: Rename Item)
|
||||
{ 0x24, PacketTypesOut.ResourcePackStatus }, // (Wiki name: Resource Pack (serverbound))
|
||||
{ 0x25, PacketTypesOut.AdvancementTab }, // (Wiki name: Seen Advancements)
|
||||
{ 0x26, PacketTypesOut.SelectTrade }, //
|
||||
{ 0x27, PacketTypesOut.SetBeaconEffect }, // Changed in 1.19 (Added a "Secondary Effect Present" and "Secondary Effect" fields) (Wiki name: Set Beacon) - (No need to be implemented)
|
||||
{ 0x28, PacketTypesOut.HeldItemChange }, // (Wiki name: Set Carried Item (serverbound))
|
||||
{ 0x29, PacketTypesOut.UpdateCommandBlock }, // (Wiki name: Set Command Block)
|
||||
{ 0x2A, PacketTypesOut.UpdateCommandBlockMinecart }, //
|
||||
{ 0x2B, PacketTypesOut.CreativeInventoryAction }, // (Wiki name: Set Creative Mode Slot)
|
||||
{ 0x2C, PacketTypesOut.UpdateJigsawBlock }, // (Wiki name: Set Jigsaw Block)
|
||||
{ 0x2D, PacketTypesOut.UpdateStructureBlock }, // (Wiki name: Set Structure Block)
|
||||
{ 0x2E, PacketTypesOut.UpdateSign }, // (Wiki name: Sign Update)
|
||||
{ 0x2F, PacketTypesOut.Animation }, // (Wiki name: Swing)
|
||||
{ 0x30, PacketTypesOut.Spectate }, // (Wiki name: Teleport To Entity)
|
||||
{ 0x31, PacketTypesOut.PlayerBlockPlacement }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item On)
|
||||
{ 0x32, PacketTypesOut.UseItem }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item)
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||
{
|
||||
return typeIn;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||
{
|
||||
return typeOut;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -47,7 +47,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
public PacketTypePalette GetTypeHandler(int protocol)
|
||||
{
|
||||
PacketTypePalette p;
|
||||
if (protocol > Protocol18Handler.MC_1_19_2_Version)
|
||||
if (protocol > Protocol18Handler.MC_1_19_3_Version)
|
||||
throw new NotImplementedException(Translations.exception_palette_packet);
|
||||
|
||||
if (protocol <= Protocol18Handler.MC_1_8_Version)
|
||||
|
|
@ -74,8 +74,10 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
p = new PacketPalette118();
|
||||
else if (protocol <= Protocol18Handler.MC_1_19_Version)
|
||||
p = new PacketPalette119();
|
||||
else
|
||||
else if (protocol <= Protocol18Handler.MC_1_19_2_Version)
|
||||
p = new PacketPalette1192();
|
||||
else
|
||||
p = new PacketPalette1193();
|
||||
|
||||
p.SetForgeEnabled(forgeEnabled);
|
||||
return p;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@
|
|||
EntityVelocity, //
|
||||
Explosion, //
|
||||
FacePlayer, //
|
||||
FeatureFlags, // Added in 1.19.3
|
||||
HeldItemChange, //
|
||||
HideMessage, // Added in 1.19.1 (1.19.2)
|
||||
InitializeWorldBorder, //
|
||||
|
|
@ -71,8 +72,10 @@
|
|||
PlayerAbilities, //
|
||||
PlayerInfo, //
|
||||
PlayerListHeaderAndFooter, //
|
||||
PlayerRemove, // Added in 1.19.3 (Not used)
|
||||
PlayerPositionAndLook, //
|
||||
PluginMessage, //
|
||||
ProfilelessChatMessage, // Added in 1.19.3
|
||||
RemoveEntityEffect, //
|
||||
ResourcePackSend, //
|
||||
Respawn, //
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
PlayerPosition, //
|
||||
PlayerPositionAndRotation, //
|
||||
PlayerRotation, //
|
||||
PlayerSession, // Added in 1.19.3
|
||||
PluginMessage, //
|
||||
Pong, //
|
||||
PrepareCraftingGrid, // For 1.12 - 1.12.1 only
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case 0x02: ReadData(1); ReadNextString(); ReadNextString(); ReadData(4); break;
|
||||
case 0x03:
|
||||
string message = ReadNextString();
|
||||
handler.OnTextReceived(new ChatMessage(message, protocolversion >= 72, 0, Guid.Empty)); break;
|
||||
handler.OnTextReceived(new ChatMessage(message, null, protocolversion >= 72, -1, Guid.Empty)); break;
|
||||
case 0x04: ReadData(16); break;
|
||||
case 0x05: ReadData(6); ReadNextItemSlot(); break;
|
||||
case 0x06: ReadData(12); break;
|
||||
|
|
@ -909,5 +909,10 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
{
|
||||
return false; //Currently not implemented
|
||||
}
|
||||
|
||||
public bool SendPlayerSession(PlayerKeyPair? playerKeyPair)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -151,7 +151,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
mods[i] = dataTypes.ConcatBytes(dataTypes.GetString(mod.ModID), dataTypes.GetString(mod.Version));
|
||||
}
|
||||
SendForgeHandshakePacket(FMLHandshakeDiscriminator.ModList,
|
||||
dataTypes.ConcatBytes(dataTypes.GetVarInt(forgeInfo.Mods.Count), dataTypes.ConcatBytes(mods)));
|
||||
dataTypes.ConcatBytes(DataTypes.GetVarInt(forgeInfo.Mods.Count), dataTypes.ConcatBytes(mods)));
|
||||
|
||||
fmlHandshakeState = FMLHandshakeClientState.WAITINGSERVERDATA;
|
||||
|
||||
|
|
@ -338,19 +338,19 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
ConsoleIO.WriteLineFormatted("§8" + Translations.forge_fml2_mod_send, acceptnewlines: true);
|
||||
|
||||
// Packet ID 2: Client to Server Mod List
|
||||
fmlResponsePacket.AddRange(dataTypes.GetVarInt(2));
|
||||
fmlResponsePacket.AddRange(dataTypes.GetVarInt(mods.Count));
|
||||
fmlResponsePacket.AddRange(DataTypes.GetVarInt(2));
|
||||
fmlResponsePacket.AddRange(DataTypes.GetVarInt(mods.Count));
|
||||
foreach (string mod in mods)
|
||||
fmlResponsePacket.AddRange(dataTypes.GetString(mod));
|
||||
|
||||
fmlResponsePacket.AddRange(dataTypes.GetVarInt(channels.Count));
|
||||
fmlResponsePacket.AddRange(DataTypes.GetVarInt(channels.Count));
|
||||
foreach (KeyValuePair<string, string> item in channels)
|
||||
{
|
||||
fmlResponsePacket.AddRange(dataTypes.GetString(item.Key));
|
||||
fmlResponsePacket.AddRange(dataTypes.GetString(item.Value));
|
||||
}
|
||||
|
||||
fmlResponsePacket.AddRange(dataTypes.GetVarInt(registries.Count));
|
||||
fmlResponsePacket.AddRange(DataTypes.GetVarInt(registries.Count));
|
||||
foreach (string registry in registries)
|
||||
{
|
||||
fmlResponsePacket.AddRange(dataTypes.GetString(registry));
|
||||
|
|
@ -376,7 +376,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.forge_fml2_registry, registryName));
|
||||
}
|
||||
|
||||
fmlResponsePacket.AddRange(dataTypes.GetVarInt(99));
|
||||
fmlResponsePacket.AddRange(DataTypes.GetVarInt(99));
|
||||
fmlResponseReady = true;
|
||||
break;
|
||||
|
||||
|
|
@ -395,7 +395,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.forge_fml2_config, configName));
|
||||
}
|
||||
|
||||
fmlResponsePacket.AddRange(dataTypes.GetVarInt(99));
|
||||
fmlResponsePacket.AddRange(DataTypes.GetVarInt(99));
|
||||
fmlResponseReady = true;
|
||||
break;
|
||||
|
||||
|
|
@ -410,7 +410,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
// Wrap our FML packet into a LoginPluginResponse payload
|
||||
responseData.Clear();
|
||||
responseData.AddRange(dataTypes.GetString(fmlChannel));
|
||||
responseData.AddRange(dataTypes.GetVarInt(fmlResponsePacket.Count));
|
||||
responseData.AddRange(DataTypes.GetVarInt(fmlResponsePacket.Count));
|
||||
responseData.AddRange(fmlResponsePacket);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -264,9 +264,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
|
||||
int[] palette = new int[paletteLength];
|
||||
for (int i = 0; i < paletteLength; i++)
|
||||
{
|
||||
palette[i] = dataTypes.ReadNextVarInt(cache);
|
||||
}
|
||||
|
||||
// Bit mask covering bitsPerBlock bits
|
||||
// EG, if bitsPerBlock = 5, valueMask = 00011111 in binary
|
||||
|
|
|
|||
|
|
@ -255,6 +255,12 @@ namespace MinecraftClient.Protocol
|
|||
/// <param name="uuid">The uuid of the player/entity to spectate/teleport to.</param>
|
||||
bool SendSpectate(Guid uuid);
|
||||
|
||||
/// <summary>
|
||||
/// Send player session
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool SendPlayerSession(PlayerKeyPair? playerKeyPair);
|
||||
|
||||
/// <summary>
|
||||
/// Get net read thread (main thread) ID
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using MinecraftClient.Inventory;
|
|||
using MinecraftClient.Logger;
|
||||
using MinecraftClient.Mapping;
|
||||
using MinecraftClient.Protocol.Message;
|
||||
using MinecraftClient.Protocol.ProfileKey;
|
||||
using MinecraftClient.Scripting;
|
||||
|
||||
namespace MinecraftClient.Protocol
|
||||
|
|
@ -28,6 +29,7 @@ namespace MinecraftClient.Protocol
|
|||
string[] GetOnlinePlayers();
|
||||
Dictionary<string, string> GetOnlinePlayersWithUUID();
|
||||
PlayerInfo? GetPlayerInfo(Guid uuid);
|
||||
PlayerKeyPair? GetPlayerKeyPair();
|
||||
Location GetCurrentLocation();
|
||||
World GetWorld();
|
||||
bool GetIsSupportPreviewsChat();
|
||||
|
|
@ -78,7 +80,7 @@ namespace MinecraftClient.Protocol
|
|||
/// <summary>
|
||||
/// Called when a server was successfully joined
|
||||
/// </summary>
|
||||
void OnGameJoined();
|
||||
void OnGameJoined(bool isOnlineMode);
|
||||
|
||||
/// <summary>
|
||||
/// Received chat/system message from the server
|
||||
|
|
@ -464,6 +466,8 @@ namespace MinecraftClient.Protocol
|
|||
/// <param name="result">All commands.</param>
|
||||
public void OnAutoCompleteDone(int transactionId, string[] result);
|
||||
|
||||
public void OnDeclareCommands();
|
||||
|
||||
/// <summary>
|
||||
/// Send a click container button packet to the server.
|
||||
/// Used for Enchanting table, Lectern, stone cutter and loom
|
||||
|
|
|
|||
|
|
@ -5,33 +5,33 @@ namespace MinecraftClient.Protocol.Message
|
|||
public class ChatMessage
|
||||
{
|
||||
// in 1.19 and above, isSignedChat = true
|
||||
public readonly bool isSignedChat;
|
||||
public bool isSignedChat;
|
||||
|
||||
public readonly string content;
|
||||
public string content;
|
||||
|
||||
public readonly bool isJson;
|
||||
public bool isJson, isSenderJson;
|
||||
|
||||
// 0: chat (chat box), 1: system message (chat box), 2: game info (above hotbar), 3: say command,
|
||||
// 4: msg command, 5: team msg command, 6: emote command, 7: tellraw command
|
||||
public readonly int chatTypeId;
|
||||
public int chatTypeId;
|
||||
|
||||
public readonly Guid senderUUID;
|
||||
public Guid senderUUID;
|
||||
|
||||
public readonly bool isSystemChat;
|
||||
public bool isSystemChat;
|
||||
|
||||
public readonly string? unsignedContent;
|
||||
public string? unsignedContent;
|
||||
|
||||
public readonly string? displayName;
|
||||
public string? displayName;
|
||||
|
||||
public readonly string? teamName;
|
||||
public string? teamName;
|
||||
|
||||
public readonly DateTime? timestamp;
|
||||
public DateTime? timestamp;
|
||||
|
||||
public readonly byte[]? signature;
|
||||
public byte[]? signature;
|
||||
|
||||
public readonly bool? isSignatureLegal;
|
||||
public bool? isSignatureLegal;
|
||||
|
||||
public ChatMessage(string content, bool isJson, int chatType, Guid senderUUID, string? unsignedContent, string displayName, string? teamName, long timestamp, byte[] signature, bool isSignatureLegal)
|
||||
public ChatMessage(string content, bool isJson, int chatType, Guid senderUUID, string? unsignedContent, string displayName, string? teamName, long timestamp, byte[]? signature, bool isSignatureLegal)
|
||||
{
|
||||
isSignedChat = true;
|
||||
isSystemChat = false;
|
||||
|
|
@ -47,19 +47,20 @@ namespace MinecraftClient.Protocol.Message
|
|||
this.isSignatureLegal = isSignatureLegal;
|
||||
}
|
||||
|
||||
public ChatMessage(string content, bool isJson, int chatType, Guid senderUUID, bool isSystemChat = false)
|
||||
public ChatMessage(string content, string? displayName, bool isJson, int chatType, Guid senderUUID, bool isSystemChat = false)
|
||||
{
|
||||
isSignedChat = isSystemChat;
|
||||
this.isSystemChat = isSystemChat;
|
||||
this.content = content;
|
||||
this.displayName = displayName;
|
||||
this.isJson = isJson;
|
||||
chatTypeId = chatType;
|
||||
this.senderUUID = senderUUID;
|
||||
}
|
||||
|
||||
public LastSeenMessageList.Entry? ToLastSeenMessageEntry()
|
||||
public LastSeenMessageList.AcknowledgedMessage? ToLastSeenMessageEntry()
|
||||
{
|
||||
return signature != null ? new LastSeenMessageList.Entry(senderUUID, signature) : null;
|
||||
return signature != null ? new LastSeenMessageList.AcknowledgedMessage(senderUUID, signature, true) : null;
|
||||
}
|
||||
|
||||
public bool LacksSender()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
|
|
@ -28,6 +31,30 @@ namespace MinecraftClient.Protocol.Message
|
|||
|
||||
public static Dictionary<int, MessageType>? ChatId2Type;
|
||||
|
||||
public static void ReadChatType(Dictionary<string, object> registryCodec)
|
||||
{
|
||||
Dictionary<int, MessageType> chatTypeDictionary = ChatId2Type ?? new();
|
||||
var chatTypeListNbt = (object[])(((Dictionary<string, object>)registryCodec["minecraft:chat_type"])["value"]);
|
||||
foreach (var (chatName, chatId) in from Dictionary<string, object> chatTypeNbt in chatTypeListNbt
|
||||
let chatName = (string)chatTypeNbt["name"]
|
||||
let chatId = (int)chatTypeNbt["id"]
|
||||
select (chatName, chatId))
|
||||
{
|
||||
chatTypeDictionary[chatId] = chatName switch
|
||||
{
|
||||
"minecraft:chat" => MessageType.CHAT,
|
||||
"minecraft:emote_command" => MessageType.EMOTE_COMMAND,
|
||||
"minecraft:msg_command_incoming" => MessageType.MSG_COMMAND_INCOMING,
|
||||
"minecraft:msg_command_outgoing" => MessageType.MSG_COMMAND_OUTGOING,
|
||||
"minecraft:say_command" => MessageType.SAY_COMMAND,
|
||||
"minecraft:team_msg_command_incoming" => MessageType.TEAM_MSG_COMMAND_INCOMING,
|
||||
"minecraft:team_msg_command_outgoing" => MessageType.TEAM_MSG_COMMAND_OUTGOING,
|
||||
_ => MessageType.CHAT,
|
||||
};
|
||||
}
|
||||
ChatId2Type = chatTypeDictionary;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The main function to convert text from MC 1.6+ JSON to MC 1.5.2 formatted text
|
||||
/// </summary>
|
||||
|
|
@ -47,7 +74,7 @@ namespace MinecraftClient.Protocol.Message
|
|||
/// <returns>Returns the translated text</returns>
|
||||
public static string ParseSignedChat(ChatMessage message, List<string>? links = null)
|
||||
{
|
||||
string sender = message.displayName!;
|
||||
string sender = message.isSenderJson ? ParseText(message.displayName!) : message.displayName!;
|
||||
string content;
|
||||
if (Config.Signature.ShowModifiedChat && message.unsignedContent != null)
|
||||
{
|
||||
|
|
@ -66,7 +93,7 @@ namespace MinecraftClient.Protocol.Message
|
|||
List<string> usingData = new();
|
||||
|
||||
MessageType chatType;
|
||||
if (message.isSystemChat)
|
||||
if (message.chatTypeId == -1)
|
||||
chatType = MessageType.RAW_MSG;
|
||||
else if (!ChatId2Type!.TryGetValue(message.chatTypeId, out chatType))
|
||||
chatType = MessageType.CHAT;
|
||||
|
|
@ -119,7 +146,7 @@ namespace MinecraftClient.Protocol.Message
|
|||
if (message.isSystemChat)
|
||||
{
|
||||
if (Config.Signature.MarkSystemMessage)
|
||||
color = "§§7 §§r "; // Background Gray
|
||||
color = "§7▌§r"; // Background Gray
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -128,18 +155,18 @@ namespace MinecraftClient.Protocol.Message
|
|||
if (Config.Signature.ShowModifiedChat && message.unsignedContent != null)
|
||||
{
|
||||
if (Config.Signature.MarkModifiedMsg)
|
||||
color = "§§6 §§r "; // Background Yellow
|
||||
color = "§6▌§r"; // Background Yellow
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Config.Signature.MarkLegallySignedMsg)
|
||||
color = "§§2 §§r "; // Background Green
|
||||
color = "§2▌§r"; // Background Green
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Config.Signature.MarkIllegallySignedMsg)
|
||||
color = "§§4 §§r "; // Background Red
|
||||
color = "§4▌§r"; // Background Red
|
||||
}
|
||||
}
|
||||
return color + text;
|
||||
|
|
@ -212,7 +239,7 @@ namespace MinecraftClient.Protocol.Message
|
|||
|
||||
string languageFilePath = "lang" + Path.DirectorySeparatorChar + Config.Main.Advanced.Language + ".json";
|
||||
|
||||
// Load the external dictionnary of translation rules or display an error message
|
||||
// Load the external dictionary of translation rules or display an error message
|
||||
if (File.Exists(languageFilePath))
|
||||
{
|
||||
try
|
||||
|
|
@ -246,18 +273,18 @@ namespace MinecraftClient.Protocol.Message
|
|||
if (Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.chat_request, translation_file_location));
|
||||
|
||||
Task<Stream> fetch_file = httpClient.GetStreamAsync(translation_file_location);
|
||||
fetch_file.Wait();
|
||||
TranslationRules = JsonSerializer.Deserialize<Dictionary<string, string>>(fetch_file.Result)!;
|
||||
fetch_file.Dispose();
|
||||
Task<Dictionary<string, string>?> fetckFileTask = httpClient.GetFromJsonAsync<Dictionary<string, string>>(translation_file_location);
|
||||
fetckFileTask.Wait();
|
||||
if (fetckFileTask.Result != null && fetckFileTask.Result.Count > 0)
|
||||
{
|
||||
TranslationRules = fetckFileTask.Result;
|
||||
TranslationRules["Version"] = TranslationsFile_Version;
|
||||
File.WriteAllText(languageFilePath, JsonSerializer.Serialize(TranslationRules, typeof(Dictionary<string, string>)), Encoding.UTF8);
|
||||
|
||||
TranslationRules["Version"] = TranslationsFile_Version;
|
||||
|
||||
File.WriteAllText(languageFilePath, JsonSerializer.Serialize(TranslationRules, typeof(Dictionary<string, string>)), Encoding.UTF8);
|
||||
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.chat_done, languageFilePath));
|
||||
|
||||
return;
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.chat_done, languageFilePath));
|
||||
return;
|
||||
}
|
||||
fetckFileTask.Dispose();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -272,6 +299,15 @@ namespace MinecraftClient.Protocol.Message
|
|||
{
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.chat_save_fail, languageFilePath), acceptnewlines: true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted("§8" + Translations.chat_fail, acceptnewlines: true);
|
||||
if (Config.Logging.DebugMessages)
|
||||
{
|
||||
ConsoleIO.WriteLine(e.Message);
|
||||
ConsoleIO.WriteLine(e.StackTrace ?? "");
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
httpClient.Dispose();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using static MinecraftClient.Protocol.Message.LastSeenMessageList;
|
||||
|
||||
namespace MinecraftClient.Protocol.Message
|
||||
{
|
||||
|
|
@ -8,38 +10,45 @@ namespace MinecraftClient.Protocol.Message
|
|||
/// </summary>
|
||||
public class LastSeenMessageList
|
||||
{
|
||||
public static readonly LastSeenMessageList EMPTY = new(Array.Empty<Entry>());
|
||||
public static readonly LastSeenMessageList EMPTY = new(Array.Empty<AcknowledgedMessage>());
|
||||
public static readonly int MAX_ENTRIES = 5;
|
||||
|
||||
public Entry[] entries;
|
||||
public AcknowledgedMessage[] entries;
|
||||
|
||||
public LastSeenMessageList(Entry[] list)
|
||||
public LastSeenMessageList(AcknowledgedMessage[] list)
|
||||
{
|
||||
entries = list;
|
||||
}
|
||||
|
||||
public void WriteForSign(List<byte> data)
|
||||
{
|
||||
foreach (Entry entry in entries)
|
||||
foreach (AcknowledgedMessage entry in entries)
|
||||
{
|
||||
data.Add(70);
|
||||
data.AddRange(entry.profileId.ToBigEndianBytes());
|
||||
data.AddRange(entry.lastSignature);
|
||||
data.AddRange(entry.signature);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A pair of a player's UUID and the signature of the last message they saw, used as an entry of LastSeenMessageList.
|
||||
/// </summary>
|
||||
public class Entry
|
||||
public record AcknowledgedMessage
|
||||
{
|
||||
public bool pending;
|
||||
public Guid profileId;
|
||||
public byte[] lastSignature;
|
||||
public byte[] signature;
|
||||
|
||||
public Entry(Guid profileId, byte[] lastSignature)
|
||||
public AcknowledgedMessage(Guid profileId, byte[] lastSignature, bool pending)
|
||||
{
|
||||
this.profileId = profileId;
|
||||
this.lastSignature = lastSignature;
|
||||
this.signature = lastSignature;
|
||||
this.pending = pending;
|
||||
}
|
||||
|
||||
public AcknowledgedMessage UnmarkAsPending()
|
||||
{
|
||||
return this.pending ? new AcknowledgedMessage(profileId, signature, false) : this;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -50,9 +59,9 @@ namespace MinecraftClient.Protocol.Message
|
|||
public class Acknowledgment
|
||||
{
|
||||
public LastSeenMessageList lastSeen;
|
||||
public Entry? lastReceived;
|
||||
public AcknowledgedMessage? lastReceived;
|
||||
|
||||
public Acknowledgment(LastSeenMessageList lastSeenMessageList, Entry? lastReceivedMessage)
|
||||
public Acknowledgment(LastSeenMessageList lastSeenMessageList, AcknowledgedMessage? lastReceivedMessage)
|
||||
{
|
||||
lastSeen = lastSeenMessageList;
|
||||
lastReceived = lastReceivedMessage;
|
||||
|
|
@ -70,24 +79,26 @@ namespace MinecraftClient.Protocol.Message
|
|||
/// </summary>
|
||||
public class LastSeenMessagesCollector
|
||||
{
|
||||
private readonly LastSeenMessageList.Entry[] entries;
|
||||
private int size = 0;
|
||||
private readonly LastSeenMessageList.AcknowledgedMessage?[] acknowledgedMessages;
|
||||
private int nextIndex = 0;
|
||||
internal int messageCount { private set; get; } = 0;
|
||||
private LastSeenMessageList.AcknowledgedMessage? lastEntry = null;
|
||||
private LastSeenMessageList lastSeenMessages;
|
||||
|
||||
public LastSeenMessagesCollector(int size)
|
||||
{
|
||||
lastSeenMessages = LastSeenMessageList.EMPTY;
|
||||
entries = new LastSeenMessageList.Entry[size];
|
||||
acknowledgedMessages = new LastSeenMessageList.AcknowledgedMessage[size];
|
||||
}
|
||||
|
||||
public void Add(LastSeenMessageList.Entry entry)
|
||||
public void Add_1_19_2(LastSeenMessageList.AcknowledgedMessage entry)
|
||||
{
|
||||
LastSeenMessageList.Entry? lastEntry = entry;
|
||||
LastSeenMessageList.AcknowledgedMessage? lastEntry = entry;
|
||||
|
||||
for (int i = 0; i < size; ++i)
|
||||
for (int i = 0; i < messageCount; ++i)
|
||||
{
|
||||
LastSeenMessageList.Entry curEntry = entries[i];
|
||||
entries[i] = lastEntry;
|
||||
LastSeenMessageList.AcknowledgedMessage curEntry = acknowledgedMessages[i]!;
|
||||
acknowledgedMessages[i] = lastEntry;
|
||||
lastEntry = curEntry;
|
||||
if (curEntry.profileId == entry.profileId)
|
||||
{
|
||||
|
|
@ -96,19 +107,62 @@ namespace MinecraftClient.Protocol.Message
|
|||
}
|
||||
}
|
||||
|
||||
if (lastEntry != null && size < entries.Length)
|
||||
entries[size++] = lastEntry;
|
||||
if (lastEntry != null && messageCount < acknowledgedMessages.Length)
|
||||
acknowledgedMessages[messageCount++] = lastEntry;
|
||||
|
||||
LastSeenMessageList.Entry[] msgList = new LastSeenMessageList.Entry[size];
|
||||
for (int i = 0; i < size; ++i)
|
||||
msgList[i] = entries[i];
|
||||
LastSeenMessageList.AcknowledgedMessage[] msgList = new LastSeenMessageList.AcknowledgedMessage[messageCount];
|
||||
for (int i = 0; i < messageCount; ++i)
|
||||
msgList[i] = acknowledgedMessages[i]!;
|
||||
lastSeenMessages = new LastSeenMessageList(msgList);
|
||||
}
|
||||
|
||||
public bool Add_1_19_3(LastSeenMessageList.AcknowledgedMessage entry, bool displayed)
|
||||
{
|
||||
// net.minecraft.network.message.LastSeenMessagesCollector#add(net.minecraft.network.message.MessageSignatureData, boolean)
|
||||
// net.minecraft.network.message.LastSeenMessagesCollector#add(net.minecraft.network.message.AcknowledgedMessage)
|
||||
if (lastEntry != null && entry.signature.SequenceEqual(lastEntry.signature))
|
||||
return false;
|
||||
lastEntry = entry;
|
||||
|
||||
int index = nextIndex;
|
||||
nextIndex = (index + 1) % acknowledgedMessages.Length;
|
||||
|
||||
++messageCount;
|
||||
acknowledgedMessages[index] = displayed ? entry : null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public Tuple<AcknowledgedMessage[], byte[], int> Collect_1_19_3()
|
||||
{
|
||||
// net.minecraft.network.message.LastSeenMessagesCollector#collect
|
||||
int count = ResetMessageCount();
|
||||
byte[] bitset = new byte[3]; // new Bitset(20); Todo: Use a complete bitset implementation.
|
||||
List<AcknowledgedMessage> objectList = new(acknowledgedMessages.Length);
|
||||
for (int j = 0; j < acknowledgedMessages.Length; ++j)
|
||||
{
|
||||
int k = (nextIndex + j) % acknowledgedMessages.Length;
|
||||
AcknowledgedMessage? acknowledgedMessage = acknowledgedMessages[k];
|
||||
if (acknowledgedMessage == null)
|
||||
continue;
|
||||
bitset[j / 8] |= (byte)(1 << (j % 8)); // bitSet.set(j, true);
|
||||
objectList.Add(acknowledgedMessage);
|
||||
acknowledgedMessages[k] = acknowledgedMessage.UnmarkAsPending();
|
||||
}
|
||||
return new(objectList.ToArray(), bitset, count);
|
||||
}
|
||||
|
||||
public LastSeenMessageList GetLastSeenMessages()
|
||||
{
|
||||
return lastSeenMessages;
|
||||
}
|
||||
|
||||
public int ResetMessageCount()
|
||||
{
|
||||
// net.minecraft.network.message.LastSeenMessagesCollector#resetMessageCount
|
||||
int cnt = messageCount;
|
||||
messageCount = 0;
|
||||
return cnt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,15 +20,21 @@ namespace MinecraftClient.Protocol
|
|||
|
||||
public string? DisplayName;
|
||||
|
||||
public bool Listed = true;
|
||||
|
||||
// Entity info
|
||||
|
||||
public Mapping.Entity? entity;
|
||||
|
||||
// For message signature
|
||||
|
||||
private readonly PublicKey? PublicKey;
|
||||
public int MessageIndex = -1;
|
||||
|
||||
private readonly DateTime? KeyExpiresAt;
|
||||
public Guid ChatUuid = Guid.Empty;
|
||||
|
||||
private PublicKey? PublicKey;
|
||||
|
||||
private DateTime? KeyExpiresAt;
|
||||
|
||||
private bool lastMessageVerified;
|
||||
|
||||
|
|
@ -71,6 +77,28 @@ namespace MinecraftClient.Protocol
|
|||
precedingSignature = null;
|
||||
}
|
||||
|
||||
public void ClearPublicKey()
|
||||
{
|
||||
ChatUuid = Guid.Empty;
|
||||
PublicKey = null;
|
||||
KeyExpiresAt = null;
|
||||
}
|
||||
|
||||
public void SetPublicKey(Guid chatUuid, long publicKeyExpiryTime, byte[] encodedPublicKey, byte[] publicKeySignature)
|
||||
{
|
||||
ChatUuid = chatUuid;
|
||||
KeyExpiresAt = DateTimeOffset.FromUnixTimeMilliseconds(publicKeyExpiryTime).UtcDateTime;
|
||||
try
|
||||
{
|
||||
PublicKey = new PublicKey(encodedPublicKey, publicKeySignature);
|
||||
lastMessageVerified = true;
|
||||
}
|
||||
catch (System.Security.Cryptography.CryptographicException)
|
||||
{
|
||||
PublicKey = null;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsMessageChainLegal()
|
||||
{
|
||||
return lastMessageVerified;
|
||||
|
|
@ -105,7 +133,7 @@ namespace MinecraftClient.Protocol
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verify message - 1.19.1 and above
|
||||
/// Verify message - 1.19.1 and 1.19.2
|
||||
/// </summary>
|
||||
/// <param name="message">Message content</param>
|
||||
/// <param name="timestamp">Timestamp</param>
|
||||
|
|
@ -143,7 +171,7 @@ namespace MinecraftClient.Protocol
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verify message head - 1.19.1 and above
|
||||
/// Verify message head - 1.19.1 and 1.19.2
|
||||
/// </summary>
|
||||
/// <param name="precedingSignature">Preceding message signature</param>
|
||||
/// <param name="headerSignature">Message signature</param>
|
||||
|
|
@ -171,5 +199,24 @@ namespace MinecraftClient.Protocol
|
|||
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verify message - 1.19.3 and above
|
||||
/// </summary>
|
||||
/// <param name="message">Message content</param>
|
||||
/// <param name="timestamp">Timestamp</param>
|
||||
/// <param name="salt">Salt</param>
|
||||
/// <param name="signature">Message signature</param>
|
||||
/// <param name="precedingSignature">Preceding message signature</param>
|
||||
/// <param name="lastSeenMessages">LastSeenMessages</param>
|
||||
/// <returns>Is this message chain vaild</returns>
|
||||
public bool VerifyMessage(string message, Guid playerUuid, Guid chatUuid, int messageIndex, long timestamp, long salt, ref byte[] signature, Tuple<int, byte[]?>[] previousMessageSignatures)
|
||||
{
|
||||
if (PublicKey == null || IsKeyExpired())
|
||||
return false;
|
||||
|
||||
// net.minecraft.server.network.ServerPlayNetworkHandler#validateMessage
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using MinecraftClient.Protocol.Handlers;
|
||||
using MinecraftClient.Protocol.Message;
|
||||
using static MinecraftClient.Protocol.Message.LastSeenMessageList;
|
||||
|
||||
namespace MinecraftClient.Protocol.ProfileKey
|
||||
{
|
||||
|
|
@ -110,6 +112,33 @@ namespace MinecraftClient.Protocol.ProfileKey
|
|||
return data.ToArray();
|
||||
}
|
||||
|
||||
public static byte[] GetSignatureData_1_19_3(string message, Guid playerUuid, Guid chatUuid, int messageIndex, DateTimeOffset timestamp, ref byte[] salt, AcknowledgedMessage[] lastSeenMessages)
|
||||
{
|
||||
List<byte> data = new();
|
||||
|
||||
// net.minecraft.network.message.SignedMessage#update
|
||||
data.AddRange(DataTypes.GetInt(1));
|
||||
|
||||
// message link
|
||||
// net.minecraft.network.message.MessageLink#update
|
||||
data.AddRange(DataTypes.GetUUID(playerUuid));
|
||||
data.AddRange(DataTypes.GetUUID(chatUuid));
|
||||
data.AddRange(DataTypes.GetInt(messageIndex));
|
||||
|
||||
// message body
|
||||
// net.minecraft.network.message.MessageBody#update
|
||||
data.AddRange(salt);
|
||||
data.AddRange(DataTypes.GetLong(timestamp.ToUnixTimeSeconds()));
|
||||
byte[] messageBytes = Encoding.UTF8.GetBytes(message);
|
||||
data.AddRange(DataTypes.GetInt(messageBytes.Length));
|
||||
data.AddRange(messageBytes);
|
||||
data.AddRange(DataTypes.GetInt(lastSeenMessages.Length));
|
||||
foreach (AcknowledgedMessage ack in lastSeenMessages)
|
||||
data.AddRange(ack.signature);
|
||||
|
||||
return data.ToArray();
|
||||
}
|
||||
|
||||
public static byte[] GetSignatureData(byte[]? precedingSignature, Guid sender, byte[] bodySign)
|
||||
{
|
||||
List<byte> data = new();
|
||||
|
|
@ -124,6 +153,40 @@ namespace MinecraftClient.Protocol.ProfileKey
|
|||
return data.ToArray();
|
||||
}
|
||||
|
||||
public static byte[] GetSignatureData(string message, DateTimeOffset timestamp, ref byte[] salt, int messageCount, Guid sender, Guid sessionUuid)
|
||||
{
|
||||
List<byte> data = new();
|
||||
|
||||
// TODO!
|
||||
byte[] unknownInt1 = BitConverter.GetBytes(1);
|
||||
Array.Reverse(unknownInt1);
|
||||
data.AddRange(unknownInt1);
|
||||
|
||||
data.AddRange(sender.ToBigEndianBytes());
|
||||
data.AddRange(sessionUuid.ToBigEndianBytes());
|
||||
|
||||
byte[] msgCountByte = BitConverter.GetBytes(messageCount);
|
||||
Array.Reverse(msgCountByte);
|
||||
data.AddRange(msgCountByte);
|
||||
data.AddRange(salt);
|
||||
|
||||
byte[] timestampByte = BitConverter.GetBytes(timestamp.ToUnixTimeSeconds());
|
||||
Array.Reverse(timestampByte);
|
||||
data.AddRange(timestampByte);
|
||||
|
||||
byte[] msgByte = Encoding.UTF8.GetBytes(message);
|
||||
byte[] msgLengthByte = BitConverter.GetBytes(msgByte.Length);
|
||||
Array.Reverse(msgLengthByte);
|
||||
data.AddRange(msgLengthByte);
|
||||
data.AddRange(msgByte);
|
||||
|
||||
byte[] unknownInt2 = BitConverter.GetBytes(0);
|
||||
Array.Reverse(unknownInt2);
|
||||
data.AddRange(unknownInt2);
|
||||
|
||||
return data.ToArray();
|
||||
}
|
||||
|
||||
// https://github.com/mono/mono/blob/master/mcs/class/System.Json/System.Json/JsonValue.cs
|
||||
public static string EscapeString(string src)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Security.Cryptography;
|
||||
using MinecraftClient.Protocol.Message;
|
||||
using static MinecraftClient.Protocol.Message.LastSeenMessageList;
|
||||
|
||||
namespace MinecraftClient.Protocol.ProfileKey
|
||||
{
|
||||
|
|
@ -43,7 +44,7 @@ namespace MinecraftClient.Protocol.ProfileKey
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sign message - 1.19.1 and above
|
||||
/// Sign message - 1.19.1 and 1.19.2
|
||||
/// </summary>
|
||||
/// <param name="message">Message content</param>
|
||||
/// <param name="uuid">Sender uuid</param>
|
||||
|
|
@ -64,5 +65,21 @@ namespace MinecraftClient.Protocol.ProfileKey
|
|||
return msgSign;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sign message - 1.19.3 and above
|
||||
/// </summary>
|
||||
/// <param name="message">Message content</param>
|
||||
/// <param name="uuid">Sender uuid</param>
|
||||
/// <param name="timestamp">Timestamp</param>
|
||||
/// <param name="salt">Salt</param>
|
||||
/// <param name="lastSeenMessages">LastSeenMessageList</param>
|
||||
/// <returns>Signature data</returns>
|
||||
public byte[] SignMessage(string message, Guid playerUuid, Guid chatUuid, int messageIndex, DateTimeOffset timestamp, ref byte[] salt, AcknowledgedMessage[] lastSeenMessages)
|
||||
{
|
||||
byte[] bodySignData = KeyUtils.GetSignatureData_1_19_3(message, playerUuid, chatUuid, messageIndex, timestamp, ref salt, lastSeenMessages);
|
||||
|
||||
return SignData(bodySignData);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,12 @@ namespace MinecraftClient.Protocol.ProfileKey
|
|||
|
||||
if (!string.IsNullOrEmpty(sigV2))
|
||||
SignatureV2 = Convert.FromBase64String(sigV2!);
|
||||
|
||||
if (SignatureV2 == null || SignatureV2.Length == 0)
|
||||
SignatureV2 = Signature;
|
||||
|
||||
if (Signature == null || Signature.Length == 0)
|
||||
Signature = SignatureV2;
|
||||
}
|
||||
|
||||
public PublicKey(byte[] key, byte[] signature)
|
||||
|
|
@ -58,7 +64,7 @@ namespace MinecraftClient.Protocol.ProfileKey
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verify message - 1.19.1 and above
|
||||
/// Verify message - 1.19.1 and 1.19.2
|
||||
/// </summary>
|
||||
/// <param name="message">Message content</param>
|
||||
/// <param name="uuid">Sender uuid</param>
|
||||
|
|
@ -79,7 +85,7 @@ namespace MinecraftClient.Protocol.ProfileKey
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verify message head - 1.19.1 and above
|
||||
/// Verify message head - 1.19.1 and 1.19.2
|
||||
/// </summary>
|
||||
/// <param name="bodyDigest">Message body hash</param>
|
||||
/// <param name="signature">Message signature</param>
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ namespace MinecraftClient.Protocol
|
|||
if (Array.IndexOf(supportedVersions_Protocol16, ProtocolVersion) > -1)
|
||||
return new Protocol16Handler(Client, ProtocolVersion, Handler);
|
||||
|
||||
int[] supportedVersions_Protocol18 = { 4, 5, 47, 107, 108, 109, 110, 210, 315, 316, 335, 338, 340, 393, 401, 404, 477, 480, 485, 490, 498, 573, 575, 578, 735, 736, 751, 753, 754, 755, 756, 757, 758, 759, 760 };
|
||||
int[] supportedVersions_Protocol18 = { 4, 5, 47, 107, 108, 109, 110, 210, 315, 316, 335, 338, 340, 393, 401, 404, 477, 480, 485, 490, 498, 573, 575, 578, 735, 736, 751, 753, 754, 755, 756, 757, 758, 759, 760, 761 };
|
||||
|
||||
if (Array.IndexOf(supportedVersions_Protocol18, ProtocolVersion) > -1)
|
||||
return new Protocol18Handler(Client, ProtocolVersion, Handler, forgeInfo);
|
||||
|
|
@ -313,6 +313,8 @@ namespace MinecraftClient.Protocol
|
|||
case "1.19.1":
|
||||
case "1.19.2":
|
||||
return 760;
|
||||
case "1.19.3":
|
||||
return 761;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -389,6 +391,7 @@ namespace MinecraftClient.Protocol
|
|||
case 758: return "1.18.2";
|
||||
case 759: return "1.19";
|
||||
case 760: return "1.19.2";
|
||||
case 761: return "1.19.3";
|
||||
default: return "0.0";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ namespace MinecraftClient.Protocol
|
|||
// build raw packet
|
||||
// format: packetID + packetData
|
||||
List<byte> rawPacket = new();
|
||||
rawPacket.AddRange(dataTypes.GetVarInt(packetID).ToArray());
|
||||
rawPacket.AddRange(DataTypes.GetVarInt(packetID).ToArray());
|
||||
rawPacket.AddRange(packetData.ToArray());
|
||||
// build format
|
||||
// format: timestamp + packetLength + RawPacket
|
||||
|
|
@ -376,7 +376,7 @@ namespace MinecraftClient.Protocol
|
|||
private byte[] GetSpawnPlayerPacket(int entityID, Guid playerUUID, Location location, double pitch, double yaw)
|
||||
{
|
||||
List<byte> packet = new();
|
||||
packet.AddRange(dataTypes.GetVarInt(entityID));
|
||||
packet.AddRange(DataTypes.GetVarInt(entityID));
|
||||
packet.AddRange(playerUUID.ToBigEndianBytes());
|
||||
packet.AddRange(dataTypes.GetDouble(location.X));
|
||||
packet.AddRange(dataTypes.GetDouble(location.Y));
|
||||
|
|
|
|||
|
|
@ -1561,7 +1561,7 @@ namespace MinecraftClient {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Temporary fix for Badpacket issue on some servers..
|
||||
/// Looks up a localized string similar to Temporary fix for Badpacket issue on some servers. Need to enable "TerrainAndMovements" first..
|
||||
/// </summary>
|
||||
internal static string Main_Advanced_temporary_fix_badpacket {
|
||||
get {
|
||||
|
|
|
|||
|
|
@ -703,7 +703,7 @@ Usage examples: "/tell <mybot> connect Server1", "/connect Server2"</value
|
|||
<value>Messages displayed above xp bar, set this to false in case of xp bar spam.</value>
|
||||
</data>
|
||||
<data name="Main.Advanced.temporary_fix_badpacket" xml:space="preserve">
|
||||
<value>Temporary fix for Badpacket issue on some servers.</value>
|
||||
<value>Temporary fix for Badpacket issue on some servers. Need to enable "TerrainAndMovements" first.</value>
|
||||
</data>
|
||||
<data name="Main.Advanced.terrain_and_movements" xml:space="preserve">
|
||||
<value>Uses more ram, cpu, bandwidth but allows you to move around.</value>
|
||||
|
|
|
|||
|
|
@ -2704,6 +2704,15 @@ namespace MinecraftClient {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Cancel mining the block located at {0}..
|
||||
/// </summary>
|
||||
internal static string cmd_dig_cancel {
|
||||
get {
|
||||
return ResourceManager.GetString("cmd.dig.cancel", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Attempt to break a block.
|
||||
/// </summary>
|
||||
|
|
@ -2722,6 +2731,15 @@ namespace MinecraftClient {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Mining of the block located at {0} ends..
|
||||
/// </summary>
|
||||
internal static string cmd_dig_end {
|
||||
get {
|
||||
return ResourceManager.GetString("cmd.dig.end", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Failed to start digging block..
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -2028,4 +2028,10 @@ Logging in...</value>
|
|||
<data name="proxy.connected" xml:space="preserve">
|
||||
<value>Connected to proxy {0}:{1}</value>
|
||||
</data>
|
||||
<data name="cmd.dig.end" xml:space="preserve">
|
||||
<value>Mining of the block located at {0} ends.</value>
|
||||
</data>
|
||||
<data name="cmd.dig.cancel" xml:space="preserve">
|
||||
<value>Cancel mining the block located at {0}.</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
@ -35,7 +35,7 @@ namespace MinecraftClient
|
|||
// Other Settings
|
||||
public const string TranslationsFile_Version = "1.19.3";
|
||||
public const string TranslationsFile_Website_Index = "https://piston-meta.mojang.com/v1/packages/c492375ded5da34b646b8c5c0842a0028bc69cec/2.json";
|
||||
public const string TranslationsFile_Website_Download = "http://resources.download.minecraft.net";
|
||||
public const string TranslationsFile_Website_Download = "https://resources.download.minecraft.net";
|
||||
|
||||
public const string TranslationProjectUrl = "https://crwd.in/minecraft-console-client";
|
||||
|
||||
|
|
@ -472,6 +472,12 @@ namespace MinecraftClient
|
|||
Advanced.MinTerminalWidth = 1;
|
||||
if (Advanced.MinTerminalHeight < 1)
|
||||
Advanced.MinTerminalHeight = 1;
|
||||
|
||||
if (Advanced.TemporaryFixBadpacket && !Advanced.TerrainAndMovements)
|
||||
{
|
||||
Advanced.TerrainAndMovements = true;
|
||||
ConsoleIO.WriteLineFormatted("§c[Settings]You need to enable TerrainAndMovements before enabling TemporaryFixBadpacket.");
|
||||
}
|
||||
}
|
||||
|
||||
[TomlDoNotInlineObject]
|
||||
|
|
@ -519,7 +525,7 @@ namespace MinecraftClient
|
|||
public string MinecraftVersion = "auto";
|
||||
|
||||
[TomlInlineComment("$Main.Advanced.mc_forge$")]
|
||||
public ForgeConfigType EnableForge = ForgeConfigType.auto;
|
||||
public ForgeConfigType EnableForge = ForgeConfigType.no;
|
||||
|
||||
[TomlInlineComment("$Main.Advanced.brand_info$")]
|
||||
public BrandInfoType BrandInfo = BrandInfoType.mcc;
|
||||
|
|
@ -1204,27 +1210,27 @@ namespace MinecraftClient
|
|||
catch (ArgumentException)
|
||||
{
|
||||
checkResult = false;
|
||||
ConsoleIO.WriteLineFormatted("§cIllegal regular expression: ChatFormat.Public = " + Public);
|
||||
ConsoleIO.WriteLineFormatted("§c[Settings]Illegal regular expression: ChatFormat.Public = " + Public);
|
||||
}
|
||||
|
||||
try { _ = new Regex(Private); }
|
||||
catch (ArgumentException)
|
||||
{
|
||||
checkResult = false;
|
||||
ConsoleIO.WriteLineFormatted("§cIllegal regular expression: ChatFormat.Private = " + Private);
|
||||
ConsoleIO.WriteLineFormatted("§c[Settings]Illegal regular expression: ChatFormat.Private = " + Private);
|
||||
}
|
||||
|
||||
try { _ = new Regex(TeleportRequest); }
|
||||
catch (ArgumentException)
|
||||
{
|
||||
checkResult = false;
|
||||
ConsoleIO.WriteLineFormatted("§cIllegal regular expression: ChatFormat.TeleportRequest = " + TeleportRequest);
|
||||
ConsoleIO.WriteLineFormatted("§c[Settings]Illegal regular expression: ChatFormat.TeleportRequest = " + TeleportRequest);
|
||||
}
|
||||
|
||||
if (!checkResult)
|
||||
{
|
||||
UserDefined = false;
|
||||
ConsoleIO.WriteLineFormatted("§cChatFormat: User-defined regular expressions are disabled.");
|
||||
ConsoleIO.WriteLineFormatted("§c[Settings]ChatFormat: User-defined regular expressions are disabled.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue