Jump to content

Strange-Guy Person

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by Strange-Guy Person

  1. I created a custom effect called "Fullness" that prevents the player from losing hunger when they get the effect. For this, I created a new java class called FullnessEffect. Everything is working fine, and the player isn't able to lose hunger, but I wanted to make it so that whenever you have the Fullness effect, your hunger bar changes color to gold, similar to how your hunger bar turns sickly green when you have the hunger effect. I searched online, but there seems to be no information regarding how to do this. Does anyone know how to do this? Here is the code for the FullnessEffect class in case anyone needs it (the import section is omitted): public class FullnessEffect extends MobEffect { public FullnessEffect (MobEffectCategory mobEffectCategory, int color) { super(mobEffectCategory, color); } @Override public boolean applyEffectTick (LivingEntity pLivingEntity, int pAmplifier) { if (!pLivingEntity.getCommandSenderWorld().isClientSide() && pLivingEntity instanceof Player player) { FoodData foodData = player.getFoodData(); float exhaustionLevel = foodData.getExhaustionLevel(); if (exhaustionLevel > 0.0F) { player.causeFoodExhaustion(-exhaustionLevel); } } super.applyEffectTick(pLivingEntity, pAmplifier); return true; } @Override public boolean shouldApplyEffectTickThisTick(int duration, int amplifier) { return true; } } I may sound a bit stupid because I'm a bit new to modding but any help would be greatly appreciated
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.