Jump to content

[1.16.5] How to change the default texture of a potion ?


Recommended Posts

Posted

Hello!

Right now, I've created a potion called "Red Wine" that simply gives the player nausea, here is the code :

Quote

public class RegistryHandler {

       public static final DeferredRegister<Potion> POTIONS = DeferredRegister.create(ForgeRegistries.POTION_TYPES, OfWineAndCheese.MODID);

       //Init function

       public static final RegistryObject<Potion> RED_WINE = POTIONS.register("red_wine", () -> new Potion(new EffectInstance(Effects.CONFUSION.getEffect(), 600, 0)));

}

My potion appears correctly in the ItemGroup.TAB_BREWING with it's name (json and all that). Now, I would like for this potion to use a texture other than the "default" one. How could I achieve that? I searched the internet, but I only found tutorial on how to create effects. I also looked at the Potion class (obviously) and I did not see anything relating to texture or whatnot.

Thanks in advance.

Posted

i'm not sure if this will work but, vanilla calculates the Potion Color in PotionUtils.getColor this way is registered in ItemColors
the idea is now you subscribe to ColorHandlerEvent.Item and remove there the ItemColor for the PotionItem, SplashPotionItem and the
LingeringPotionItem then add a custom ItemColor for the these Items

Note: you need Reflection or an AT to remove the ItemColors for the Items

Posted

Thank you for the answers! Now I'm going to try and make it work.

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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