Skip to content

Commit 716ea79

Browse files
committed
Update to Minestom 1.21.8
- Move to new tag and registry system
1 parent 05c3434 commit 716ea79

File tree

7 files changed

+19
-13
lines changed

7 files changed

+19
-13
lines changed

blocks/src/main/java/net/minestom/vanilla/blocks/behaviours/JukeboxBlockBehaviour.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import net.minestom.server.instance.block.Block;
1313
import net.minestom.server.instance.block.jukebox.JukeboxSong;
1414
import net.minestom.server.item.ItemStack;
15-
import net.minestom.server.registry.DynamicRegistry;
15+
import net.minestom.server.registry.RegistryKey;
1616
import net.minestom.server.tag.Tag;
1717
import net.minestom.server.worldevent.WorldEvent;
1818
import net.minestom.vanilla.blocks.VanillaBlockBehaviour;
@@ -84,8 +84,7 @@ public boolean onInteract(@NotNull Interaction interaction) {
8484

8585
InventoryManipulation.consumeItemIfNotCreative(player, heldItem, hand);
8686

87-
JukeboxSong song = heldItem.get(DataComponents.JUKEBOX_PLAYABLE).holder().resolve(MinecraftServer.getJukeboxSongRegistry());
88-
DynamicRegistry.Key<JukeboxSong> songKey = MinecraftServer.getJukeboxSongRegistry().getKey(song);
87+
RegistryKey<JukeboxSong> songKey = heldItem.get(DataComponents.JUKEBOX_PLAYABLE);
8988
int songId = MinecraftServer.getJukeboxSongRegistry().getId(songKey);
9089

9190
// TODO: Group packet?

core/src/main/java/net/minestom/vanilla/utils/MinestomUtils.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package net.minestom.vanilla.utils;
22

3+
import net.kyori.adventure.key.Key;
34
import net.minestom.server.MinecraftServer;
45
import net.minestom.server.component.DataComponents;
56
import net.minestom.server.entity.EntityType;
@@ -31,7 +32,15 @@ public static int getEnchantLevel(ItemStack itemStack, Enchantment enchantment,
3132
return enchants.level(enchant);
3233
}
3334

35+
public static int getEnchantLevel(ItemStack itemStack, Key enchantment, int defaultValue) {
36+
return getEnchantLevel(itemStack, MinecraftServer.getEnchantmentRegistry().get(enchantment), defaultValue);
37+
}
38+
3439
public static RegistryKey<Enchantment> getEnchantKey(Enchantment enchantment) {
3540
return MinecraftServer.getEnchantmentRegistry().getKey(enchantment);
3641
}
42+
43+
public static RegistryKey<Enchantment> getEnchantKey(Key enchantment) {
44+
return getEnchantKey(MinecraftServer.getEnchantmentRegistry().get(enchantment));
45+
}
3746
}

