mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Implemented 1.19.4, fixed multiple bugs in multiple versions
- Implemented 1.19.4 - Changed the Entity Metadata Code to use Palettes (1.13 - 1.19.4 supported) - Implemented Particles Reading code for 1.13 - 1.19.4 - Fixed Elytra flyby crashing the bot when rocket was used (incorrect particles reading cause this) - Fixed a crash on 1.15.X - Fixed a crash on 1.14.X
This commit is contained in:
commit
f467f4d6e4
23 changed files with 4963 additions and 572 deletions
1246
MinecraftClient/Inventory/ItemPalettes/ItemPalette1194.cs
Normal file
1246
MinecraftClient/Inventory/ItemPalettes/ItemPalette1194.cs
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -171,6 +171,7 @@
|
||||||
BrownStainedGlassPane,
|
BrownStainedGlassPane,
|
||||||
BrownTerracotta,
|
BrownTerracotta,
|
||||||
BrownWool,
|
BrownWool,
|
||||||
|
Brush,
|
||||||
BubbleCoral,
|
BubbleCoral,
|
||||||
BubbleCoralBlock,
|
BubbleCoralBlock,
|
||||||
BubbleCoralFan,
|
BubbleCoralFan,
|
||||||
|
|
@ -197,6 +198,23 @@
|
||||||
ChainmailHelmet,
|
ChainmailHelmet,
|
||||||
ChainmailLeggings,
|
ChainmailLeggings,
|
||||||
Charcoal,
|
Charcoal,
|
||||||
|
CherryBoat,
|
||||||
|
CherryButton,
|
||||||
|
CherryChestBoat,
|
||||||
|
CherryDoor,
|
||||||
|
CherryFence,
|
||||||
|
CherryFenceGate,
|
||||||
|
CherryHangingSign,
|
||||||
|
CherryLeaves,
|
||||||
|
CherryLog,
|
||||||
|
CherryPlanks,
|
||||||
|
CherryPressurePlate,
|
||||||
|
CherrySapling,
|
||||||
|
CherrySign,
|
||||||
|
CherrySlab,
|
||||||
|
CherryStairs,
|
||||||
|
CherryTrapdoor,
|
||||||
|
CherryWood,
|
||||||
Chest,
|
Chest,
|
||||||
ChestMinecart,
|
ChestMinecart,
|
||||||
Chicken,
|
Chicken,
|
||||||
|
|
@ -220,6 +238,7 @@
|
||||||
CoalBlock,
|
CoalBlock,
|
||||||
CoalOre,
|
CoalOre,
|
||||||
CoarseDirt,
|
CoarseDirt,
|
||||||
|
CoastArmorTrimSmithingTemplate,
|
||||||
CobbledDeepslate,
|
CobbledDeepslate,
|
||||||
CobbledDeepslateSlab,
|
CobbledDeepslateSlab,
|
||||||
CobbledDeepslateStairs,
|
CobbledDeepslateStairs,
|
||||||
|
|
@ -339,6 +358,7 @@
|
||||||
DeadTubeCoralBlock,
|
DeadTubeCoralBlock,
|
||||||
DeadTubeCoralFan,
|
DeadTubeCoralFan,
|
||||||
DebugStick,
|
DebugStick,
|
||||||
|
DecoratedPot,
|
||||||
Deepslate,
|
Deepslate,
|
||||||
DeepslateBrickSlab,
|
DeepslateBrickSlab,
|
||||||
DeepslateBrickStairs,
|
DeepslateBrickStairs,
|
||||||
|
|
@ -388,6 +408,7 @@
|
||||||
DripstoneBlock,
|
DripstoneBlock,
|
||||||
Dropper,
|
Dropper,
|
||||||
DrownedSpawnEgg,
|
DrownedSpawnEgg,
|
||||||
|
DuneArmorTrimSmithingTemplate,
|
||||||
EchoShard,
|
EchoShard,
|
||||||
Egg,
|
Egg,
|
||||||
ElderGuardianSpawnEgg,
|
ElderGuardianSpawnEgg,
|
||||||
|
|
@ -418,6 +439,7 @@
|
||||||
ExposedCutCopper,
|
ExposedCutCopper,
|
||||||
ExposedCutCopperSlab,
|
ExposedCutCopperSlab,
|
||||||
ExposedCutCopperStairs,
|
ExposedCutCopperStairs,
|
||||||
|
EyeArmorTrimSmithingTemplate,
|
||||||
Farmland,
|
Farmland,
|
||||||
Feather,
|
Feather,
|
||||||
FermentedSpiderEye,
|
FermentedSpiderEye,
|
||||||
|
|
@ -748,6 +770,7 @@
|
||||||
NetheriteScrap,
|
NetheriteScrap,
|
||||||
NetheriteShovel,
|
NetheriteShovel,
|
||||||
NetheriteSword,
|
NetheriteSword,
|
||||||
|
NetheriteUpgradeSmithingTemplate,
|
||||||
Netherrack,
|
Netherrack,
|
||||||
NoteBlock,
|
NoteBlock,
|
||||||
OakBoat,
|
OakBoat,
|
||||||
|
|
@ -815,6 +838,7 @@
|
||||||
PinkConcretePowder,
|
PinkConcretePowder,
|
||||||
PinkDye,
|
PinkDye,
|
||||||
PinkGlazedTerracotta,
|
PinkGlazedTerracotta,
|
||||||
|
PinkPetals,
|
||||||
PinkShulkerBox,
|
PinkShulkerBox,
|
||||||
PinkStainedGlass,
|
PinkStainedGlass,
|
||||||
PinkStainedGlassPane,
|
PinkStainedGlassPane,
|
||||||
|
|
@ -856,6 +880,10 @@
|
||||||
Porkchop,
|
Porkchop,
|
||||||
Potato,
|
Potato,
|
||||||
Potion,
|
Potion,
|
||||||
|
PotteryShardArcher,
|
||||||
|
PotteryShardArmsUp,
|
||||||
|
PotteryShardPrize,
|
||||||
|
PotteryShardSkull,
|
||||||
PowderSnowBucket,
|
PowderSnowBucket,
|
||||||
PoweredRail,
|
PoweredRail,
|
||||||
Prismarine,
|
Prismarine,
|
||||||
|
|
@ -944,6 +972,7 @@
|
||||||
Repeater,
|
Repeater,
|
||||||
RepeatingCommandBlock,
|
RepeatingCommandBlock,
|
||||||
RespawnAnchor,
|
RespawnAnchor,
|
||||||
|
RibArmorTrimSmithingTemplate,
|
||||||
RootedDirt,
|
RootedDirt,
|
||||||
RoseBush,
|
RoseBush,
|
||||||
RottenFlesh,
|
RottenFlesh,
|
||||||
|
|
@ -966,6 +995,7 @@
|
||||||
SeaLantern,
|
SeaLantern,
|
||||||
SeaPickle,
|
SeaPickle,
|
||||||
Seagrass,
|
Seagrass,
|
||||||
|
SentryArmorTrimSmithingTemplate,
|
||||||
Shears,
|
Shears,
|
||||||
SheepSpawnEgg,
|
SheepSpawnEgg,
|
||||||
Shield,
|
Shield,
|
||||||
|
|
@ -997,6 +1027,8 @@
|
||||||
SmoothSandstoneStairs,
|
SmoothSandstoneStairs,
|
||||||
SmoothStone,
|
SmoothStone,
|
||||||
SmoothStoneSlab,
|
SmoothStoneSlab,
|
||||||
|
SnifferSpawnEgg,
|
||||||
|
SnoutArmorTrimSmithingTemplate,
|
||||||
Snow,
|
Snow,
|
||||||
SnowBlock,
|
SnowBlock,
|
||||||
SnowGolemSpawnEgg,
|
SnowGolemSpawnEgg,
|
||||||
|
|
@ -1010,6 +1042,7 @@
|
||||||
SpectralArrow,
|
SpectralArrow,
|
||||||
SpiderEye,
|
SpiderEye,
|
||||||
SpiderSpawnEgg,
|
SpiderSpawnEgg,
|
||||||
|
SpireArmorTrimSmithingTemplate,
|
||||||
SplashPotion,
|
SplashPotion,
|
||||||
Sponge,
|
Sponge,
|
||||||
SporeBlossom,
|
SporeBlossom,
|
||||||
|
|
@ -1057,6 +1090,8 @@
|
||||||
StrippedBambooBlock,
|
StrippedBambooBlock,
|
||||||
StrippedBirchLog,
|
StrippedBirchLog,
|
||||||
StrippedBirchWood,
|
StrippedBirchWood,
|
||||||
|
StrippedCherryLog,
|
||||||
|
StrippedCherryWood,
|
||||||
StrippedCrimsonHyphae,
|
StrippedCrimsonHyphae,
|
||||||
StrippedCrimsonStem,
|
StrippedCrimsonStem,
|
||||||
StrippedDarkOakLog,
|
StrippedDarkOakLog,
|
||||||
|
|
@ -1076,6 +1111,7 @@
|
||||||
Sugar,
|
Sugar,
|
||||||
SugarCane,
|
SugarCane,
|
||||||
Sunflower,
|
Sunflower,
|
||||||
|
SuspiciousSand,
|
||||||
SuspiciousStew,
|
SuspiciousStew,
|
||||||
SweetBerries,
|
SweetBerries,
|
||||||
TadpoleBucket,
|
TadpoleBucket,
|
||||||
|
|
@ -1083,11 +1119,14 @@
|
||||||
TallGrass,
|
TallGrass,
|
||||||
Target,
|
Target,
|
||||||
Terracotta,
|
Terracotta,
|
||||||
|
TideArmorTrimSmithingTemplate,
|
||||||
TintedGlass,
|
TintedGlass,
|
||||||
TippedArrow,
|
TippedArrow,
|
||||||
Tnt,
|
Tnt,
|
||||||
TntMinecart,
|
TntMinecart,
|
||||||
Torch,
|
Torch,
|
||||||
|
Torchflower,
|
||||||
|
TorchflowerSeeds,
|
||||||
TotemOfUndying,
|
TotemOfUndying,
|
||||||
TraderLlamaSpawnEgg,
|
TraderLlamaSpawnEgg,
|
||||||
TrappedChest,
|
TrappedChest,
|
||||||
|
|
@ -1105,11 +1144,13 @@
|
||||||
TurtleSpawnEgg,
|
TurtleSpawnEgg,
|
||||||
TwistingVines,
|
TwistingVines,
|
||||||
VerdantFroglight,
|
VerdantFroglight,
|
||||||
|
VexArmorTrimSmithingTemplate,
|
||||||
VexSpawnEgg,
|
VexSpawnEgg,
|
||||||
VillagerSpawnEgg,
|
VillagerSpawnEgg,
|
||||||
VindicatorSpawnEgg,
|
VindicatorSpawnEgg,
|
||||||
Vine,
|
Vine,
|
||||||
WanderingTraderSpawnEgg,
|
WanderingTraderSpawnEgg,
|
||||||
|
WardArmorTrimSmithingTemplate,
|
||||||
WardenSpawnEgg,
|
WardenSpawnEgg,
|
||||||
WarpedButton,
|
WarpedButton,
|
||||||
WarpedDoor,
|
WarpedDoor,
|
||||||
|
|
@ -1168,6 +1209,7 @@
|
||||||
WhiteTerracotta,
|
WhiteTerracotta,
|
||||||
WhiteTulip,
|
WhiteTulip,
|
||||||
WhiteWool,
|
WhiteWool,
|
||||||
|
WildArmorTrimSmithingTemplate,
|
||||||
WitchSpawnEgg,
|
WitchSpawnEgg,
|
||||||
WitherRose,
|
WitherRose,
|
||||||
WitherSkeletonSkull,
|
WitherSkeletonSkull,
|
||||||
|
|
|
||||||
1653
MinecraftClient/Mapping/BlockPalettes/Palette1194.cs
Normal file
1653
MinecraftClient/Mapping/BlockPalettes/Palette1194.cs
Normal file
File diff suppressed because it is too large
Load diff
73
MinecraftClient/Mapping/EntityMetaDataType.cs
Normal file
73
MinecraftClient/Mapping/EntityMetaDataType.cs
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
namespace MinecraftClient.Mapping;
|
||||||
|
|
||||||
|
public enum EntityMetaDataType
|
||||||
|
{
|
||||||
|
Byte,
|
||||||
|
VarInt,
|
||||||
|
VarLong,
|
||||||
|
Float,
|
||||||
|
String,
|
||||||
|
Chat,
|
||||||
|
OptionalChat,
|
||||||
|
Slot,
|
||||||
|
Boolean,
|
||||||
|
/// <summary>
|
||||||
|
/// Float x3
|
||||||
|
/// </summary>
|
||||||
|
Rotation,
|
||||||
|
Position,
|
||||||
|
OptionalPosition,
|
||||||
|
/// <summary>
|
||||||
|
/// VarInt
|
||||||
|
/// </summary>
|
||||||
|
Direction,
|
||||||
|
OptionalUuid,
|
||||||
|
/// <summary>
|
||||||
|
/// VarInt
|
||||||
|
/// </summary>
|
||||||
|
BlockId,
|
||||||
|
/// <summary>
|
||||||
|
/// VarInt (0 for absent)
|
||||||
|
/// </summary>
|
||||||
|
OptionalBlockId,
|
||||||
|
Nbt,
|
||||||
|
Particle,
|
||||||
|
/// <summary>
|
||||||
|
/// VarInt x3
|
||||||
|
/// </summary>
|
||||||
|
VillagerData,
|
||||||
|
OptionalVarInt,
|
||||||
|
/// <summary>
|
||||||
|
/// VarInt
|
||||||
|
/// </summary>
|
||||||
|
Pose,
|
||||||
|
/// <summary>
|
||||||
|
/// VarInt
|
||||||
|
/// </summary>
|
||||||
|
CatVariant,
|
||||||
|
FrogVariant,
|
||||||
|
/// <summary>
|
||||||
|
/// String + Position
|
||||||
|
/// </summary>
|
||||||
|
GlobalPosition,
|
||||||
|
/// <summary>
|
||||||
|
/// Boolean + String + Position
|
||||||
|
/// </summary>
|
||||||
|
OptionalGlobalPosition,
|
||||||
|
/// <summary>
|
||||||
|
/// VarInt
|
||||||
|
/// </summary>
|
||||||
|
PaintingVariant,
|
||||||
|
/// <summary>
|
||||||
|
/// VarInt
|
||||||
|
/// </summary>
|
||||||
|
SnifferState,
|
||||||
|
/// <summary>
|
||||||
|
/// Float x3
|
||||||
|
/// </summary>
|
||||||
|
Vector3,
|
||||||
|
/// <summary>
|
||||||
|
/// Float x4
|
||||||
|
/// </summary>
|
||||||
|
Quaternion
|
||||||
|
}
|
||||||
32
MinecraftClient/Mapping/EntityMetadataPalette.cs
Normal file
32
MinecraftClient/Mapping/EntityMetadataPalette.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
using MinecraftClient.Mapping.EntityMetadataPalettes;
|
||||||
|
using MinecraftClient.Protocol.Handlers;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Mapping;
|
||||||
|
|
||||||
|
public abstract class EntityMetadataPalette
|
||||||
|
{
|
||||||
|
public abstract Dictionary<int, EntityMetaDataType> GetEntityMetadataMappingsList();
|
||||||
|
|
||||||
|
public EntityMetaDataType GetDataType(int typeId)
|
||||||
|
{
|
||||||
|
return GetEntityMetadataMappingsList()[typeId];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EntityMetadataPalette GetPalette(int protocolVersion)
|
||||||
|
{
|
||||||
|
if (protocolVersion < Protocol18Handler.MC_1_9_Version)
|
||||||
|
throw new NotImplementedException();
|
||||||
|
else if (protocolVersion <= Protocol18Handler.MC_1_12_2_Version)
|
||||||
|
return new EntityMetadataPalette1122(); // 1.9 - 1.12.2
|
||||||
|
else if (protocolVersion <= Protocol18Handler.MC_1_19_2_Version)
|
||||||
|
return new EntityMetadataPalette1191(); // 1.13 - 1.19.2
|
||||||
|
else if (protocolVersion <= Protocol18Handler.MC_1_19_3_Version)
|
||||||
|
return new EntityMetadataPalette1193(); // 1.19.3
|
||||||
|
else if (protocolVersion <= Protocol18Handler.MC_1_19_4_Version)
|
||||||
|
return new EntityMetadataPalette1194(); // 1.19.4
|
||||||
|
else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Mapping.EntityMetadataPalettes;
|
||||||
|
|
||||||
|
public class EntityMetadataPalette1122 : EntityMetadataPalette
|
||||||
|
{
|
||||||
|
// 1.9 - 1.12.2
|
||||||
|
private readonly Dictionary<int, EntityMetaDataType> entityMetadataMappings = new()
|
||||||
|
{
|
||||||
|
{ 0, EntityMetaDataType.Byte },
|
||||||
|
{ 1, EntityMetaDataType.VarInt },
|
||||||
|
{ 2, EntityMetaDataType.Float },
|
||||||
|
{ 3, EntityMetaDataType.String },
|
||||||
|
{ 4, EntityMetaDataType.Chat },
|
||||||
|
{ 5, EntityMetaDataType.Slot },
|
||||||
|
{ 6, EntityMetaDataType.Boolean },
|
||||||
|
{ 7, EntityMetaDataType.Rotation },
|
||||||
|
{ 8, EntityMetaDataType.Position },
|
||||||
|
{ 9, EntityMetaDataType.OptionalPosition },
|
||||||
|
{ 10, EntityMetaDataType.Direction },
|
||||||
|
{ 11, EntityMetaDataType.OptionalUuid },
|
||||||
|
{ 12, EntityMetaDataType.OptionalBlockId },
|
||||||
|
{ 13, EntityMetaDataType.Nbt },
|
||||||
|
};
|
||||||
|
|
||||||
|
public override Dictionary<int, EntityMetaDataType> GetEntityMetadataMappingsList()
|
||||||
|
{
|
||||||
|
return entityMetadataMappings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Mapping.EntityMetadataPalettes;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 1.13 - 1.19.2
|
||||||
|
/// </summary>
|
||||||
|
public class EntityMetadataPalette1191 : EntityMetadataPalette
|
||||||
|
{
|
||||||
|
private readonly Dictionary<int, EntityMetaDataType> entityMetadataMappings = new()
|
||||||
|
{
|
||||||
|
{ 0, EntityMetaDataType.Byte },
|
||||||
|
{ 1, EntityMetaDataType.VarInt },
|
||||||
|
{ 2, EntityMetaDataType.Float },
|
||||||
|
{ 3, EntityMetaDataType.String },
|
||||||
|
{ 4, EntityMetaDataType.Chat },
|
||||||
|
{ 5, EntityMetaDataType.OptionalChat },
|
||||||
|
{ 6, EntityMetaDataType.Slot },
|
||||||
|
{ 7, EntityMetaDataType.Boolean },
|
||||||
|
{ 8, EntityMetaDataType.Rotation },
|
||||||
|
{ 9, EntityMetaDataType.Position },
|
||||||
|
{ 10, EntityMetaDataType.OptionalPosition },
|
||||||
|
{ 11, EntityMetaDataType.Direction },
|
||||||
|
{ 12, EntityMetaDataType.OptionalUuid },
|
||||||
|
{ 13, EntityMetaDataType.OptionalBlockId },
|
||||||
|
{ 14, EntityMetaDataType.Nbt },
|
||||||
|
{ 15, EntityMetaDataType.Particle },
|
||||||
|
{ 16, EntityMetaDataType.VillagerData },
|
||||||
|
{ 17, EntityMetaDataType.OptionalVarInt },
|
||||||
|
{ 18, EntityMetaDataType.Pose },
|
||||||
|
{ 19, EntityMetaDataType.CatVariant },
|
||||||
|
{ 20, EntityMetaDataType.FrogVariant },
|
||||||
|
{ 21, EntityMetaDataType.OptionalGlobalPosition },
|
||||||
|
{ 22, EntityMetaDataType.PaintingVariant }
|
||||||
|
};
|
||||||
|
|
||||||
|
public override Dictionary<int, EntityMetaDataType> GetEntityMetadataMappingsList()
|
||||||
|
{
|
||||||
|
return entityMetadataMappings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Mapping.EntityMetadataPalettes;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For 1.19.3
|
||||||
|
/// </summary>
|
||||||
|
public class EntityMetadataPalette1193 : EntityMetadataPalette
|
||||||
|
{
|
||||||
|
private readonly Dictionary<int, EntityMetaDataType> entityMetadataMappings = new()
|
||||||
|
{
|
||||||
|
{ 0, EntityMetaDataType.Byte },
|
||||||
|
{ 1, EntityMetaDataType.VarInt },
|
||||||
|
{ 2, EntityMetaDataType.VarLong },
|
||||||
|
{ 3, EntityMetaDataType.Float },
|
||||||
|
{ 4, EntityMetaDataType.String },
|
||||||
|
{ 5, EntityMetaDataType.Chat },
|
||||||
|
{ 6, EntityMetaDataType.OptionalChat },
|
||||||
|
{ 7, EntityMetaDataType.Slot },
|
||||||
|
{ 8, EntityMetaDataType.Boolean },
|
||||||
|
{ 9, EntityMetaDataType.Rotation },
|
||||||
|
{ 10, EntityMetaDataType.Position },
|
||||||
|
{ 11, EntityMetaDataType.OptionalPosition },
|
||||||
|
{ 12, EntityMetaDataType.Direction },
|
||||||
|
{ 13, EntityMetaDataType.OptionalUuid },
|
||||||
|
{ 14, EntityMetaDataType.OptionalBlockId },
|
||||||
|
{ 15, EntityMetaDataType.Nbt },
|
||||||
|
{ 16, EntityMetaDataType.Particle },
|
||||||
|
{ 17, EntityMetaDataType.VillagerData },
|
||||||
|
{ 18, EntityMetaDataType.OptionalVarInt },
|
||||||
|
{ 19, EntityMetaDataType.Pose },
|
||||||
|
{ 20, EntityMetaDataType.CatVariant },
|
||||||
|
{ 21, EntityMetaDataType.FrogVariant },
|
||||||
|
{ 22, EntityMetaDataType.OptionalGlobalPosition },
|
||||||
|
{ 23, EntityMetaDataType.PaintingVariant }
|
||||||
|
};
|
||||||
|
|
||||||
|
public override Dictionary<int, EntityMetaDataType> GetEntityMetadataMappingsList()
|
||||||
|
{
|
||||||
|
return entityMetadataMappings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Mapping.EntityMetadataPalettes;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For 1.19.4
|
||||||
|
/// </summary>
|
||||||
|
public class EntityMetadataPalette1194 : EntityMetadataPalette
|
||||||
|
{
|
||||||
|
private readonly Dictionary<int, EntityMetaDataType> entityMetadataMappings = new()
|
||||||
|
{
|
||||||
|
{ 0, EntityMetaDataType.Byte },
|
||||||
|
{ 1, EntityMetaDataType.VarInt },
|
||||||
|
{ 2, EntityMetaDataType.VarLong },
|
||||||
|
{ 3, EntityMetaDataType.Float },
|
||||||
|
{ 4, EntityMetaDataType.String },
|
||||||
|
{ 5, EntityMetaDataType.Chat },
|
||||||
|
{ 6, EntityMetaDataType.OptionalChat },
|
||||||
|
{ 7, EntityMetaDataType.Slot },
|
||||||
|
{ 8, EntityMetaDataType.Boolean },
|
||||||
|
{ 9, EntityMetaDataType.Rotation },
|
||||||
|
{ 10, EntityMetaDataType.Position },
|
||||||
|
{ 11, EntityMetaDataType.OptionalPosition },
|
||||||
|
{ 12, EntityMetaDataType.Direction },
|
||||||
|
{ 13, EntityMetaDataType.OptionalUuid },
|
||||||
|
{ 14, EntityMetaDataType.BlockId },
|
||||||
|
{ 15, EntityMetaDataType.OptionalBlockId },
|
||||||
|
{ 16, EntityMetaDataType.Nbt },
|
||||||
|
{ 17, EntityMetaDataType.Particle },
|
||||||
|
{ 18, EntityMetaDataType.VillagerData },
|
||||||
|
{ 19, EntityMetaDataType.OptionalVarInt },
|
||||||
|
{ 20, EntityMetaDataType.Pose },
|
||||||
|
{ 21, EntityMetaDataType.CatVariant },
|
||||||
|
{ 22, EntityMetaDataType.FrogVariant },
|
||||||
|
{ 23, EntityMetaDataType.OptionalGlobalPosition },
|
||||||
|
{ 24, EntityMetaDataType.PaintingVariant },
|
||||||
|
{ 25, EntityMetaDataType.SnifferState },
|
||||||
|
{ 26, EntityMetaDataType.Vector3 },
|
||||||
|
{ 27, EntityMetaDataType.Quaternion },
|
||||||
|
};
|
||||||
|
|
||||||
|
public override Dictionary<int, EntityMetaDataType> GetEntityMetadataMappingsList()
|
||||||
|
{
|
||||||
|
return entityMetadataMappings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Mapping.EntityMetadataPalettes;
|
||||||
|
|
||||||
|
// TODO: Use this for 1.8
|
||||||
|
public class EntityMetadataPalette19 : EntityMetadataPalette
|
||||||
|
{
|
||||||
|
// 1.8 : https://wiki.vg/index.php?title=Entity_metadata&oldid=6220 (Requires a different algorithm)
|
||||||
|
// 1.9 : https://wiki.vg/index.php?title=Entity_metadata&oldid=7416
|
||||||
|
private readonly Dictionary<int, EntityMetaDataType> entityMetadataMappings = new()
|
||||||
|
{
|
||||||
|
{ 0, EntityMetaDataType.Byte },
|
||||||
|
{ 1, EntityMetaDataType.VarInt },
|
||||||
|
{ 2, EntityMetaDataType.Float },
|
||||||
|
{ 3, EntityMetaDataType.String },
|
||||||
|
{ 4, EntityMetaDataType.Chat },
|
||||||
|
{ 5, EntityMetaDataType.Slot },
|
||||||
|
{ 6, EntityMetaDataType.Boolean },
|
||||||
|
{ 7, EntityMetaDataType.Vector3 },
|
||||||
|
{ 8, EntityMetaDataType.Position },
|
||||||
|
{ 9, EntityMetaDataType.OptionalPosition },
|
||||||
|
{ 10, EntityMetaDataType.Direction },
|
||||||
|
{ 11, EntityMetaDataType.OptionalUuid },
|
||||||
|
{ 12, EntityMetaDataType.OptionalBlockId }
|
||||||
|
};
|
||||||
|
|
||||||
|
public override Dictionary<int, EntityMetaDataType> GetEntityMetadataMappingsList()
|
||||||
|
{
|
||||||
|
return entityMetadataMappings;
|
||||||
|
}
|
||||||
|
}
|
||||||
142
MinecraftClient/Mapping/EntityPalettes/EntityPalette11194.cs
Normal file
142
MinecraftClient/Mapping/EntityPalettes/EntityPalette11194.cs
Normal file
|
|
@ -0,0 +1,142 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Mapping.EntityPalettes
|
||||||
|
{
|
||||||
|
public class EntityPalette1194 : EntityPalette
|
||||||
|
{
|
||||||
|
private static readonly Dictionary<int, EntityType> mappings = new();
|
||||||
|
|
||||||
|
static EntityPalette1194()
|
||||||
|
{
|
||||||
|
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.BlockDisplay;
|
||||||
|
mappings[9] = EntityType.Boat;
|
||||||
|
mappings[10] = EntityType.Camel;
|
||||||
|
mappings[11] = EntityType.Cat;
|
||||||
|
mappings[12] = EntityType.CaveSpider;
|
||||||
|
mappings[13] = EntityType.ChestBoat;
|
||||||
|
mappings[14] = EntityType.ChestMinecart;
|
||||||
|
mappings[15] = EntityType.Chicken;
|
||||||
|
mappings[16] = EntityType.Cod;
|
||||||
|
mappings[17] = EntityType.CommandBlockMinecart;
|
||||||
|
mappings[18] = EntityType.Cow;
|
||||||
|
mappings[19] = EntityType.Creeper;
|
||||||
|
mappings[20] = EntityType.Dolphin;
|
||||||
|
mappings[21] = EntityType.Donkey;
|
||||||
|
mappings[22] = EntityType.DragonFireball;
|
||||||
|
mappings[23] = EntityType.Drowned;
|
||||||
|
mappings[24] = EntityType.Egg;
|
||||||
|
mappings[25] = EntityType.ElderGuardian;
|
||||||
|
mappings[26] = EntityType.EndCrystal;
|
||||||
|
mappings[27] = EntityType.EnderDragon;
|
||||||
|
mappings[28] = EntityType.EnderPearl;
|
||||||
|
mappings[29] = EntityType.Enderman;
|
||||||
|
mappings[30] = EntityType.Endermite;
|
||||||
|
mappings[31] = EntityType.Evoker;
|
||||||
|
mappings[32] = EntityType.EvokerFangs;
|
||||||
|
mappings[33] = EntityType.ExperienceBottle;
|
||||||
|
mappings[34] = EntityType.ExperienceOrb;
|
||||||
|
mappings[35] = EntityType.EyeOfEnder;
|
||||||
|
mappings[36] = EntityType.FallingBlock;
|
||||||
|
mappings[57] = EntityType.Fireball;
|
||||||
|
mappings[37] = EntityType.FireworkRocket;
|
||||||
|
mappings[123] = EntityType.FishingBobber;
|
||||||
|
mappings[38] = EntityType.Fox;
|
||||||
|
mappings[39] = EntityType.Frog;
|
||||||
|
mappings[40] = EntityType.FurnaceMinecart;
|
||||||
|
mappings[41] = EntityType.Ghast;
|
||||||
|
mappings[42] = EntityType.Giant;
|
||||||
|
mappings[43] = EntityType.GlowItemFrame;
|
||||||
|
mappings[44] = EntityType.GlowSquid;
|
||||||
|
mappings[45] = EntityType.Goat;
|
||||||
|
mappings[46] = EntityType.Guardian;
|
||||||
|
mappings[47] = EntityType.Hoglin;
|
||||||
|
mappings[48] = EntityType.HopperMinecart;
|
||||||
|
mappings[49] = EntityType.Horse;
|
||||||
|
mappings[50] = EntityType.Husk;
|
||||||
|
mappings[51] = EntityType.Illusioner;
|
||||||
|
mappings[52] = EntityType.Interaction;
|
||||||
|
mappings[53] = EntityType.IronGolem;
|
||||||
|
mappings[54] = EntityType.Item;
|
||||||
|
mappings[55] = EntityType.ItemDisplay;
|
||||||
|
mappings[56] = EntityType.ItemFrame;
|
||||||
|
mappings[58] = EntityType.LeashKnot;
|
||||||
|
mappings[59] = EntityType.LightningBolt;
|
||||||
|
mappings[60] = EntityType.Llama;
|
||||||
|
mappings[61] = EntityType.LlamaSpit;
|
||||||
|
mappings[62] = EntityType.MagmaCube;
|
||||||
|
mappings[63] = EntityType.Marker;
|
||||||
|
mappings[64] = EntityType.Minecart;
|
||||||
|
mappings[65] = EntityType.Mooshroom;
|
||||||
|
mappings[66] = EntityType.Mule;
|
||||||
|
mappings[67] = EntityType.Ocelot;
|
||||||
|
mappings[68] = EntityType.Painting;
|
||||||
|
mappings[69] = EntityType.Panda;
|
||||||
|
mappings[70] = EntityType.Parrot;
|
||||||
|
mappings[71] = EntityType.Phantom;
|
||||||
|
mappings[72] = EntityType.Pig;
|
||||||
|
mappings[73] = EntityType.Piglin;
|
||||||
|
mappings[74] = EntityType.PiglinBrute;
|
||||||
|
mappings[75] = EntityType.Pillager;
|
||||||
|
mappings[122] = EntityType.Player;
|
||||||
|
mappings[76] = EntityType.PolarBear;
|
||||||
|
mappings[77] = EntityType.Potion;
|
||||||
|
mappings[78] = EntityType.Pufferfish;
|
||||||
|
mappings[79] = EntityType.Rabbit;
|
||||||
|
mappings[80] = EntityType.Ravager;
|
||||||
|
mappings[81] = EntityType.Salmon;
|
||||||
|
mappings[82] = EntityType.Sheep;
|
||||||
|
mappings[83] = EntityType.Shulker;
|
||||||
|
mappings[84] = EntityType.ShulkerBullet;
|
||||||
|
mappings[85] = EntityType.Silverfish;
|
||||||
|
mappings[86] = EntityType.Skeleton;
|
||||||
|
mappings[87] = EntityType.SkeletonHorse;
|
||||||
|
mappings[88] = EntityType.Slime;
|
||||||
|
mappings[89] = EntityType.SmallFireball;
|
||||||
|
mappings[90] = EntityType.Sniffer;
|
||||||
|
mappings[91] = EntityType.SnowGolem;
|
||||||
|
mappings[92] = EntityType.Snowball;
|
||||||
|
mappings[93] = EntityType.SpawnerMinecart;
|
||||||
|
mappings[94] = EntityType.SpectralArrow;
|
||||||
|
mappings[95] = EntityType.Spider;
|
||||||
|
mappings[96] = EntityType.Squid;
|
||||||
|
mappings[97] = EntityType.Stray;
|
||||||
|
mappings[98] = EntityType.Strider;
|
||||||
|
mappings[99] = EntityType.Tadpole;
|
||||||
|
mappings[100] = EntityType.TextDisplay;
|
||||||
|
mappings[101] = EntityType.Tnt;
|
||||||
|
mappings[102] = EntityType.TntMinecart;
|
||||||
|
mappings[103] = EntityType.TraderLlama;
|
||||||
|
mappings[104] = EntityType.Trident;
|
||||||
|
mappings[105] = EntityType.TropicalFish;
|
||||||
|
mappings[106] = EntityType.Turtle;
|
||||||
|
mappings[107] = EntityType.Vex;
|
||||||
|
mappings[108] = EntityType.Villager;
|
||||||
|
mappings[109] = EntityType.Vindicator;
|
||||||
|
mappings[110] = EntityType.WanderingTrader;
|
||||||
|
mappings[111] = EntityType.Warden;
|
||||||
|
mappings[112] = EntityType.Witch;
|
||||||
|
mappings[113] = EntityType.Wither;
|
||||||
|
mappings[114] = EntityType.WitherSkeleton;
|
||||||
|
mappings[115] = EntityType.WitherSkull;
|
||||||
|
mappings[116] = EntityType.Wolf;
|
||||||
|
mappings[117] = EntityType.Zoglin;
|
||||||
|
mappings[118] = EntityType.Zombie;
|
||||||
|
mappings[119] = EntityType.ZombieHorse;
|
||||||
|
mappings[120] = EntityType.ZombieVillager;
|
||||||
|
mappings[121] = EntityType.ZombifiedPiglin;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Dictionary<int, EntityType> GetDict()
|
||||||
|
{
|
||||||
|
return mappings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
Bat,
|
Bat,
|
||||||
Bee,
|
Bee,
|
||||||
Blaze,
|
Blaze,
|
||||||
|
BlockDisplay,
|
||||||
Boat,
|
Boat,
|
||||||
Camel,
|
Camel,
|
||||||
Cat,
|
Cat,
|
||||||
|
|
@ -67,8 +68,10 @@
|
||||||
Horse,
|
Horse,
|
||||||
Husk,
|
Husk,
|
||||||
Illusioner,
|
Illusioner,
|
||||||
|
Interaction,
|
||||||
IronGolem,
|
IronGolem,
|
||||||
Item,
|
Item,
|
||||||
|
ItemDisplay,
|
||||||
ItemFrame,
|
ItemFrame,
|
||||||
LeashKnot,
|
LeashKnot,
|
||||||
LightningBolt,
|
LightningBolt,
|
||||||
|
|
@ -103,6 +106,7 @@
|
||||||
SkeletonHorse,
|
SkeletonHorse,
|
||||||
Slime,
|
Slime,
|
||||||
SmallFireball,
|
SmallFireball,
|
||||||
|
Sniffer,
|
||||||
SnowGolem,
|
SnowGolem,
|
||||||
Snowball,
|
Snowball,
|
||||||
SpawnerMinecart,
|
SpawnerMinecart,
|
||||||
|
|
@ -112,6 +116,7 @@
|
||||||
Stray,
|
Stray,
|
||||||
Strider,
|
Strider,
|
||||||
Tadpole,
|
Tadpole,
|
||||||
|
TextDisplay,
|
||||||
Tnt,
|
Tnt,
|
||||||
TntMinecart,
|
TntMinecart,
|
||||||
TraderLlama,
|
TraderLlama,
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,23 @@
|
||||||
CaveVinesPlant,
|
CaveVinesPlant,
|
||||||
Chain,
|
Chain,
|
||||||
ChainCommandBlock,
|
ChainCommandBlock,
|
||||||
|
CherryButton,
|
||||||
|
CherryDoor,
|
||||||
|
CherryFence,
|
||||||
|
CherryFenceGate,
|
||||||
|
CherryHangingSign,
|
||||||
|
CherryLeaves,
|
||||||
|
CherryLog,
|
||||||
|
CherryPlanks,
|
||||||
|
CherryPressurePlate,
|
||||||
|
CherrySapling,
|
||||||
|
CherrySign,
|
||||||
|
CherrySlab,
|
||||||
|
CherryStairs,
|
||||||
|
CherryTrapdoor,
|
||||||
|
CherryWallHangingSign,
|
||||||
|
CherryWallSign,
|
||||||
|
CherryWood,
|
||||||
Chest,
|
Chest,
|
||||||
ChippedAnvil,
|
ChippedAnvil,
|
||||||
ChiseledBookshelf,
|
ChiseledBookshelf,
|
||||||
|
|
@ -302,6 +319,7 @@
|
||||||
DeadTubeCoralBlock,
|
DeadTubeCoralBlock,
|
||||||
DeadTubeCoralFan,
|
DeadTubeCoralFan,
|
||||||
DeadTubeCoralWallFan,
|
DeadTubeCoralWallFan,
|
||||||
|
DecoratedPot,
|
||||||
Deepslate,
|
Deepslate,
|
||||||
DeepslateBrickSlab,
|
DeepslateBrickSlab,
|
||||||
DeepslateBrickStairs,
|
DeepslateBrickStairs,
|
||||||
|
|
@ -638,6 +656,7 @@
|
||||||
PinkConcrete,
|
PinkConcrete,
|
||||||
PinkConcretePowder,
|
PinkConcretePowder,
|
||||||
PinkGlazedTerracotta,
|
PinkGlazedTerracotta,
|
||||||
|
PinkPetals,
|
||||||
PinkShulkerBox,
|
PinkShulkerBox,
|
||||||
PinkStainedGlass,
|
PinkStainedGlass,
|
||||||
PinkStainedGlassPane,
|
PinkStainedGlassPane,
|
||||||
|
|
@ -686,6 +705,7 @@
|
||||||
PottedBlueOrchid,
|
PottedBlueOrchid,
|
||||||
PottedBrownMushroom,
|
PottedBrownMushroom,
|
||||||
PottedCactus,
|
PottedCactus,
|
||||||
|
PottedCherrySapling,
|
||||||
PottedCornflower,
|
PottedCornflower,
|
||||||
PottedCrimsonFungus,
|
PottedCrimsonFungus,
|
||||||
PottedCrimsonRoots,
|
PottedCrimsonRoots,
|
||||||
|
|
@ -705,6 +725,7 @@
|
||||||
PottedRedMushroom,
|
PottedRedMushroom,
|
||||||
PottedRedTulip,
|
PottedRedTulip,
|
||||||
PottedSpruceSapling,
|
PottedSpruceSapling,
|
||||||
|
PottedTorchflower,
|
||||||
PottedWarpedFungus,
|
PottedWarpedFungus,
|
||||||
PottedWarpedRoots,
|
PottedWarpedRoots,
|
||||||
PottedWhiteTulip,
|
PottedWhiteTulip,
|
||||||
|
|
@ -866,6 +887,8 @@
|
||||||
StrippedBambooBlock,
|
StrippedBambooBlock,
|
||||||
StrippedBirchLog,
|
StrippedBirchLog,
|
||||||
StrippedBirchWood,
|
StrippedBirchWood,
|
||||||
|
StrippedCherryLog,
|
||||||
|
StrippedCherryWood,
|
||||||
StrippedCrimsonHyphae,
|
StrippedCrimsonHyphae,
|
||||||
StrippedCrimsonStem,
|
StrippedCrimsonStem,
|
||||||
StrippedDarkOakLog,
|
StrippedDarkOakLog,
|
||||||
|
|
@ -884,6 +907,7 @@
|
||||||
StructureVoid,
|
StructureVoid,
|
||||||
SugarCane,
|
SugarCane,
|
||||||
Sunflower,
|
Sunflower,
|
||||||
|
SuspiciousSand,
|
||||||
SweetBerryBush,
|
SweetBerryBush,
|
||||||
TallGrass,
|
TallGrass,
|
||||||
TallSeagrass,
|
TallSeagrass,
|
||||||
|
|
@ -892,6 +916,8 @@
|
||||||
TintedGlass,
|
TintedGlass,
|
||||||
Tnt,
|
Tnt,
|
||||||
Torch,
|
Torch,
|
||||||
|
Torchflower,
|
||||||
|
TorchflowerCrop,
|
||||||
TrappedChest,
|
TrappedChest,
|
||||||
Tripwire,
|
Tripwire,
|
||||||
TripwireHook,
|
TripwireHook,
|
||||||
|
|
|
||||||
|
|
@ -2634,11 +2634,41 @@ namespace MinecraftClient
|
||||||
List<string> links = new();
|
List<string> links = new();
|
||||||
string messageText;
|
string messageText;
|
||||||
|
|
||||||
|
// Used for 1.19+ to mark: system message, legal / illegal signature
|
||||||
|
string color = string.Empty;
|
||||||
|
|
||||||
if (message.isSignedChat)
|
if (message.isSignedChat)
|
||||||
{
|
{
|
||||||
if (!Config.Signature.ShowIllegalSignedChat && !message.isSystemChat && !(bool)message.isSignatureLegal!)
|
if (!Config.Signature.ShowIllegalSignedChat && !message.isSystemChat && !(bool)message.isSignatureLegal!)
|
||||||
return;
|
return;
|
||||||
messageText = ChatParser.ParseSignedChat(message, links);
|
messageText = ChatParser.ParseSignedChat(message, links);
|
||||||
|
|
||||||
|
if (message.isSystemChat)
|
||||||
|
{
|
||||||
|
if (Config.Signature.MarkSystemMessage)
|
||||||
|
color = "§7▌§r"; // Background Gray
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((bool)message.isSignatureLegal!)
|
||||||
|
{
|
||||||
|
if (Config.Signature.ShowModifiedChat && message.unsignedContent != null)
|
||||||
|
{
|
||||||
|
if (Config.Signature.MarkModifiedMsg)
|
||||||
|
color = "§6▌§r"; // Background Yellow
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Config.Signature.MarkLegallySignedMsg)
|
||||||
|
color = "§2▌§r"; // Background Green
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Config.Signature.MarkIllegallySignedMsg)
|
||||||
|
color = "§4▌§r"; // Background Red
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -2648,7 +2678,7 @@ namespace MinecraftClient
|
||||||
messageText = message.content;
|
messageText = message.content;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Chat(messageText);
|
Log.Chat(color + messageText);
|
||||||
|
|
||||||
if (Config.Main.Advanced.ShowChatLinks)
|
if (Config.Main.Advanced.ShowChatLinks)
|
||||||
foreach (string link in links)
|
foreach (string link in links)
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ namespace MinecraftClient
|
||||||
|
|
||||||
public const string Version = MCHighestVersion;
|
public const string Version = MCHighestVersion;
|
||||||
public const string MCLowestVersion = "1.4.6";
|
public const string MCLowestVersion = "1.4.6";
|
||||||
public const string MCHighestVersion = "1.19.3";
|
public const string MCHighestVersion = "1.19.4";
|
||||||
public static readonly string? BuildInfo = null;
|
public static readonly string? BuildInfo = null;
|
||||||
|
|
||||||
private static Tuple<Thread, CancellationTokenSource>? offlinePrompt = null;
|
private static Tuple<Thread, CancellationTokenSource>? offlinePrompt = null;
|
||||||
|
|
|
||||||
|
|
@ -188,6 +188,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
y = (int)((locEncoded >> 26) & 0xFFF);
|
y = (int)((locEncoded >> 26) & 0xFFF);
|
||||||
z = (int)(locEncoded << 38 >> 38);
|
z = (int)(locEncoded << 38 >> 38);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x >= 0x02000000) // 33,554,432
|
if (x >= 0x02000000) // 33,554,432
|
||||||
x -= 0x04000000; // 67,108,864
|
x -= 0x04000000; // 67,108,864
|
||||||
if (y >= 0x00000800) // 2,048
|
if (y >= 0x00000800) // 2,048
|
||||||
|
|
@ -309,6 +310,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
if (j > 5) throw new OverflowException("VarInt too big");
|
if (j > 5) throw new OverflowException("VarInt too big");
|
||||||
if ((b & 0x80) != 128) break;
|
if ((b & 0x80) != 128) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -329,6 +331,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
i |= (b & 0x7F) << j++ * 7;
|
i |= (b & 0x7F) << j++ * 7;
|
||||||
if (j > 5) throw new OverflowException("VarInt too big");
|
if (j > 5) throw new OverflowException("VarInt too big");
|
||||||
} while ((b & 0x80) == 128);
|
} while ((b & 0x80) == 128);
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -360,6 +363,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
low &= 0x7FFF;
|
low &= 0x7FFF;
|
||||||
high = ReadNextByte(cache);
|
high = ReadNextByte(cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ((high & 0xFF) << 15) | low;
|
return ((high & 0xFF) << 15) | low;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -385,6 +389,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
throw new OverflowException("VarLong is too big");
|
throw new OverflowException("VarLong is too big");
|
||||||
}
|
}
|
||||||
} while ((read & 0x80) != 0);
|
} while ((read & 0x80) != 0);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -413,13 +418,18 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
/// <returns>The item that was read or NULL for an empty slot</returns>
|
/// <returns>The item that was read or NULL for an empty slot</returns>
|
||||||
public Item? ReadNextItemSlot(Queue<byte> cache, ItemPalette itemPalette)
|
public Item? ReadNextItemSlot(Queue<byte> cache, ItemPalette itemPalette)
|
||||||
{
|
{
|
||||||
|
// MC 1.13.2 and greater
|
||||||
if (protocolversion > Protocol18Handler.MC_1_13_Version)
|
if (protocolversion > Protocol18Handler.MC_1_13_Version)
|
||||||
{
|
{
|
||||||
// MC 1.13 and greater
|
|
||||||
bool itemPresent = ReadNextBool(cache);
|
bool itemPresent = ReadNextBool(cache);
|
||||||
if (itemPresent)
|
if (itemPresent)
|
||||||
{
|
{
|
||||||
ItemType type = itemPalette.FromId(ReadNextVarInt(cache));
|
int itemID = ReadNextVarInt(cache);
|
||||||
|
|
||||||
|
if (itemID == -1)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
ItemType type = itemPalette.FromId(itemID);
|
||||||
byte itemCount = ReadNextByte(cache);
|
byte itemCount = ReadNextByte(cache);
|
||||||
Dictionary<string, object> nbt = ReadNextNbt(cache);
|
Dictionary<string, object> nbt = ReadNextNbt(cache);
|
||||||
return new Item(type, itemCount, nbt);
|
return new Item(type, itemCount, nbt);
|
||||||
|
|
@ -428,12 +438,17 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// MC 1.12.2 and lower
|
// MC 1.13 and lower
|
||||||
short itemID = ReadNextShort(cache);
|
short itemID = ReadNextShort(cache);
|
||||||
|
|
||||||
if (itemID == -1)
|
if (itemID == -1)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
byte itemCount = ReadNextByte(cache);
|
byte itemCount = ReadNextByte(cache);
|
||||||
short itemDamage = ReadNextShort(cache);
|
|
||||||
|
if(protocolversion < Protocol18Handler.MC_1_13_Version)
|
||||||
|
ReadNextShort(cache);
|
||||||
|
|
||||||
Dictionary<string, object> nbt = ReadNextNbt(cache);
|
Dictionary<string, object> nbt = ReadNextNbt(cache);
|
||||||
return new Item(itemPalette.FromId(itemID), itemCount, nbt);
|
return new Item(itemPalette.FromId(itemID), itemCount, nbt);
|
||||||
}
|
}
|
||||||
|
|
@ -487,7 +502,8 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
short velocityY = ReadNextShort(cache);
|
short velocityY = ReadNextShort(cache);
|
||||||
short velocityZ = ReadNextShort(cache);
|
short velocityZ = ReadNextShort(cache);
|
||||||
|
|
||||||
return new Entity(entityID, entityType, new Location(entityX, entityY, entityZ), entityYaw, entityPitch, metadata);
|
return new Entity(entityID, entityType, new Location(entityX, entityY, entityZ), entityYaw, entityPitch,
|
||||||
|
metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -504,6 +520,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
cache.Dequeue();
|
cache.Dequeue();
|
||||||
return nbtData;
|
return nbtData;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cache.Peek() != 10) // TAG_Compound
|
if (cache.Peek() != 10) // TAG_Compound
|
||||||
throw new System.IO.InvalidDataException("Failed to decode NBT: Does not start with TAG_Compound");
|
throw new System.IO.InvalidDataException("Failed to decode NBT: Does not start with TAG_Compound");
|
||||||
ReadNextByte(cache); // Tag type (TAG_Compound)
|
ReadNextByte(cache); // Tag type (TAG_Compound)
|
||||||
|
|
@ -582,74 +599,62 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<int, object?> ReadNextMetadata(Queue<byte> cache, ItemPalette itemPalette)
|
//TODO: Refactor this to use new Entity Metadata Palettes
|
||||||
|
public Dictionary<int, object?> ReadNextMetadata(Queue<byte> cache, ItemPalette itemPalette, EntityMetadataPalette metadataPalette)
|
||||||
{
|
{
|
||||||
|
if (protocolversion <= Protocol18Handler.MC_1_8_Version)
|
||||||
|
throw new NotImplementedException(); // Require sepcial implementation
|
||||||
|
|
||||||
Dictionary<int, object?> data = new();
|
Dictionary<int, object?> data = new();
|
||||||
byte key = ReadNextByte(cache);
|
byte key = ReadNextByte(cache);
|
||||||
|
|
||||||
while (key != 0xff)
|
while (key != 0xff)
|
||||||
{
|
{
|
||||||
int type = ReadNextVarInt(cache);
|
int typeId = ReadNextVarInt(cache);
|
||||||
|
EntityMetaDataType type;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
type = metadataPalette.GetDataType(typeId);
|
||||||
|
}
|
||||||
|
catch (KeyNotFoundException)
|
||||||
|
{
|
||||||
|
throw new System.IO.InvalidDataException("Unknown Metadata Type ID " + typeId + ". Is this up to date for new MC Version?");
|
||||||
|
}
|
||||||
|
|
||||||
// Value's data type is depended on Type
|
// Value's data type is depended on Type
|
||||||
object? value = null;
|
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
|
|
||||||
// - type ID larger than 4
|
|
||||||
if (protocolversion < Protocol18Handler.MC_1_13_Version)
|
|
||||||
{
|
|
||||||
if (type > 4)
|
|
||||||
++type;
|
|
||||||
}
|
|
||||||
else if (protocolversion >= Protocol18Handler.MC_1_19_3_Version)
|
|
||||||
{
|
|
||||||
if (type == 2)
|
|
||||||
{
|
|
||||||
value = ReadNextVarLong(cache);
|
|
||||||
type = -1;
|
|
||||||
}
|
|
||||||
else if (type >= 3)
|
|
||||||
{
|
|
||||||
--type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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)
|
switch (type)
|
||||||
{
|
{
|
||||||
case -1: // already readed
|
case EntityMetaDataType.Byte: // byte
|
||||||
break;
|
|
||||||
case 0: // byte
|
|
||||||
value = ReadNextByte(cache);
|
value = ReadNextByte(cache);
|
||||||
break;
|
break;
|
||||||
case 1: // VarInt
|
case EntityMetaDataType.VarInt: // VarInt
|
||||||
value = ReadNextVarInt(cache);
|
value = ReadNextVarInt(cache);
|
||||||
break;
|
break;
|
||||||
case 2: // Float
|
case EntityMetaDataType.VarLong: // Long
|
||||||
|
value = ReadNextVarLong(cache);
|
||||||
|
break;
|
||||||
|
case EntityMetaDataType.Float: // Float
|
||||||
value = ReadNextFloat(cache);
|
value = ReadNextFloat(cache);
|
||||||
break;
|
break;
|
||||||
case 3: // String
|
case EntityMetaDataType.String: // String
|
||||||
value = ReadNextString(cache);
|
value = ReadNextString(cache);
|
||||||
break;
|
break;
|
||||||
case 4: // Chat
|
case EntityMetaDataType.Chat: // Chat
|
||||||
value = ReadNextString(cache);
|
value = ReadNextString(cache);
|
||||||
break;
|
break;
|
||||||
case 5: // Optional Chat
|
case EntityMetaDataType.OptionalChat: // Optional Chat
|
||||||
if (ReadNextBool(cache))
|
if (ReadNextBool(cache))
|
||||||
value = ReadNextString(cache);
|
value = ReadNextString(cache);
|
||||||
break;
|
break;
|
||||||
case 6: // Slot
|
case EntityMetaDataType.Slot: // Slot
|
||||||
value = ReadNextItemSlot(cache, itemPalette);
|
value = ReadNextItemSlot(cache, itemPalette);
|
||||||
break;
|
break;
|
||||||
case 7: // Boolean
|
case EntityMetaDataType.Boolean: // Boolean
|
||||||
value = ReadNextBool(cache);
|
value = ReadNextBool(cache);
|
||||||
break;
|
break;
|
||||||
case 8: // Rotation (3x floats)
|
case EntityMetaDataType.Rotation: // Rotation (3x floats)
|
||||||
value = new List<float>
|
value = new List<float>
|
||||||
{
|
{
|
||||||
ReadNextFloat(cache),
|
ReadNextFloat(cache),
|
||||||
|
|
@ -657,103 +662,38 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
ReadNextFloat(cache)
|
ReadNextFloat(cache)
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case 9: // Position
|
case EntityMetaDataType.Position: // Position
|
||||||
value = ReadNextLocation(cache);
|
value = ReadNextLocation(cache);
|
||||||
break;
|
break;
|
||||||
case 10: // Optional Position
|
case EntityMetaDataType.OptionalPosition: // Optional Position
|
||||||
if (ReadNextBool(cache))
|
if (ReadNextBool(cache))
|
||||||
{
|
{
|
||||||
value = ReadNextLocation(cache);
|
value = ReadNextLocation(cache);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 11: // Direction (VarInt)
|
case EntityMetaDataType.Direction: // Direction (VarInt)
|
||||||
value = ReadNextVarInt(cache);
|
value = ReadNextVarInt(cache);
|
||||||
break;
|
break;
|
||||||
case 12: // Optional UUID
|
case EntityMetaDataType.OptionalUuid: // Optional UUID
|
||||||
if (ReadNextBool(cache))
|
if (ReadNextBool(cache))
|
||||||
{
|
{
|
||||||
value = ReadNextUUID(cache);
|
value = ReadNextUUID(cache);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 13: // Optional BlockID (VarInt)
|
case EntityMetaDataType.BlockId: // BlockID (VarInt)
|
||||||
value = ReadNextVarInt(cache);
|
value = ReadNextVarInt(cache);
|
||||||
break;
|
break;
|
||||||
case 14: // NBT
|
case EntityMetaDataType.OptionalBlockId: // Optional BlockID (VarInt)
|
||||||
|
value = ReadNextVarInt(cache);
|
||||||
|
break;
|
||||||
|
case EntityMetaDataType.Nbt: // NBT
|
||||||
value = ReadNextNbt(cache);
|
value = ReadNextNbt(cache);
|
||||||
break;
|
break;
|
||||||
case 15: // Particle
|
case EntityMetaDataType.Particle: // Particle
|
||||||
// Currecutly not handled. Reading data only
|
// Skip data only, not used
|
||||||
int ParticleID = ReadNextVarInt(cache);
|
ReadParticleData(cache, itemPalette);
|
||||||
// Need to check the exact version where the change occurred!!!!!
|
|
||||||
if (protocolversion >= Protocol18Handler.MC_1_19_3_Version)
|
|
||||||
{
|
|
||||||
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;
|
break;
|
||||||
case 16: // Villager Data (3x VarInt)
|
case EntityMetaDataType.VillagerData: // Villager Data (3x VarInt)
|
||||||
value = new List<int>
|
value = new List<int>
|
||||||
{
|
{
|
||||||
ReadNextVarInt(cache),
|
ReadNextVarInt(cache),
|
||||||
|
|
@ -761,42 +701,223 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
ReadNextVarInt(cache)
|
ReadNextVarInt(cache)
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case 17: // Optional VarInt
|
case EntityMetaDataType.OptionalVarInt: // Optional VarInt
|
||||||
if (ReadNextBool(cache))
|
if (ReadNextBool(cache))
|
||||||
{
|
{
|
||||||
value = ReadNextVarInt(cache);
|
value = ReadNextVarInt(cache);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 18: // Pose
|
case EntityMetaDataType.Pose: // Pose
|
||||||
value = ReadNextVarInt(cache);
|
value = ReadNextVarInt(cache);
|
||||||
break;
|
break;
|
||||||
case 19: // Cat Variant
|
case EntityMetaDataType.CatVariant: // Cat Variant
|
||||||
value = ReadNextVarInt(cache);
|
value = ReadNextVarInt(cache);
|
||||||
break;
|
break;
|
||||||
case 20: // Frog Varint
|
case EntityMetaDataType.FrogVariant: // Frog Varint
|
||||||
value = ReadNextVarInt(cache);
|
value = ReadNextVarInt(cache);
|
||||||
break;
|
break;
|
||||||
case 21: // GlobalPos at 1.19.2+; Painting Variant at 1.19-
|
case EntityMetaDataType.GlobalPosition: // GlobalPos
|
||||||
if (protocolversion <= Protocol18Handler.MC_1_19_Version)
|
// Dimension and blockPos, currently not in use
|
||||||
value = ReadNextVarInt(cache);
|
value = new Tuple<string, Location>(ReadNextString(cache), ReadNextLocation(cache));
|
||||||
else
|
break;
|
||||||
|
case EntityMetaDataType.OptionalGlobalPosition:
|
||||||
|
// FIXME: wiki.vg is bool + string + location
|
||||||
|
// but minecraft-data is bool + string
|
||||||
|
if (ReadNextBool(cache))
|
||||||
{
|
{
|
||||||
// Dimension and blockPos, currently not in use
|
// Dimension and blockPos, currently not in use
|
||||||
value = new Tuple<string, Location>(ReadNextString(cache), ReadNextLocation(cache));
|
value = new Tuple<string, Location>(ReadNextString(cache), ReadNextLocation(cache));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 22: // Painting Variant
|
case EntityMetaDataType.PaintingVariant: // Painting Variant
|
||||||
value = ReadNextVarInt(cache);
|
value = ReadNextVarInt(cache);
|
||||||
break;
|
break;
|
||||||
default:
|
case EntityMetaDataType.SnifferState: // Sniffer state
|
||||||
throw new System.IO.InvalidDataException("Unknown Metadata Type ID " + type + ". Is this up to date for new MC Version?");
|
value = ReadNextVarInt(cache);
|
||||||
|
break;
|
||||||
|
case EntityMetaDataType.Vector3: // Vector 3f
|
||||||
|
value = new List<float>
|
||||||
|
{
|
||||||
|
ReadNextFloat(cache),
|
||||||
|
ReadNextFloat(cache),
|
||||||
|
ReadNextFloat(cache)
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case EntityMetaDataType.Quaternion: // Quaternion
|
||||||
|
value = new List<float>
|
||||||
|
{
|
||||||
|
ReadNextFloat(cache),
|
||||||
|
ReadNextFloat(cache),
|
||||||
|
ReadNextFloat(cache),
|
||||||
|
ReadNextFloat(cache)
|
||||||
|
};
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
data[key] = value;
|
data[key] = value;
|
||||||
key = ReadNextByte(cache);
|
key = ReadNextByte(cache);
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Currently not handled. Reading data only
|
||||||
|
protected void ReadParticleData(Queue<byte> cache, ItemPalette itemPalette)
|
||||||
|
{
|
||||||
|
if (protocolversion < Protocol18Handler.MC_1_13_Version)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int ParticleID = ReadNextVarInt(cache);
|
||||||
|
|
||||||
|
// Refernece:
|
||||||
|
// 1.19.3 - https://wiki.vg/index.php?title=Data_types&oldid=17986
|
||||||
|
// 1.18 - https://wiki.vg/index.php?title=Data_types&oldid=17180
|
||||||
|
// 1.17 - https://wiki.vg/index.php?title=Data_types&oldid=16740
|
||||||
|
// 1.15 - https://wiki.vg/index.php?title=Data_types&oldid=15338
|
||||||
|
// 1.13 - https://wiki.vg/index.php?title=Data_types&oldid=14271
|
||||||
|
|
||||||
|
switch (ParticleID)
|
||||||
|
{
|
||||||
|
case 2:
|
||||||
|
// 1.18 +
|
||||||
|
if (protocolversion > Protocol18Handler.MC_1_17_1_Version)
|
||||||
|
ReadNextVarInt(cache); // Block state (minecraft:block)
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if (protocolversion < Protocol18Handler.MC_1_17_Version
|
||||||
|
|| protocolversion > Protocol18Handler.MC_1_17_1_Version)
|
||||||
|
ReadNextVarInt(cache); // Block State (minecraft:block before 1.18, minecraft:block_marker after 1.18)
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
if (protocolversion == Protocol18Handler.MC_1_17_Version
|
||||||
|
|| protocolversion == Protocol18Handler.MC_1_17_1_Version)
|
||||||
|
ReadNextVarInt(cache); // Block State (minecraft:block)
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
// 1.13 - 1.14.4
|
||||||
|
if (protocolversion < Protocol18Handler.MC_1_15_Version)
|
||||||
|
ReadDustParticle(cache);
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
// 1.15 - 1.16.5 and 1.18 - 1.19.4
|
||||||
|
if ((protocolversion >= Protocol18Handler.MC_1_15_Version && protocolversion < Protocol18Handler.MC_1_17_Version)
|
||||||
|
|| protocolversion > Protocol18Handler.MC_1_17_1_Version)
|
||||||
|
ReadDustParticle(cache);
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
|
if (protocolversion == Protocol18Handler.MC_1_17_Version || protocolversion == Protocol18Handler.MC_1_17_1_Version)
|
||||||
|
ReadDustParticle(cache);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (protocolversion > Protocol18Handler.MC_1_17_1_Version)
|
||||||
|
ReadDustParticleColorTransition(cache);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
if (protocolversion == Protocol18Handler.MC_1_17_Version || protocolversion == Protocol18Handler.MC_1_17_1_Version)
|
||||||
|
ReadDustParticleColorTransition(cache);
|
||||||
|
break;
|
||||||
|
case 23:
|
||||||
|
// 1.15 - 1.16.5
|
||||||
|
if (protocolversion >= Protocol18Handler.MC_1_15_Version && protocolversion < Protocol18Handler.MC_1_17_Version)
|
||||||
|
ReadNextVarInt(cache); // Block State (minecraft:falling_dust)
|
||||||
|
break;
|
||||||
|
case 24:
|
||||||
|
// 1.18 - 1.19.2 onwards
|
||||||
|
if (protocolversion > Protocol18Handler.MC_1_17_1_Version && protocolversion < Protocol18Handler.MC_1_19_3_Version)
|
||||||
|
ReadNextVarInt(cache); // Block State (minecraft:falling_dust)
|
||||||
|
break;
|
||||||
|
case 25:
|
||||||
|
// 1.17 - 1.17.1 and 1.19.3 onwards
|
||||||
|
if (protocolversion == Protocol18Handler.MC_1_17_Version
|
||||||
|
|| protocolversion == Protocol18Handler.MC_1_17_1_Version
|
||||||
|
|| protocolversion >= Protocol18Handler.MC_1_19_3_Version)
|
||||||
|
ReadNextVarInt(cache); // Block State (minecraft:falling_dust)
|
||||||
|
break;
|
||||||
|
case 27:
|
||||||
|
// 1.13 - 1.14.4
|
||||||
|
if (protocolversion < Protocol18Handler.MC_1_15_Version)
|
||||||
|
ReadNextItemSlot(cache, itemPalette); // Item (minecraft:item)
|
||||||
|
break;
|
||||||
|
case 30:
|
||||||
|
if (protocolversion >= Protocol18Handler.MC_1_19_3_Version)
|
||||||
|
ReadNextFloat(cache); // Roll (minecraft:sculk_charge)
|
||||||
|
break;
|
||||||
|
case 32:
|
||||||
|
// 1.15 - 1.16.5
|
||||||
|
if (protocolversion >= Protocol18Handler.MC_1_15_Version && protocolversion < Protocol18Handler.MC_1_17_Version)
|
||||||
|
ReadNextItemSlot(cache, itemPalette); // Item (minecraft:item)
|
||||||
|
break;
|
||||||
|
case 36:
|
||||||
|
// 1.17 - 1.17.1
|
||||||
|
if (protocolversion == Protocol18Handler.MC_1_17_Version || protocolversion == Protocol18Handler.MC_1_17_1_Version)
|
||||||
|
{
|
||||||
|
ReadNextItemSlot(cache, itemPalette); // Item (minecraft:item)
|
||||||
|
}
|
||||||
|
else if (protocolversion > Protocol18Handler.MC_1_17_1_Version && protocolversion < Protocol18Handler.MC_1_19_3_Version)
|
||||||
|
{
|
||||||
|
// minecraft:vibration
|
||||||
|
ReadNextLocation(cache); // Origin (Starting Position)
|
||||||
|
ReadNextLocation(cache); // Desitination (Ending Position)
|
||||||
|
ReadNextVarInt(cache); // Ticks
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 37:
|
||||||
|
// minecraft:vibration
|
||||||
|
if (protocolversion == Protocol18Handler.MC_1_17_Version
|
||||||
|
|| protocolversion == Protocol18Handler.MC_1_17_1_Version)
|
||||||
|
{
|
||||||
|
ReadNextDouble(cache); // Origin X
|
||||||
|
ReadNextDouble(cache); // Origin Y
|
||||||
|
ReadNextDouble(cache); // Origin Z
|
||||||
|
ReadNextDouble(cache); // Destination X
|
||||||
|
ReadNextDouble(cache); // Destination Y
|
||||||
|
ReadNextDouble(cache); // Destination Z
|
||||||
|
ReadNextInt(cache); // Ticks
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 39:
|
||||||
|
if (protocolversion >= Protocol18Handler.MC_1_19_3_Version)
|
||||||
|
ReadNextItemSlot(cache, itemPalette); // Item (minecraft:item)
|
||||||
|
break;
|
||||||
|
case 40:
|
||||||
|
if (protocolversion >= Protocol18Handler.MC_1_19_3_Version)
|
||||||
|
{
|
||||||
|
string positionSourceType = ReadNextString(cache);
|
||||||
|
if (positionSourceType == "minecraft:block")
|
||||||
|
{
|
||||||
|
ReadNextLocation(cache);
|
||||||
|
}
|
||||||
|
else if (positionSourceType == "minecraft:entity")
|
||||||
|
{
|
||||||
|
ReadNextVarInt(cache);
|
||||||
|
ReadNextFloat(cache);
|
||||||
|
}
|
||||||
|
|
||||||
|
ReadNextVarInt(cache);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReadDustParticle(Queue<byte> cache)
|
||||||
|
{
|
||||||
|
ReadNextFloat(cache); // Red
|
||||||
|
ReadNextFloat(cache); // Green
|
||||||
|
ReadNextFloat(cache); // Blue
|
||||||
|
ReadNextFloat(cache); // Scale
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReadDustParticleColorTransition(Queue<byte> cache)
|
||||||
|
{
|
||||||
|
ReadNextFloat(cache); // From red
|
||||||
|
ReadNextFloat(cache); // From green
|
||||||
|
ReadNextFloat(cache); // From blue
|
||||||
|
ReadNextFloat(cache); // Scale
|
||||||
|
ReadNextFloat(cache); // To red
|
||||||
|
ReadNextFloat(cache); // To green
|
||||||
|
ReadNextFloat(cache); // To Blue
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Read a single villager trade from a cache of bytes and remove it from the cache
|
/// Read a single villager trade from a cache of bytes and remove it from the cache
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -823,7 +944,8 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
int specialPrice = ReadNextInt(cache);
|
int specialPrice = ReadNextInt(cache);
|
||||||
float priceMultiplier = ReadNextFloat(cache);
|
float priceMultiplier = ReadNextFloat(cache);
|
||||||
int demand = ReadNextInt(cache);
|
int demand = ReadNextInt(cache);
|
||||||
return new VillagerTrade(inputItem1, outputItem, inputItem2, tradeDisabled, numberOfTradeUses, maximumNumberOfTradeUses, xp, specialPrice, priceMultiplier, demand);
|
return new VillagerTrade(inputItem1, outputItem, inputItem2, tradeDisabled, numberOfTradeUses,
|
||||||
|
maximumNumberOfTradeUses, xp, specialPrice, priceMultiplier, demand);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -956,11 +1078,13 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
subsequentItemsBytes.AddRange(GetNbtField(item, out byte subsequentItemType));
|
subsequentItemsBytes.AddRange(GetNbtField(item, out byte subsequentItemType));
|
||||||
if (subsequentItemType != firstItemType)
|
if (subsequentItemType != firstItemType)
|
||||||
throw new System.IO.InvalidDataException(
|
throw new System.IO.InvalidDataException(
|
||||||
"GetNbt: Cannot encode object[] list with mixed types: " + firstItemTypeString + ", " + item.GetType().Name + " into NBT!");
|
"GetNbt: Cannot encode object[] list with mixed types: " + firstItemTypeString + ", " +
|
||||||
|
item.GetType().Name + " into NBT!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build NBT list: type, length, item array
|
// Build NBT list: type, length, item array
|
||||||
return ConcatBytes(new[] { firstItemType }, GetInt(arrayLengthTotal), firstItemBytes, subsequentItemsBytes.ToArray());
|
return ConcatBytes(new[] { firstItemType }, GetInt(arrayLengthTotal), firstItemBytes,
|
||||||
|
subsequentItemsBytes.ToArray());
|
||||||
}
|
}
|
||||||
else if (obj is Dictionary<string, object>)
|
else if (obj is Dictionary<string, object>)
|
||||||
{
|
{
|
||||||
|
|
@ -1008,6 +1132,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
bytes.Add((byte)(paramInt & 127 | 128));
|
bytes.Add((byte)(paramInt & 127 | 128));
|
||||||
paramInt = (int)(((uint)paramInt) >> 7);
|
paramInt = (int)(((uint)paramInt) >> 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes.Add((byte)paramInt);
|
bytes.Add((byte)paramInt);
|
||||||
return bytes.ToArray();
|
return bytes.ToArray();
|
||||||
}
|
}
|
||||||
|
|
@ -1152,9 +1277,15 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
byte[] locationBytes;
|
byte[] locationBytes;
|
||||||
if (protocolversion >= Protocol18Handler.MC_1_14_Version)
|
if (protocolversion >= Protocol18Handler.MC_1_14_Version)
|
||||||
{
|
{
|
||||||
locationBytes = BitConverter.GetBytes(((((ulong)location.X) & 0x3FFFFFF) << 38) | ((((ulong)location.Z) & 0x3FFFFFF) << 12) | (((ulong)location.Y) & 0xFFF));
|
locationBytes = BitConverter.GetBytes(((((ulong)location.X) & 0x3FFFFFF) << 38) |
|
||||||
|
((((ulong)location.Z) & 0x3FFFFFF) << 12) |
|
||||||
|
(((ulong)location.Y) & 0xFFF));
|
||||||
}
|
}
|
||||||
else locationBytes = BitConverter.GetBytes(((((ulong)location.X) & 0x3FFFFFF) << 38) | ((((ulong)location.Y) & 0xFFF) << 26) | (((ulong)location.Z) & 0x3FFFFFF));
|
else
|
||||||
|
locationBytes = BitConverter.GetBytes(((((ulong)location.X) & 0x3FFFFFF) << 38) |
|
||||||
|
((((ulong)location.Y) & 0xFFF) << 26) |
|
||||||
|
(((ulong)location.Z) & 0x3FFFFFF));
|
||||||
|
|
||||||
Array.Reverse(locationBytes); //Endianness
|
Array.Reverse(locationBytes); //Endianness
|
||||||
return locationBytes;
|
return locationBytes;
|
||||||
}
|
}
|
||||||
|
|
@ -1193,6 +1324,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
slotData.AddRange(GetNbt(item.NBT));
|
slotData.AddRange(GetNbt(item.NBT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return slotData.ToArray();
|
return slotData.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1278,17 +1410,18 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
public byte[] GetLastSeenMessageList(Message.LastSeenMessageList msgList, bool isOnlineMode)
|
public byte[] GetLastSeenMessageList(Message.LastSeenMessageList msgList, bool isOnlineMode)
|
||||||
{
|
{
|
||||||
if (!isOnlineMode)
|
if (!isOnlineMode)
|
||||||
return GetVarInt(0); // Message list size
|
return GetVarInt(0); // Message list size
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
List<byte> fields = new();
|
List<byte> fields = new();
|
||||||
fields.AddRange(GetVarInt(msgList.entries.Length)); // Message list size
|
fields.AddRange(GetVarInt(msgList.entries.Length)); // Message list size
|
||||||
foreach (Message.LastSeenMessageList.AcknowledgedMessage entry in msgList.entries)
|
foreach (Message.LastSeenMessageList.AcknowledgedMessage entry in msgList.entries)
|
||||||
{
|
{
|
||||||
fields.AddRange(entry.profileId.ToBigEndianBytes()); // UUID
|
fields.AddRange(entry.profileId.ToBigEndianBytes()); // UUID
|
||||||
fields.AddRange(GetVarInt(entry.signature.Length)); // Signature length
|
fields.AddRange(GetVarInt(entry.signature.Length)); // Signature length
|
||||||
fields.AddRange(entry.signature); // Signature data
|
fields.AddRange(entry.signature); // Signature data
|
||||||
}
|
}
|
||||||
|
|
||||||
return fields.ToArray();
|
return fields.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1304,15 +1437,16 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
List<byte> fields = new();
|
List<byte> fields = new();
|
||||||
fields.AddRange(GetLastSeenMessageList(ack.lastSeen, isOnlineMode));
|
fields.AddRange(GetLastSeenMessageList(ack.lastSeen, isOnlineMode));
|
||||||
if (!isOnlineMode || ack.lastReceived == null)
|
if (!isOnlineMode || ack.lastReceived == null)
|
||||||
fields.AddRange(GetBool(false)); // Has last received message
|
fields.AddRange(GetBool(false)); // Has last received message
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fields.AddRange(GetBool(true));
|
fields.AddRange(GetBool(true));
|
||||||
fields.AddRange(ack.lastReceived.profileId.ToBigEndianBytes()); // Has last received message
|
fields.AddRange(ack.lastReceived.profileId.ToBigEndianBytes()); // Has last received message
|
||||||
fields.AddRange(GetVarInt(ack.lastReceived.signature.Length)); // Last received message signature length
|
fields.AddRange(GetVarInt(ack.lastReceived.signature.Length)); // Last received message signature length
|
||||||
fields.AddRange(ack.lastReceived.signature); // Last received message signature data
|
fields.AddRange(ack.lastReceived.signature); // Last received message signature data
|
||||||
}
|
}
|
||||||
|
|
||||||
return fields.ToArray();
|
return fields.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,188 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||||
|
{
|
||||||
|
public class PacketPalette1194 : PacketTypePalette
|
||||||
|
{
|
||||||
|
private readonly Dictionary<int, PacketTypesIn> typeIn = new()
|
||||||
|
{
|
||||||
|
{ 0x00, PacketTypesIn.Bundle }, // Added in 1.19.4
|
||||||
|
{ 0x01, PacketTypesIn.SpawnEntity }, // Changed in 1.19 (Wiki name: Spawn Entity)
|
||||||
|
{ 0x02, PacketTypesIn.SpawnExperienceOrb }, // (Wiki name: Spawn Exeprience Orb)
|
||||||
|
{ 0x03, PacketTypesIn.SpawnPlayer }, //
|
||||||
|
{ 0x04, PacketTypesIn.EntityAnimation }, // (Wiki name: Entity Animation (clientbound))
|
||||||
|
{ 0x05, PacketTypesIn.Statistics }, // (Wiki name: Award Statistics)
|
||||||
|
{ 0x06, PacketTypesIn.BlockChangedAck }, // Added 1.19 (Wiki name: Acknowledge Block Change)
|
||||||
|
{ 0x07, PacketTypesIn.BlockBreakAnimation }, // (Wiki name: Set Block Destroy Stage)
|
||||||
|
{ 0x08, PacketTypesIn.BlockEntityData }, //
|
||||||
|
{ 0x09, PacketTypesIn.BlockAction }, //
|
||||||
|
{ 0x0A, PacketTypesIn.BlockChange }, // (Wiki name: Block Update)
|
||||||
|
{ 0x0B, PacketTypesIn.BossBar }, //
|
||||||
|
{ 0x0C, PacketTypesIn.ServerDifficulty }, // (Wiki name: Change Difficulty)
|
||||||
|
{ 0x0D, PacketTypesIn.ChunksBiomes }, // Added in 1.19.4
|
||||||
|
{ 0x0E, PacketTypesIn.ClearTiles }, //
|
||||||
|
{ 0x0F, PacketTypesIn.TabComplete }, // (Wiki name: Command Suggestions Response)
|
||||||
|
{ 0x10, PacketTypesIn.DeclareCommands }, // (Wiki name: Commands)
|
||||||
|
{ 0x11, PacketTypesIn.CloseWindow }, // (Wiki name: Close Container (clientbound))
|
||||||
|
{ 0x12, PacketTypesIn.WindowItems }, // (Wiki name: Set Container Content)
|
||||||
|
{ 0x13, PacketTypesIn.WindowProperty }, // (Wiki name: Set Container Property)
|
||||||
|
{ 0x14, PacketTypesIn.SetSlot }, // (Wiki name: Set Container Slot)
|
||||||
|
{ 0x15, PacketTypesIn.SetCooldown }, //
|
||||||
|
{ 0x16, PacketTypesIn.ChatSuggestions }, // Added in 1.19.1
|
||||||
|
{ 0x17, PacketTypesIn.PluginMessage }, // (Wiki name: Plugin Message (clientbound))
|
||||||
|
{ 0x18, PacketTypesIn.DamageEvent }, // Added in 1.19.4
|
||||||
|
{ 0x19, PacketTypesIn.HideMessage }, // Added in 1.19.1
|
||||||
|
{ 0x1A, PacketTypesIn.Disconnect }, //
|
||||||
|
{ 0x1B, PacketTypesIn.ProfilelessChatMessage }, // Added in 1.19.3 (Wiki name: Disguised Chat Message)
|
||||||
|
{ 0x1C, PacketTypesIn.EntityStatus }, // (Wiki name: Entity Event)
|
||||||
|
{ 0x1D, PacketTypesIn.Explosion }, // Changed in 1.19 (Location fields are now Double instead of Float) (Wiki name: Explosion)
|
||||||
|
{ 0x1E, PacketTypesIn.UnloadChunk }, // (Wiki name: Forget Chunk)
|
||||||
|
{ 0x1F, PacketTypesIn.ChangeGameState }, // (Wiki name: Game Event)
|
||||||
|
{ 0x20, PacketTypesIn.OpenHorseWindow }, // (Wiki name: Horse Screen Open)
|
||||||
|
{ 0x21, PacketTypesIn.HurtAnimation }, // 1.19.4
|
||||||
|
{ 0x22, PacketTypesIn.InitializeWorldBorder }, //
|
||||||
|
{ 0x23, PacketTypesIn.KeepAlive }, //
|
||||||
|
{ 0x24, PacketTypesIn.ChunkData }, //
|
||||||
|
{ 0x25, PacketTypesIn.Effect }, // (Wiki name: World Event)
|
||||||
|
{ 0x26, 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)
|
||||||
|
{ 0x27, PacketTypesIn.UpdateLight }, // (Wiki name: Light Update)
|
||||||
|
{ 0x28, PacketTypesIn.JoinGame }, // Changed in 1.19 (lot's of changes) (Wiki name: Login (play))
|
||||||
|
{ 0x29, PacketTypesIn.MapData }, // (Wiki name: Map Item Data)
|
||||||
|
{ 0x2A, PacketTypesIn.TradeList }, // (Wiki name: Merchant Offers)
|
||||||
|
{ 0x2B, PacketTypesIn.EntityPosition }, // (Wiki name: Move Entity Position)
|
||||||
|
{ 0x2C, PacketTypesIn.EntityPositionAndRotation }, // (Wiki name: Move Entity Position and Rotation)
|
||||||
|
{ 0x2D, PacketTypesIn.EntityRotation }, // (Wiki name: Move Entity Rotation)
|
||||||
|
{ 0x2E, PacketTypesIn.VehicleMove }, // (Wiki name: Move Vehicle)
|
||||||
|
{ 0x2F, PacketTypesIn.OpenBook }, //
|
||||||
|
{ 0x30, PacketTypesIn.OpenWindow }, // (Wiki name: Open Screen)
|
||||||
|
{ 0x31, PacketTypesIn.OpenSignEditor }, //
|
||||||
|
{ 0x32, PacketTypesIn.Ping }, // (Wiki name: Ping (play))
|
||||||
|
{ 0x33, PacketTypesIn.CraftRecipeResponse }, // (Wiki name: Place Ghost Recipe)
|
||||||
|
{ 0x34, PacketTypesIn.PlayerAbilities }, //
|
||||||
|
{ 0x35, PacketTypesIn.ChatMessage }, // Changed in 1.19 (Completely changed) (Wiki name: Player Chat Message) - TODO
|
||||||
|
{ 0x36, PacketTypesIn.EndCombatEvent }, // (Wiki name: Player Combat End)
|
||||||
|
{ 0x37, PacketTypesIn.EnterCombatEvent }, // (Wiki name: Player Combat Enter)
|
||||||
|
{ 0x38, PacketTypesIn.DeathCombatEvent }, // (Wiki name: Player Combat Kill)
|
||||||
|
{ 0x39, PacketTypesIn.PlayerRemove }, // Added in 1.19.3 (Not used)
|
||||||
|
{ 0x3A, PacketTypesIn.PlayerInfo }, // Changed in 1.19 (Heavy changes)
|
||||||
|
{ 0x3B, PacketTypesIn.FacePlayer }, // (Wiki name: Player Look At)
|
||||||
|
{ 0x3C, PacketTypesIn.PlayerPositionAndLook }, // (Wiki name: Player Position)
|
||||||
|
{ 0x3D, PacketTypesIn.UnlockRecipes }, // (Wiki name: Recipe)
|
||||||
|
{ 0x3E, PacketTypesIn.DestroyEntities }, // (Wiki name: Remove Entites)
|
||||||
|
{ 0x3F, PacketTypesIn.RemoveEntityEffect }, //
|
||||||
|
{ 0x40, PacketTypesIn.ResourcePackSend }, // (Wiki name: Resource Pack)
|
||||||
|
{ 0x41, PacketTypesIn.Respawn }, // Changed in 1.19 (Heavy changes)
|
||||||
|
{ 0x42, PacketTypesIn.EntityHeadLook }, // (Wiki name: Rotate Head)
|
||||||
|
{ 0x43, PacketTypesIn.MultiBlockChange }, // (Wiki name: Sections Block Update)
|
||||||
|
{ 0x44, PacketTypesIn.SelectAdvancementTab }, //
|
||||||
|
{ 0x45, PacketTypesIn.ServerData }, // Added in 1.19
|
||||||
|
{ 0x46, PacketTypesIn.ActionBar }, // (Wiki name: Set Action Bar Text)
|
||||||
|
{ 0x47, PacketTypesIn.WorldBorderCenter }, // (Wiki name: Set Border Center)
|
||||||
|
{ 0x48, PacketTypesIn.WorldBorderLerpSize }, //
|
||||||
|
{ 0x49, PacketTypesIn.WorldBorderSize }, // (Wiki name: Set World Border Size)
|
||||||
|
{ 0x4A, PacketTypesIn.WorldBorderWarningDelay }, // (Wiki name: Set World Border Warning Delay)
|
||||||
|
{ 0x4B, PacketTypesIn.WorldBorderWarningReach }, // (Wiki name: Set Border Warning Distance)
|
||||||
|
{ 0x4C, PacketTypesIn.Camera }, // (Wiki name: Set Camera)
|
||||||
|
{ 0x4D, PacketTypesIn.HeldItemChange }, // (Wiki name: Set Carried Item (clientbound))
|
||||||
|
{ 0x4E, PacketTypesIn.UpdateViewPosition }, // (Wiki name: Set Chunk Cache Center)
|
||||||
|
{ 0x4F, PacketTypesIn.UpdateViewDistance }, // (Wiki name: Set Chunk Cache Radius)
|
||||||
|
{ 0x50, PacketTypesIn.SpawnPosition }, // (Wiki name: Set Default Spawn Position)
|
||||||
|
{ 0x51, PacketTypesIn.DisplayScoreboard }, // (Wiki name: Set Display Objective)
|
||||||
|
{ 0x52, PacketTypesIn.EntityMetadata }, // (Wiki name: Set Entity Metadata)
|
||||||
|
{ 0x53, PacketTypesIn.AttachEntity }, // (Wiki name: Set Entity Link)
|
||||||
|
{ 0x54, PacketTypesIn.EntityVelocity }, // (Wiki name: Set Entity Motion)
|
||||||
|
{ 0x55, PacketTypesIn.EntityEquipment }, // (Wiki name: Set Equipment)
|
||||||
|
{ 0x56, PacketTypesIn.SetExperience }, //
|
||||||
|
{ 0x57, PacketTypesIn.UpdateHealth }, // (Wiki name: Set Health)
|
||||||
|
{ 0x58, PacketTypesIn.ScoreboardObjective }, // (Wiki name: Set Objective)
|
||||||
|
{ 0x59, PacketTypesIn.SetPassengers }, //
|
||||||
|
{ 0x5A, PacketTypesIn.Teams }, // (Wiki name: Set Player Team)
|
||||||
|
{ 0x5B, PacketTypesIn.UpdateScore }, // (Wiki name: Set Score)
|
||||||
|
{ 0x5C, PacketTypesIn.UpdateSimulationDistance }, // (Wiki name: Set Simulation Distance)
|
||||||
|
{ 0x5D, PacketTypesIn.SetTitleSubTitle }, // (Wiki name: Set Subtitle Test)
|
||||||
|
{ 0x5E, PacketTypesIn.TimeUpdate }, // (Wiki name: Set Time)
|
||||||
|
{ 0x5F, PacketTypesIn.SetTitleText }, // (Wiki name: Set Title)
|
||||||
|
{ 0x60, PacketTypesIn.SetTitleTime }, // (Wiki name: Set Titles Animation)
|
||||||
|
{ 0x61, PacketTypesIn.EntitySoundEffect }, // (Wiki name: Sound Entity)
|
||||||
|
{ 0x62, PacketTypesIn.SoundEffect }, // Changed in 1.19 (Added "Seed" field) (Wiki name: Sound Effect) (No need to be implemented)
|
||||||
|
{ 0x63, PacketTypesIn.StopSound }, //
|
||||||
|
{ 0x64, PacketTypesIn.SystemChat }, // Added in 1.19 (Wiki name: System Chat Message)
|
||||||
|
{ 0x65, PacketTypesIn.PlayerListHeaderAndFooter }, // (Wiki name: Tab List)
|
||||||
|
{ 0x66, PacketTypesIn.NBTQueryResponse }, // (Wiki name: Tab Query)
|
||||||
|
{ 0x67, PacketTypesIn.CollectItem }, // (Wiki name: Take Item Entity)
|
||||||
|
{ 0x68, PacketTypesIn.EntityTeleport }, // (Wiki name: Teleport Entity)
|
||||||
|
{ 0x69, PacketTypesIn.Advancements }, // (Wiki name: Update Advancements)
|
||||||
|
{ 0x6A, PacketTypesIn.EntityProperties }, // (Wiki name: Update Attributes)
|
||||||
|
{ 0x6B, PacketTypesIn.FeatureFlags }, // Added in 1.19.3 (Not yet clear what is the purpose of this packet)
|
||||||
|
{ 0x6C, PacketTypesIn.EntityEffect }, // Changed in 1.19 (Added "Has Factor Data" and "Factor Codec" fields) (Wiki name: Entity Effect)
|
||||||
|
{ 0x6D, PacketTypesIn.DeclareRecipes }, // (Wiki name: Update Recipes)
|
||||||
|
{ 0x6E, 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.PlayerSession }, // Added in 1.19.3
|
||||||
|
{ 0x07, PacketTypesOut.ClientStatus }, // (Wiki name: Client Command)
|
||||||
|
{ 0x08, PacketTypesOut.ClientSettings }, // (Wiki name: Client Information)
|
||||||
|
{ 0x09, PacketTypesOut.TabComplete }, // (Wiki name: Command Suggestions Request)
|
||||||
|
{ 0x0A, PacketTypesOut.ClickWindowButton }, // (Wiki name: Click Container Button)
|
||||||
|
{ 0x0B, PacketTypesOut.ClickWindow }, // (Wiki name: Click Container)
|
||||||
|
{ 0x0C, PacketTypesOut.CloseWindow }, // (Wiki name: Close Container (serverbound))
|
||||||
|
{ 0x0D, PacketTypesOut.PluginMessage }, // (Wiki name: Plugin Message (serverbound))
|
||||||
|
{ 0x0E, PacketTypesOut.EditBook }, //
|
||||||
|
{ 0x0F, PacketTypesOut.EntityNBTRequest }, // (Wiki name: Query Entity Tag)
|
||||||
|
{ 0x10, PacketTypesOut.InteractEntity }, // (Wiki name: Interact)
|
||||||
|
{ 0x11, PacketTypesOut.GenerateStructure }, // (Wiki name: Jigsaw Generate)
|
||||||
|
{ 0x12, PacketTypesOut.KeepAlive }, //
|
||||||
|
{ 0x13, PacketTypesOut.LockDifficulty }, //
|
||||||
|
{ 0x14, PacketTypesOut.PlayerPosition }, // (Wiki name: Move Player Position)
|
||||||
|
{ 0x15, PacketTypesOut.PlayerPositionAndRotation }, // (Wiki name: Set Player Position and Rotation)
|
||||||
|
{ 0x16, PacketTypesOut.PlayerRotation }, // (Wiki name: Set Player Rotation)
|
||||||
|
{ 0x17, PacketTypesOut.PlayerMovement }, // (Wiki name: Set Player On Ground)
|
||||||
|
{ 0x18, PacketTypesOut.VehicleMove }, // (Wiki name: Move Vehicle (serverbound))
|
||||||
|
{ 0x19, PacketTypesOut.SteerBoat }, // (Wiki name: Paddle Boat)
|
||||||
|
{ 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)
|
||||||
|
{ 0x1E, PacketTypesOut.EntityAction }, // (Wiki name: Player Command)
|
||||||
|
{ 0x1F, PacketTypesOut.SteerVehicle }, // (Wiki name: Player Input)
|
||||||
|
{ 0x20, PacketTypesOut.Pong }, // (Wiki name: Pong (play))
|
||||||
|
|
||||||
|
{ 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)
|
public PacketTypePalette GetTypeHandler(int protocol)
|
||||||
{
|
{
|
||||||
PacketTypePalette p;
|
PacketTypePalette p;
|
||||||
if (protocol > Protocol18Handler.MC_1_19_3_Version)
|
if (protocol > Protocol18Handler.MC_1_19_4_Version)
|
||||||
throw new NotImplementedException(Translations.exception_palette_packet);
|
throw new NotImplementedException(Translations.exception_palette_packet);
|
||||||
|
|
||||||
if (protocol <= Protocol18Handler.MC_1_8_Version)
|
if (protocol <= Protocol18Handler.MC_1_8_Version)
|
||||||
|
|
@ -60,7 +60,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
p = new PacketPalette1122();
|
p = new PacketPalette1122();
|
||||||
else if (protocol < Protocol18Handler.MC_1_14_Version)
|
else if (protocol < Protocol18Handler.MC_1_14_Version)
|
||||||
p = new PacketPalette113();
|
p = new PacketPalette113();
|
||||||
else if (protocol <= Protocol18Handler.MC_1_15_Version)
|
else if (protocol < Protocol18Handler.MC_1_15_Version)
|
||||||
p = new PacketPalette114();
|
p = new PacketPalette114();
|
||||||
else if (protocol <= Protocol18Handler.MC_1_15_2_Version)
|
else if (protocol <= Protocol18Handler.MC_1_15_2_Version)
|
||||||
p = new PacketPalette115();
|
p = new PacketPalette115();
|
||||||
|
|
@ -76,8 +76,10 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
p = new PacketPalette119();
|
p = new PacketPalette119();
|
||||||
else if (protocol <= Protocol18Handler.MC_1_19_2_Version)
|
else if (protocol <= Protocol18Handler.MC_1_19_2_Version)
|
||||||
p = new PacketPalette1192();
|
p = new PacketPalette1192();
|
||||||
else
|
else if (protocol <= Protocol18Handler.MC_1_19_3_Version)
|
||||||
p = new PacketPalette1193();
|
p = new PacketPalette1193();
|
||||||
|
else
|
||||||
|
p = new PacketPalette1194();
|
||||||
|
|
||||||
p.SetForgeEnabled(forgeEnabled);
|
p.SetForgeEnabled(forgeEnabled);
|
||||||
return p;
|
return p;
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
ActionBar, //
|
ActionBar, //
|
||||||
Advancements, //
|
Advancements, //
|
||||||
AttachEntity, //
|
AttachEntity, //
|
||||||
|
Bundle, // Added in 1.19.4
|
||||||
BlockAction, //
|
BlockAction, //
|
||||||
BlockBreakAnimation, //
|
BlockBreakAnimation, //
|
||||||
BlockChange, //
|
BlockChange, //
|
||||||
|
|
@ -20,12 +21,14 @@
|
||||||
ChatMessage, //
|
ChatMessage, //
|
||||||
ChatPreview, // Added in 1.19
|
ChatPreview, // Added in 1.19
|
||||||
ChatSuggestions, // Added in 1.19.1 (1.19.2)
|
ChatSuggestions, // Added in 1.19.1 (1.19.2)
|
||||||
|
ChunksBiomes, // Added in 1.19.4
|
||||||
ChunkData, //
|
ChunkData, //
|
||||||
ClearTiles, //
|
ClearTiles, //
|
||||||
CloseWindow, //
|
CloseWindow, //
|
||||||
CollectItem, //
|
CollectItem, //
|
||||||
CombatEvent, //
|
CombatEvent, //
|
||||||
CraftRecipeResponse, //
|
CraftRecipeResponse, //
|
||||||
|
DamageEvent, // Added in 1.19.4
|
||||||
DeathCombatEvent, //
|
DeathCombatEvent, //
|
||||||
DeclareCommands, //
|
DeclareCommands, //
|
||||||
DeclareRecipes, //
|
DeclareRecipes, //
|
||||||
|
|
@ -54,6 +57,7 @@
|
||||||
FeatureFlags, // Added in 1.19.3
|
FeatureFlags, // Added in 1.19.3
|
||||||
HeldItemChange, //
|
HeldItemChange, //
|
||||||
HideMessage, // Added in 1.19.1 (1.19.2)
|
HideMessage, // Added in 1.19.1 (1.19.2)
|
||||||
|
HurtAnimation, // Added in 1.19.4
|
||||||
InitializeWorldBorder, //
|
InitializeWorldBorder, //
|
||||||
JoinGame, //
|
JoinGame, //
|
||||||
KeepAlive, //
|
KeepAlive, //
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -4,15 +4,19 @@ namespace MinecraftClient.Protocol.Message
|
||||||
{
|
{
|
||||||
public class ChatMessage
|
public class ChatMessage
|
||||||
{
|
{
|
||||||
// in 1.19 and above, isSignedChat = true
|
/// <summary>
|
||||||
|
/// In 1.19 and above, isSignedChat = true
|
||||||
|
/// </summary>
|
||||||
public bool isSignedChat;
|
public bool isSignedChat;
|
||||||
|
|
||||||
public string content;
|
public string content;
|
||||||
|
|
||||||
public bool isJson, isSenderJson;
|
public bool isJson, isSenderJson;
|
||||||
|
|
||||||
// 0: chat (chat box), 1: system message (chat box), 2: game info (above hotbar), 3: say command,
|
/// <summary>
|
||||||
// 4: msg command, 5: team msg command, 6: emote command, 7: tellraw command
|
/// 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
|
||||||
|
/// </summary>
|
||||||
public int chatTypeId;
|
public int chatTypeId;
|
||||||
|
|
||||||
public Guid senderUUID;
|
public Guid senderUUID;
|
||||||
|
|
|
||||||
|
|
@ -142,34 +142,7 @@ namespace MinecraftClient.Protocol.Message
|
||||||
default:
|
default:
|
||||||
goto case MessageType.CHAT;
|
goto case MessageType.CHAT;
|
||||||
}
|
}
|
||||||
string color = string.Empty;
|
return text;
|
||||||
if (message.isSystemChat)
|
|
||||||
{
|
|
||||||
if (Config.Signature.MarkSystemMessage)
|
|
||||||
color = "§7▌§r"; // Background Gray
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((bool)message.isSignatureLegal!)
|
|
||||||
{
|
|
||||||
if (Config.Signature.ShowModifiedChat && message.unsignedContent != null)
|
|
||||||
{
|
|
||||||
if (Config.Signature.MarkModifiedMsg)
|
|
||||||
color = "§6▌§r"; // Background Yellow
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Config.Signature.MarkLegallySignedMsg)
|
|
||||||
color = "§2▌§r"; // Background Green
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Config.Signature.MarkIllegallySignedMsg)
|
|
||||||
color = "§4▌§r"; // Background Red
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return color + text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ namespace MinecraftClient.Protocol
|
||||||
if (Array.IndexOf(supportedVersions_Protocol16, ProtocolVersion) > -1)
|
if (Array.IndexOf(supportedVersions_Protocol16, ProtocolVersion) > -1)
|
||||||
return new Protocol16Handler(Client, ProtocolVersion, Handler);
|
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, 761 };
|
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, 762 };
|
||||||
|
|
||||||
if (Array.IndexOf(supportedVersions_Protocol18, ProtocolVersion) > -1)
|
if (Array.IndexOf(supportedVersions_Protocol18, ProtocolVersion) > -1)
|
||||||
return new Protocol18Handler(Client, ProtocolVersion, Handler, forgeInfo);
|
return new Protocol18Handler(Client, ProtocolVersion, Handler, forgeInfo);
|
||||||
|
|
@ -315,6 +315,8 @@ namespace MinecraftClient.Protocol
|
||||||
return 760;
|
return 760;
|
||||||
case "1.19.3":
|
case "1.19.3":
|
||||||
return 761;
|
return 761;
|
||||||
|
case "1.19.4":
|
||||||
|
return 762;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -392,6 +394,7 @@ namespace MinecraftClient.Protocol
|
||||||
case 759: return "1.19";
|
case 759: return "1.19";
|
||||||
case 760: return "1.19.2";
|
case 760: return "1.19.2";
|
||||||
case 761: return "1.19.3";
|
case 761: return "1.19.3";
|
||||||
|
case 762: return "1.19.4";
|
||||||
default: return "0.0";
|
default: return "0.0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue