Add heatmap, add more commands, add usage

This commit is contained in:
Astatin3
2024-04-25 14:31:06 -06:00
parent f482859eb0
commit fa0e843f29
16 changed files with 146 additions and 9 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
View File
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>
Generated
-1
View File
@@ -2,6 +2,5 @@
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" /> <mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/Randar" vcs="Git" />
</component> </component>
</project> </project>
+20
View File
@@ -5,6 +5,26 @@ A Quick and dirty minimap using the Randar exploit
100% of the credit for this goes to https://github.com/spawnmason/randar-explanation 100% of the credit for this goes to https://github.com/spawnmason/randar-explanation
Their work is really cool. Their work is really cool.
### Commands
- **.randar help** - print this help info
- **.randar clear** - clear map data
- **.randar getseed** - print current seed
- **.rander setseed \<seed>** - set current seed
### Settings
- **Seed** - The seed of the map
- **Map corner** - The corner of the screen that the map is displayed in
- **Map range** - The maximum borders of the radar
- **Color** - The color of the detected areas
- **Heatmap mode** - Enable showing the age of detected regions using brightness
- **Size** - The size of the map on screen
- **Smear** - Stretch detected regions out to make them more visible
- **Radar mode** - Center radar at player pos, not 0, 0
- **Verbose** - Enable original debug output
##### How do I run this? ##### How do I run this?
- Add the mod alongside Meteor client as an addon - Add the mod alongside Meteor client as an addon
##### If Meteor client is on the latest version and the Randar exploit only works on versions up until 1.12.2, then how can I possibly use this? ##### If Meteor client is on the latest version and the Randar exploit only works on versions up until 1.12.2, then how can I possibly use this?
Symlink
+1
View File
@@ -0,0 +1 @@
/home/astatin3/.local/share/PrismLauncher/instances/1.20.4-dev/.minecraft/
@@ -1,6 +1,8 @@
package com.astatin3.randarminimap.commands; package com.astatin3.randarminimap.commands;
import com.astatin3.randarminimap.modules.Randar; import com.astatin3.randarminimap.modules.Randar;
import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import meteordevelopment.meteorclient.commands.Command; import meteordevelopment.meteorclient.commands.Command;
import net.minecraft.command.CommandSource; import net.minecraft.command.CommandSource;
@@ -11,16 +13,69 @@ public class RandarCMD extends Command {
final Randar randar; final Randar randar;
public RandarCMD(Randar randar) { public RandarCMD(Randar randar) {
super("randar-clear", "Clear Randar map."); super("randar", "Randar utility commands.");
this.randar = randar; this.randar = randar;
} }
private void printHelpInfo(){
info("\n" +
"Randar Help\n" +
"\n" +
".randar help - print this help info\n" +
".randar clear - clear map data\n" +
".randar getseed - print current seed\n" +
".rander setseed <seed> - set current seed\n");
}
@Override @Override
public void build(LiteralArgumentBuilder<CommandSource> builder) { public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.executes(context -> {
builder.then(literal("clear").executes(context -> {
info("Map cleared!"); info("Map cleared!");
this.randar.clearMap(); this.randar.clearMap();
return SINGLE_SUCCESS; return SINGLE_SUCCESS;
}));
builder.then(literal("getseed").executes(context -> {
info("Current seed: " + this.randar.getSeed());
return SINGLE_SUCCESS;
}));
builder.then(
literal("setseed")
.then(argument("seed", StringArgumentType.greedyString())
.executes(context -> {
final String newSeed;
try{
newSeed = context.getArgument("seed", String.class);
}catch (Exception e){
info("Error parsing seed");
return SINGLE_SUCCESS;
}
try{
Long.parseLong(context.getArgument("seed", String.class));
}catch (Exception e){
info(newSeed + " is not a valid seed!");
return SINGLE_SUCCESS;
}
info("Previous seed: " + this.randar.getSeed());
this.randar.setSeed(newSeed);
info("Current seed: " + this.randar.getSeed());
return SINGLE_SUCCESS;
}
)));
builder.executes(context -> {
printHelpInfo();
return SINGLE_SUCCESS;
}); });
// builder.executes(context -> {
// info("Map cleared!");
// this.randar.clearMap();
// return SINGLE_SUCCESS;
// });
} }
} }
@@ -7,6 +7,7 @@ import meteordevelopment.meteorclient.renderer.Renderer2D;
import meteordevelopment.meteorclient.settings.*; import meteordevelopment.meteorclient.settings.*;
import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.utils.player.ChatUtils; import meteordevelopment.meteorclient.utils.player.ChatUtils;
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
import meteordevelopment.orbit.EventHandler; import meteordevelopment.orbit.EventHandler;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import meteordevelopment.meteorclient.utils.render.color.Color; import meteordevelopment.meteorclient.utils.render.color.Color;
@@ -26,22 +27,34 @@ public class Randar extends Module {
@Override @Override
public void onDeactivate() {} public void onDeactivate() {}
public void clearMap(){ public void clearMap(){
positonRanges = new ArrayList<>(); positonRanges = new ArrayList<>();
} }
public String getSeed(){
return seed.get();
}
public boolean setSeed(String newSeed){
return seed.set(newSeed);
}
private class positonRange { private class positonRange {
public final int startX; public final int startX;
public final int startY; public final int startY;
public final int endX; public final int endX;
public final int endY; public final int endY;
public final long time;
public positonRange(int startX, int startY, int endX, int endY){ public positonRange(int startX, int startY, int endX, int endY, long time){
this.startX = startX; this.startX = startX;
this.startY = startY; this.startY = startY;
this.endX = endX; this.endX = endX;
this.endY = endY; this.endY = endY;
this.time = time;
} }
} }
@@ -83,6 +96,32 @@ public class Randar extends Module {
.build() .build()
); );
private final Setting<SettingColor> mapColor = sgGeneral.add(new ColorSetting.Builder()
.name("Color")
.description("Change the color of detected areas")
.defaultValue(new Color(255,0,0))
.visible(() -> true)
.build()
);
private final Setting<Boolean> heatmapEnable = sgGeneral.add(new BoolSetting.Builder()
.name("Heatmap Mode")
.description("Change brightness of detected areas based on age")
.defaultValue(false)
.visible(() -> true)
.build()
);
private final Setting<Double> heatmapMultiplier = sgGeneral.add(new DoubleSetting.Builder()
.name("Heatmap Multiplier")
.description("The brightness of heatmap")
.defaultValue(10000)
.min(0)
.sliderMax(5)
.visible(heatmapEnable::get)
.build()
);
private final Setting<Integer> mapSize = sgGeneral.add(new IntSetting.Builder() private final Setting<Integer> mapSize = sgGeneral.add(new IntSetting.Builder()
.name("Size") .name("Size")
.description("The scale of the map in pixels") .description("The scale of the map in pixels")
@@ -136,8 +175,8 @@ public class Randar extends Module {
// ChatUtils.sendMsg(Formatting.AQUA, "Y: " + packet.getVelocityY()); // ChatUtils.sendMsg(Formatting.AQUA, "Y: " + packet.getVelocityY());
} }
private static int clamp(long val, int min, int max) { private static int clamp(int val, int min, int max) {
return (int)Math.max(min, Math.min(max, val)); return Math.max(min, Math.min(max, val));
} }
private static int map(long val, int oldRange, int newRange) { private static int map(long val, int oldRange, int newRange) {
@@ -198,6 +237,13 @@ public class Randar extends Module {
final int mapBound = mapScale.get(); final int mapBound = mapScale.get();
final int smear = smearSetting.get(); final int smear = smearSetting.get();
final double multiplier = heatmapMultiplier.get();
final long time = System.currentTimeMillis();
final boolean heatmapMode = heatmapEnable.get();
final Color color = mapColor.get();
if(nextPositonRange != null){ if(nextPositonRange != null){
// This weirdness is to avoid a ConcurrentModificationException // This weirdness is to avoid a ConcurrentModificationException
positonRanges.add(nextPositonRange); positonRanges.add(nextPositonRange);
@@ -215,12 +261,27 @@ public class Randar extends Module {
int w = map(Math.abs(posRange.endX-posRange.startX), mapBound, width); int w = map(Math.abs(posRange.endX-posRange.startX), mapBound, width);
int h = map(Math.abs(posRange.endY-posRange.startY), mapBound, height); int h = map(Math.abs(posRange.endY-posRange.startY), mapBound, height);
// System.out.println(x + " " + y + " " + w + " " + h); final int alpha;
if(heatmapMode) {
final long diffTime = (time - posRange.time);
alpha = 256-clamp(
(int) (((diffTime / 1000) * multiplier)),
0, 255);
}else{
alpha = 255;
}
// System.out.println(diffTime/1000 + ", " + alpha);
Renderer2D.COLOR.quad( Renderer2D.COLOR.quad(
x-smear, y-smear, x-smear, y-smear,
w+(smear*2), h+(smear*2), w+(smear*2), h+(smear*2),
new Color(255,255,255)); new Color(
color.r,
color.g,
color.b,
alpha));
} }
Renderer2D.COLOR.quad(boxX+(int)((width+ crosshair_tickness)/2),boxY, crosshair_tickness,height,new Color(255,255,255, 64)); Renderer2D.COLOR.quad(boxX+(int)((width+ crosshair_tickness)/2),boxY, crosshair_tickness,height,new Color(255,255,255, 64));
@@ -277,7 +338,7 @@ public class Randar extends Module {
final int startY = (int)(z * 1280 - 128); final int startY = (int)(z * 1280 - 128);
final int endX = (int)(z * 1280 - 128); final int endX = (int)(z * 1280 - 128);
final int endY = (int)(z * 1280 + 1151); final int endY = (int)(z * 1280 + 1151);
nextPositonRange = new positonRange(startX, startY, endX, endY); nextPositonRange = new positonRange(startX, startY, endX, endY, System.currentTimeMillis());
ChatUtils.sendMsg(Formatting.AQUA, "[Randar] Located someone between " + startX + "," + startY + " and " + endX + "," + endY); ChatUtils.sendMsg(Formatting.AQUA, "[Randar] Located someone between " + startX + "," + startY + " and " + endX + "," + endY);
return; return;
} }