Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I'm trying to make a sword that gives you an extra heart while it's in your inventory for every kill youv'e gotten with it, It can only give up to 5 hearts at once and everytime you die and recover the sword it will give you one less heart.

Here's what I Have so far

package com.legendaryldude.collectorssmpmod.item.items;

import net.minecraft.network.chat.Component;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.SwordItem;
import net.minecraft.world.item.Tier;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;

import java.util.List;

public class HeartsBane extends SwordItem {
    public HeartsBane(Tier tier, int damage, float atkspeed, Properties properties) {
        super(tier, damage, atkspeed, properties);
    }
    @Override
    public void appendHoverText(ItemStack stack, Level level, List<Component> component, TooltipFlag flag) {
        component.add(Component.literal("A Stealer Of Hearts"));
        component.add(Component.literal("   Utility Weapon  "));
        component.add(Component.literal(""));
        component.add(Component.literal("When Killing Players With"));
        component.add(Component.literal("This Weapon, Gives You 1"));
        component.add(Component.literal("Extra Max Heart. Up To Five"));
        component.add(Component.literal("Extra Hearts At Once. Hearts"));
        component.add(Component.literal("Apply As Long As I'm In Your"));
        component.add(Component.literal("Inventory."));

        super.appendHoverText(stack, level, component, flag);
    }
}

Ty in advance for help, have a great day

Edited by LittleLDude

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.