Posted July 9, 20232 yr Im gonna make it detect right click then shout out a custom beam here is most of the code in my moditems section I only need the code to detect right clicks atm package com.littleldude.idleon.item; import com.littleldude.idleon.IdleOn; import net.minecraft.world.item.Item; import net.minecraft.world.item.SwordItem; import net.minecraft.world.item.Tier; import net.minecraft.world.item.crafting.Ingredient; import net.minecraftforge.common.ForgeTier; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; public class ModItems { public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, IdleOn.MODID); public static final RegistryObject<SwordItem> AMAROK_SWORD = ITEMS.register("amarok_sword", () -> new SwordItem(Tiers.AMAROK, 0, 0, new Item.Properties())); public static void register(IEventBus eventBus) { ITEMS.register(eventBus); } public static class Tiers { public static final Tier AMAROK = new ForgeTier(10, 10000, 15f, 0,40, null, () -> Ingredient.EMPTY); } }
July 19, 20232 yr Author On 7/10/2023 at 1:55 AM, MFMods said: in your sword class (make one, extend SwordItem), override onItemUseFirst. How would I override that in 1.20
July 19, 20232 yr if you have a sword class you should override the method use(Level p_41432_, Player p_41433_, InteractionHand hand) that is called when you hold use key (right mouse button). Or else you can subscribe to PlayerInteractEvent subclasses: EntityInteractSpecific EntityInteract RightClickBlock RightClickItem
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.