day counter crosshair and coordinates
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package org.saturnclient.modules.interfaces;
|
||||
|
||||
public interface CoordinatesInterface {
|
||||
|
||||
int getPlayerX();
|
||||
|
||||
int getPlayerY();
|
||||
|
||||
int getPlayerZ();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.saturnclient.modules.interfaces;
|
||||
|
||||
public interface CrosshairInterface {
|
||||
|
||||
boolean isTargetingLivingEntity();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.saturnclient.modules.interfaces;
|
||||
|
||||
public interface DayCounterInterface {
|
||||
|
||||
long getDay();
|
||||
|
||||
}
|
||||
+37
-14
@@ -4,20 +4,27 @@ 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.modules.interfaces.CoordinatesInterface;
|
||||
import org.saturnclient.config.manager.Property;
|
||||
import org.saturnclient.ui.RenderScope;
|
||||
import org.saturnclient.ui.resources.Fonts;
|
||||
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public class Coordinates extends Module implements HudMod {
|
||||
|
||||
private static Property<Boolean> enabled = Property.bool(false);
|
||||
private static Property<Integer> displayMethod = Property.select(0, "Flat", "Flat annotated", "Newline",
|
||||
|
||||
private static Property<Integer> displayMethod = Property.select(
|
||||
0,
|
||||
"Flat",
|
||||
"Flat annotated",
|
||||
"Newline",
|
||||
"Newline annotated");
|
||||
|
||||
private static ModDimensions dimensions = new ModDimensions(40, 18);
|
||||
|
||||
public Coordinates() {
|
||||
private final CoordinatesInterface minecraft;
|
||||
|
||||
public Coordinates(CoordinatesInterface minecraft) {
|
||||
super(new ModuleDetails("Coordinates", "coords")
|
||||
.description("Displays your current coordinates")
|
||||
.version("v0.1.0")
|
||||
@@ -25,6 +32,8 @@ public class Coordinates extends Module implements HudMod {
|
||||
enabled.named("Enabled"),
|
||||
displayMethod.named("Display Method"),
|
||||
dimensions.prop());
|
||||
|
||||
this.minecraft = minecraft;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -34,26 +43,40 @@ public class Coordinates extends Module implements HudMod {
|
||||
|
||||
@Override
|
||||
public void renderHud(RenderScope scope) {
|
||||
Vec3d pos = SaturnClient.client.player.getPos();
|
||||
renderCoords((int) pos.x, (int) pos.y, (int) pos.z, scope);
|
||||
int x = minecraft.getPlayerX();
|
||||
int y = minecraft.getPlayerY();
|
||||
int z = minecraft.getPlayerZ();
|
||||
|
||||
renderCoords(x, y, z, scope);
|
||||
}
|
||||
|
||||
public void renderCoords(int x, int y, int z, RenderScope scope) {
|
||||
String f = "%d %d %d"; // Flat
|
||||
|
||||
String f = "%d %d %d";
|
||||
|
||||
switch (displayMethod.value) {
|
||||
case 1: // Flat annotated
|
||||
case 1:
|
||||
f = "X: %d Y: %d Z: %d";
|
||||
break;
|
||||
case 2: // Newline
|
||||
|
||||
case 2:
|
||||
f = "%d\n%d\n%d";
|
||||
break;
|
||||
case 3: // Newline annotated
|
||||
|
||||
case 3:
|
||||
f = "X: %d\nY: %d\nZ: %d";
|
||||
break;
|
||||
}
|
||||
|
||||
String text = String.format(f, x, y, z);
|
||||
scope.drawText(text,
|
||||
0, 0, dimensions.font.value, dimensions.fgColor.value);
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -72,4 +95,4 @@ public class Coordinates extends Module implements HudMod {
|
||||
public void onEnabled(boolean e) {
|
||||
enabled.value = e;
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
-8
@@ -2,34 +2,44 @@ package org.saturnclient.modules.mods;
|
||||
|
||||
import org.saturnclient.modules.Module;
|
||||
import org.saturnclient.modules.ModuleDetails;
|
||||
import org.saturnclient.saturnclient.SaturnClient;
|
||||
import org.saturnclient.modules.interfaces.CrosshairInterface;
|
||||
import org.saturnclient.config.manager.Property;
|
||||
import org.saturnclient.ui.RenderScope;
|
||||
import org.saturnclient.ui.resources.Textures;
|
||||
|
||||
public class Crosshair extends Module {
|
||||
|
||||
public static Property<Boolean> enabled = Property.bool(false);
|
||||
|
||||
public Crosshair() {
|
||||
private final CrosshairInterface minecraft;
|
||||
|
||||
public Crosshair(CrosshairInterface minecraft) {
|
||||
super(
|
||||
new ModuleDetails("Crosshair", "crosshair")
|
||||
.description("Changes the crosshair if you're aiming at a entity")
|
||||
.tags("Visuals", "Utility")
|
||||
.version("v0.1.0"),
|
||||
enabled.named("Enabled"));
|
||||
|
||||
this.minecraft = minecraft;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(RenderScope scope) {
|
||||
if (enabled.value
|
||||
&& SaturnClient.client.targetedEntity != null
|
||||
&& SaturnClient.client.targetedEntity.isAlive()) {
|
||||
|
||||
if (enabled.value && minecraft.isTargetingLivingEntity()) {
|
||||
|
||||
int scaledWidth = 15;
|
||||
int scaledHeight = 15;
|
||||
|
||||
scope.drawTexture(Textures.CROSSHAIR_RANGE,
|
||||
scope.drawTexture(
|
||||
Textures.CROSSHAIR_RANGE,
|
||||
(scope.getScaledWindowWidth() - scaledWidth) / 2,
|
||||
(scope.getScaledWindowHeight() - scaledHeight) / 2, 0.0F, 0.0F, scaledWidth, scaledHeight);
|
||||
(scope.getScaledWindowHeight() - scaledHeight) / 2,
|
||||
0.0F,
|
||||
0.0F,
|
||||
scaledWidth,
|
||||
scaledHeight);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,4 +52,4 @@ public class Crosshair extends Module {
|
||||
public void onEnabled(boolean e) {
|
||||
enabled.value = e;
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
-6
@@ -4,23 +4,29 @@ 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.modules.interfaces.DayCounterInterface;
|
||||
import org.saturnclient.config.manager.Property;
|
||||
import org.saturnclient.ui.RenderScope;
|
||||
import org.saturnclient.ui.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);
|
||||
|
||||
private final DayCounterInterface minecraft;
|
||||
|
||||
long day = 0;
|
||||
|
||||
public DayCounter() {
|
||||
public DayCounter(DayCounterInterface minecraft) {
|
||||
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());
|
||||
|
||||
this.minecraft = minecraft;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -30,14 +36,20 @@ public class DayCounter extends Module implements HudMod {
|
||||
|
||||
@Override
|
||||
public void renderHud(RenderScope scope) {
|
||||
day = (SaturnClient.client.world.getTimeOfDay() / 24000L);
|
||||
day = minecraft.getDay();
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -56,4 +68,4 @@ public class DayCounter extends Module implements HudMod {
|
||||
public void onEnabled(boolean e) {
|
||||
enabled.value = e;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,10 @@ import org.saturnclient.impl.modules.*;
|
||||
public class FabricModuleProvider implements ModuleProvider {
|
||||
public static Module[] MODS = {
|
||||
new ArmorDisplay(new ArmorDisplayFabric()),
|
||||
new AutoSprint(new AutoSprintFabric())
|
||||
new AutoSprint(new AutoSprintFabric()),
|
||||
new Coordinates(new CoordinatesFabric()),
|
||||
new Crosshair(new CrosshairFabric()),
|
||||
new Clock(),
|
||||
};
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.saturnclient.impl.modules;
|
||||
|
||||
import org.saturnclient.modules.interfaces.CoordinatesInterface;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public class CoordinatesFabric implements CoordinatesInterface {
|
||||
|
||||
private final MinecraftClient mc = MinecraftClient.getInstance();
|
||||
|
||||
@Override
|
||||
public int getPlayerX() {
|
||||
Vec3d pos = mc.player.getPos();
|
||||
return (int) pos.x;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayerY() {
|
||||
Vec3d pos = mc.player.getPos();
|
||||
return (int) pos.y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayerZ() {
|
||||
Vec3d pos = mc.player.getPos();
|
||||
return (int) pos.z;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.saturnclient.impl.modules;
|
||||
|
||||
import org.saturnclient.modules.interfaces.CrosshairInterface;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class CrosshairFabric implements CrosshairInterface {
|
||||
|
||||
private final MinecraftClient mc = MinecraftClient.getInstance();
|
||||
|
||||
@Override
|
||||
public boolean isTargetingLivingEntity() {
|
||||
|
||||
Entity entity = mc.targetedEntity;
|
||||
|
||||
return entity != null && entity.isAlive();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.saturnclient.impl.modules;
|
||||
|
||||
import org.saturnclient.modules.interfaces.DayCounterInterface;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
|
||||
public class DayCounterFabric implements DayCounterInterface {
|
||||
|
||||
private final MinecraftClient mc = MinecraftClient.getInstance();
|
||||
|
||||
@Override
|
||||
public long getDay() {
|
||||
if (mc.world == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mc.world.getTimeOfDay() / 24000L;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user