untamemadman Posted August 25, 2014 Share Posted August 25, 2014 How do I add a potion effect to armor in 1.7.10 I found a tutorial for 1.7.2 that said I just have to add: @Override public void onArmorTick(World world, EntityPlayer player, ItemStack armor) { player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 500, 1, true)); } to my Armor code but it doesn't give the player Night vision when he equip it. any help? Quote http://vps.untamemadman.pw/pics/ForumSignature.gif[/img] Link to comment Share on other sites More sharing options...
untamemadman Posted August 25, 2014 Author Share Posted August 25, 2014 Would it be better to only have it for maybe 10 ticks and it will refresh? Also just checking, I do make it server side using @SideOnly(Server)? Quote http://vps.untamemadman.pw/pics/ForumSignature.gif[/img] Link to comment Share on other sites More sharing options...
untamemadman Posted August 25, 2014 Author Share Posted August 25, 2014 I made it server side and changed the tick time but it still doesn't work. here is my code: http://goo.gl/XNE7vO Quote http://vps.untamemadman.pw/pics/ForumSignature.gif[/img] Link to comment Share on other sites More sharing options...
untamemadman Posted August 26, 2014 Author Share Posted August 26, 2014 You either did not read or did not understand the tutorial I posted. The title already tells you your mistake. I understand the difference between Server and Client, but I don't understand what you mean by the alternatives Quote http://vps.untamemadman.pw/pics/ForumSignature.gif[/img] Link to comment Share on other sites More sharing options...
untamemadman Posted August 26, 2014 Author Share Posted August 26, 2014 Ok, say I don't use @SideOnly. Why won't my code work still Quote http://vps.untamemadman.pw/pics/ForumSignature.gif[/img] Link to comment Share on other sites More sharing options...
untamemadman Posted August 26, 2014 Author Share Posted August 26, 2014 And how would I do that without using "@SideOnly", because your tutorial isn't clear on that Quote http://vps.untamemadman.pw/pics/ForumSignature.gif[/img] Link to comment Share on other sites More sharing options...
daafganggdg Posted August 26, 2014 Share Posted August 26, 2014 u can simply check with world.isRemote Quote Link to comment Share on other sites More sharing options...
untamemadman Posted August 26, 2014 Author Share Posted August 26, 2014 And how would I do that without using "@SideOnly", because your tutorial isn't clear on that Yes, it is clear. There's a section about what to use instead. Well I was confused by it. Quote http://vps.untamemadman.pw/pics/ForumSignature.gif[/img] Link to comment Share on other sites More sharing options...
untamemadman Posted August 26, 2014 Author Share Posted August 26, 2014 I have this now: @Override public void onArmorTick(World world, EntityPlayer player, ItemStack armor) { if(world.isRemote == true) { player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 2, 1, true)); } } Can you tell me if that is done correctly? Quote http://vps.untamemadman.pw/pics/ForumSignature.gif[/img] Link to comment Share on other sites More sharing options...
untamemadman Posted August 26, 2014 Author Share Posted August 26, 2014 So how should I do it? Quote http://vps.untamemadman.pw/pics/ForumSignature.gif[/img] Link to comment Share on other sites More sharing options...
untamemadman Posted August 26, 2014 Author Share Posted August 26, 2014 Check for the server, not the client. So "if(world.isRemote = false)" Quote http://vps.untamemadman.pw/pics/ForumSignature.gif[/img] Link to comment Share on other sites More sharing options...
Eternaldoom Posted August 26, 2014 Share Posted August 26, 2014 if(!world.isRemote) Quote Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button! Link to comment Share on other sites More sharing options...
untamemadman Posted August 26, 2014 Author Share Posted August 26, 2014 if(!world.isRemote) My code is: @Override public void onArmorTick(World world, EntityPlayer player, ItemStack armor) { if(!world.isRemote) { player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 2, 1, true)); } } But the player still doesn't get night vision Quote http://vps.untamemadman.pw/pics/ForumSignature.gif[/img] Link to comment Share on other sites More sharing options...
Eternaldoom Posted August 26, 2014 Share Posted August 26, 2014 I use a PlayerTickEvent for armor bonuses. Maybe try that? Quote Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button! Link to comment Share on other sites More sharing options...
untamemadman Posted August 26, 2014 Author Share Posted August 26, 2014 Can someone just give me a chunk of code that will give the user of a peace of armor Night Vision Quote http://vps.untamemadman.pw/pics/ForumSignature.gif[/img] Link to comment Share on other sites More sharing options...
untamemadman Posted August 26, 2014 Author Share Posted August 26, 2014 You already have the right code. The cause must be somewhere else. As I said, please use a breakpoint to determine if the method is actually getting called. I'm not sure why it wasn't working before, but it is working now. thanks for the help anyway Quote http://vps.untamemadman.pw/pics/ForumSignature.gif[/img] Link to comment Share on other sites More sharing options...
Recommended Posts
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.