mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
Merge pull request #20 from milutinke/fix/inventory-version-regressions
chores: Improved skills, pulled from master, formatted, removed unused imports.
This commit is contained in:
commit
f25fe53881
123 changed files with 1246 additions and 642 deletions
|
|
@ -115,6 +115,37 @@ Use this for TPS, movement-cadence, or packet-cadence work:
|
|||
|
||||
Run them against a real server with a temp config and summarize counts from the captured logs.
|
||||
|
||||
### 4. Full inventory regression sweep
|
||||
|
||||
Use this when touching inventory snapshots, player/container slot sync, creative inventory, item-slot serialization, packet palettes, game-mode updates, or block-use paths that open containers:
|
||||
|
||||
```bash
|
||||
tools/run-inventory-full-sweep.sh --versions "1.21.10 1.21.11"
|
||||
```
|
||||
|
||||
Default coverage includes:
|
||||
|
||||
- player inventory listing and inventory discovery
|
||||
- creative give/delete
|
||||
- inventory search
|
||||
- player right/left click stack split and merge
|
||||
- player drop one and drop all
|
||||
- chest open via `useblock`
|
||||
- container listing and close
|
||||
- mirrored player slots in container windows
|
||||
- shift-click and shift-right-click transfer
|
||||
- container right/left click, cursor stack, drop one, and drop all
|
||||
- creative middle-click command path
|
||||
- log scan for packet parse failures, queue-empty crashes, unhandled exceptions, and disconnects
|
||||
|
||||
The script writes `summary.tsv` under `RUN_ROOT` and per-version logs under `/tmp/mcc-debug/inventory-full-<version>/mcc-debug.log`.
|
||||
|
||||
When a matrix has existing PASS rows, do not rerun them unless a later code change affects that row or the user asks for a full rerun. Derive remaining rows from summaries:
|
||||
|
||||
```bash
|
||||
awk 'FNR>1 && $2=="PASS" {print $1}' /tmp/mcc-inventory-full-sweep/*/summary.tsv | sort -V | uniq
|
||||
```
|
||||
|
||||
## Preconditions
|
||||
|
||||
Before running any scenario:
|
||||
|
|
@ -165,6 +196,8 @@ Optionally override the login name with the fourth argument to the config helper
|
|||
- summarize the latest full-spectrum run
|
||||
- `tools/run-creative-e2e.sh`
|
||||
- ordered creative-mode E2E regression scenario
|
||||
- `tools/run-inventory-full-sweep.sh`
|
||||
- full inventory command/API sweep across one or more versions
|
||||
|
||||
## Evidence Discipline
|
||||
|
||||
|
|
@ -224,3 +257,7 @@ Always summarize:
|
|||
- If a test assertion fails, inspect the real MCC output before changing the code or weakening the assertion.
|
||||
- If an older server behaves oddly on Linux, check `use-native-transport=false` in `server.properties`.
|
||||
- If a matrix row fails before producing `mcc.log` or a command transcript, treat it as a harness failure, fix the environment, and rerun that row before drawing product conclusions.
|
||||
- If creative inventory commands report "You must be in Creative gamemode" after RCON switched the player, inspect game-mode update parsing before assuming creative inventory is broken. Modern servers can update local game mode through game event reason `3`.
|
||||
- If an inventory row crashes with `Queue empty` or `Failed to process incoming packet`, inspect packet palette routing before changing inventory code. A single shifted packet ID can make a healthy inventory feature look broken.
|
||||
- For chest-open failures, separate product and harness causes. The player may be standing inside the chest or suffocating on older servers. Stand beside the chest, put a floor under the player, and retry `useblock`.
|
||||
- For shared local servers, a `Done` log line does not prove RCON is ready. Retry setup commands and verify the actual RCON port from `server.properties`.
|
||||
|
|
|
|||
|
|
@ -157,6 +157,43 @@ When packet changes are detected:
|
|||
2. Create new `PacketPaletteXXX.cs` based on the previous one, adjusting IDs
|
||||
3. Update `PacketType18Handler.cs` routing
|
||||
|
||||
Use scriptable comparisons instead of eyeballing long packet tables. The packet ID is the registration index in `GameProtocols.java`:
|
||||
|
||||
```bash
|
||||
python3 - <<'PY'
|
||||
import re
|
||||
for ver in ["1.21.10", "1.21.11", "26.1"]:
|
||||
path=f"MinecraftOfficial/{ver}-decompiled/net/minecraft/network/protocol/game/GameProtocols.java"
|
||||
text=open(path).read()
|
||||
start=text.index("CLIENTBOUND_TEMPLATE")
|
||||
names=[m.group(1) for m in re.finditer(r"\.addPacket\(([^,]+),", text[start:])]
|
||||
print("==", ver, len(names))
|
||||
for i, name in enumerate(names):
|
||||
print(f"0x{i:02X}", name)
|
||||
PY
|
||||
```
|
||||
|
||||
For focused diffs:
|
||||
|
||||
```bash
|
||||
python3 - <<'PY'
|
||||
import re
|
||||
def packets(ver, marker):
|
||||
text=open(f"MinecraftOfficial/{ver}-decompiled/net/minecraft/network/protocol/game/GameProtocols.java").read()
|
||||
start=text.index(marker)
|
||||
return [m.group(1) for m in re.finditer(r"\.addPacket\(([^,]+),", text[start:])]
|
||||
left, right = "1.21.10", "1.21.11"
|
||||
a, b = packets(left, "CLIENTBOUND_TEMPLATE"), packets(right, "CLIENTBOUND_TEMPLATE")
|
||||
for i in range(max(len(a), len(b))):
|
||||
x = a[i] if i < len(a) else "<none>"
|
||||
y = b[i] if i < len(b) else "<none>"
|
||||
if x != y:
|
||||
print(f"0x{i:02X}: {left}={x} | {right}={y}")
|
||||
PY
|
||||
```
|
||||
|
||||
Do the same for `SERVERBOUND_TEMPLATE`. Clientbound and serverbound can change independently. Do not inherit a newer palette just because one side looks similar. For example, `1.21.11` used the same play packet order as `1.21.9/1.21.10` for the tested inventory path, while `26.1` had additional shifts.
|
||||
|
||||
## Step 5: Check Variant Encoding Changes
|
||||
|
||||
For entity types that use variant serializers (Cat, Wolf, Frog, Painting), check if the codec changed between versions by inspecting:
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ namespace MinecraftClient.ChatBots
|
|||
private void DoAntiAfkStuff()
|
||||
{
|
||||
var isMovementLocked = BotMovementLock.Instance;
|
||||
if (Config.Use_Terrain_Handling && GetTerrainEnabled() && isMovementLocked is {IsLocked: false})
|
||||
if (Config.Use_Terrain_Handling && GetTerrainEnabled() && isMovementLocked is { IsLocked: false })
|
||||
{
|
||||
var currentLocation = GetCurrentLocation();
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace MinecraftClient.ChatBots
|
|||
public PriorityType Priority = PriorityType.distance;
|
||||
|
||||
[TomlInlineComment("$ChatBot.AutoAttack.Cooldown_Time$")]
|
||||
public CooldownConfig Cooldown_Time = new(false, 1.0);
|
||||
public CooldownConfig Cooldown_Time = new();
|
||||
|
||||
[TomlInlineComment("$ChatBot.AutoAttack.Interaction$")]
|
||||
public InteractType Interaction = InteractType.Attack;
|
||||
|
|
@ -50,10 +50,19 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public void OnSettingUpdate()
|
||||
{
|
||||
if (Cooldown_Time.Custom && Cooldown_Time.value <= 0)
|
||||
if (Cooldown_Time.Custom)
|
||||
{
|
||||
LogToConsole(BotName, Translations.bot_autoAttack_invalidcooldown);
|
||||
Cooldown_Time.value = 1.0;
|
||||
if (Cooldown_Time.Min <= 0)
|
||||
Cooldown_Time.Min = 0.1;
|
||||
if (Cooldown_Time.Max <= 0)
|
||||
Cooldown_Time.Max = 0.1;
|
||||
|
||||
if (Cooldown_Time.Min > Cooldown_Time.Max)
|
||||
{
|
||||
double temp = Cooldown_Time.Min;
|
||||
Cooldown_Time.Min = Cooldown_Time.Max;
|
||||
Cooldown_Time.Max = temp;
|
||||
}
|
||||
}
|
||||
|
||||
if (Attack_Range < 1.0)
|
||||
|
|
@ -72,24 +81,16 @@ namespace MinecraftClient.ChatBots
|
|||
public struct CooldownConfig
|
||||
{
|
||||
public bool Custom;
|
||||
public double value;
|
||||
public bool RandomMode = false;
|
||||
public double Min = 1.5;
|
||||
public double Max = 2.5;
|
||||
|
||||
public CooldownConfig()
|
||||
{
|
||||
Custom = false;
|
||||
value = 0;
|
||||
}
|
||||
|
||||
public CooldownConfig(double value)
|
||||
{
|
||||
Custom = true;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public CooldownConfig(bool Override, double value)
|
||||
{
|
||||
this.Custom = Override;
|
||||
this.value = value;
|
||||
RandomMode = false;
|
||||
Min = 1.5;
|
||||
Max = 2.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -105,13 +106,14 @@ namespace MinecraftClient.ChatBots
|
|||
private float health = 100;
|
||||
private readonly bool attackHostile = true;
|
||||
private readonly bool attackPassive = false;
|
||||
private readonly Random _random = new();
|
||||
|
||||
public AutoAttack()
|
||||
{
|
||||
overrideAttackSpeed = Config.Cooldown_Time.Custom;
|
||||
if (Config.Cooldown_Time.Custom)
|
||||
{
|
||||
attackCooldownSeconds = Config.Cooldown_Time.value;
|
||||
attackCooldownSeconds = Config.Cooldown_Time.Min;
|
||||
attackCooldown = SecondsToAttackCooldownTicks(attackCooldownSeconds);
|
||||
}
|
||||
|
||||
|
|
@ -137,6 +139,12 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
if (attackCooldownCounter == 0)
|
||||
{
|
||||
if (Config.Cooldown_Time.Custom && Config.Cooldown_Time.RandomMode)
|
||||
{
|
||||
double randomSeconds = _random.NextDouble() * (Config.Cooldown_Time.Max - Config.Cooldown_Time.Min) + Config.Cooldown_Time.Min;
|
||||
attackCooldown = SecondsToAttackCooldownTicks(randomSeconds);
|
||||
}
|
||||
|
||||
attackCooldownCounter = attackCooldown;
|
||||
if (entitiesToAttack.Count > 0)
|
||||
{
|
||||
|
|
@ -177,6 +185,8 @@ namespace MinecraftClient.ChatBots
|
|||
InteractEntity(priorityEntity, Config.Interaction); // hit the entity!
|
||||
SendAnimation(Inventory.Hand.MainHand); // Arm animation
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -188,6 +198,7 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
InteractEntity(entity.Key, Config.Interaction); // hit the entity!
|
||||
}
|
||||
|
||||
}
|
||||
SendAnimation(Inventory.Hand.MainHand); // Arm animation
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,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,
|
||||
|
|
@ -149,6 +149,12 @@ namespace MinecraftClient.ChatBots
|
|||
}
|
||||
}
|
||||
|
||||
public override bool OnDisconnect(DisconnectReason reason, string message)
|
||||
{
|
||||
UnloadBot();
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
if (csharp) //C# compiled script
|
||||
|
|
@ -213,7 +219,7 @@ namespace MinecraftClient.ChatBots
|
|||
.ToLower();
|
||||
processedLine = string.Join("", processedLine.Split(default(string[]), StringSplitOptions.RemoveEmptyEntries));
|
||||
var parts = processedLine.Contains("to") ? processedLine.Split("to") : processedLine.Split("-");
|
||||
|
||||
|
||||
if (parts.Length == 2)
|
||||
{
|
||||
var min = Convert.ToInt32(parts[0]);
|
||||
|
|
@ -224,10 +230,12 @@ namespace MinecraftClient.ChatBots
|
|||
(min, max) = (max, min);
|
||||
LogToConsole(Translations.cmd_wait_random_min_bigger);
|
||||
}
|
||||
|
||||
|
||||
ticks = new Random().Next(min, max);
|
||||
} else ticks = Convert.ToInt32(instruction_line[5..]);
|
||||
} else ticks = Convert.ToInt32(instruction_line[5..]);
|
||||
}
|
||||
else ticks = Convert.ToInt32(instruction_line[5..]);
|
||||
}
|
||||
else ticks = Convert.ToInt32(instruction_line[5..]);
|
||||
}
|
||||
catch { }
|
||||
sleepticks = ticks;
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ namespace MinecraftClient.ChatBots
|
|||
replyParameters: message.MessageId,
|
||||
cancellationToken: _cancellationToken,
|
||||
parseMode: ParseMode.Markdown);
|
||||
return;;
|
||||
return; ;
|
||||
}
|
||||
|
||||
CmdResult result = new();
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ namespace MinecraftClient.Commands
|
|||
bool shouldInteractAt = entity.Type == EntityType.ArmorStand ||
|
||||
entity.Type == EntityType.ChestMinecart ||
|
||||
entity.Type == EntityType.ChestBoat;
|
||||
|
||||
|
||||
handler.InteractEntity(entity.ID, shouldInteractAt ? InteractType.InteractAt : InteractType.Interact);
|
||||
return Translations.cmd_entityCmd_used;
|
||||
case ActionType.List:
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ namespace MinecraftClient.Inventory
|
|||
Count = count;
|
||||
NBT = nbt;
|
||||
}
|
||||
|
||||
|
||||
public Item(ItemType itemType, int count, int data, Dictionary<string, object>? nbt) : this(itemType, count, nbt)
|
||||
{
|
||||
Data = data;
|
||||
|
|
@ -134,8 +134,8 @@ namespace MinecraftClient.Inventory
|
|||
{
|
||||
object[] displayName = (object[])displayProperties["Lore"];
|
||||
lores.AddRange(from string st in displayName
|
||||
let str = ChatParser.ParseText(st.ToString())
|
||||
select str);
|
||||
let str = ChatParser.ParseText(st.ToString())
|
||||
select str);
|
||||
return lores.ToArray();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace MinecraftClient.Inventory.ItemPalettes
|
|||
{
|
||||
if (DictReverse.ContainsKey(entry.Value))
|
||||
continue;
|
||||
|
||||
|
||||
DictReverse.Add(entry.Value, entry.Key);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class EntityMetadataPalette1122 : EntityMetadataPalette
|
|||
{ 12, EntityMetaDataType.OptionalBlockId },
|
||||
{ 13, EntityMetaDataType.Nbt },
|
||||
};
|
||||
|
||||
|
||||
public override Dictionary<int, EntityMetaDataType> GetEntityMetadataMappingsList()
|
||||
{
|
||||
return entityMetadataMappings;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class EntityMetadataPalette1191 : EntityMetadataPalette
|
|||
{ 21, EntityMetaDataType.OptionalGlobalPosition },
|
||||
{ 22, EntityMetaDataType.PaintingVariant }
|
||||
};
|
||||
|
||||
|
||||
public override Dictionary<int, EntityMetaDataType> GetEntityMetadataMappingsList()
|
||||
{
|
||||
return entityMetadataMappings;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class EntityMetadataPalette1193 : EntityMetadataPalette
|
|||
{ 22, EntityMetaDataType.OptionalGlobalPosition },
|
||||
{ 23, EntityMetaDataType.PaintingVariant }
|
||||
};
|
||||
|
||||
|
||||
public override Dictionary<int, EntityMetaDataType> GetEntityMetadataMappingsList()
|
||||
{
|
||||
return entityMetadataMappings;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class EntityMetadataPalette1194 : EntityMetadataPalette
|
|||
{ 26, EntityMetaDataType.Vector3 },
|
||||
{ 27, EntityMetaDataType.Quaternion },
|
||||
};
|
||||
|
||||
|
||||
public override Dictionary<int, EntityMetaDataType> GetEntityMetadataMappingsList()
|
||||
{
|
||||
return entityMetadataMappings;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public class EntityMetadataPalette18 : EntityMetadataPalette
|
|||
{ 6, EntityMetaDataType.Vector3Int },
|
||||
{ 7, EntityMetaDataType.Rotation }
|
||||
};
|
||||
|
||||
|
||||
public override Dictionary<int, EntityMetaDataType> GetEntityMetadataMappingsList()
|
||||
{
|
||||
return entityMetadataMappings;
|
||||
|
|
|
|||
|
|
@ -117,7 +117,8 @@ namespace MinecraftClient.Mapping
|
|||
return true;
|
||||
default:
|
||||
return false;
|
||||
};
|
||||
}
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace MinecraftClient.Mapping
|
|||
/// <summary>
|
||||
/// The dimension info of the world
|
||||
/// </summary>
|
||||
private static Dimension curDimension= new();
|
||||
private static Dimension curDimension = new();
|
||||
|
||||
private static readonly Dictionary<string, Dimension> dimensionList = new();
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ namespace MinecraftClient.Mapping
|
|||
public static void LoadDefaultDimensions1206Plus()
|
||||
{
|
||||
// TODO: Move this to a JSON file.
|
||||
|
||||
|
||||
var defaultRegistryCodec = new Dictionary<string, object>
|
||||
{
|
||||
{ "minecraft:dimension_type", new Dictionary<string, object>
|
||||
|
|
@ -323,58 +323,58 @@ namespace MinecraftClient.Mapping
|
|||
/// </summary>
|
||||
/// <param name="name"> The name of the dimension type</param>
|
||||
/// <param name="nbt">The dimension type (NBT Tag Compound)</param>
|
||||
public static void SetDimension(string name)
|
||||
{
|
||||
// Try to get the dimension using the name as is
|
||||
if (dimensionList.TryGetValue(name, out Dimension? dimension))
|
||||
{
|
||||
curDimension = dimension;
|
||||
return; // Dimension found
|
||||
}
|
||||
public static void SetDimension(string name)
|
||||
{
|
||||
// Try to get the dimension using the name as is
|
||||
if (dimensionList.TryGetValue(name, out Dimension? dimension))
|
||||
{
|
||||
curDimension = dimension;
|
||||
return; // Dimension found
|
||||
}
|
||||
|
||||
// If not found, check if name lacks 'minecraft:' prefix and try again
|
||||
if (!name.StartsWith("minecraft:"))
|
||||
{
|
||||
string prefixedName = "minecraft:" + name;
|
||||
if (dimensionList.TryGetValue(prefixedName, out dimension))
|
||||
{
|
||||
curDimension = dimension;
|
||||
return; // Dimension found with prefixed name
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string unprefixedName = name["minecraft:".Length..];
|
||||
if (dimensionList.TryGetValue(unprefixedName, out dimension))
|
||||
{
|
||||
curDimension = dimension;
|
||||
return;
|
||||
}
|
||||
}
|
||||
// If not found, check if name lacks 'minecraft:' prefix and try again
|
||||
if (!name.StartsWith("minecraft:"))
|
||||
{
|
||||
string prefixedName = "minecraft:" + name;
|
||||
if (dimensionList.TryGetValue(prefixedName, out dimension))
|
||||
{
|
||||
curDimension = dimension;
|
||||
return; // Dimension found with prefixed name
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string unprefixedName = name["minecraft:".Length..];
|
||||
if (dimensionList.TryGetValue(unprefixedName, out dimension))
|
||||
{
|
||||
curDimension = dimension;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (TryStoreDefaultVanillaDimension(name)
|
||||
&& dimensionList.TryGetValue(name, out dimension))
|
||||
{
|
||||
curDimension = dimension;
|
||||
return;
|
||||
}
|
||||
if (TryStoreDefaultVanillaDimension(name)
|
||||
&& dimensionList.TryGetValue(name, out dimension))
|
||||
{
|
||||
curDimension = dimension;
|
||||
return;
|
||||
}
|
||||
|
||||
// If still not found, dimension does not exist
|
||||
throw new KeyNotFoundException($"Dimension '{name}' not found in dimensions dictionary.");
|
||||
}
|
||||
// If still not found, dimension does not exist
|
||||
throw new KeyNotFoundException($"Dimension '{name}' not found in dimensions dictionary.");
|
||||
}
|
||||
|
||||
private static bool TryStoreDefaultVanillaDimension(string name)
|
||||
{
|
||||
var normalizedName = name.StartsWith("minecraft:")
|
||||
? name
|
||||
: "minecraft:" + name;
|
||||
private static bool TryStoreDefaultVanillaDimension(string name)
|
||||
{
|
||||
var normalizedName = name.StartsWith("minecraft:")
|
||||
? name
|
||||
: "minecraft:" + name;
|
||||
|
||||
if (normalizedName is not ("minecraft:overworld" or "minecraft:the_nether" or "minecraft:the_end"))
|
||||
return false;
|
||||
if (normalizedName is not ("minecraft:overworld" or "minecraft:the_nether" or "minecraft:the_end"))
|
||||
return false;
|
||||
|
||||
StoreOneDimension(name, new Dictionary<string, object>());
|
||||
return true;
|
||||
}
|
||||
StoreOneDimension(name, new Dictionary<string, object>());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ namespace MinecraftClient
|
|||
|
||||
// scoreboard teams (key = team name)
|
||||
private readonly Dictionary<string, PlayerTeam> teams = new(StringComparer.Ordinal);
|
||||
|
||||
|
||||
// Sneaking
|
||||
public bool IsSneaking { get; set; } = false;
|
||||
private bool isUnderSlab = false;
|
||||
|
|
@ -142,7 +142,7 @@ namespace MinecraftClient
|
|||
|
||||
// ChatBot OnNetworkPacket event
|
||||
private bool networkPacketCaptureEnabled = false;
|
||||
|
||||
|
||||
// Cookies
|
||||
private Dictionary<string, byte[]> Cookies { get; set; } = new();
|
||||
|
||||
|
|
@ -233,7 +233,7 @@ namespace MinecraftClient
|
|||
private bool consoleHandlersAttached = false;
|
||||
|
||||
public ILogger Log;
|
||||
|
||||
|
||||
private static IMinecraftComHandler? instance;
|
||||
public static IMinecraftComHandler? Instance => instance;
|
||||
|
||||
|
|
@ -250,7 +250,7 @@ namespace MinecraftClient
|
|||
{
|
||||
CmdResult.currentHandler = this;
|
||||
instance = this;
|
||||
|
||||
|
||||
terrainAndMovementsEnabled = Config.Main.Advanced.TerrainAndMovements;
|
||||
inventoryHandlingEnabled = Config.Main.Advanced.InventoryHandling;
|
||||
entityHandlingEnabled = Config.Main.Advanced.EntityHandling;
|
||||
|
|
@ -281,7 +281,7 @@ namespace MinecraftClient
|
|||
scope.SetTag("Protocol Version", protocolversion.ToString());
|
||||
scope.SetTag("Minecraft Version", ProtocolHandler.ProtocolVersion2MCVer(protocolversion));
|
||||
scope.SetTag("MCC Build", Program.BuildInfo is null ? "Debug" : Program.BuildInfo);
|
||||
|
||||
|
||||
if (forgeInfo is not null)
|
||||
scope.SetTag("Forge Version", forgeInfo.Version.ToString());
|
||||
|
||||
|
|
@ -291,17 +291,17 @@ namespace MinecraftClient
|
|||
MinecraftVersion = ProtocolHandler.ProtocolVersion2MCVer(protocolversion),
|
||||
ForgeInfo = forgeInfo?.Version
|
||||
};
|
||||
|
||||
scope.Contexts["Client Configuration"] = new
|
||||
|
||||
scope.Contexts["Client Configuration"] = new
|
||||
{
|
||||
TerrainAndMovementsEnabled = terrainAndMovementsEnabled,
|
||||
InventoryHandlingEnabled = inventoryHandlingEnabled,
|
||||
EntityHandlingEnabled = entityHandlingEnabled
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
SentrySdk.StartSession();
|
||||
|
||||
|
||||
/* Load commands from Commands namespace */
|
||||
LoadCommands();
|
||||
|
||||
|
|
@ -356,7 +356,7 @@ namespace MinecraftClient
|
|||
|
||||
return;
|
||||
|
||||
Retry:
|
||||
Retry:
|
||||
if (timeoutdetector is not null)
|
||||
{
|
||||
timeoutdetector.Item2.Cancel();
|
||||
|
|
@ -379,7 +379,7 @@ namespace MinecraftClient
|
|||
}
|
||||
|
||||
throw new Exception("Initialization failed.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// AutoRelog is enabled - invoke its static handler to trigger reconnection.
|
||||
|
|
@ -399,7 +399,7 @@ namespace MinecraftClient
|
|||
throw new Exception("Initialization failed.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Transfer(string newHost, int newPort)
|
||||
{
|
||||
// Do not block here: a new handler can start processing packets before the
|
||||
|
|
@ -419,13 +419,13 @@ namespace MinecraftClient
|
|||
{
|
||||
ResolveTransferAddress(ref resolvedHost, ref resolvedPort);
|
||||
Log.Info($"Initiating a transfer to: {resolvedHost}:{resolvedPort}");
|
||||
|
||||
|
||||
// Unload bots
|
||||
UnloadAllBots();
|
||||
bots.Clear();
|
||||
|
||||
ResetStateForTransfer();
|
||||
|
||||
|
||||
// Retire the old handler so its updater exits without reporting a stale disconnect.
|
||||
oldHandler.Dispose();
|
||||
oldClient.Close();
|
||||
|
|
@ -916,7 +916,7 @@ namespace MinecraftClient
|
|||
}
|
||||
|
||||
SentrySdk.EndSession();
|
||||
|
||||
|
||||
if (!will_restart)
|
||||
{
|
||||
StopConsoleSession();
|
||||
|
|
@ -2939,7 +2939,7 @@ namespace MinecraftClient
|
|||
_ => handler.SendInteractEntity(entityID, (int)type),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -3223,7 +3223,7 @@ namespace MinecraftClient
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Send the server a command to type in the item name in the Anvil inventory when it's open.
|
||||
/// </summary>
|
||||
|
|
@ -3235,7 +3235,7 @@ namespace MinecraftClient
|
|||
|
||||
if (inventories.Values.ToList().Last().Type != ContainerType.Anvil)
|
||||
return false;
|
||||
|
||||
|
||||
return handler.SendRenameItem(itemName);
|
||||
}
|
||||
|
||||
|
|
@ -3658,7 +3658,7 @@ namespace MinecraftClient
|
|||
if (!Config.Signature.ShowIllegalSignedChat && !message.isSystemChat && !(bool)message.isSignatureLegal!)
|
||||
return;
|
||||
messageText = ChatParser.ParseSignedChat(message, links);
|
||||
|
||||
|
||||
if (message.isSystemChat)
|
||||
{
|
||||
if (Config.Signature.MarkSystemMessage)
|
||||
|
|
@ -4656,7 +4656,7 @@ namespace MinecraftClient
|
|||
Entity entity = entities[entityID];
|
||||
entity.Metadata = metadata;
|
||||
int itemEntityMetadataFieldIndex = protocolversion < Protocol18Handler.MC_1_17_Version ? 7 : 8;
|
||||
|
||||
|
||||
if (entity.Type.ContainsItem() && metadata.TryGetValue(itemEntityMetadataFieldIndex, out object? itemObj) && itemObj is not null && itemObj.GetType() == typeof(Item))
|
||||
{
|
||||
Item item = (Item)itemObj;
|
||||
|
|
|
|||
|
|
@ -1392,18 +1392,18 @@ public sealed class MccMcpCapabilities : IMccMcpCapabilities
|
|||
bool success = client.SendLocationUpdate();
|
||||
return success
|
||||
? MccMcpResult.Ok(new
|
||||
{
|
||||
success,
|
||||
direction = parsedDirection.ToString(),
|
||||
yaw = client.GetYaw(),
|
||||
pitch = client.GetPitch(),
|
||||
location = ToCoordinate(current)
|
||||
})
|
||||
{
|
||||
success,
|
||||
direction = parsedDirection.ToString(),
|
||||
yaw = client.GetYaw(),
|
||||
pitch = client.GetPitch(),
|
||||
location = ToCoordinate(current)
|
||||
})
|
||||
: MccMcpResult.Fail("action_failed", data: new
|
||||
{
|
||||
success,
|
||||
direction = parsedDirection.ToString()
|
||||
});
|
||||
{
|
||||
success,
|
||||
direction = parsedDirection.ToString()
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -1426,19 +1426,19 @@ public sealed class MccMcpCapabilities : IMccMcpCapabilities
|
|||
bool success = client.SendLocationUpdate();
|
||||
return success
|
||||
? MccMcpResult.Ok(new
|
||||
{
|
||||
success,
|
||||
yaw = client.GetYaw(),
|
||||
pitch = client.GetPitch(),
|
||||
location = ToCoordinate(current)
|
||||
})
|
||||
{
|
||||
success,
|
||||
yaw = client.GetYaw(),
|
||||
pitch = client.GetPitch(),
|
||||
location = ToCoordinate(current)
|
||||
})
|
||||
: MccMcpResult.Fail("action_failed", data: new
|
||||
{
|
||||
success,
|
||||
yaw,
|
||||
pitch,
|
||||
location = ToCoordinate(current)
|
||||
});
|
||||
{
|
||||
success,
|
||||
yaw,
|
||||
pitch,
|
||||
location = ToCoordinate(current)
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,6 @@ public enum ConfigurationPacketTypesIn
|
|||
ClearDialog, // Added in 1.21.6
|
||||
ShowDialog, // Added in 1.21.6
|
||||
CodeOfConduct, // Added in 1.21.9
|
||||
|
||||
|
||||
Unknown
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,6 @@ public enum ConfigurationPacketTypesOut
|
|||
KnownDataPacks,
|
||||
CustomClickAction, // Added in 1.21.6
|
||||
AcceptCodeOfConduct, // Added in 1.21.9
|
||||
|
||||
|
||||
Unknown
|
||||
}
|
||||
|
|
@ -459,7 +459,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
var nbt = null as Dictionary<string, object>;
|
||||
var item = null as Item;
|
||||
var strcturedComponentsToAdd = new List<StructuredComponent>();
|
||||
|
||||
|
||||
switch (protocolversion)
|
||||
{
|
||||
// MC 1.13.2 and greater
|
||||
|
|
@ -467,10 +467,10 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
itemCount = ReadNextVarInt(cache);
|
||||
|
||||
if (itemCount <= 0) return null;
|
||||
|
||||
|
||||
itemId = ReadNextVarInt(cache);
|
||||
item = new Item(itemPalette.FromId(itemId), itemCount, null);
|
||||
|
||||
|
||||
var numberOfComponentsToAdd = ReadNextVarInt(cache);
|
||||
var numberofComponentsToRemove = ReadNextVarInt(cache);
|
||||
var structuredComponentHandler = new StructuredComponentsHandler(protocolversion, this, itemPalette);
|
||||
|
|
@ -506,55 +506,55 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
|
||||
return item;
|
||||
case >= Protocol18Handler.MC_1_13_2_Version:
|
||||
{
|
||||
var itemPresent = ReadNextBool(cache);
|
||||
{
|
||||
var itemPresent = ReadNextBool(cache);
|
||||
|
||||
if (!itemPresent)
|
||||
return null;
|
||||
if (!itemPresent)
|
||||
return null;
|
||||
|
||||
itemId = ReadNextVarInt(cache);
|
||||
itemId = ReadNextVarInt(cache);
|
||||
|
||||
if (itemId == -1)
|
||||
return null;
|
||||
if (itemId == -1)
|
||||
return null;
|
||||
|
||||
var type = itemPalette.FromId(itemId);
|
||||
itemCount = ReadNextByte(cache);
|
||||
nbt = ReadNextNbt(cache);
|
||||
return new Item(type, itemCount, itemId, nbt);
|
||||
}
|
||||
var type = itemPalette.FromId(itemId);
|
||||
itemCount = ReadNextByte(cache);
|
||||
nbt = ReadNextNbt(cache);
|
||||
return new Item(type, itemCount, itemId, nbt);
|
||||
}
|
||||
case >= Protocol18Handler.MC_1_13_Version:
|
||||
{
|
||||
itemId = ReadNextShort(cache);
|
||||
{
|
||||
itemId = ReadNextShort(cache);
|
||||
|
||||
if (itemId == -1)
|
||||
return null;
|
||||
if (itemId == -1)
|
||||
return null;
|
||||
|
||||
var type = itemPalette.FromId(itemId);
|
||||
itemCount = ReadNextByte(cache);
|
||||
nbt = ReadNextNbt(cache);
|
||||
return new Item(type, itemCount, itemId, nbt);
|
||||
}
|
||||
var type = itemPalette.FromId(itemId);
|
||||
itemCount = ReadNextByte(cache);
|
||||
nbt = ReadNextNbt(cache);
|
||||
return new Item(type, itemCount, itemId, nbt);
|
||||
}
|
||||
default:
|
||||
{
|
||||
itemId = ReadNextShort(cache);
|
||||
{
|
||||
itemId = ReadNextShort(cache);
|
||||
|
||||
if (itemId == -1)
|
||||
return null;
|
||||
if (itemId == -1)
|
||||
return null;
|
||||
|
||||
itemCount = ReadNextByte(cache);
|
||||
var data = ReadNextShort(cache);
|
||||
nbt = ReadNextNbt(cache);
|
||||
itemCount = ReadNextByte(cache);
|
||||
var data = ReadNextShort(cache);
|
||||
nbt = ReadNextNbt(cache);
|
||||
|
||||
// For 1.8 - 1.12.2 we combine Item Id and Item Data/Damage to a single value using: (id << 16) | data
|
||||
return new Item(itemPalette.FromId((itemId << 16) | (ushort)data), itemCount, data, nbt);
|
||||
}
|
||||
// For 1.8 - 1.12.2 we combine Item Id and Item Data/Damage to a single value using: (id << 16) | data
|
||||
return new Item(itemPalette.FromId((itemId << 16) | (ushort)data), itemCount, data, nbt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ReadNextDetail(Queue<byte> cache)
|
||||
{
|
||||
var potionEffectId = ReadNextVarInt(cache);
|
||||
|
||||
|
||||
// Details
|
||||
var potionEffectAmplifier = ReadNextVarInt(cache);
|
||||
var duration = ReadNextVarInt(cache); // -1 for infinite
|
||||
|
|
@ -1179,14 +1179,14 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
if (protocolversion >= Protocol18Handler.MC_1_20_6_Version)
|
||||
ReadNextVarInt(cache); // BlockState (minecraft:block)
|
||||
break;
|
||||
|
||||
|
||||
case 2:
|
||||
// 1.18
|
||||
if (protocolversion > Protocol18Handler.MC_1_17_1_Version)
|
||||
ReadNextVarInt(cache); // Block state (minecraft:block before 1.20.6, minecraft:block_marker in 1.20.6+)
|
||||
break;
|
||||
case 3:
|
||||
if (protocolversion is (< Protocol18Handler.MC_1_17_Version or > Protocol18Handler.MC_1_17_1_Version)
|
||||
if (protocolversion is (< Protocol18Handler.MC_1_17_Version or > Protocol18Handler.MC_1_17_1_Version)
|
||||
and < Protocol18Handler.MC_1_20_6_Version)
|
||||
ReadNextVarInt(
|
||||
cache); // Block State (minecraft:block before 1.18, minecraft:block_marker after 1.18 up to 1.20.6)
|
||||
|
|
@ -1346,7 +1346,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
break;
|
||||
case 45:
|
||||
// 1.21+
|
||||
if(protocolversion >= Protocol18Handler.MC_1_21_Version)
|
||||
if (protocolversion >= Protocol18Handler.MC_1_21_Version)
|
||||
ReadVibration(cache);
|
||||
break;
|
||||
case 99:
|
||||
|
|
@ -1389,7 +1389,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
ReadNextFloat(cache); // Entity eye height
|
||||
ReadNextVarInt(cache); // Ticks
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Read a single villager trade from a cache of bytes and remove it from the cache
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ namespace MinecraftClient.Protocol.Handlers.Forge
|
|||
break;
|
||||
case FMLVersion.FML3:
|
||||
// Example ModInfo for Minecraft 1.18 and greater (FML3)
|
||||
|
||||
|
||||
// "forgeData": {
|
||||
// "channels": [],
|
||||
// "mods": [],
|
||||
|
|
@ -169,24 +169,26 @@ namespace MinecraftClient.Protocol.Handlers.Forge
|
|||
// [ Channel Version ][ String ]
|
||||
// [ Required On Client ][ Bool ]
|
||||
|
||||
for (var i = 0; i < modsSize; i++) {
|
||||
for (var i = 0; i < modsSize; i++)
|
||||
{
|
||||
var channelSizeAndVersionFlag = dataTypes.ReadNextVarInt(dataPackage);
|
||||
var channelSize = channelSizeAndVersionFlag >> 1;
|
||||
|
||||
int VERSION_FLAG_IGNORESERVERONLY = 0b1;
|
||||
var isIgnoreServerOnly = (channelSizeAndVersionFlag & VERSION_FLAG_IGNORESERVERONLY) != 0;
|
||||
|
||||
|
||||
var modId = dataTypes.ReadNextString(dataPackage);
|
||||
|
||||
|
||||
string IGNORESERVERONLY = "IGNORED";
|
||||
var modVersion = isIgnoreServerOnly ? IGNORESERVERONLY : dataTypes.ReadNextString(dataPackage);
|
||||
|
||||
for (var i1 = 0; i1 < channelSize; i1++) {
|
||||
|
||||
for (var i1 = 0; i1 < channelSize; i1++)
|
||||
{
|
||||
dataTypes.ReadNextString(dataPackage); // channelName
|
||||
dataTypes.ReadNextString(dataPackage); // channelVersion
|
||||
dataTypes.ReadNextBool(dataPackage); // requiredOnClient
|
||||
}
|
||||
|
||||
|
||||
mods.Add(modId, modVersion);
|
||||
Mods.Add(new ForgeMod(modId, modVersion));
|
||||
}
|
||||
|
|
@ -213,7 +215,8 @@ namespace MinecraftClient.Protocol.Handlers.Forge
|
|||
/// The code below is converted from forge source code, see:
|
||||
/// https://github.com/MinecraftForge/MinecraftForge/blob/cb12df41e13da576b781be695f80728b9594c25f/src/main/java/net/minecraftforge/network/ServerStatusPing.java#L361
|
||||
/// </para>
|
||||
private static Queue<byte> decodeOptimized(string encodedData) {
|
||||
private static Queue<byte> decodeOptimized(string encodedData)
|
||||
{
|
||||
int size0 = encodedData[0];
|
||||
int size1 = encodedData[1];
|
||||
int size = size0 | (size1 << 15);
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x34, PacketTypesOut.PlayerBlockPlacement }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item On)
|
||||
{ 0x35, PacketTypesOut.UseItem }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item)
|
||||
};
|
||||
|
||||
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesIn> configurationTypesIn = new()
|
||||
{
|
||||
{ 0x00, ConfigurationPacketTypesIn.PluginMessage },
|
||||
|
|
@ -201,7 +201,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x04, ConfigurationPacketTypesOut.Pong },
|
||||
{ 0x05, ConfigurationPacketTypesOut.ResourcePackResponse }
|
||||
};
|
||||
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => configurationTypesIn!;
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ using System.Collections.Generic;
|
|||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes;
|
||||
|
||||
public class PacketPalette1204 : PacketTypePalette
|
||||
{
|
||||
private readonly Dictionary<int, PacketTypesIn> typeIn = new()
|
||||
{
|
||||
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)
|
||||
|
|
@ -125,7 +125,7 @@ public class PacketPalette1204 : PacketTypePalette
|
|||
{ 0x74, PacketTypesIn.Tags }, // (Wiki name: Update Tags)
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, PacketTypesOut> typeOut = new()
|
||||
private readonly Dictionary<int, PacketTypesOut> typeOut = new()
|
||||
{
|
||||
{ 0x00, PacketTypesOut.TeleportConfirm }, // (Wiki name: Confirm Teleportation)
|
||||
{ 0x01, PacketTypesOut.QueryBlockNBT }, // (Wiki name: Query Block Entity Tag)
|
||||
|
|
@ -184,7 +184,7 @@ public class PacketPalette1204 : PacketTypePalette
|
|||
{ 0x36, PacketTypesOut.UseItem }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item)
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesIn> configurationTypesIn = new()
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesIn> configurationTypesIn = new()
|
||||
{
|
||||
{ 0x00, ConfigurationPacketTypesIn.PluginMessage },
|
||||
{ 0x01, ConfigurationPacketTypesIn.Disconnect },
|
||||
|
|
@ -198,7 +198,7 @@ public class PacketPalette1204 : PacketTypePalette
|
|||
{ 0x09, ConfigurationPacketTypesIn.UpdateTags },
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesOut> configurationTypesOut = new()
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesOut> configurationTypesOut = new()
|
||||
{
|
||||
{ 0x00, ConfigurationPacketTypesOut.ClientInformation },
|
||||
{ 0x01, ConfigurationPacketTypesOut.PluginMessage },
|
||||
|
|
@ -207,9 +207,9 @@ public class PacketPalette1204 : PacketTypePalette
|
|||
{ 0x04, ConfigurationPacketTypesOut.Pong },
|
||||
{ 0x05, ConfigurationPacketTypesOut.ResourcePackResponse }
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => configurationTypesIn!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => configurationTypesOut!;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => configurationTypesIn!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => configurationTypesOut!;
|
||||
}
|
||||
|
|
@ -3,8 +3,8 @@ using System.Collections.Generic;
|
|||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes;
|
||||
|
||||
public class PacketPalette1206 : PacketTypePalette
|
||||
{
|
||||
private readonly Dictionary<int, PacketTypesIn> typeIn = new()
|
||||
{
|
||||
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)
|
||||
|
|
@ -130,7 +130,7 @@ public class PacketPalette1206 : PacketTypePalette
|
|||
{ 0x79, PacketTypesIn.ProjectilePower }, // Added in 1.20.6
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, PacketTypesOut> typeOut = new()
|
||||
private readonly Dictionary<int, PacketTypesOut> typeOut = new()
|
||||
{
|
||||
{ 0x00, PacketTypesOut.TeleportConfirm }, // (Wiki name: Confirm Teleportation)
|
||||
{ 0x01, PacketTypesOut.QueryBlockNBT }, // (Wiki name: Query Block Entity Tag)
|
||||
|
|
@ -192,7 +192,7 @@ public class PacketPalette1206 : PacketTypePalette
|
|||
{ 0x39, PacketTypesOut.UseItem }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item)
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesIn> configurationTypesIn = new()
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesIn> configurationTypesIn = new()
|
||||
{
|
||||
{ 0x00, ConfigurationPacketTypesIn.CookieRequest },
|
||||
{ 0x01, ConfigurationPacketTypesIn.PluginMessage },
|
||||
|
|
@ -211,7 +211,7 @@ public class PacketPalette1206 : PacketTypePalette
|
|||
{ 0x0E, ConfigurationPacketTypesIn.KnownDataPacks }
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesOut> configurationTypesOut = new()
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesOut> configurationTypesOut = new()
|
||||
{
|
||||
{ 0x00, ConfigurationPacketTypesOut.ClientInformation },
|
||||
{ 0x01, ConfigurationPacketTypesOut.CookieResponse },
|
||||
|
|
@ -222,9 +222,9 @@ public class PacketPalette1206 : PacketTypePalette
|
|||
{ 0x06, ConfigurationPacketTypesOut.ResourcePackResponse },
|
||||
{ 0x07, ConfigurationPacketTypesOut.KnownDataPacks }
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => configurationTypesIn!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => configurationTypesOut!;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => configurationTypesIn!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => configurationTypesOut!;
|
||||
}
|
||||
|
|
@ -3,8 +3,8 @@ using System.Collections.Generic;
|
|||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes;
|
||||
|
||||
public class PacketPalette121 : PacketTypePalette
|
||||
{
|
||||
private readonly Dictionary<int, PacketTypesIn> typeIn = new()
|
||||
{
|
||||
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)
|
||||
|
|
@ -132,7 +132,7 @@ public class PacketPalette121 : PacketTypePalette
|
|||
{ 0x7B, PacketTypesIn.ServerLinks } // Added in 1.21
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, PacketTypesOut> typeOut = new()
|
||||
private readonly Dictionary<int, PacketTypesOut> typeOut = new()
|
||||
{
|
||||
{ 0x00, PacketTypesOut.TeleportConfirm }, // (Wiki name: Confirm Teleportation)
|
||||
{ 0x01, PacketTypesOut.QueryBlockNBT }, // (Wiki name: Query Block Entity Tag)
|
||||
|
|
@ -194,7 +194,7 @@ public class PacketPalette121 : PacketTypePalette
|
|||
{ 0x39, PacketTypesOut.UseItem }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item)
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesIn> configurationTypesIn = new()
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesIn> configurationTypesIn = new()
|
||||
{
|
||||
{ 0x00, ConfigurationPacketTypesIn.CookieRequest },
|
||||
{ 0x01, ConfigurationPacketTypesIn.PluginMessage },
|
||||
|
|
@ -215,7 +215,7 @@ public class PacketPalette121 : PacketTypePalette
|
|||
{ 0x10, ConfigurationPacketTypesIn.ServerLinks } // Added in 1.21 (Not used)
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesOut> configurationTypesOut = new()
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesOut> configurationTypesOut = new()
|
||||
{
|
||||
{ 0x00, ConfigurationPacketTypesOut.ClientInformation },
|
||||
{ 0x01, ConfigurationPacketTypesOut.CookieResponse },
|
||||
|
|
@ -226,9 +226,9 @@ public class PacketPalette121 : PacketTypePalette
|
|||
{ 0x06, ConfigurationPacketTypesOut.ResourcePackResponse },
|
||||
{ 0x07, ConfigurationPacketTypesOut.KnownDataPacks }
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => configurationTypesIn!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => configurationTypesOut!;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => configurationTypesIn!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => configurationTypesOut!;
|
||||
}
|
||||
|
|
@ -3,8 +3,8 @@ using System.Collections.Generic;
|
|||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes;
|
||||
|
||||
public class PacketPalette1212 : PacketTypePalette
|
||||
{
|
||||
private readonly Dictionary<int, PacketTypesIn> typeIn = new()
|
||||
{
|
||||
private readonly Dictionary<int, PacketTypesIn> typeIn = new()
|
||||
{
|
||||
{ 0x00, PacketTypesIn.Bundle }, // Bundle delimiter
|
||||
{ 0x01, PacketTypesIn.SpawnEntity }, // Add Entity
|
||||
|
|
@ -139,7 +139,7 @@ public class PacketPalette1212 : PacketTypePalette
|
|||
{ 0x82, PacketTypesIn.ServerLinks } // Server Links
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, PacketTypesOut> typeOut = new()
|
||||
private readonly Dictionary<int, PacketTypesOut> typeOut = new()
|
||||
{
|
||||
{ 0x00, PacketTypesOut.TeleportConfirm }, // Accept Teleportation
|
||||
{ 0x01, PacketTypesOut.QueryBlockNBT }, // Block Entity Tag Query
|
||||
|
|
@ -203,7 +203,7 @@ public class PacketPalette1212 : PacketTypePalette
|
|||
{ 0x3B, PacketTypesOut.UseItem }, // Use Item
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesIn> configurationTypesIn = new()
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesIn> configurationTypesIn = new()
|
||||
{
|
||||
{ 0x00, ConfigurationPacketTypesIn.CookieRequest },
|
||||
{ 0x01, ConfigurationPacketTypesIn.PluginMessage },
|
||||
|
|
@ -224,7 +224,7 @@ public class PacketPalette1212 : PacketTypePalette
|
|||
{ 0x10, ConfigurationPacketTypesIn.ServerLinks }
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesOut> configurationTypesOut = new()
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesOut> configurationTypesOut = new()
|
||||
{
|
||||
{ 0x00, ConfigurationPacketTypesOut.ClientInformation },
|
||||
{ 0x01, ConfigurationPacketTypesOut.CookieResponse },
|
||||
|
|
@ -235,9 +235,9 @@ public class PacketPalette1212 : PacketTypePalette
|
|||
{ 0x06, ConfigurationPacketTypesOut.ResourcePackResponse },
|
||||
{ 0x07, ConfigurationPacketTypesOut.KnownDataPacks }
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => configurationTypesIn!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => configurationTypesOut!;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => configurationTypesIn!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => configurationTypesOut!;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ using System.Collections.Generic;
|
|||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes;
|
||||
|
||||
public class PacketPalette1214 : PacketTypePalette
|
||||
{
|
||||
private readonly Dictionary<int, PacketTypesIn> typeIn = new()
|
||||
{
|
||||
private readonly Dictionary<int, PacketTypesIn> typeIn = new()
|
||||
{
|
||||
{ 0x00, PacketTypesIn.Bundle }, // Bundle delimiter
|
||||
{ 0x01, PacketTypesIn.SpawnEntity }, // Add Entity
|
||||
|
|
@ -139,7 +139,7 @@ public class PacketPalette1214 : PacketTypePalette
|
|||
{ 0x82, PacketTypesIn.ServerLinks } // Server Links
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, PacketTypesOut> typeOut = new()
|
||||
private readonly Dictionary<int, PacketTypesOut> typeOut = new()
|
||||
{
|
||||
{ 0x00, PacketTypesOut.TeleportConfirm }, // Accept Teleportation
|
||||
{ 0x01, PacketTypesOut.QueryBlockNBT }, // Block Entity Tag Query
|
||||
|
|
@ -205,7 +205,7 @@ public class PacketPalette1214 : PacketTypePalette
|
|||
{ 0x3D, PacketTypesOut.UseItem }, // Use Item
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesIn> configurationTypesIn = new()
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesIn> configurationTypesIn = new()
|
||||
{
|
||||
{ 0x00, ConfigurationPacketTypesIn.CookieRequest },
|
||||
{ 0x01, ConfigurationPacketTypesIn.PluginMessage },
|
||||
|
|
@ -226,7 +226,7 @@ public class PacketPalette1214 : PacketTypePalette
|
|||
{ 0x10, ConfigurationPacketTypesIn.ServerLinks }
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesOut> configurationTypesOut = new()
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesOut> configurationTypesOut = new()
|
||||
{
|
||||
{ 0x00, ConfigurationPacketTypesOut.ClientInformation },
|
||||
{ 0x01, ConfigurationPacketTypesOut.CookieResponse },
|
||||
|
|
@ -237,9 +237,9 @@ public class PacketPalette1214 : PacketTypePalette
|
|||
{ 0x06, ConfigurationPacketTypesOut.ResourcePackResponse },
|
||||
{ 0x07, ConfigurationPacketTypesOut.KnownDataPacks }
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => configurationTypesIn!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => configurationTypesOut!;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => configurationTypesIn!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => configurationTypesOut!;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ using System.Collections.Generic;
|
|||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes;
|
||||
|
||||
public class PacketPalette1215 : PacketTypePalette
|
||||
{
|
||||
private readonly Dictionary<int, PacketTypesIn> typeIn = new()
|
||||
{
|
||||
private readonly Dictionary<int, PacketTypesIn> typeIn = new()
|
||||
{
|
||||
{ 0x00, PacketTypesIn.Bundle }, // Bundle delimiter
|
||||
{ 0x01, PacketTypesIn.SpawnEntity }, // Add Entity
|
||||
|
|
@ -139,7 +139,7 @@ public class PacketPalette1215 : PacketTypePalette
|
|||
{ 0x82, PacketTypesIn.ServerLinks } // Server Links
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, PacketTypesOut> typeOut = new()
|
||||
private readonly Dictionary<int, PacketTypesOut> typeOut = new()
|
||||
{
|
||||
{ 0x00, PacketTypesOut.TeleportConfirm }, // Accept Teleportation
|
||||
{ 0x01, PacketTypesOut.QueryBlockNBT }, // Block Entity Tag Query
|
||||
|
|
@ -207,7 +207,7 @@ public class PacketPalette1215 : PacketTypePalette
|
|||
{ 0x3F, PacketTypesOut.UseItem }, // Use Item
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesIn> configurationTypesIn = new()
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesIn> configurationTypesIn = new()
|
||||
{
|
||||
{ 0x00, ConfigurationPacketTypesIn.CookieRequest },
|
||||
{ 0x01, ConfigurationPacketTypesIn.PluginMessage },
|
||||
|
|
@ -228,7 +228,7 @@ public class PacketPalette1215 : PacketTypePalette
|
|||
{ 0x10, ConfigurationPacketTypesIn.ServerLinks }
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesOut> configurationTypesOut = new()
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesOut> configurationTypesOut = new()
|
||||
{
|
||||
{ 0x00, ConfigurationPacketTypesOut.ClientInformation },
|
||||
{ 0x01, ConfigurationPacketTypesOut.CookieResponse },
|
||||
|
|
@ -239,9 +239,9 @@ public class PacketPalette1215 : PacketTypePalette
|
|||
{ 0x06, ConfigurationPacketTypesOut.ResourcePackResponse },
|
||||
{ 0x07, ConfigurationPacketTypesOut.KnownDataPacks }
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => configurationTypesIn!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => configurationTypesOut!;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => configurationTypesIn!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => configurationTypesOut!;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ using System.Collections.Generic;
|
|||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes;
|
||||
|
||||
public class PacketPalette1216 : PacketTypePalette
|
||||
{
|
||||
private readonly Dictionary<int, PacketTypesIn> typeIn = new()
|
||||
{
|
||||
private readonly Dictionary<int, PacketTypesIn> typeIn = new()
|
||||
{
|
||||
{ 0x00, PacketTypesIn.Bundle }, // Bundle delimiter
|
||||
{ 0x01, PacketTypesIn.SpawnEntity }, // Add Entity
|
||||
|
|
@ -142,7 +142,7 @@ public class PacketPalette1216 : PacketTypePalette
|
|||
{ 0x85, PacketTypesIn.ShowDialog } // Show Dialog (new in 1.21.6)
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, PacketTypesOut> typeOut = new()
|
||||
private readonly Dictionary<int, PacketTypesOut> typeOut = new()
|
||||
{
|
||||
{ 0x00, PacketTypesOut.TeleportConfirm }, // Accept Teleportation
|
||||
{ 0x01, PacketTypesOut.QueryBlockNBT }, // Block Entity Tag Query
|
||||
|
|
@ -212,7 +212,7 @@ public class PacketPalette1216 : PacketTypePalette
|
|||
{ 0x41, PacketTypesOut.CustomClickAction } // Custom Click Action (new in 1.21.6)
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesIn> configurationTypesIn = new()
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesIn> configurationTypesIn = new()
|
||||
{
|
||||
{ 0x00, ConfigurationPacketTypesIn.CookieRequest },
|
||||
{ 0x01, ConfigurationPacketTypesIn.PluginMessage },
|
||||
|
|
@ -235,7 +235,7 @@ public class PacketPalette1216 : PacketTypePalette
|
|||
{ 0x12, ConfigurationPacketTypesIn.ShowDialog } // New in 1.21.6
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesOut> configurationTypesOut = new()
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesOut> configurationTypesOut = new()
|
||||
{
|
||||
{ 0x00, ConfigurationPacketTypesOut.ClientInformation },
|
||||
{ 0x01, ConfigurationPacketTypesOut.CookieResponse },
|
||||
|
|
@ -247,9 +247,9 @@ public class PacketPalette1216 : PacketTypePalette
|
|||
{ 0x07, ConfigurationPacketTypesOut.KnownDataPacks },
|
||||
{ 0x08, ConfigurationPacketTypesOut.CustomClickAction } // New in 1.21.6
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => configurationTypesIn!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => configurationTypesOut!;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => configurationTypesIn!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => configurationTypesOut!;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ using System.Collections.Generic;
|
|||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes;
|
||||
|
||||
public class PacketPalette1219 : PacketTypePalette
|
||||
{
|
||||
private readonly Dictionary<int, PacketTypesIn> typeIn = new()
|
||||
{
|
||||
private readonly Dictionary<int, PacketTypesIn> typeIn = new()
|
||||
{
|
||||
{ 0x00, PacketTypesIn.Bundle }, // Bundle delimiter
|
||||
{ 0x01, PacketTypesIn.SpawnEntity }, // Add Entity
|
||||
|
|
@ -147,7 +147,7 @@ public class PacketPalette1219 : PacketTypePalette
|
|||
{ 0x8A, PacketTypesIn.ShowDialog } // Show Dialog
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, PacketTypesOut> typeOut = new()
|
||||
private readonly Dictionary<int, PacketTypesOut> typeOut = new()
|
||||
{
|
||||
{ 0x00, PacketTypesOut.TeleportConfirm }, // Accept Teleportation
|
||||
{ 0x01, PacketTypesOut.QueryBlockNBT }, // Block Entity Tag Query
|
||||
|
|
@ -217,7 +217,7 @@ public class PacketPalette1219 : PacketTypePalette
|
|||
{ 0x41, PacketTypesOut.CustomClickAction } // Custom Click Action
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesIn> configurationTypesIn = new()
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesIn> configurationTypesIn = new()
|
||||
{
|
||||
{ 0x00, ConfigurationPacketTypesIn.CookieRequest },
|
||||
{ 0x01, ConfigurationPacketTypesIn.PluginMessage },
|
||||
|
|
@ -241,7 +241,7 @@ public class PacketPalette1219 : PacketTypePalette
|
|||
{ 0x13, ConfigurationPacketTypesIn.CodeOfConduct } // New in 1.21.9
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesOut> configurationTypesOut = new()
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesOut> configurationTypesOut = new()
|
||||
{
|
||||
{ 0x00, ConfigurationPacketTypesOut.ClientInformation },
|
||||
{ 0x01, ConfigurationPacketTypesOut.CookieResponse },
|
||||
|
|
@ -254,9 +254,9 @@ public class PacketPalette1219 : PacketTypePalette
|
|||
{ 0x08, ConfigurationPacketTypesOut.CustomClickAction },
|
||||
{ 0x09, ConfigurationPacketTypesOut.AcceptCodeOfConduct } // New in 1.21.9
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => configurationTypesIn!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => configurationTypesOut!;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => configurationTypesIn!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => configurationTypesOut!;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
|
||||
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => new();
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => new();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ using System.Collections.Generic;
|
|||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes;
|
||||
|
||||
public class PacketPalette261 : PacketTypePalette
|
||||
{
|
||||
private readonly Dictionary<int, PacketTypesIn> typeIn = new()
|
||||
{
|
||||
private readonly Dictionary<int, PacketTypesIn> typeIn = new()
|
||||
{
|
||||
{ 0x00, PacketTypesIn.Bundle }, // Bundle delimiter
|
||||
{ 0x01, PacketTypesIn.SpawnEntity }, // Add Entity
|
||||
|
|
@ -149,7 +149,7 @@ public class PacketPalette261 : PacketTypePalette
|
|||
{ 0x8C, PacketTypesIn.ShowDialog } // Show Dialog
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, PacketTypesOut> typeOut = new()
|
||||
private readonly Dictionary<int, PacketTypesOut> typeOut = new()
|
||||
{
|
||||
{ 0x00, PacketTypesOut.TeleportConfirm }, // Accept Teleportation
|
||||
{ 0x01, PacketTypesOut.Attack }, // Attack (new in 26.1)
|
||||
|
|
@ -221,7 +221,7 @@ public class PacketPalette261 : PacketTypePalette
|
|||
{ 0x44, PacketTypesOut.CustomClickAction } // Custom Click Action
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesIn> configurationTypesIn = new()
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesIn> configurationTypesIn = new()
|
||||
{
|
||||
{ 0x00, ConfigurationPacketTypesIn.CookieRequest },
|
||||
{ 0x01, ConfigurationPacketTypesIn.PluginMessage },
|
||||
|
|
@ -245,7 +245,7 @@ public class PacketPalette261 : PacketTypePalette
|
|||
{ 0x13, ConfigurationPacketTypesIn.CodeOfConduct }
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesOut> configurationTypesOut = new()
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesOut> configurationTypesOut = new()
|
||||
{
|
||||
{ 0x00, ConfigurationPacketTypesOut.ClientInformation },
|
||||
{ 0x01, ConfigurationPacketTypesOut.CookieResponse },
|
||||
|
|
@ -258,9 +258,9 @@ public class PacketPalette261 : PacketTypePalette
|
|||
{ 0x08, ConfigurationPacketTypesOut.CustomClickAction },
|
||||
{ 0x09, ConfigurationPacketTypesOut.AcceptCodeOfConduct }
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => configurationTypesIn!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => configurationTypesOut!;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => configurationTypesIn!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => configurationTypesOut!;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -949,7 +949,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
{
|
||||
return false; //Currently not implemented
|
||||
}
|
||||
|
||||
|
||||
public bool SendRenameItem(string itemName)
|
||||
{
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -836,15 +836,15 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
dimensionTypeName =
|
||||
dataTypes.ReadNextString(packetData); // Dimension Type: Identifier
|
||||
break;
|
||||
case >= MC_1_16_2_Version:
|
||||
dimensionType =
|
||||
dataTypes.ReadNextNbt(
|
||||
packetData); // Dimension Type: NBT Tag Compound
|
||||
break;
|
||||
default:
|
||||
dimensionTypeName = dataTypes.ReadNextString(packetData);
|
||||
break;
|
||||
}
|
||||
case >= MC_1_16_2_Version:
|
||||
dimensionType =
|
||||
dataTypes.ReadNextNbt(
|
||||
packetData); // Dimension Type: NBT Tag Compound
|
||||
break;
|
||||
default:
|
||||
dimensionTypeName = dataTypes.ReadNextString(packetData);
|
||||
break;
|
||||
}
|
||||
|
||||
currentDimension = 0;
|
||||
break;
|
||||
|
|
@ -1409,14 +1409,14 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
dimensionTypeNameRespawn =
|
||||
dataTypes.ReadNextString(packetData); // Dimension Type: Identifier
|
||||
break;
|
||||
case >= MC_1_16_2_Version:
|
||||
dimensionTypeRespawn =
|
||||
dataTypes.ReadNextNbt(packetData); // Dimension Type: NBT Tag Compound
|
||||
break;
|
||||
default:
|
||||
dimensionTypeNameRespawn = dataTypes.ReadNextString(packetData);
|
||||
break;
|
||||
}
|
||||
case >= MC_1_16_2_Version:
|
||||
dimensionTypeRespawn =
|
||||
dataTypes.ReadNextNbt(packetData); // Dimension Type: NBT Tag Compound
|
||||
break;
|
||||
default:
|
||||
dimensionTypeNameRespawn = dataTypes.ReadNextString(packetData);
|
||||
break;
|
||||
}
|
||||
|
||||
currentDimension = 0;
|
||||
}
|
||||
|
|
@ -2986,71 +2986,71 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
handler.OnExplosion(explosionLocation, explosionStrength, explosionBlockCount);
|
||||
break;
|
||||
case PacketTypesIn.NamedSoundEffect:
|
||||
{
|
||||
string? soundName = dataTypes.ReadNextString(packetData);
|
||||
int category = dataTypes.ReadNextVarInt(packetData);
|
||||
double x = dataTypes.ReadNextInt(packetData) / 8.0D;
|
||||
double y = dataTypes.ReadNextInt(packetData) / 8.0D;
|
||||
double z = dataTypes.ReadNextInt(packetData) / 8.0D;
|
||||
float volume = dataTypes.ReadNextFloat(packetData);
|
||||
float pitch = protocolVersion < MC_1_10_Version
|
||||
? dataTypes.ReadNextByte(packetData) / 63.0f
|
||||
: dataTypes.ReadNextFloat(packetData);
|
||||
|
||||
handler.OnSoundEffect(soundName, new Location(x, y, z), category, volume, pitch, null);
|
||||
break;
|
||||
}
|
||||
case PacketTypesIn.SoundEffect:
|
||||
{
|
||||
string? soundName;
|
||||
if (protocolVersion >= MC_1_19_Version)
|
||||
soundName = ReadSoundEventHolderName(packetData);
|
||||
else
|
||||
{
|
||||
dataTypes.ReadNextVarInt(packetData); // Sound id
|
||||
soundName = null;
|
||||
}
|
||||
string? soundName = dataTypes.ReadNextString(packetData);
|
||||
int category = dataTypes.ReadNextVarInt(packetData);
|
||||
double x = dataTypes.ReadNextInt(packetData) / 8.0D;
|
||||
double y = dataTypes.ReadNextInt(packetData) / 8.0D;
|
||||
double z = dataTypes.ReadNextInt(packetData) / 8.0D;
|
||||
float volume = dataTypes.ReadNextFloat(packetData);
|
||||
float pitch = protocolVersion < MC_1_10_Version
|
||||
? dataTypes.ReadNextByte(packetData) / 63.0f
|
||||
: dataTypes.ReadNextFloat(packetData);
|
||||
|
||||
if (protocolVersion < MC_1_19_Version && packetData.Count < 21)
|
||||
handler.OnSoundEffect(soundName, new Location(x, y, z), category, volume, pitch, null);
|
||||
break;
|
||||
|
||||
int category = dataTypes.ReadNextVarInt(packetData);
|
||||
double x = dataTypes.ReadNextInt(packetData) / 8.0D;
|
||||
double y = dataTypes.ReadNextInt(packetData) / 8.0D;
|
||||
double z = dataTypes.ReadNextInt(packetData) / 8.0D;
|
||||
float volume = dataTypes.ReadNextFloat(packetData);
|
||||
float pitch = protocolVersion < MC_1_10_Version
|
||||
? dataTypes.ReadNextByte(packetData) / 63.0f
|
||||
: dataTypes.ReadNextFloat(packetData);
|
||||
|
||||
if (protocolVersion >= MC_1_19_Version)
|
||||
dataTypes.ReadNextLong(packetData); // Seed
|
||||
|
||||
handler.OnSoundEffect(soundName, new Location(x, y, z), category, volume, pitch, null);
|
||||
break;
|
||||
}
|
||||
case PacketTypesIn.EntitySoundEffect:
|
||||
{
|
||||
string? soundName;
|
||||
if (protocolVersion >= MC_1_19_Version)
|
||||
soundName = ReadSoundEventHolderName(packetData);
|
||||
else
|
||||
{
|
||||
dataTypes.ReadNextVarInt(packetData); // Sound id
|
||||
soundName = null;
|
||||
}
|
||||
case PacketTypesIn.SoundEffect:
|
||||
{
|
||||
string? soundName;
|
||||
if (protocolVersion >= MC_1_19_Version)
|
||||
soundName = ReadSoundEventHolderName(packetData);
|
||||
else
|
||||
{
|
||||
dataTypes.ReadNextVarInt(packetData); // Sound id
|
||||
soundName = null;
|
||||
}
|
||||
|
||||
int category = dataTypes.ReadNextVarInt(packetData);
|
||||
int entityId = dataTypes.ReadNextVarInt(packetData);
|
||||
float volume = dataTypes.ReadNextFloat(packetData);
|
||||
float pitch = dataTypes.ReadNextFloat(packetData);
|
||||
if (protocolVersion < MC_1_19_Version && packetData.Count < 21)
|
||||
break;
|
||||
|
||||
if (protocolVersion >= MC_1_19_Version)
|
||||
dataTypes.ReadNextLong(packetData); // Seed
|
||||
int category = dataTypes.ReadNextVarInt(packetData);
|
||||
double x = dataTypes.ReadNextInt(packetData) / 8.0D;
|
||||
double y = dataTypes.ReadNextInt(packetData) / 8.0D;
|
||||
double z = dataTypes.ReadNextInt(packetData) / 8.0D;
|
||||
float volume = dataTypes.ReadNextFloat(packetData);
|
||||
float pitch = protocolVersion < MC_1_10_Version
|
||||
? dataTypes.ReadNextByte(packetData) / 63.0f
|
||||
: dataTypes.ReadNextFloat(packetData);
|
||||
|
||||
handler.OnSoundEffect(soundName, null, category, volume, pitch, entityId);
|
||||
break;
|
||||
}
|
||||
if (protocolVersion >= MC_1_19_Version)
|
||||
dataTypes.ReadNextLong(packetData); // Seed
|
||||
|
||||
handler.OnSoundEffect(soundName, new Location(x, y, z), category, volume, pitch, null);
|
||||
break;
|
||||
}
|
||||
case PacketTypesIn.EntitySoundEffect:
|
||||
{
|
||||
string? soundName;
|
||||
if (protocolVersion >= MC_1_19_Version)
|
||||
soundName = ReadSoundEventHolderName(packetData);
|
||||
else
|
||||
{
|
||||
dataTypes.ReadNextVarInt(packetData); // Sound id
|
||||
soundName = null;
|
||||
}
|
||||
|
||||
int category = dataTypes.ReadNextVarInt(packetData);
|
||||
int entityId = dataTypes.ReadNextVarInt(packetData);
|
||||
float volume = dataTypes.ReadNextFloat(packetData);
|
||||
float pitch = dataTypes.ReadNextFloat(packetData);
|
||||
|
||||
if (protocolVersion >= MC_1_19_Version)
|
||||
dataTypes.ReadNextLong(packetData); // Seed
|
||||
|
||||
handler.OnSoundEffect(soundName, null, category, volume, pitch, entityId);
|
||||
break;
|
||||
}
|
||||
case PacketTypesIn.HeldItemChange:
|
||||
case PacketTypesIn.SetHeldSlot:
|
||||
handler.OnHeldItemChange(dataTypes.ReadNextByte(packetData)); // Slot
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
string registryName = dataTypes.ReadNextString(packetData);
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.forge_fml2_registry, registryName));
|
||||
}
|
||||
|
||||
|
||||
fmlResponsePacket.AddRange(DataTypes.GetVarInt(99));
|
||||
fmlResponseReady = true;
|
||||
break;
|
||||
|
|
@ -410,7 +410,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
// [ Version ][ String ]
|
||||
//
|
||||
// We're ignoring this packet in MCC
|
||||
|
||||
|
||||
if (Settings.Config.Logging.DebugMessages)
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted("§8" + "Received FML3 Server Mod Data List");
|
||||
|
|
@ -505,7 +505,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
{
|
||||
return new ForgeInfo(FMLVersion.FML3);
|
||||
}
|
||||
return new ForgeInfo(FMLVersion.FML2);
|
||||
return new ForgeInfo(FMLVersion.FML2);
|
||||
}
|
||||
else throw new InvalidOperationException(Translations.error_forgeforce);
|
||||
}
|
||||
|
|
@ -568,6 +568,6 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class AttributeModifiersComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class AttributeModifiersComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public int NumberOfAttributes { get; set; }
|
||||
public List<SubComponent> Attributes { get; set; } = new();
|
||||
public bool ShowInTooltip { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
NumberOfAttributes = DataTypes.ReadNextVarInt(data);
|
||||
|
|
@ -27,13 +27,13 @@ public class AttributeModifiersComponent(DataTypes dataTypes, ItemPalette itemPa
|
|||
{
|
||||
var data = new List<byte>();
|
||||
data.AddRange(DataTypes.GetVarInt(NumberOfAttributes));
|
||||
|
||||
if(Attributes.Count != NumberOfAttributes)
|
||||
|
||||
if (Attributes.Count != NumberOfAttributes)
|
||||
throw new ArgumentNullException($"Can not serialize a AttributeModifiersComponent when the Attributes count != NumberOfAttributes!");
|
||||
|
||||
|
||||
foreach (var attribute in Attributes)
|
||||
data.AddRange(attribute.Serialize());
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetBool(ShowInTooltip));
|
||||
return new Queue<byte>(data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class BannerPatternsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class BannerPatternsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public int NumberOfLayers { get; set; }
|
||||
public List<BannerLayer> Layers { get; set; } = [];
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
NumberOfLayers = DataTypes.ReadNextVarInt(data);
|
||||
|
|
@ -44,17 +44,17 @@ public class BannerPatternsComponent(DataTypes dataTypes, ItemPalette itemPalett
|
|||
|
||||
if (bannerLayer.PatternType == 0)
|
||||
{
|
||||
if(string.IsNullOrEmpty(bannerLayer.AssetId) || string.IsNullOrEmpty(bannerLayer.TranslationKey))
|
||||
if (string.IsNullOrEmpty(bannerLayer.AssetId) || string.IsNullOrEmpty(bannerLayer.TranslationKey))
|
||||
throw new Exception("Can't serialize BannerPatternsComponent because AssetId or TranslationKey is null/empty!");
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetString(bannerLayer.AssetId));
|
||||
data.AddRange(DataTypes.GetString(bannerLayer.TranslationKey));
|
||||
}
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetVarInt(bannerLayer.DyeColor));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return new Queue<byte>(data);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class BaseColorComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class BaseColorComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public int DyeColor { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
DyeColor = DataTypes.ReadNextVarInt(data);
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class BeesComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class BeesComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public int NumberOfBees { get; set; }
|
||||
public List<Bee> Bees { get; set; } = [];
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
NumberOfBees = DataTypes.ReadNextVarInt(data);
|
||||
|
|
@ -30,7 +30,7 @@ public class BeesComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComp
|
|||
{
|
||||
if (NumberOfBees != Bees.Count)
|
||||
throw new Exception("Can't serialize the BeeComponent because NumberOfBees and Bees.Count differ!");
|
||||
|
||||
|
||||
foreach (var bee in Bees)
|
||||
{
|
||||
data.AddRange(DataTypes.GetNbt(bee.EntityDataNbt));
|
||||
|
|
|
|||
|
|
@ -4,15 +4,15 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class BlockStateComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class BlockStateComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public List<(string, string)> Properties { get; set; } = [];
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
var count = DataTypes.ReadNextVarInt(data);
|
||||
for(var i = 0; i < count; i++)
|
||||
for (var i = 0; i < count; i++)
|
||||
Properties.Add((DataTypes.ReadNextString(data), DataTypes.ReadNextString(data)));
|
||||
}
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ public class BlockStateComponent(DataTypes dataTypes, ItemPalette itemPalette, S
|
|||
data.AddRange(DataTypes.GetString(key));
|
||||
data.AddRange(DataTypes.GetString(value));
|
||||
}
|
||||
|
||||
|
||||
return new Queue<byte>(data);
|
||||
}
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class BundleContentsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class BundleContentsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public List<Item> Items { get; set; } = [];
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class CanBreakComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class CanBreakComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public int NumberOfPredicates { get; set; }
|
||||
public List<BlockPredicateSubcomponent> BlockPredicates { get; set; } = new();
|
||||
public bool ShowInTooltip { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
NumberOfPredicates = DataTypes.ReadNextVarInt(data);
|
||||
|
|
@ -28,13 +28,13 @@ public class CanBreakComponent(DataTypes dataTypes, ItemPalette itemPalette, Sub
|
|||
{
|
||||
var data = new List<byte>();
|
||||
data.AddRange(DataTypes.GetVarInt(NumberOfPredicates));
|
||||
|
||||
if(NumberOfPredicates > 0 && BlockPredicates.Count == 0)
|
||||
|
||||
if (NumberOfPredicates > 0 && BlockPredicates.Count == 0)
|
||||
throw new ArgumentNullException($"Can not serialize a CanBreakComponent when the BlockPredicates is empty but NumberOfPredicates is > 0!");
|
||||
|
||||
|
||||
foreach (var blockPredicate in BlockPredicates)
|
||||
data.AddRange(blockPredicate.Serialize());
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetBool(ShowInTooltip));
|
||||
return new Queue<byte>(data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class CanPlaceOnComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class CanPlaceOnComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public int NumberOfPredicates { get; set; }
|
||||
public List<BlockPredicateSubcomponent> BlockPredicates { get; set; } = new();
|
||||
public bool ShowInTooltip { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
NumberOfPredicates = DataTypes.ReadNextVarInt(data);
|
||||
|
|
@ -28,13 +28,13 @@ public class CanPlaceOnComponent(DataTypes dataTypes, ItemPalette itemPalette, S
|
|||
{
|
||||
var data = new List<byte>();
|
||||
data.AddRange(DataTypes.GetVarInt(NumberOfPredicates));
|
||||
|
||||
if(NumberOfPredicates > 0 && BlockPredicates.Count == 0)
|
||||
|
||||
if (NumberOfPredicates > 0 && BlockPredicates.Count == 0)
|
||||
throw new ArgumentNullException($"Can not serialize a CanPlaceOnComponent when the BlockPredicates is empty but NumberOfPredicates is > 0!");
|
||||
|
||||
|
||||
foreach (var blockPredicate in BlockPredicates)
|
||||
data.AddRange(blockPredicate.Serialize());
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetBool(ShowInTooltip));
|
||||
return new Queue<byte>(data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class ChargedProjectilesComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class ChargedProjectilesComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public List<Item> Items { get; set; } = [];
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class ContainerComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class ContainerComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public List<Item?> Items { get; set; } = [];
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
var count = DataTypes.ReadNextVarInt(data);
|
||||
|
|
@ -23,7 +23,7 @@ public class ContainerComponent(DataTypes dataTypes, ItemPalette itemPalette, Su
|
|||
data.AddRange(DataTypes.GetVarInt(Items.Count));
|
||||
foreach (var item in Items)
|
||||
data.AddRange(DataTypes.GetItemSlot(item, ItemPalette));
|
||||
|
||||
|
||||
return new Queue<byte>(data);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class ContainerLootComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class ContainerLootComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public Dictionary<string, object>? Nbt { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
Nbt = DataTypes.ReadNextNbt(data);
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class CreativeSlotLockComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class CreativeSlotLockComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: EmptyComponent(dataTypes, itemPalette, subComponentRegistry);
|
||||
|
|
@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class CustomDataComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class CustomDataComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public Dictionary<string, object>? Nbt { get; set; } = new();
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
Nbt = DataTypes.ReadNextNbt(data);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ public class CustomModelDataComponent(DataTypes dataTypes, ItemPalette itemPalet
|
|||
public List<bool> Flags { get; set; } = [];
|
||||
public List<string> Strings { get; set; } = [];
|
||||
public List<int> Colors { get; set; } = [];
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
Floats = ReadList(data, static (dataTypes, componentData) => dataTypes.ReadNextFloat(componentData));
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ using MinecraftClient.Protocol.Message;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class CustomNameComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class CustomNameComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public string CustomName { get; set; } = string.Empty;
|
||||
public Dictionary<string, object>? CustomNameNbt { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
CustomNameNbt = DataTypes.ReadNextNbt(data);
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class DamageComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class DamageComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public int Damage { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
Damage = DataTypes.ReadNextVarInt(data);
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class DebugStickStateComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class DebugStickStateComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public Dictionary<string, object>? Nbt { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
Nbt = DataTypes.ReadNextNbt(data);
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class DyeColorComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class DyeColorComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public int Color { get; set; }
|
||||
public bool ShowInTooltip { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
Color = DataTypes.ReadNextInt(data);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ public class EnchantmentGlintOverrideComponent(DataTypes dataTypes, ItemPalette
|
|||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public bool HasGlint { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
HasGlint = DataTypes.ReadNextBool(data);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class EnchantmentsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class EnchantmentsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public int NumberOfEnchantments { get; set; }
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class EntityDataComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class EntityDataComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public Dictionary<string, object>? Nbt { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
Nbt = DataTypes.ReadNextNbt(data);
|
||||
|
|
@ -22,8 +22,10 @@ public class EntityDataComponent(DataTypes dataTypes, ItemPalette itemPalette, S
|
|||
}
|
||||
}
|
||||
|
||||
public class BucketEntityDataComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: EntityDataComponent(dataTypes, itemPalette, subComponentRegistry) {}
|
||||
public class BucketEntityDataComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: EntityDataComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{ }
|
||||
|
||||
public class BlockEntityDataComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: EntityDataComponent(dataTypes, itemPalette, subComponentRegistry) {}
|
||||
public class BlockEntityDataComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: EntityDataComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{ }
|
||||
|
|
@ -3,5 +3,5 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class FireResistantComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class FireResistantComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: EmptyComponent(dataTypes, itemPalette, subComponentRegistry);
|
||||
|
|
@ -8,11 +8,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class FireworkExplosionComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class FireworkExplosionComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public FireworkExplosionSubComponent? FireworkExplosionSubComponent { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
FireworkExplosionSubComponent = (FireworkExplosionSubComponent)SubComponentRegistry.ParseSubComponent(SubComponents.FireworkExplosion, data);
|
||||
|
|
|
|||
|
|
@ -9,14 +9,14 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class FireworksComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class FireworksComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public int FlightDuration { get; set; }
|
||||
public int NumberOfExplosions { get; set; }
|
||||
|
||||
public List<FireworkExplosionSubComponent> Explosions { get; set; } = [];
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
FlightDuration = DataTypes.ReadNextVarInt(data);
|
||||
|
|
@ -24,7 +24,7 @@ public class FireworksComponent(DataTypes dataTypes, ItemPalette itemPalette, Su
|
|||
|
||||
if (NumberOfExplosions > 0)
|
||||
{
|
||||
for(var i = 0; i < NumberOfExplosions; i++)
|
||||
for (var i = 0; i < NumberOfExplosions; i++)
|
||||
Explosions.Add(
|
||||
(FireworkExplosionSubComponent)SubComponentRegistry.ParseSubComponent(SubComponents.FireworkExplosion,
|
||||
data));
|
||||
|
|
@ -40,8 +40,8 @@ public class FireworksComponent(DataTypes dataTypes, ItemPalette itemPalette, Su
|
|||
{
|
||||
if (NumberOfExplosions != Explosions.Count)
|
||||
throw new Exception("Can't serialize FireworksComponent because NumberOfExplosions and the lenght of Explosions differ!");
|
||||
|
||||
foreach(var explosion in Explosions)
|
||||
|
||||
foreach (var explosion in Explosions)
|
||||
data.AddRange(explosion.Serialize().ToList());
|
||||
}
|
||||
return new Queue<byte>(data);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class FoodComponentComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class FoodComponentComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public int Nutrition { get; set; }
|
||||
|
|
@ -15,7 +15,7 @@ public class FoodComponentComponent(DataTypes dataTypes, ItemPalette itemPalette
|
|||
public bool CanAlwaysEat { get; set; }
|
||||
public float SecondsToEat { get; set; }
|
||||
public List<EffectSubComponent> Effects { get; set; } = new();
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
Nutrition = DataTypes.ReadNextVarInt(data);
|
||||
|
|
@ -23,8 +23,8 @@ public class FoodComponentComponent(DataTypes dataTypes, ItemPalette itemPalette
|
|||
CanAlwaysEat = DataTypes.ReadNextBool(data);
|
||||
SecondsToEat = DataTypes.ReadNextFloat(data);
|
||||
var numberOfEffects = DataTypes.ReadNextVarInt(data);
|
||||
|
||||
for(var i = 0; i < numberOfEffects; i++)
|
||||
|
||||
for (var i = 0; i < numberOfEffects; i++)
|
||||
Effects.Add((EffectSubComponent)SubComponentRegistry.ParseSubComponent(SubComponents.Effect, data));
|
||||
}
|
||||
|
||||
|
|
@ -37,9 +37,9 @@ public class FoodComponentComponent(DataTypes dataTypes, ItemPalette itemPalette
|
|||
data.AddRange(DataTypes.GetFloat(SecondsToEat));
|
||||
data.AddRange(DataTypes.GetVarInt(Effects.Count));
|
||||
|
||||
foreach(var effect in Effects)
|
||||
foreach (var effect in Effects)
|
||||
data.AddRange(effect.Serialize());
|
||||
|
||||
|
||||
return new Queue<byte>(data);
|
||||
}
|
||||
}
|
||||
|
|
@ -3,5 +3,5 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class HideAdditionalTooltipComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class HideAdditionalTooltipComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: EmptyComponent(dataTypes, itemPalette, subComponentRegistry);
|
||||
|
|
@ -3,5 +3,5 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class HideTooltipComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class HideTooltipComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: EmptyComponent(dataTypes, itemPalette, subComponentRegistry);
|
||||
|
|
@ -4,7 +4,7 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class InstrumentComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class InstrumentComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
// holder ID: 0 = inline instrument data, N>0 = registry reference (id = N-1)
|
||||
|
|
@ -20,7 +20,7 @@ public class InstrumentComponent(DataTypes dataTypes, ItemPalette itemPalette, S
|
|||
|
||||
public int UseDuration { get; set; }
|
||||
public float Range { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
InstrumentHolderId = DataTypes.ReadNextVarInt(data);
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class IntangibleProjectileComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class IntangibleProjectileComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public Dictionary<string, object>? Nbt { get; set; } = new();
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
Nbt = DataTypes.ReadNextNbt(data);
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ using MinecraftClient.Protocol.Message;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class ItemNameComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class ItemNameComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public string ItemName { get; set; } = string.Empty;
|
||||
public Dictionary<string, object>? ItemNameNbt { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
ItemNameNbt = DataTypes.ReadNextNbt(data);
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class LockComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class LockComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public Dictionary<string, object>? Nbt { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
Nbt = DataTypes.ReadNextNbt(data);
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class LodestoneTrackerComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class LodestoneTrackerComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public bool HasGlobalPosition { get; set; }
|
||||
public string Dimension { get; set; } = null!;
|
||||
public Location Position { get; set; }
|
||||
public bool Tracked { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
HasGlobalPosition = DataTypes.ReadNextBool(data);
|
||||
|
|
@ -22,7 +22,7 @@ public class LodestoneTrackerComponent(DataTypes dataTypes, ItemPalette itemPale
|
|||
Dimension = DataTypes.ReadNextString(data);
|
||||
Position = DataTypes.ReadNextLocation(data);
|
||||
}
|
||||
|
||||
|
||||
Tracked = DataTypes.ReadNextBool(data);
|
||||
}
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ public class LodestoneTrackerComponent(DataTypes dataTypes, ItemPalette itemPale
|
|||
data.AddRange(DataTypes.GetString(Dimension));
|
||||
data.AddRange(DataTypes.GetLocation(Position));
|
||||
}
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetBool(Tracked));
|
||||
return new Queue<byte>(data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,19 +5,19 @@ using MinecraftClient.Protocol.Message;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class LoreNameComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class LoreNameComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public int NumberOfLines { get; set; }
|
||||
public List<string> Lines { get; set; } = [];
|
||||
public List<Dictionary<string, object>> LinesNbt { get; set; } = [];
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
NumberOfLines = DataTypes.ReadNextVarInt(data);
|
||||
|
||||
|
||||
if (NumberOfLines <= 0) return;
|
||||
|
||||
|
||||
for (var i = 0; i < NumberOfLines; i++)
|
||||
{
|
||||
var lineNbt = DataTypes.ReadNextNbt(data);
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class MapColorComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class MapColorComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
Id = DataTypes.ReadNextInt(data);
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class MapDecorationsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class MapDecorationsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public Dictionary<string, object>? Nbt { get; set; } = new();
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
Nbt = DataTypes.ReadNextNbt(data);
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class MapIdComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class MapIdComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
Id = DataTypes.ReadNextVarInt(data);
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class MapPostProcessingComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class MapPostProcessingComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public int Type { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
Type = DataTypes.ReadNextVarInt(data);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ public class MaxDamageComponent(DataTypes dataTypes, ItemPalette itemPalette, Su
|
|||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public int MaxDamage { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
MaxDamage = DataTypes.ReadNextVarInt(data);
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class MaxStackSizeComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class MaxStackSizeComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public int MaxStackSize { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
MaxStackSize = DataTypes.ReadNextVarInt(data);
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class NoteBlockSoundComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class NoteBlockSoundComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public string Identifier { get; set; } = null!;
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
Identifier = DataTypes.ReadNextString(data);
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class OmniousBottleAmplifierComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class OmniousBottleAmplifierComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public int Amplifier { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
Amplifier = DataTypes.ReadNextVarInt(data);
|
||||
|
|
|
|||
|
|
@ -4,15 +4,15 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class PotDecorationsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class PotDecorationsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public List<int> Items { get; set; } = [];
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
var count = DataTypes.ReadNextVarInt(data);
|
||||
for(var i = 0; i < count; i++)
|
||||
for (var i = 0; i < count; i++)
|
||||
Items.Add(DataTypes.ReadNextVarInt(data));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class PotionContentsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class PotionContentsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public bool HasPotionId { get; set; }
|
||||
|
|
@ -14,7 +14,7 @@ public class PotionContentsComponent(DataTypes dataTypes, ItemPalette itemPalett
|
|||
public bool HasCustomColor { get; set; }
|
||||
public int CustomColor { get; set; }
|
||||
public List<PotionEffectSubComponent> Effects { get; set; } = new();
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
HasPotionId = DataTypes.ReadNextBool(data);
|
||||
|
|
@ -44,7 +44,7 @@ public class PotionContentsComponent(DataTypes dataTypes, ItemPalette itemPalett
|
|||
data.AddRange(DataTypes.GetVarInt(Effects.Count));
|
||||
foreach (var effect in Effects)
|
||||
data.AddRange(effect.Serialize());
|
||||
|
||||
|
||||
return new Queue<byte>(data);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public class ProfileComponent(DataTypes dataTypes, ItemPalette itemPalette, SubC
|
|||
public string? CapeAssetId { get; set; }
|
||||
public string? ElytraAssetId { get; set; }
|
||||
public ProfileSkinModel? Model { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
ResetState();
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class RarityComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class RarityComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public ItemRarity Rarity { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
Rarity = (ItemRarity)DataTypes.ReadNextVarInt(data);
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class RecipesComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class RecipesComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public Dictionary<string, object>? Nbt { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
Nbt = DataTypes.ReadNextNbt(data);
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class RepairCostComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class RepairCostComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public int Cost { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
Cost = DataTypes.ReadNextVarInt(data);
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class StoredEnchantmentsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class StoredEnchantmentsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: EnchantmentsComponent(dataTypes, itemPalette, subComponentRegistry);
|
||||
|
|
@ -7,7 +7,7 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class SuspiciousStewEffectsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class SuspiciousStewEffectsComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public int NumberOfEffects { get; set; }
|
||||
|
|
@ -28,7 +28,7 @@ public class SuspiciousStewEffectsComponent(DataTypes dataTypes, ItemPalette ite
|
|||
|
||||
if (NumberOfEffects != Effects.Count)
|
||||
throw new InvalidOperationException("Can not serialize SuspiciousStewEffectsComponent1206 because umberOfEffects != Effects.Count!");
|
||||
|
||||
|
||||
foreach (var effect in Effects)
|
||||
{
|
||||
data.AddRange(DataTypes.GetVarInt(effect.TypeId));
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class ToolComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class ToolComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public int NumberOfRules { get; set; }
|
||||
public List<RuleSubComponent> Rules { get; set; } = new();
|
||||
public float DefaultMiningSpeed { get; set; }
|
||||
public int DamagePerBlock { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
NumberOfRules = DataTypes.ReadNextVarInt(data);
|
||||
|
|
@ -30,13 +30,13 @@ public class ToolComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComp
|
|||
{
|
||||
var data = new List<byte>();
|
||||
data.AddRange(DataTypes.GetVarInt(NumberOfRules));
|
||||
|
||||
if(Rules.Count != NumberOfRules)
|
||||
|
||||
if (Rules.Count != NumberOfRules)
|
||||
throw new ArgumentNullException($"Can not serialize a ToolComponent1206 when the Rules count != NumberOfRules!");
|
||||
|
||||
|
||||
foreach (var rule in Rules)
|
||||
data.AddRange(rule.Serialize());
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetFloat(DefaultMiningSpeed));
|
||||
data.AddRange(DataTypes.GetVarInt(DamagePerBlock));
|
||||
return new Queue<byte>(data);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class TrimComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComp
|
|||
public string TrimPatternTypeDescription { get; set; } = null!;
|
||||
public bool Decal { get; set; }
|
||||
public bool ShowInTooltip { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
TrimMaterialType = DataTypes.ReadNextVarInt(data);
|
||||
|
|
@ -73,16 +73,16 @@ public class TrimComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComp
|
|||
{
|
||||
if (string.IsNullOrEmpty(AssetName))
|
||||
throw new NullReferenceException("Can't serialize the TrimComponent because the Asset Name is null!");
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetString(AssetName));
|
||||
data.AddRange(DataTypes.GetVarInt(Ingredient));
|
||||
data.AddRange(DataTypes.GetFloat(ItemModelIndex));
|
||||
data.AddRange(DataTypes.GetVarInt(NumberOfOverrides));
|
||||
if (NumberOfOverrides > 0)
|
||||
{
|
||||
if(NumberOfOverrides != Overrides?.Count)
|
||||
if (NumberOfOverrides != Overrides?.Count)
|
||||
throw new NullReferenceException("Can't serialize the TrimComponent because value of NumberOfOverrides and the size of Overrides don't match!");
|
||||
|
||||
|
||||
foreach (var (armorMaterialType, assetName) in Overrides)
|
||||
{
|
||||
data.AddRange(DataTypes.GetVarInt(armorMaterialType));
|
||||
|
|
@ -97,15 +97,15 @@ public class TrimComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComp
|
|||
{
|
||||
if (string.IsNullOrEmpty(TrimPatternTypeAssetName))
|
||||
throw new NullReferenceException("Can't serialize the TrimComponent because the TrimPatternTypeAssetName is null!");
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetString(TrimPatternTypeAssetName));
|
||||
data.AddRange(DataTypes.GetVarInt(TemplateItem));
|
||||
data.AddRange(DataTypes.GetNbt(TrimPatternTypeDescriptionNbt));
|
||||
data.AddRange(DataTypes.GetBool(Decal));
|
||||
}
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetBool(ShowInTooltip));
|
||||
|
||||
|
||||
return new Queue<byte>(data);
|
||||
}
|
||||
}
|
||||
|
|
@ -4,11 +4,11 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
|
||||
public class UnbrekableComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class UnbrekableComponent1206(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public bool Unbrekable { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
Unbrekable = DataTypes.ReadNextBool(data);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_2
|
|||
public class WritableBlookContentComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry) : StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public List<BookPage> Pages { get; set; } = [];
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
var count = DataTypes.ReadNextVarInt(data);
|
||||
|
|
@ -19,10 +19,10 @@ public class WritableBlookContentComponent(DataTypes dataTypes, ItemPalette item
|
|||
var rawContent = DataTypes.ReadNextString(data);
|
||||
var hasFilteredContent = DataTypes.ReadNextBool(data);
|
||||
var filteredContent = null as string;
|
||||
|
||||
if(hasFilteredContent)
|
||||
|
||||
if (hasFilteredContent)
|
||||
filteredContent = DataTypes.ReadNextString(data);
|
||||
|
||||
|
||||
Pages.Add(new BookPage(rawContent, hasFilteredContent, filteredContent));
|
||||
}
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ public class WritableBlookContentComponent(DataTypes dataTypes, ItemPalette item
|
|||
public override Queue<byte> Serialize()
|
||||
{
|
||||
var data = new List<byte>();
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetVarInt(Pages.Count));
|
||||
|
||||
foreach (var page in Pages)
|
||||
|
|
@ -40,9 +40,9 @@ public class WritableBlookContentComponent(DataTypes dataTypes, ItemPalette item
|
|||
|
||||
if (page.HasFilteredContent)
|
||||
{
|
||||
if(page.FilteredContent is null)
|
||||
if (page.FilteredContent is null)
|
||||
throw new InvalidOperationException("Can not serialize WritableBlookContentComponent because page.HasFilteredContent = true, but FilteredContent is null!");
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetString(page.FilteredContent));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public class WrittenBlookContentComponent(DataTypes dataTypes, ItemPalette itemP
|
|||
public int NumberOfPages { get; set; }
|
||||
public List<BookPage> Pages { get; set; } = [];
|
||||
public bool Resolved { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
RawTitle = DataTypes.ReadNextString(data);
|
||||
|
|
@ -25,7 +25,7 @@ public class WrittenBlookContentComponent(DataTypes dataTypes, ItemPalette itemP
|
|||
|
||||
if (HasFilteredTitle)
|
||||
FilteredTitle = DataTypes.ReadNextString(data);
|
||||
|
||||
|
||||
Author = DataTypes.ReadNextString(data);
|
||||
Generation = DataTypes.ReadNextVarInt(data);
|
||||
NumberOfPages = DataTypes.ReadNextVarInt(data);
|
||||
|
|
@ -37,13 +37,13 @@ public class WrittenBlookContentComponent(DataTypes dataTypes, ItemPalette itemP
|
|||
var hasFilteredContent = DataTypes.ReadNextBool(data);
|
||||
Dictionary<string, object>? filteredContentNbt = null;
|
||||
string? filteredContent = null;
|
||||
|
||||
|
||||
if (hasFilteredContent)
|
||||
{
|
||||
filteredContentNbt = DataTypes.ReadNextNbt(data);
|
||||
filteredContent = ChatParser.ParseText(filteredContentNbt);
|
||||
}
|
||||
|
||||
|
||||
Pages.Add(new BookPage(rawContent, hasFilteredContent, filteredContent, rawContentNbt, filteredContentNbt));
|
||||
}
|
||||
|
||||
|
|
@ -53,18 +53,18 @@ public class WrittenBlookContentComponent(DataTypes dataTypes, ItemPalette itemP
|
|||
public override Queue<byte> Serialize()
|
||||
{
|
||||
var data = new List<byte>();
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetString(RawTitle));
|
||||
data.AddRange(DataTypes.GetBool(HasFilteredTitle));
|
||||
|
||||
if (HasFilteredTitle)
|
||||
{
|
||||
if(FilteredTitle is null)
|
||||
if (FilteredTitle is null)
|
||||
throw new InvalidOperationException("Can not serialize WrittenBookContentComponent because HasFilteredTitle is true but FilteredTitle is null!");
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetString(FilteredTitle));
|
||||
}
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetString(Author));
|
||||
data.AddRange(DataTypes.GetVarInt(Generation));
|
||||
data.AddRange(DataTypes.GetVarInt(Pages.Count));
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
|||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_21;
|
||||
|
||||
public class JukeBoxPlayableComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
public class JukeBoxPlayableComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
public bool DirectMode { get; set; }
|
||||
|
|
@ -18,7 +18,7 @@ public class JukeBoxPlayableComponent(DataTypes dataTypes, ItemPalette itemPalet
|
|||
public float? Duration { get; set; }
|
||||
public int? Output { get; set; }
|
||||
public bool ShowTooltip { get; set; }
|
||||
|
||||
|
||||
public override void Parse(Queue<byte> data)
|
||||
{
|
||||
DirectMode = DataTypes.ReadNextBool(data);
|
||||
|
|
@ -46,22 +46,22 @@ public class JukeBoxPlayableComponent(DataTypes dataTypes, ItemPalette itemPalet
|
|||
public override Queue<byte> Serialize()
|
||||
{
|
||||
var data = new List<byte>();
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetBool(DirectMode));
|
||||
|
||||
if (!DirectMode)
|
||||
{
|
||||
if (string.IsNullOrEmpty(SongName?.Trim()))
|
||||
throw new ArgumentNullException($"Can not serialize JukeBoxPlayableComponent due to SongName being null or empty!");
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetString(SongName));
|
||||
}
|
||||
|
||||
if (DirectMode)
|
||||
{
|
||||
if(SongType is null)
|
||||
if (SongType is null)
|
||||
throw new ArgumentNullException($"Can not serialize JukeBoxPlayableComponent due to SongType being null!");
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetVarInt((int)SongType));
|
||||
|
||||
if (SongType == 0)
|
||||
|
|
@ -91,9 +91,9 @@ public class JukeBoxPlayableComponent(DataTypes dataTypes, ItemPalette itemPalet
|
|||
data.AddRange(DataTypes.GetVarInt((int)Output));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetBool(ShowTooltip));
|
||||
|
||||
|
||||
return new Queue<byte>(data);
|
||||
}
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ public class EquippableComponent(DataTypes dataTypes, ItemPalette itemPalette, S
|
|||
{
|
||||
Slot = DataTypes.ReadNextVarInt(data);
|
||||
EquipSound = (SoundEventSubComponent)SubComponentRegistry.ParseSubComponent(SubComponents.SoundEvent, data);
|
||||
|
||||
|
||||
HasModel = DataTypes.ReadNextBool(data);
|
||||
if (HasModel)
|
||||
Model = DataTypes.ReadNextString(data);
|
||||
|
|
|
|||
|
|
@ -26,4 +26,5 @@ public class TypedEntityDataComponent261(DataTypes dataTypes, ItemPalette itemPa
|
|||
}
|
||||
|
||||
public class BlockEntityDataComponent261(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: TypedEntityDataComponent261(dataTypes, itemPalette, subComponentRegistry) {}
|
||||
: TypedEntityDataComponent261(dataTypes, itemPalette, subComponentRegistry)
|
||||
{ }
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public class AttributeSubComponent(DataTypes dataTypes, SubComponentRegistry sub
|
|||
public double Value { get; set; }
|
||||
public int Operation { get; set; }
|
||||
public int Slot { get; set; }
|
||||
|
||||
|
||||
protected override void Parse(Queue<byte> data)
|
||||
{
|
||||
TypeId = DataTypes.ReadNextVarInt(data);
|
||||
|
|
@ -28,10 +28,10 @@ public class AttributeSubComponent(DataTypes dataTypes, SubComponentRegistry sub
|
|||
var data = new List<byte>();
|
||||
data.AddRange(DataTypes.GetVarInt(TypeId));
|
||||
data.AddRange(DataTypes.GetUUID(Uuid));
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(Name?.Trim()))
|
||||
throw new ArgumentNullException($"Can not serialize AttributeSubComponent due to Name being null or empty!");
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetString(Name));
|
||||
data.AddRange(DataTypes.GetDouble(Value));
|
||||
data.AddRange(DataTypes.GetVarInt(Operation));
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public class BlockPredicateSubcomponent(DataTypes dataTypes, SubComponentRegistr
|
|||
public List<PropertySubComponent>? Properties { get; set; }
|
||||
public bool HasNbt { get; set; }
|
||||
public Dictionary<string, object>? Nbt { get; set; }
|
||||
|
||||
|
||||
protected override void Parse(Queue<byte> data)
|
||||
{
|
||||
HasBlocks = DataTypes.ReadNextBool(data);
|
||||
|
|
@ -31,7 +31,7 @@ public class BlockPredicateSubcomponent(DataTypes dataTypes, SubComponentRegistr
|
|||
}
|
||||
|
||||
HasNbt = DataTypes.ReadNextBool(data);
|
||||
|
||||
|
||||
if (HasNbt)
|
||||
Nbt = DataTypes.ReadNextNbt(data);
|
||||
}
|
||||
|
|
@ -39,22 +39,22 @@ public class BlockPredicateSubcomponent(DataTypes dataTypes, SubComponentRegistr
|
|||
public override Queue<byte> Serialize()
|
||||
{
|
||||
var data = new List<byte>();
|
||||
|
||||
|
||||
// Block Sets
|
||||
data.AddRange(DataTypes.GetBool(HasBlocks));
|
||||
if (HasBlocks)
|
||||
{
|
||||
if(BlockSet is null)
|
||||
if (BlockSet is null)
|
||||
throw new ArgumentNullException($"Can not serialize a BlockPredicate when the BlockSet is empty but HasBlocks is true!");
|
||||
|
||||
|
||||
data.AddRange(BlockSet.Serialize());
|
||||
}
|
||||
|
||||
|
||||
// Properties
|
||||
data.AddRange(DataTypes.GetBool(HasProperities));
|
||||
if (HasProperities)
|
||||
{
|
||||
if(Properties is null || Properties.Count == 0)
|
||||
if (Properties is null || Properties.Count == 0)
|
||||
throw new ArgumentNullException($"Can not serialize a BlockPredicate when the Properties is empty but HasProperties is true!");
|
||||
|
||||
data.AddRange(DataTypes.GetVarInt(Properties.Count));
|
||||
|
|
@ -66,12 +66,12 @@ public class BlockPredicateSubcomponent(DataTypes dataTypes, SubComponentRegistr
|
|||
data.AddRange(DataTypes.GetBool(HasNbt));
|
||||
if (HasNbt)
|
||||
{
|
||||
if(Nbt is null)
|
||||
if (Nbt is null)
|
||||
throw new ArgumentNullException($"Can not serialize a BlockPredicate when the Nbt is empty but HasNbt is true!");
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetNbt(Nbt));
|
||||
}
|
||||
|
||||
|
||||
return new Queue<byte>(data);
|
||||
}
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ public class BlockSetSubcomponent(DataTypes dataTypes, SubComponentRegistry subC
|
|||
public int Type { get; set; }
|
||||
public string? TagName { get; set; }
|
||||
public List<int>? BlockIds { get; set; }
|
||||
|
||||
|
||||
protected override void Parse(Queue<byte> data)
|
||||
{
|
||||
Type = DataTypes.ReadNextVarInt(data);
|
||||
|
|
@ -18,9 +18,9 @@ public class BlockSetSubcomponent(DataTypes dataTypes, SubComponentRegistry subC
|
|||
TagName = DataTypes.ReadNextString(data);
|
||||
|
||||
if (Type == 0) return;
|
||||
|
||||
|
||||
BlockIds = [];
|
||||
|
||||
|
||||
for (var i = 0; i < Type - 1; i++)
|
||||
BlockIds.Add(DataTypes.ReadNextVarInt(data));
|
||||
}
|
||||
|
|
@ -33,16 +33,16 @@ public class BlockSetSubcomponent(DataTypes dataTypes, SubComponentRegistry subC
|
|||
{
|
||||
if (string.IsNullOrEmpty(TagName?.Trim()))
|
||||
throw new ArgumentNullException($"Can not serialize an empty tag name when the Block Set type is 0!");
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetString(TagName));
|
||||
}
|
||||
|
||||
if (Type == 0) return new Queue<byte>(data);
|
||||
|
||||
if(BlockIds is null || BlockIds.Count == 0)
|
||||
|
||||
if (BlockIds is null || BlockIds.Count == 0)
|
||||
throw new ArgumentNullException($"Can not serialize an empty list of Block IDs in a Block Set when the type is not 0!");
|
||||
|
||||
for(var i = 0; i < Type - 1; i++)
|
||||
|
||||
for (var i = 0; i < Type - 1; i++)
|
||||
data.AddRange(DataTypes.GetVarInt(BlockIds[i]));
|
||||
|
||||
return new Queue<byte>(data);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public class DetailsSubComponent(DataTypes dataTypes, SubComponentRegistry subCo
|
|||
public bool ShowIcon { get; set; }
|
||||
public bool HasHiddenEffects { get; set; }
|
||||
public DetailsSubComponent? Detail { get; set; }
|
||||
|
||||
|
||||
protected override void Parse(Queue<byte> data)
|
||||
{
|
||||
Amplifier = DataTypes.ReadNextVarInt(data);
|
||||
|
|
@ -22,8 +22,8 @@ public class DetailsSubComponent(DataTypes dataTypes, SubComponentRegistry subCo
|
|||
ShowParticles = DataTypes.ReadNextBool(data);
|
||||
ShowIcon = DataTypes.ReadNextBool(data);
|
||||
HasHiddenEffects = DataTypes.ReadNextBool(data);
|
||||
|
||||
if(HasHiddenEffects)
|
||||
|
||||
if (HasHiddenEffects)
|
||||
Detail = (DetailsSubComponent)SubComponentRegistry.ParseSubComponent(SubComponents.Details, data);
|
||||
}
|
||||
|
||||
|
|
@ -39,9 +39,9 @@ public class DetailsSubComponent(DataTypes dataTypes, SubComponentRegistry subCo
|
|||
|
||||
if (HasHiddenEffects)
|
||||
{
|
||||
if(Detail is null)
|
||||
if (Detail is null)
|
||||
throw new ArgumentNullException($"Can not serialize a DetailSubComponent1206 when the Detail is empty but HasHiddenEffects is true!");
|
||||
|
||||
|
||||
data.AddRange(Detail.Serialize());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ public class EffectSubComponent(DataTypes dataTypes, SubComponentRegistry subCom
|
|||
{
|
||||
public PotionEffectSubComponent TypeId { get; set; } = null!;
|
||||
public float Probability { get; set; }
|
||||
|
||||
|
||||
protected override void Parse(Queue<byte> data)
|
||||
{
|
||||
TypeId = (PotionEffectSubComponent)SubComponentRegistry.ParseSubComponent(SubComponents.PotionEffect, data);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public class FireworkExplosionSubComponent(DataTypes dataTypes, SubComponentRegi
|
|||
public List<int> FadeColors { get; set; } = [];
|
||||
public bool HasTrail { get; set; }
|
||||
public bool HasTwinkle { get; set; }
|
||||
|
||||
|
||||
protected override void Parse(Queue<byte> data)
|
||||
{
|
||||
Shape = DataTypes.ReadNextVarInt(data);
|
||||
|
|
@ -21,12 +21,12 @@ public class FireworkExplosionSubComponent(DataTypes dataTypes, SubComponentRegi
|
|||
|
||||
for (var i = 0; i < NumberOfColors; i++)
|
||||
Colors.Add(DataTypes.ReadNextInt(data));
|
||||
|
||||
|
||||
NumberOfFadeColors = DataTypes.ReadNextVarInt(data);
|
||||
|
||||
for (var i = 0; i < NumberOfFadeColors; i++)
|
||||
FadeColors.Add(DataTypes.ReadNextInt(data));
|
||||
|
||||
|
||||
HasTrail = DataTypes.ReadNextBool(data);
|
||||
HasTwinkle = DataTypes.ReadNextBool(data);
|
||||
}
|
||||
|
|
@ -45,7 +45,7 @@ public class FireworkExplosionSubComponent(DataTypes dataTypes, SubComponentRegi
|
|||
foreach (var color in Colors)
|
||||
data.AddRange(DataTypes.GetInt(color));
|
||||
}
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetVarInt(NumberOfFadeColors));
|
||||
if (NumberOfFadeColors > 0)
|
||||
{
|
||||
|
|
@ -55,7 +55,7 @@ public class FireworkExplosionSubComponent(DataTypes dataTypes, SubComponentRegi
|
|||
foreach (var fadeColor in FadeColors)
|
||||
data.AddRange(DataTypes.GetInt(fadeColor));
|
||||
}
|
||||
|
||||
|
||||
data.AddRange(DataTypes.GetBool(HasTrail));
|
||||
data.AddRange(DataTypes.GetBool(HasTwinkle));
|
||||
return new Queue<byte>(data);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ public class PotionEffectSubComponent(DataTypes dataTypes, SubComponentRegistry
|
|||
{
|
||||
public int TypeId { get; set; }
|
||||
public DetailsSubComponent Details { get; set; } = null!;
|
||||
|
||||
|
||||
protected override void Parse(Queue<byte> data)
|
||||
{
|
||||
TypeId = DataTypes.ReadNextVarInt(data);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue