0
0
mirror of https://github.com/Wurst-Imperium/Wurst7.git synced 2024-09-20 09:16:20 +02:00

Add BaseFinder Color setting

This commit is contained in:
Alexander01998 2021-09-09 12:00:37 +02:00
parent 1ebce339b6
commit 7f524078c7

View File

@ -7,6 +7,7 @@
*/ */
package net.wurstclient.hacks; package net.wurstclient.hacks;
import java.awt.Color;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
@ -27,10 +28,12 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Matrix4f; import net.minecraft.util.math.Matrix4f;
import net.wurstclient.Category; import net.wurstclient.Category;
import net.wurstclient.SearchTags; import net.wurstclient.SearchTags;
import net.wurstclient.WurstClient;
import net.wurstclient.events.RenderListener; import net.wurstclient.events.RenderListener;
import net.wurstclient.events.UpdateListener; import net.wurstclient.events.UpdateListener;
import net.wurstclient.hack.Hack; import net.wurstclient.hack.Hack;
import net.wurstclient.settings.BlockListSetting; import net.wurstclient.settings.BlockListSetting;
import net.wurstclient.settings.ColorSetting;
import net.wurstclient.util.BlockUtils; import net.wurstclient.util.BlockUtils;
import net.wurstclient.util.ChatUtils; import net.wurstclient.util.ChatUtils;
import net.wurstclient.util.RenderUtils; import net.wurstclient.util.RenderUtils;
@ -84,6 +87,9 @@ public final class BaseFinderHack extends Hack
"minecraft:tall_grass", "minecraft:tall_seagrass", "minecraft:tuff", "minecraft:tall_grass", "minecraft:tall_seagrass", "minecraft:tuff",
"minecraft:vine", "minecraft:water", "minecraft:white_tulip"); "minecraft:vine", "minecraft:water", "minecraft:white_tulip");
private final ColorSetting color = new ColorSetting("Color",
"Man-made blocks will be\n" + "highlighted in this color.", Color.RED);
private ArrayList<String> blockNames; private ArrayList<String> blockNames;
private final HashSet<BlockPos> matchingBlocks = new HashSet<>(); private final HashSet<BlockPos> matchingBlocks = new HashSet<>();
@ -100,11 +106,12 @@ public final class BaseFinderHack extends Hack
{ {
super("BaseFinder", super("BaseFinder",
"Finds player bases by searching for man-made blocks.\n" "Finds player bases by searching for man-made blocks.\n"
+ "The blocks that it finds will be highlighted in red.\n" + "The blocks that it finds will be highlighted in the\n"
+ "Good for finding faction bases."); + "selected color.\n" + "Good for finding faction bases.");
setCategory(Category.RENDER); setCategory(Category.RENDER);
addSetting(naturalBlocks); addSetting(naturalBlocks);
addSetting(color);
} }
@Override @Override
@ -164,8 +171,9 @@ public final class BaseFinderHack extends Hack
matrixStack.push(); matrixStack.push();
RenderUtils.applyRegionalRenderOffset(matrixStack); RenderUtils.applyRegionalRenderOffset(matrixStack);
float[] colorF = color.getColorF();
RenderSystem.setShader(GameRenderer::getPositionShader); RenderSystem.setShader(GameRenderer::getPositionShader);
RenderSystem.setShaderColor(1, 0, 0, 0.15F); RenderSystem.setShaderColor(colorF[0], colorF[1], colorF[2], 0.15F);
if(vertexBuffer != null) if(vertexBuffer != null)
{ {
@ -188,6 +196,9 @@ public final class BaseFinderHack extends Hack
{ {
int modulo = MC.player.age % 64; int modulo = MC.player.age % 64;
if(WurstClient.MC.getBlockEntityRenderDispatcher().camera == null)
return;
BlockPos camPos = RenderUtils.getCameraBlockPos(); BlockPos camPos = RenderUtils.getCameraBlockPos();
Integer regionX = (camPos.getX() >> 9) * 512; Integer regionX = (camPos.getX() >> 9) * 512;
Integer regionZ = (camPos.getZ() >> 9) * 512; Integer regionZ = (camPos.getZ() >> 9) * 512;