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();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
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.modules.interfaces.CoordinatesInterface;
|
||||
import org.saturnclient.config.manager.Property;
|
||||
import org.saturnclient.ui.RenderScope;
|
||||
import org.saturnclient.ui.resources.Fonts;
|
||||
|
||||
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",
|
||||
"Newline annotated");
|
||||
|
||||
private static ModDimensions dimensions = new ModDimensions(40, 18);
|
||||
|
||||
private final CoordinatesInterface minecraft;
|
||||
|
||||
public Coordinates(CoordinatesInterface minecraft) {
|
||||
super(new ModuleDetails("Coordinates", "coords")
|
||||
.description("Displays your current coordinates")
|
||||
.version("v0.1.0")
|
||||
.tags("Utility"),
|
||||
enabled.named("Enabled"),
|
||||
displayMethod.named("Display Method"),
|
||||
dimensions.prop());
|
||||
|
||||
this.minecraft = minecraft;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderDummy(RenderScope scope) {
|
||||
renderCoords(532, 69, 253, scope);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderHud(RenderScope 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";
|
||||
|
||||
switch (displayMethod.value) {
|
||||
case 1:
|
||||
f = "X: %d Y: %d Z: %d";
|
||||
break;
|
||||
|
||||
case 2:
|
||||
f = "%d\n%d\n%d";
|
||||
break;
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package org.saturnclient.modules.mods;
|
||||
|
||||
import org.saturnclient.modules.Module;
|
||||
import org.saturnclient.modules.ModuleDetails;
|
||||
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);
|
||||
|
||||
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 && minecraft.isTargetingLivingEntity()) {
|
||||
|
||||
int scaledWidth = 15;
|
||||
int scaledHeight = 15;
|
||||
|
||||
scope.drawTexture(
|
||||
Textures.CROSSHAIR_RANGE,
|
||||
(scope.getScaledWindowWidth() - scaledWidth) / 2,
|
||||
(scope.getScaledWindowHeight() - scaledHeight) / 2,
|
||||
0.0F,
|
||||
0.0F,
|
||||
scaledWidth,
|
||||
scaledHeight);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return enabled.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnabled(boolean e) {
|
||||
enabled.value = e;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
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.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(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
|
||||
public void renderDummy(RenderScope scope) {
|
||||
renderDay(271, scope);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderHud(RenderScope scope) {
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user