Posted January 9, 20178 yr Hi, I'm working on porting a mod to 1.10.2 and I'm having trouble making the potion effect work correctly on 1.10.2. Here's the code from 1.7.10 if that helps. public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLiving, EntityLivingBase par3EntityLiving) { par2EntityLiving.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 40, 5)); return super.hitEntity(par1ItemStack, par2EntityLiving, par3EntityLiving); } Thanks for any help.
January 9, 20178 yr EntityLivingBase#addPotionEffect(new PotionEffect(Potion.getPotionById(10), 100, 3)); Will give the entity regeneration for 100 seconds and level 4. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
January 9, 20178 yr EntityLivingBase#addPotionEffect(new PotionEffect(Potion.getPotionById(10), 100, 3)); Will give the entity regeneration for 100 seconds and level 4. Don't use numeric IDs, they're not guaranteed to be the same for every save and they're a lot less descriptive than using fields or registry names. The vanilla Potion instances are now stored in the MobEffects class. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
January 9, 20178 yr Author Alright so I've got the potion effect part, I just need to apply it on sword hit. Any help with that?
January 9, 20178 yr There should be a function in the ItemSword class that deals with hurting enemies. Find it, override it, add that code to it. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
January 9, 20178 yr EntityLivingBase#addPotionEffect(new PotionEffect(Potion.getPotionById(10), 100, 3)); Will give the entity regeneration for 100 seconds and level 4. Don't use numeric IDs, they're not guaranteed to be the same for every save and they're a lot less descriptive than using fields or registry names. The vanilla Potion instances are now stored in the MobEffects class. Ah, very true, but why did MobEffects become MobEffects and not Potions? Kinda like how we have Block and Blocks or Item and Items? VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
January 9, 20178 yr Ah, very true, but why did MobEffects become MobEffects and not Potions? Kinda like how we have Block and Blocks or Item and Items? Because potions cause Effects. There are also (or can be) affects that aren't applied by potions. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
January 9, 20178 yr Ah, very true, but why did MobEffects become MobEffects and not Potions? Kinda like how we have Block and Blocks or Item and Items? Because potions cause Effects. There are also (or can be) affects that aren't applied by potions. You are right there, but I fail to see the logic behind that reasoning. All that MobEffects stores is the Potion instances from the Registry. It doesn't store any effects inside of it. And the only link between Potions and Mobs is that potion effects are applied to mobs. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
January 9, 20178 yr Author Ok, here's my code so far. public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLiving, EntityLivingBase par3EntityLiving) { EntityLivingBase#addPotionEffect(new PotionEffect(Potion.getPotionById(10), 100, 3)); return super.hitEntity(par1ItemStack, par2EntityLiving, par3EntityLiving); } It doesn't compile due to illegal characters in the potion effect line. Any idea why this is happening?
January 9, 20178 yr Classname#MethodName() is not valid java. It's javadoc notation. If you'd been told to use someEntityLivingBaseObject_ThisNameIsArbitrary.addPotionEffect(...) you'd have pasted someEntityLivingBaseObject_ThisNameIsArbitrary.addPotionEffect(...) into your code and then complained that eclipse doesn't know what someEntityLivingBaseObject_ThisNameIsArbitrary was, despite the obviously arbitrary name. So we told you the type of the object because its variable name is arbitrary. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
January 9, 20178 yr Author I copied Animefan8888's code. I'm a bit confused on how to fix it, can you help?
January 9, 20178 yr I copied Animefan8888's code. I'm a bit confused on how to fix it, can you help? First how much Java do you know? VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
January 9, 20178 yr Author I used to be into modding 1.2.5, I know c decently. I can't remember any java syntax though.
January 9, 20178 yr I used to be into modding 1.2.5, I know c decently. I can't remember any java syntax though. "#"'s are not used in Java for any actual programming. They are used to denote that what comes after it is a method and is not static so no confusion comes. AKA EntityLivingBase.addPotionEffect(...) is different from EntityLivingBase living = ... living.addPotionEffect(...) VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
January 9, 20178 yr Author Alright, so what should I change in my actual code? public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLiving, EntityLivingBase par3EntityLiving) { EntityLivingBase#addPotionEffect(new PotionEffect(Potion.getPotionById(10), 100,3)); return super.hitEntity(par1ItemStack, par2EntityLiving, par3EntityLiving); }
January 9, 20178 yr Find an EntityLivingBase that is available within the method (hint: there are two) and use one of those. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
January 9, 20178 yr You should call EntityLivingBase#addPotionEffect on an instance of EntityLivingBase . You have to parameters of type EntityLivingBase , the first one being the target and the second being the attacker. You decide which one to use. Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
May 1, 20187 yr On 1/8/2017 at 11:54 PM, Choonster said: Don't use numeric IDs, they're not guaranteed to be the same for every save and they're a lot less descriptive than using fields or registry names. The vanilla Potion instances are now stored in the MobEffects class. unless the source code of minecraft forge 1.10 changes based on the world seed numeric potion IDs of vanilla potion effects are always the same. Edited June 23, 20187 yr by Tyfyter
May 2, 20187 yr 5 hours ago, Tyfyter said: unless the source code of minecraft forge 1.10 changes based on the world seed numeric potion IDs are always the same. Mods that add potions may not have the same ID every time. Also this thread is over a year old. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
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.