Jump to content

Recommended Posts

Posted

Trying to follow previous tutorials on Potions and I think I have it working, but I can't figure out how to add my potion to a creative tab.

 

I've got a custom creative tab working and all that, but how do I refer to my custom potion?  \

 

I tried 'new ItemStack(Items.potionitem, 1, Potion_Manager.waterwalk.getId())'

 

But that humorously provided "A Bungling Potion".  haha

 

waterwalk extended Potion per the tutorials.

 

 

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

First, potion items don't use potion ids, but strange data values system:

Bits 0-3 (1, 2, 4 and 8) determine the potion effect. The highest legitimately available is currently 14 decimal = 1110 binary.

Bits 0-5 (1, 2, 4, 8, 16, 32) determine the potion's name.

If bit 5 (32) is true, the potion is a level II potion (or, in some cases, a reverted potion).

If bit 6 (64) is true, the potion is an extended potion (or, in some cases, a reverted potion).

Potions with bits 5 and 6 set to true cannot be brewed.

Bits 13 and 14 (8192 and 16384) determines whether the potion is a drinkable potion or a splash potion. If bit 13 is true, it's drinkable. If 14 is true, it's a splash potion.

Bits 7-12 and 15 are ignored, so many potions with distinct data values will have the same properties.

Also, this gave you "A Bungling Potion", because... http://minecraft.gamepedia.com/Potion#Unused_potions

Posted

Thanks, that explains that.

 

I'm not the best with bit calcs. 

 

How do I specify my new custom potion for a new Itemstack?

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

Thanks, that explains that.

 

I'm not the best with bit calcs. 

 

How do I specify my new custom potion for a new Itemstack?

Actually, me neither... But you can take a look at PotionHelper class, it must have a method convert effect in to meta, because it has method to convert it back...

 

EDIT: Also, you can add effects by wrting those in to compounds in to tag list called CustomPotionEffects in stack's tag compound...

Posted

I just found the NBT thing before your edit.  I got a potion that delivers my effect.  Name is wrong and color is wrong, but I'm sure I could fix that.

 

All that being said, surely there is a built in way to do it??  Anyone got experience with this?

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

I just found the NBT thing before your edit.  I got a potion that delivers my effect.  Name is wrong and color is wrong, but I'm sure I could fix that.

 

All that being said, surely there is a built in way to do it??  Anyone got experience with this?

The way to fix the color is to use metadata. That's all...

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.