Jump to content

modder819

Members
  • Posts

    6
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

modder819's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I defined a custom item, ItemGrapevine. When I use an equipped grapevine item, I'd like it to have the same behavior as the vanilla "vine" item: When the item is equipped and used when the player is standing in front of a block, the block changes appearance so that it is covered in vines. What code do I need in the ItemGrapevine class to implement this behavior?
  2. I created my own item, and overrode getItemUseAction, but right-clicking had no effect. So then I also overrode onItemRightClick, using the code from the ItemPotion class: public class ItemLemonade extends Item { @Override public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.DRINK; } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { playerIn.setActiveHand(handIn); return new ActionResult<>(EnumActionResult.SUCCESS, playerIn.getHeldItem(handIn)); } } Now right-clicking does an animation when I've equipped the potion, but it's a different animation from the one with a regular potion (the potion just goes up and down in the character's right hand instead of centering like a potion). How do I recreate the animation of a regular potion? Also, how do I add in the sound effect that occurs when drinking a regular potion?
  3. I'm trying to create a "lemonade" potion. I'd like it to look yellow, and not shimmer (the way that a water bottle looks, except yellow instead of blue). It should boost health when drunk. I looked but couldn't find any info about creating potions in the MinecraftForge documentation. I tried doing something like this: @Mod(modid=modId, name="Lemonade Mod", version="1.0") public class LemonadeMod { ... private static final Potion POTION_LEMONADE = new PotionHealth(false, 0xFF_FF_FF_55); private static final PotionType POTION_TYPE_LEMONADE = new PotionType("lemonade", new PotionEffect(POTION_LEMONADE)); ... @Mod.EventBusSubscriber public static class RegistrationHandler { @SubscribeEvent public static void registerPotions(RegistryEvent.Register<Potion> event) { event.getRegistry().register(POTION_LEMONADE.setRegistryName("lemonade")); } @SubscribeEvent public static void registerPotionTypes(RegistryEvent.Register<PotionType> event) { event.getRegistry().register(POTION_TYPE_LEMONADE.setRegistryName("lemonade")); } } } This created a new potion, but it shimmered (enchantment glint?). Do I need to create a subclass of ItemPotion and override the hasEffect method? If so, how do I associate the PotionType with an instance of my ItemPotion subclass?
  4. In the example mod that comes with the MDK, both mcmod.info and the @Mod annotation on the ExampleMod class specify a modid and version. Do the modid and version need to be the same in both places? If so, why does the same information need to be specified twice?
×
×
  • Create New...

Important Information

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