add some new modules, kill off alt manager, clean up other code
This commit is contained in:
parent
4b1e0b4fa9
commit
3ad5af7ea7
13 changed files with 120 additions and 95 deletions
|
@ -1,29 +1,15 @@
|
|||
package me.kawaiizenbo.moonlight.util;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
public class ChatUtils
|
||||
{
|
||||
private static MinecraftClient mc = MinecraftClient.getInstance();
|
||||
|
||||
public static void sendMsg(String message)
|
||||
{
|
||||
sendMsg(null, null, Text.literal(message));
|
||||
}
|
||||
|
||||
public static void sendMsg(@Nullable String prefixTitle, @Nullable Formatting prefixColor, Text msg)
|
||||
{
|
||||
if (mc.world == null) return;
|
||||
|
||||
//Text message = Text.literal("");
|
||||
//message.append(CommandManager.get().getPrefix());
|
||||
//if (prefixTitle != null) message.append(CommandManager.get().getPrefix());
|
||||
//message.append(msg);
|
||||
|
||||
mc.inGameHud.getChatHud().addMessage(msg);
|
||||
mc.inGameHud.getChatHud().addMessage(Text.literal(message));
|
||||
}
|
||||
}
|
||||
|
|
32
src/main/java/me/kawaiizenbo/moonlight/util/Timer.java
Normal file
32
src/main/java/me/kawaiizenbo/moonlight/util/Timer.java
Normal file
|
@ -0,0 +1,32 @@
|
|||
package me.kawaiizenbo.moonlight.util;
|
||||
|
||||
public class Timer
|
||||
{
|
||||
public long lastMS = System.currentTimeMillis();
|
||||
|
||||
public void reset()
|
||||
{
|
||||
lastMS = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public boolean hasTimeElapsed(long time, boolean reset)
|
||||
{
|
||||
if (lastMS > System.currentTimeMillis())
|
||||
{
|
||||
lastMS = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis()-lastMS > time)
|
||||
{
|
||||
if (reset) reset();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue