mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-18 02:22:32 +00:00
feat: update Minestom version and replace deprecated ItemComponent API
Updated the Minestom library to version 1_21_5-69b9a5d844 and migrated from the deprecated `ItemComponent` API to `DataComponents`. This ensures compatibility with the latest changes and improves maintainability.
This commit is contained in:
parent
1dd59c378e
commit
089b25dea4
@ -84,6 +84,6 @@ object Versions {
|
||||
}
|
||||
|
||||
object Minestom {
|
||||
const val minestom = "fb895cb899"
|
||||
const val minestom = "1_21_5-69b9a5d844"
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import com.dfsek.terra.api.inventory.item.Enchantment;
|
||||
import com.dfsek.terra.api.inventory.item.ItemMeta;
|
||||
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.item.ItemComponent;
|
||||
import net.minestom.server.component.DataComponents;
|
||||
import net.minestom.server.item.ItemStack;
|
||||
import net.minestom.server.item.component.EnchantmentList;
|
||||
import net.minestom.server.registry.DynamicRegistry;
|
||||
@ -47,7 +47,7 @@ public class MinestomItemStack implements com.dfsek.terra.api.inventory.ItemStac
|
||||
@Override
|
||||
public ItemMeta getItemMeta() {
|
||||
HashMap<Enchantment, Integer> enchantments = new HashMap<>();
|
||||
EnchantmentList enchantmentList = base.get(ItemComponent.ENCHANTMENTS);
|
||||
EnchantmentList enchantmentList = base.get(DataComponents.ENCHANTMENTS);
|
||||
if(enchantmentList != null) {
|
||||
enchantmentList.enchantments().forEach((enchantmentKey, integer) -> {
|
||||
enchantments.put(
|
||||
@ -67,6 +67,6 @@ public class MinestomItemStack implements com.dfsek.terra.api.inventory.ItemStac
|
||||
});
|
||||
|
||||
EnchantmentList list = new EnchantmentList(enchantments);
|
||||
base = base.with(ItemComponent.ENCHANTMENTS, list);
|
||||
base = base.with(DataComponents.ENCHANTMENTS, list);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user