datapack-loading/src/main/java/net/minestom/vanilla/datapack/loot/function/InBuiltLootFunctions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import net.minestom.server.item.component.AttributeList;
2121
import net.minestom.server.item.component.EnchantmentList;
2222
import net.minestom.server.item.enchant.Enchantment;
23-
import net.minestom.server.registry.DynamicRegistry;
23+
import net.minestom.server.registry.RegistryKey;
2424
import net.minestom.vanilla.datapack.DatapackLoader;
2525
import net.minestom.vanilla.datapack.json.JsonUtils;
2626
import net.minestom.vanilla.datapack.loot.LootTable;
@@ -793,7 +793,7 @@ public ItemStack apply(Context context) {
793793
Enchantment enchantment = entry.getKey();
794794
int count = entry.getValue().asInt().apply(context::random);
795795

796-
DynamicRegistry.Key<Enchantment> key = MinestomUtils.getEnchantKey(enchantment);
796+
RegistryKey<Enchantment> key = MinestomUtils.getEnchantKey(enchantment);
797797

798798
if (add) {
799799
int previousValue = list.has(key) ? list.level(key) : 0;

datapack-loading/src/main/java/net/minestom/vanilla/datapack/loot/function/InBuiltPredicates.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import net.minestom.server.item.ItemStack;
1010
import net.minestom.server.item.component.EnchantmentList;
1111
import net.minestom.server.item.enchant.Enchantment;
12-
import net.minestom.server.registry.DynamicRegistry;
12+
import net.minestom.server.registry.RegistryKey;
1313
import net.minestom.vanilla.datapack.DatapackLoader;
1414
import net.minestom.vanilla.datapack.json.JsonUtils;
1515
import net.minestom.vanilla.datapack.json.Optional;
@@ -362,7 +362,7 @@ public String condition() {
362362
public boolean test(LootContext context) {
363363
ItemStack item = context.getOrThrow(LootContext.TOOL);
364364
EnchantmentList enchants = item.get(DataComponents.ENCHANTMENTS);
365-
DynamicRegistry.Key<Enchantment> enchantment = MinestomUtils.getEnchantKey(this.enchantment);
365+
RegistryKey<Enchantment> enchantment = MinestomUtils.getEnchantKey(this.enchantment);
366366
int level = enchants == null || !enchants.has(enchantment) ? 0 : enchants.level(enchantment);
367367

368368
return ThreadLocalRandom.current().nextFloat() < chances.get(level);

fluid-simulation/src/main/java/io/github/togar2/fluids/FlowableFluid.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
import it.unimi.dsi.fastutil.shorts.Short2BooleanMap;
44
import it.unimi.dsi.fastutil.shorts.Short2BooleanOpenHashMap;
5-
import net.minestom.server.MinecraftServer;
65
import net.minestom.server.coordinate.Point;
7-
import net.minestom.server.gamedata.tags.Tag;
8-
import net.minestom.server.gamedata.tags.TagManager;
96
import net.minestom.server.instance.Instance;
107
import net.minestom.server.instance.block.Block;
118
import net.minestom.server.item.Material;
9+
import net.minestom.server.registry.TagKey;
1210
import net.minestom.server.utils.Direction;
1311

1412
import java.util.EnumMap;
@@ -242,7 +240,6 @@ private int getAdjacentSourceCount(Instance instance, Point point) {
242240
*/
243241
private boolean canFill(Instance instance, Point point, Block block, Block flowing) {
244242
//TODO check waterloggable
245-
TagManager tags = MinecraftServer.getTagManager();
246243
if (block.compare(Block.LADDER)
247244
|| block.compare(Block.SUGAR_CANE)
248245
|| block.compare(Block.BUBBLE_COLUMN)
@@ -254,7 +251,7 @@ private boolean canFill(Instance instance, Point point, Block block, Block flowi
254251
|| block.compare(Block.SEAGRASS)
255252
|| block.compare(Block.TALL_SEAGRASS)
256253
|| block.compare(Block.SEA_PICKLE)
257-
|| Objects.requireNonNull(tags.getTag(Tag.BasicType.BLOCKS, "minecraft:signs")).contains(block.key())
254+
|| Objects.requireNonNull(Block.staticRegistry().getTag(TagKey.ofHash("#minecraft:all_signs"))).contains(Objects.requireNonNull(block.asKey()))
258255
|| block.name().contains("door")
259256
|| block.name().contains("coral")) {
260257
return false;

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
minestom_version=2025.07.04-1.21.5
1+
minestom_version=2025.08.29-1.21.8
22
rayfast_version=684e854a48
33
jnoise_version=4.0.0
44
annotations_version=23.0.0

items/src/main/java/net/minestom/vanilla/items/FlintAndSteelHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public boolean onUseOnBlock(PlayerUseItemOnBlockEvent event) {
4040
// BlockFace blockFace, float cursorX, float cursorY, float cursorZ
4141
instance.placeBlock(new BlockHandler.PlayerPlacement(
4242
Block.FIRE,
43+
atFirePosition,
4344
instance,
4445
firePosition,
4546
player,

0 commit comments

Comments
 (0)