me when radar

This commit is contained in:
0x3C50 2022-05-01 20:57:04 +02:00
parent c77d944eef
commit 58599be48d
6 changed files with 151 additions and 3 deletions

View file

@ -10,6 +10,7 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import net.shadow.client.ShadowMain;
import net.shadow.client.feature.gui.hud.element.HudElement;
import net.shadow.client.feature.gui.hud.element.RadarElement;
import net.shadow.client.feature.gui.hud.element.SpeedHud;
import net.shadow.client.feature.gui.hud.element.TabGui;
import net.shadow.client.feature.gui.hud.element.Taco;
@ -78,6 +79,7 @@ public class HudRenderer {
he.add(new Taco());
he.add(new SpeedHud());
he.add(new TabGui());
he.add(new RadarElement());
return he;
}

View file

@ -0,0 +1,82 @@
/*
* Copyright (c) Shadow client, 0x150, Saturn5VFive 2022. All rights reserved.
*/
package net.shadow.client.feature.gui.hud.element;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.mob.EndermanEntity;
import net.minecraft.entity.mob.HostileEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.Quaternion;
import net.minecraft.util.math.Vec3d;
import net.shadow.client.ShadowMain;
import net.shadow.client.feature.module.ModuleRegistry;
import net.shadow.client.feature.module.ModuleType;
import net.shadow.client.feature.module.impl.render.Radar;
import net.shadow.client.helper.font.FontRenderers;
import net.shadow.client.helper.render.ClipStack;
import net.shadow.client.helper.render.Rectangle;
import net.shadow.client.helper.render.Renderer;
import java.awt.Color;
public class RadarElement extends HudElement{
public RadarElement() {
super("Radar", 5, 100 + ModuleType.values().length * FontRenderers.getRenderer().getMarginHeight() + 4 + 5,100,100);
}
@Override
public void renderIntern(MatrixStack stack) {
Radar radar = ModuleRegistry.getByClass(Radar.class);
if (radar.isEnabled()) {
Renderer.R2D.renderRoundedQuadWithShadow(stack, new Color(10,10,20,200),0,0,width,height,5,20);
double maxDistToRender = radar.iScale*16;
Vec3d ppos = ShadowMain.client.player.getPos();
double originX = ppos.x;
double originZ = ppos.z;
ClipStack.globalInstance.addWindow(stack, new Rectangle(0, 0, width, height));
stack.push();
stack.translate(width/2d,height/2d,0);
stack.multiply(new Quaternion(0,0,-ShadowMain.client.player.getYaw()-180,true));
for (Entity entity : ShadowMain.client.world.getEntities()) {
Vec3d epos = entity.getPos();
double entityX = epos.x;
double entityZ = epos.z;
double deltaX = entityX-originX;
double deltaZ = entityZ-originZ;
deltaX = deltaX / maxDistToRender;
deltaZ = deltaZ / maxDistToRender;
// deltaX += 0.5;
// deltaZ += 0.5;
// if (deltaX <= -.5 || deltaX >= .5 || deltaZ <= -.5 || deltaZ >= .5) continue; // out of bounds
deltaX *= width;
deltaZ *= width;
Color c;
if (entity.equals(ShadowMain.client.player)) c = Color.WHITE;
else if (entity instanceof PlayerEntity) {
c = Color.RED;
} else if (entity instanceof ItemEntity) {
c = Color.CYAN;
} else if (entity instanceof EndermanEntity enderman) {
if (enderman.isProvoked()) {
c = Color.YELLOW;
} else {
c = Color.GREEN;
}
} else if (entity instanceof HostileEntity) {
c = Color.YELLOW;
} else {
c = Color.GREEN;
}
Renderer.R2D.renderCircle(stack,c,deltaX,deltaZ,1,10);
// Renderer.R2D.renderQuad(stack,Color.WHITE,deltaX,deltaZ,deltaX+1,deltaZ+1);
}
stack.pop();
ClipStack.globalInstance.popWindow();
}
}
}

View file

@ -113,6 +113,7 @@ import net.shadow.client.feature.module.impl.render.ItemByteSize;
import net.shadow.client.feature.module.impl.render.MouseEars;
import net.shadow.client.feature.module.impl.render.NameTags;
import net.shadow.client.feature.module.impl.render.NoLiquidFog;
import net.shadow.client.feature.module.impl.render.Radar;
import net.shadow.client.feature.module.impl.render.ShowTntPrime;
import net.shadow.client.feature.module.impl.render.Spotlight;
import net.shadow.client.feature.module.impl.render.TabGui;
@ -353,6 +354,7 @@ public class ModuleRegistry {
registerModule(Equipper.class);
registerModule(Godmode.class);
registerModule(ErrorCrash.class);
registerModule(Radar.class);
rebuildSharedModuleList();

View file

@ -0,0 +1,60 @@
/*
* Copyright (c) Shadow client, 0x150, Saturn5VFive 2022. All rights reserved.
*/
package net.shadow.client.feature.module.impl.render;
import net.minecraft.client.util.math.MatrixStack;
import net.shadow.client.feature.config.DoubleSetting;
import net.shadow.client.feature.module.Module;
import net.shadow.client.feature.module.ModuleType;
import net.shadow.client.helper.util.Transitions;
public class Radar extends Module {
DoubleSetting scale = this.config.create(new DoubleSetting.Builder(3)
.name("Scale")
.description("How much area to show around you")
.min(0.1)
.max(10)
.precision(1)
.get());
public double iScale = 0;
public Radar() {
super("Radar", "Allows you to see other players and entities around", ModuleType.RENDER);
}
@Override
public void tick() {
}
@Override
public void enable() {
}
@Override
public void disable() {
}
@Override
public String getContext() {
return null;
}
@Override
public void onWorldRender(MatrixStack matrices) {
}
@Override
public void onFastTick() {
iScale = Transitions.transition(iScale,scale.getValue(),30,0);
}
@Override
public void onHudRender() {
}
}

View file

@ -1,2 +1,4 @@
Fixed compat issues
Fixed race condition crash on startup
Added online services
Added IRC
Added ability to view other shadow users
Ported over modules

View file

@ -1 +1 @@
20
21