#how do i get Potion from an ItemStack
46 messages · Page 1 of 1 (latest)
probably components
that only tells if its lingering and stuff
yes, there is the class PotionContentsComponent that you can get from an Item stack with more information, such as the effects.
thaks
wait but how do i get it then
the constructor asks for potion
bro?
.
thats how you get it
!!learnjava
To start modding Minecraft using Fabric, it's strongly recommended to know Java.
Minecraft, in its codebase, and mods, using Fabric API, use more advanced Java concepts like lambdas, generics and polymorphism.
If you don't know all of these concepts, you may have some difficulties modding.
Here are some online resources that will help learning Java
JetBrains Academy (free online course): https://www.jetbrains.com/academy/
Codecademy (free online course): https://www.codecademy.com/learn/learn-java
University of Helsinki (free online course): https://java-programming.mooc.fi/
Basic Java Tutorials: https://docs.oracle.com/javase/tutorial/
Introduction to Programming using Java by David J. Eck (free online textbook): http://math.hws.edu/javanotes/
After Learning Java
For most mods you will want to make, you will have to use the Spongepowered Mixin Java library.
To learn more about Mixin, you can use the faq/mixin bot tag by typing !!faq/mixin in #bot-posting .
that has nothing to do with this
I would disagree, but if you say so
it was a misunderstanding tf do you mean
You have a solution, do you need anything else?
Cool
stack.getItem() instanceof PotionItem
no
?
yes
get the Potion from an PotionItem instance
without components
its not possible
components are the way
ok?
the op asked how to check if an itemstack is a potion
"how do i get Potion from an ItemStack"
then maybe he should word his question better
i agree
i can check how to do that when i get home
alr