Restructure some stuff

This commit is contained in:
zontreck 2024-01-09 14:57:08 -07:00
parent d3cbcc3f36
commit 131cd673f8
7 changed files with 20 additions and 9 deletions

View file

@ -1,48 +0,0 @@
package dev.zontreck.wmd;
import dev.zontreck.ariaslib.terminal.Task;
import dev.zontreck.ariaslib.util.DelayedExecutorService;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.wmd.configs.WMDClientConfig;
import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.Component;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
public class CheckHunger extends Task
{
private static CheckHunger inst = new CheckHunger();
public static CheckHunger getInstance()
{
return inst;
}
public CheckHunger()
{
super("CheckHunger", true);
}
@Override
public void run() {
if(!WMDClientConfig.EnableHungerAlert.get()) return;
Hunger current = Hunger.of(Minecraft.getInstance().player);
if(WatchMyDurability.LastHunger == null)WatchMyDurability.LastHunger = new Hunger();
if(current.identical()) return;
if(current.shouldGiveAlert())
{
String Msg = ChatColor.doColors("!Dark_Red!!bold!You need to eat!");
Component chat = Component.literal(Msg);
Minecraft.getInstance().player.displayClientMessage(chat, false);
SoundEvent sv = SoundEvents.WARDEN_ROAR; // It sounds like a growling stomach
WatchMyDurability.Soundify(sv);
}
WatchMyDurability.LastHunger = current;
}
}