I'm new at modding for mc and it says this shi
"The method setCustomName(MutableText) is undefined for the type ItemStack"
private static int giveHearts(ServerPlayerEntity executor, int amount) {
UUID uuid = executor.getUuid();
int heartCount = PlayerDataManager.getPlayerHeartCount(uuid);
if (heartCount <= amount) {
executor.sendMessage(Text.literal("§cYeterli kalbiniz yok! En az " + (amount + 1) + " kalp olmalı."), true);
return 0;
}
PlayerDataManager.setPlayerHeartCount(uuid, heartCount - amount);
double newMaxHealth = (heartCount - amount) * 2.0;
executor.getAttributeInstance(EntityAttributes.MAX_HEALTH).setBaseValue(newMaxHealth);
executor.setHealth((float) Math.min(executor.getHealth(), newMaxHealth));
for (int i = 0; i < amount; i++) {
ItemStack heartItem = new ItemStack(Items.NETHER_STAR);
// Use setCustomName for 1.21.10
** heartItem.setCustomName(Text.literal("§c❤️ Kalp"));**
executor.getInventory().offerOrDrop(heartItem);
}
executor.sendMessage(Text.literal("§c❤ " + amount + " kalbinizi verdiniz! Kalan kalp sayınız: " + (heartCount - amount)), true);
return 1;
}
i'm trying to make mod like lifestealsmp for playing with my friends i did ask to ai and it stuck.
Can someone help me