LittleLDude Posted July 9, 2023 Posted July 9, 2023 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); } } Quote
MFMods Posted July 10, 2023 Posted July 10, 2023 in your sword class (make one, extend SwordItem), override onItemUseFirst. Quote
LittleLDude Posted July 19, 2023 Author Posted July 19, 2023 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 Quote
Zacomat Posted July 19, 2023 Posted July 19, 2023 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 Quote
Recommended Posts
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.