Started by
CyberAk
on
Topic category: Help with Minecraft modding (Java Edition)
I am trying to make it so that upon right click "IF" it is night time "THEN" item applies potion effects, "ELSE" Message player "Not Night Time Yet"
I just cannot figure out how to set up if statement right please help
public class Artefact5RightclickedProcedure {
public static void execute(Entity entity) {
if (entity == null)
return;
if (true) {
if (entity instanceof LivingEntity _entity)
_entity.addEffect(new MobEffectInstance(MobEffects.NIGHT_VISION, 500, 4));
if (entity instanceof LivingEntity _entity)
_entity.addEffect(new MobEffectInstance(MobEffects.INVISIBILITY, 500, 4));
if (entity instanceof Player _player)
_player.getCooldowns().addCooldown(DungeonsRpgMcModItems.ARTEFACT_5.get(), 600);
} else {
if (entity instanceof Player _player && !_player.level.isClientSide())
_player.displayClientMessage(new TextComponent("It not dark yet"), (true));
}
}
}