daycounter mod
counts days
This commit is contained in:
@@ -18,7 +18,8 @@ public class ModManager {
|
|||||||
new Freelook(),
|
new Freelook(),
|
||||||
new Keystrokes(),
|
new Keystrokes(),
|
||||||
new Fullbright(),
|
new Fullbright(),
|
||||||
new NoFog()
|
new NoFog(),
|
||||||
|
new DayCounter()
|
||||||
};
|
};
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package org.saturnclient.modules.mods;
|
||||||
|
|
||||||
|
import org.saturnclient.modules.HudMod;
|
||||||
|
import org.saturnclient.modules.ModDimensions;
|
||||||
|
import org.saturnclient.modules.Module;
|
||||||
|
import org.saturnclient.modules.ModuleDetails;
|
||||||
|
import org.saturnclient.saturnclient.SaturnClient;
|
||||||
|
import org.saturnclient.saturnclient.config.Property;
|
||||||
|
import org.saturnclient.ui2.RenderScope;
|
||||||
|
import org.saturnclient.ui2.resources.Fonts;
|
||||||
|
|
||||||
|
public class DayCounter extends Module implements HudMod {
|
||||||
|
private static Property<Boolean> enabled = Property.bool(false);
|
||||||
|
private static ModDimensions dimensions = new ModDimensions(40, 18);
|
||||||
|
|
||||||
|
public DayCounter() {
|
||||||
|
super(new ModuleDetails("DayCounter", "day")
|
||||||
|
.description("Displays the number of days that have passed")
|
||||||
|
.version("v0.1.0")
|
||||||
|
.tags("Utility"),
|
||||||
|
enabled.named("Enabled"),
|
||||||
|
dimensions.prop()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderDummy(RenderScope scope) {
|
||||||
|
renderDay(271, scope);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderHud(RenderScope scope) {
|
||||||
|
long day = (SaturnClient.client.world.getTimeOfDay() / 24000L);
|
||||||
|
renderDay(day, scope);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderDay(long day, RenderScope scope) {
|
||||||
|
String text = "Day: " + day;
|
||||||
|
scope.drawText(text,
|
||||||
|
0, 0, dimensions.font.value, dimensions.fgColor.value);
|
||||||
|
dimensions.width = Fonts.getWidth(text, dimensions.font.value);
|
||||||
|
dimensions.height = 18 * text.split("\n").length;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return enabled.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ModDimensions getDimensions() {
|
||||||
|
return dimensions;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnabled(boolean e) {
|
||||||
|
enabled.value = e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ public class BackgroundRendererMixin {
|
|||||||
@ModifyVariable(method = "applyFog", at = @At("HEAD"), ordinal = 0, argsOnly = true)
|
@ModifyVariable(method = "applyFog", at = @At("HEAD"), ordinal = 0, argsOnly = true)
|
||||||
private static float modifyFogStart(float viewDistance) {
|
private static float modifyFogStart(float viewDistance) {
|
||||||
if (NoFog.isActive()) {
|
if (NoFog.isActive()) {
|
||||||
return Float.MAX_VALUE;
|
return Float.MAX_VALUE; // this could be customised
|
||||||
}
|
}
|
||||||
return viewDistance;
|
return viewDistance;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user