Skip to content

Commit 8ae1ee3

Browse files
authored
1.21.7 (#491)
1 parent c419636 commit 8ae1ee3

File tree

19 files changed

+1535
-2052
lines changed

19 files changed

+1535
-2052
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using Obsidian.API.Utilities;
2+
using Obsidian.Nbt.Interfaces;
3+
4+
namespace Obsidian.API.Registry.Codecs.Dialogs;
5+
public sealed record class DialogAction : INbtSerializable
6+
{
7+
public required ChatMessage Label { get; set; }
8+
9+
public required int Width { get; set; }
10+
11+
public void Write(INbtWriter writer)
12+
{
13+
writer.WriteInt("width", Width);
14+
15+
writer.WriteCompoundStart("label");
16+
17+
writer.WriteChatMessage(this.Label);
18+
19+
writer.EndCompound();
20+
}
21+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using Obsidian.Nbt.Interfaces;
2+
3+
namespace Obsidian.API.Registry.Codecs.Dialogs;
4+
public sealed record class DialogCodec : ICodec
5+
{
6+
public required string Name { get; init; }
7+
8+
public required int Id { get; init; }
9+
10+
public required DialogElement Element { get; init; }
11+
12+
public void WriteElement(INbtWriter writer) => this.Element.Write(writer);
13+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using Obsidian.Nbt.Interfaces;
2+
3+
namespace Obsidian.API.Registry.Codecs.Dialogs;
4+
5+
//TODO: Expand this class to include more properties as needed
6+
public sealed record class DialogElement : INbtSerializable
7+
{
8+
public required string Type { get; init; }
9+
10+
public int ButtonWidth { get; set; } = 200;
11+
12+
public int Columns { get; set; }
13+
14+
public string? Dialogs { get; set; }
15+
16+
public required DialogAction ExitAction { get; set; }
17+
18+
public ChatMessage? ExternalTitle { get; set; }
19+
20+
public required ChatMessage Title { get; set; }
21+
22+
public void Write(INbtWriter writer) => throw new NotImplementedException();
23+
}

Obsidian.API/Registry/Codecs/Dimensions/DimensionCodec.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using Obsidian.Nbt;
2-
using Obsidian.Nbt.Interfaces;
1+
using Obsidian.Nbt.Interfaces;
32

43
namespace Obsidian.API.Registry.Codecs.Dimensions;
54

Obsidian/Utilities/Extensions.Nbt.Chat.cs renamed to Obsidian.API/Utilities/Extensions.Nbt.cs

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
using Obsidian.Nbt;
1+
using Obsidian.API.Inventory;
2+
using Obsidian.API.Registries;
3+
using Obsidian.Nbt;
24
using Obsidian.Nbt.Interfaces;
35
using System.Text.Json;
46

5-
namespace Obsidian.Utilities;
6-
7+
namespace Obsidian.API.Utilities;
78
public partial class Extensions
89
{
910
public static void WriteChatMessage(this INbtWriter writer, ChatMessage chatMessage)
@@ -184,4 +185,27 @@ public static NbtCompound ToNbt(this HoverComponent hoverComponent)
184185
new NbtTag<string>("action", JsonNamingPolicy.SnakeCaseLower.ConvertName(clickComponent.Action.ToString())),
185186
new NbtTag<string>("command", clickComponent.Value)
186187
};
188+
189+
public static void WriteNbtCompound(this INetStreamWriter writer, NbtCompound compound)
190+
{
191+
using var nbtWriter = new RawNbtWriter(true);
192+
193+
foreach (var (_, tag) in compound)
194+
nbtWriter.WriteTag(tag);
195+
196+
nbtWriter.TryFinish();
197+
198+
writer.WriteByteArray(nbtWriter.Data);
199+
}
200+
201+
//DESERIALIZE ITEM COMPONENTS
202+
public static ItemStack? ItemFromNbt(this NbtCompound? item)
203+
{
204+
if (item is null)
205+
return null;
206+
207+
var itemStack = ItemsRegistry.GetSingleItem(item.GetString("id"));
208+
209+
return itemStack;
210+
}
187211
}

Obsidian.API/_Enums/ParticleType.cs

Lines changed: 79 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -37,81 +37,83 @@ public enum ParticleType : int
3737
Infested = 32,
3838
CherryLeaves = 33,
3939
PaleOakLeaves = 34,
40-
SculkSoul = 35,
41-
SculkCharge = 36,
42-
SculkChargePop = 37,
43-
SoulFireFlame = 38,
44-
Soul = 39,
45-
Flash = 40,
46-
HappyVillager = 41,
47-
Composter = 42,
48-
Heart = 43,
49-
InstantEffect = 44,
50-
Item = 45,
51-
Vibration = 46,
52-
Trail = 47,
53-
ItemSlime = 48,
54-
ItemCobweb = 49,
55-
ItemSnowball = 50,
56-
LargeSmoke = 51,
57-
Lava = 52,
58-
Mycelium = 53,
59-
Note = 54,
60-
Poof = 55,
61-
Portal = 56,
62-
Rain = 57,
63-
Smoke = 58,
64-
WhiteSmoke = 59,
65-
Sneeze = 60,
66-
Spit = 61,
67-
SquidInk = 62,
68-
SweepAttack = 63,
69-
TotemOfUndying = 64,
70-
Underwater = 65,
71-
Splash = 66,
72-
Witch = 67,
73-
BubblePop = 68,
74-
CurrentDown = 69,
75-
BubbleColumnUp = 70,
76-
Nautilus = 71,
77-
Dolphin = 72,
78-
CampfireCosySmoke = 73,
79-
CampfireSignalSmoke = 74,
80-
DrippingHoney = 75,
81-
FallingHoney = 76,
82-
LandingHoney = 77,
83-
FallingNectar = 78,
84-
FallingSporeBlossom = 79,
85-
Ash = 80,
86-
CrimsonSpore = 81,
87-
WarpedSpore = 82,
88-
SporeBlossomAir = 83,
89-
DrippingObsidianTear = 84,
90-
FallingObsidianTear = 85,
91-
LandingObsidianTear = 86,
92-
ReversePortal = 87,
93-
WhiteAsh = 88,
94-
SmallFlame = 89,
95-
Snowflake = 90,
96-
DrippingDripstoneLava = 91,
97-
FallingDripstoneLava = 92,
98-
DrippingDripstoneWater = 93,
99-
FallingDripstoneWater = 94,
100-
GlowSquidInk = 95,
101-
Glow = 96,
102-
WaxOn = 97,
103-
WaxOff = 98,
104-
ElectricSpark = 99,
105-
Scrape = 100,
106-
Shriek = 101,
107-
EggCrack = 102,
108-
DustPlume = 103,
109-
TrialSpawnerDetection = 104,
110-
TrialSpawnerDetectionOminous = 105,
111-
VaultConnection = 106,
112-
DustPillar = 107,
113-
OminousSpawning = 108,
114-
RaidOmen = 109,
115-
TrialOmen = 110,
116-
BlockCrumble = 111,
40+
TintedLeaves = 35,
41+
SculkSoul = 36,
42+
SculkCharge = 37,
43+
SculkChargePop = 38,
44+
SoulFireFlame = 39,
45+
Soul = 40,
46+
Flash = 41,
47+
HappyVillager = 42,
48+
Composter = 43,
49+
Heart = 44,
50+
InstantEffect = 45,
51+
Item = 46,
52+
Vibration = 47,
53+
Trail = 48,
54+
ItemSlime = 49,
55+
ItemCobweb = 50,
56+
ItemSnowball = 51,
57+
LargeSmoke = 52,
58+
Lava = 53,
59+
Mycelium = 54,
60+
Note = 55,
61+
Poof = 56,
62+
Portal = 57,
63+
Rain = 58,
64+
Smoke = 59,
65+
WhiteSmoke = 60,
66+
Sneeze = 61,
67+
Spit = 62,
68+
SquidInk = 63,
69+
SweepAttack = 64,
70+
TotemOfUndying = 65,
71+
Underwater = 66,
72+
Splash = 67,
73+
Witch = 68,
74+
BubblePop = 69,
75+
CurrentDown = 70,
76+
BubbleColumnUp = 71,
77+
Nautilus = 72,
78+
Dolphin = 73,
79+
CampfireCosySmoke = 74,
80+
CampfireSignalSmoke = 75,
81+
DrippingHoney = 76,
82+
FallingHoney = 77,
83+
LandingHoney = 78,
84+
FallingNectar = 79,
85+
FallingSporeBlossom = 80,
86+
Ash = 81,
87+
CrimsonSpore = 82,
88+
WarpedSpore = 83,
89+
SporeBlossomAir = 84,
90+
DrippingObsidianTear = 85,
91+
FallingObsidianTear = 86,
92+
LandingObsidianTear = 87,
93+
ReversePortal = 88,
94+
WhiteAsh = 89,
95+
SmallFlame = 90,
96+
Snowflake = 91,
97+
DrippingDripstoneLava = 92,
98+
FallingDripstoneLava = 93,
99+
DrippingDripstoneWater = 94,
100+
FallingDripstoneWater = 95,
101+
GlowSquidInk = 96,
102+
Glow = 97,
103+
WaxOn = 98,
104+
WaxOff = 99,
105+
ElectricSpark = 100,
106+
Scrape = 101,
107+
Shriek = 102,
108+
EggCrack = 103,
109+
DustPlume = 104,
110+
TrialSpawnerDetection = 105,
111+
TrialSpawnerDetectionOminous = 106,
112+
VaultConnection = 107,
113+
DustPillar = 108,
114+
OminousSpawning = 109,
115+
RaidOmen = 110,
116+
TrialOmen = 111,
117+
BlockCrumble = 112,
118+
Firefly = 113,
117119
}

Obsidian.API/_Enums/ProtocolVersion.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,8 @@ public enum ProtocolVersion
7676
v1_21_5 = 770,
7777

7878
[Description("1.21.6")]
79-
v1_21_6 = 771
79+
v1_21_6 = 771,
80+
81+
[Description("1.21.7")]
82+
v1_21_7 = 772,
8083
}

Obsidian.SourceGenerators/Registry/Models/Assets.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ public static Dictionary<string, Codec[]> GetCodecs(ImmutableArray<(string name,
5353
{ "pig_variant", ParseCodec(files.GetJsonFromArray("pig_variant")) },
5454
{ "wolf_variant", ParseCodec(files.GetJsonFromArray("wolf_variant")) },
5555
{ "painting_variant", ParseCodec(files.GetJsonFromArray("painting_variant")) },
56-
{ "wolf_sound_variant", ParseCodec(files.GetJsonFromArray("wolf_sound_variant")) }
56+
{ "wolf_sound_variant", ParseCodec(files.GetJsonFromArray("wolf_sound_variant")) },
57+
{ "dialogs", ParseCodec(files.GetJsonFromArray("dialogs")) }
5758
};
5859
}
5960

Obsidian.SourceGenerators/Registry/RegistryAssetsGenerator.Codecs.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ private static void GenerateCodecs(Assets assets, SourceProductionContext ctx)
1818
.Using("Obsidian.API.Registry.Codecs")
1919
.Using("Obsidian.API.Registry.Codecs.Biomes")
2020
.Using("Obsidian.API.Registry.Codecs.Chat")
21+
.Using("Obsidian.API.Registry.Codecs.Dialogs")
2122
.Using("Obsidian.API.Registry.Codecs.Dimensions")
2223
.Using("Obsidian.API.Registry.Codecs.DamageTypes")
2324
.Using("Obsidian.API.Registry.Codecs.ArmorTrims")
@@ -135,7 +136,7 @@ private static void GenerateCodecs(Assets assets, SourceProductionContext ctx)
135136
builder.GenerateSimpleCodec(codecs["pig_variant"].ToArray(), "PigVariant", "minecraft:pig_variant", "BiomeVariantCodec", ctx);
136137

