Posted August 25, 201411 yr 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? http://vps.untamemadman.pw/pics/ForumSignature.gif[/img]
August 25, 201411 yr Author 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)? http://vps.untamemadman.pw/pics/ForumSignature.gif[/img]
August 25, 201411 yr Author I made it server side and changed the tick time but it still doesn't work. here is my code: http://goo.gl/XNE7vO http://vps.untamemadman.pw/pics/ForumSignature.gif[/img]
August 26, 201411 yr Author 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 http://vps.untamemadman.pw/pics/ForumSignature.gif[/img]
August 26, 201411 yr Author Ok, say I don't use @SideOnly. Why won't my code work still http://vps.untamemadman.pw/pics/ForumSignature.gif[/img]
August 26, 201411 yr Author And how would I do that without using "@SideOnly", because your tutorial isn't clear on that http://vps.untamemadman.pw/pics/ForumSignature.gif[/img]
August 26, 201411 yr Author 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. http://vps.untamemadman.pw/pics/ForumSignature.gif[/img]
August 26, 201411 yr Author 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? http://vps.untamemadman.pw/pics/ForumSignature.gif[/img]
August 26, 201411 yr Author So how should I do it? http://vps.untamemadman.pw/pics/ForumSignature.gif[/img]
August 26, 201411 yr Author Check for the server, not the client. So "if(world.isRemote = false)" http://vps.untamemadman.pw/pics/ForumSignature.gif[/img]
August 26, 201411 yr if(!world.isRemote) Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
August 26, 201411 yr Author 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 http://vps.untamemadman.pw/pics/ForumSignature.gif[/img]
August 26, 201411 yr I use a PlayerTickEvent for armor bonuses. Maybe try that? Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
August 26, 201411 yr Author Can someone just give me a chunk of code that will give the user of a peace of armor Night Vision http://vps.untamemadman.pw/pics/ForumSignature.gif[/img]
August 26, 201411 yr Author 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 http://vps.untamemadman.pw/pics/ForumSignature.gif[/img]
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.