Feroov Posted October 30, 2021 Posted October 30, 2021 (edited) Hello everyone, so currently my onArmorTick as of now works but not the way I want, basically it is on a constant, for example if I have absorption, lets say it is on always 0:10 seconds and when I do take damage, instantly the absorption regens (basically invincible). Here is my code: @Override public void onArmorTick(ItemStack stack, World world, PlayerEntity player) { if(!world.isClientSide) { boolean hasPlayerAbsorptionEffect = !Objects.equals(player.getEffect(Effects.ABSORPTION), null); if(player.getItemBySlot(EquipmentSlotType.HEAD).getItem() == ModItems.OCLUTRIUM_HELMET.get() && player.getItemBySlot(EquipmentSlotType.CHEST).getItem() == ModItems.OCLUTRIUM_CHESTPLATE.get() && player.getItemBySlot(EquipmentSlotType.LEGS).getItem() == ModItems.OCLUTRIUM_LEGGINGS.get() && player.getItemBySlot(EquipmentSlotType.FEET).getItem() == ModItems.OCLUTRIUM_BOOTS.get() ) player.addEffect(new EffectInstance(Effects.ABSORPTION, 200, 2)); super.onArmorTick(stack, world, player); } } Cheers! Edited October 30, 2021 by Feroov Quote
Luis_ST Posted October 30, 2021 Posted October 30, 2021 your code works how it should, since ArmorItem#onArmorTick is called every tick (20 times in a second) what did you try to achieve? Quote
Feroov Posted October 30, 2021 Author Posted October 30, 2021 7 minutes ago, Luis_ST said: your code works how it should, since ArmorItem#onArmorTick is called every tick (20 times in a second) what did you try to achieve? Yes everything works it's just that if i have absorption, it will insta heal the player back, which is game breaking you become lets say invincible, I wanted to make it in a way when you take damage, you still have the absorption effect but empty hearts if that makes sense, lets say you ate a golden apple and took damage, you know how the hearts still stay but blacked out, same logic here how I want hope that makes sense Quote
Luis_ST Posted October 30, 2021 Posted October 30, 2021 again it works how it should, the absorption hearts are temporary, if the heart is "empty" it will be removed instantly Quote
Feroov Posted October 30, 2021 Author Posted October 30, 2021 1 minute ago, Luis_ST said: again it works how it should, the absorption hearts are temporary, if the heart is "empty" it will be removed instantly Ok then fair enough, but still thank you so much Quote
Draco18s Posted October 31, 2021 Posted October 31, 2021 23 hours ago, Feroov said: Objects.equals( The fuck? Why not just compare the return value to something useful? Like, I don't know, getEffect() == null? 23 hours ago, Feroov said: boolean hasPlayerAbsorptionEffect Cool you stored whether or not the player has the absorption effect in a local variable. Which you then never use. Quote 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.
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.