137138
builder.GenerateSimpleCodec(codecs["painting_variant"].ToArray(), "PaintingVariant", "minecraft:painting_variant", "PaintingVariantCodec", ctx);
138-
139+
builder.GenerateSimpleCodec(codecs["dialogs"].ToArray(), "Dialog", "minecraft:dialog", "DialogCodec", ctx);
139140
builder.EndScope();
140141

141142
ctx.AddSource("CodecRegistry.g.cs", builder.ToString());
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"type": "minecraft:dialog",
3+
"value": [
4+
{
5+
"name": "minecraft:custom_options",
6+
"id": 0,
7+
"element": {
8+
"type": "minecraft:dialog_list",
9+
"button_width": 310,
10+
"columns": 1,
11+
"dialogs": "#minecraft:pause_screen_additions",
12+
"exit_action": {
13+
"label": {
14+
"translate": "gui.back"
15+
},
16+
"width": 200
17+
},
18+
"external_title": {
19+
"translate": "menu.custom_options"
20+
},
21+
"title": {
22+
"translate": "menu.custom_options.title"
23+
}
24+
}
25+
},
26+
{
27+
"name": "minecraft:quick_actions",
28+
"id": 1,
29+
"element": {
30+
"type": "minecraft:dialog_list",
31+
"button_width": 310,
32+
"columns": 1,
33+
"dialogs": "#minecraft:quick_actions",
34+
"exit_action": {
35+
"label": {
36+
"translate": "gui.back"
37+
},
38+
"width": 200
39+
},
40+
"external_title": {
41+
"translate": "menu.quick_actions"
42+
},
43+
"title": {
44+
"translate": "menu.quick_actions.title"
45+
}
46+
}
47+
},
48+
{
49+
"name": "minecraft:server_links",
50+
"id": 2,
51+
"element": {
52+
"type": "minecraft:server_links",
53+
"button_width": 310,
54+
"columns": 1,
55+
"exit_action": {
56+
"label": {
57+
"translate": "gui.back"
58+
},
59+
"width": 200
60+
},
61+
"external_title": {
62+
"translate": "menu.server_links"
63+
},
64+
"title": {
65+
"translate": "menu.server_links.title"
66+
}
67+
}
68+
}
69+
]
70+
}

0 commit comments

Comments
 (0)