file_name
stringlengths 6
86
| file_path
stringlengths 45
249
| content
stringlengths 47
6.26M
| file_size
int64 47
6.26M
| language
stringclasses 1
value | extension
stringclasses 1
value | repo_name
stringclasses 767
values | repo_stars
int64 8
14.4k
| repo_forks
int64 0
1.17k
| repo_open_issues
int64 0
788
| repo_created_at
stringclasses 767
values | repo_pushed_at
stringclasses 767
values |
---|---|---|---|---|---|---|---|---|---|---|---|
JsonUtils.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/config/JsonUtils.java | package me.corruptionhades.vapemenu.config;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParser;
public class JsonUtils {
public static Gson gson = new Gson();
public static Gson prettyGson = new GsonBuilder().setPrettyPrinting().create();
public static JsonParser jsonParser = new JsonParser();
}
| 360 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
ConfigLoader.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/config/ConfigLoader.java | package me.corruptionhades.vapemenu.config;
import com.google.gson.JsonObject;
import me.corruptionhades.vapemenu.VapeMenu;
import net.fabricmc.loader.api.FabricLoader;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class ConfigLoader {
private static final List<Config> configs = new ArrayList<>();
// Used for the add animation
public static Config lastAddedConfig;
// Loads all configs from folder
public static void loadConfigs() throws IOException {
// In case of reload we don't want duplicate Configs
configs.clear();
// Main Folder
@SuppressWarnings("all")
File ROOT_DIR = new File(FabricLoader.getInstance().getGameDirectory(), VapeMenu.getName());
if(!ROOT_DIR.exists()) ROOT_DIR.mkdir();
// Configs folder
File configFolder = new File(ROOT_DIR, "Configs");
if(!configFolder.exists()) configFolder.mkdir();
// Don't load anything when no configs are there
if(configFolder.listFiles().length <= 0) {
// Create a default config
Config defaultConfig = new Config("default", "Default configuration");
defaultConfig.save();
configs.add(defaultConfig);
VapeMenu.selectedConfig = defaultConfig;
return;
}
for(File file : configFolder.listFiles()) {
load(file);
}
// Sets the Default config active
VapeMenu.selectedConfig = getDefaultConfig();
}
public static void addConfig(Config config) {
configs.add(config);
lastAddedConfig = config;
}
// Loads a config from a File
public static void load(File file) throws IOException {
BufferedReader load = new BufferedReader(new FileReader(file));
JsonObject json = (JsonObject) JsonUtils.jsonParser.parse(load);
load.close();
configs.add(new Config(file.getName().replace(".json", ""), json.get("description").getAsString(), file));
}
// LOADS a config (the mods from it)
public static void loadConfig(Config config) throws IOException {
config.load();
}
public static Config getDefaultConfig() {
for(Config config : configs) {
if(config.getName().equalsIgnoreCase("default")) return config;
}
// When default config doesn't exist (which shouldn't be able to happen)
// Create a default config
Config defaultConfig = new Config("default", "Default configuration");
try {
defaultConfig.save();
} catch (IOException e) {
e.printStackTrace();
}
configs.add(defaultConfig);
return defaultConfig;
}
public static List<Config> getConfigs() {
return configs;
}
}
| 2,901 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
NumberSetting.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/setting/NumberSetting.java | package me.corruptionhades.vapemenu.setting;
public class NumberSetting extends Setting{
private double min, max, increment;
private double value;
public NumberSetting(String name, double min, double max, double defaultValue, double increment) {
super(name);
this.min = min;
this.max = max;
this.value = defaultValue;
this.increment = increment;
}
public double clamp(double value, double min, double max) {
value = Math.max(min, value);
value = Math.min(max, value);
return value;
}
public double getValue() {
return value;
}
public float getFloatValue() {
return (float) value;
}
public void setValue(double value) {
value = clamp(value,this.min, this.max);
value = Math.round(value * (1.0 / this.increment)) / (1.0 / this.increment);
this.value = value;
}
public void increment(boolean positive) {
if(positive) {
setValue(getValue() + getIncrement());
}
else {
setValue(getFloatValue() - getIncrement());
}
}
public double getMin() {
return min;
}
public double getMax() {
return max;
}
public double getIncrement() {
return increment;
}
}
| 1,318 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
ModeSetting.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/setting/ModeSetting.java | package me.corruptionhades.vapemenu.setting;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
public class ModeSetting extends Setting{
private String mode;
private List<String> modes;
private int index;
public ModeSetting(String name, String defaultMode, String...modes) {
super(name);
this.mode = defaultMode;
this.modes = Arrays.asList(modes);
this.index = this.modes.indexOf(defaultMode);
}
public String getMode() {
return mode;
}
public List<String> getModes() {
return modes;
}
public void setMode(String mode) {
this.mode = mode;
this.index = modes.indexOf(mode);
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
this.mode = modes.get(index);
}
public void cycle() {
if(index < modes.size() - 1) {
index++;
mode = modes.get(index);
}
else if(index >= modes.size() - 1) {
index = 0;
mode = modes.get(0);
}
}
public boolean isMode(String mode) {
return Objects.equals(this.mode, mode);
}
}
| 1,231 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
Setting.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/setting/Setting.java | package me.corruptionhades.vapemenu.setting;
public class Setting {
private String name;
private boolean visible = true;
public Setting(String name) {
this.name = name;
}
public boolean isVisible() {
return visible;
}
public void setVisible(boolean visible) {
this.visible = visible;
}
public String getName() {
return name;
}
}
| 407 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
BooleanSetting.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/setting/BooleanSetting.java | package me.corruptionhades.vapemenu.setting;
public class BooleanSetting extends Setting {
private boolean enabled;
public BooleanSetting(String name, boolean defaultValue) {
super(name);
this.enabled = defaultValue;
}
public void toggle() {
this.enabled = !enabled;
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}
| 468 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
VapeMenuClient.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/client/VapeMenuClient.java | package me.corruptionhades.vapemenu.client;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@Environment(EnvType.CLIENT)
public class VapeMenuClient implements ClientModInitializer {
@Override
public void onInitializeClient() {}
}
| 310 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
RenderUtils.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/utils/RenderUtils.java | package me.corruptionhades.vapemenu.utils;
import com.mojang.blaze3d.systems.RenderSystem;
import net.fabricmc.fabric.impl.client.indigo.renderer.helper.ColorHelper;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.Font;
import net.minecraft.client.font.FontManager;
import net.minecraft.client.font.FontStorage;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.render.*;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.resource.ResourceManager;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import org.jetbrains.annotations.NotNull;
import org.joml.Matrix4f;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.net.URL;
// This is a Helper class for drawing specific things to the screen
public class RenderUtils {
// Stolen from DrawableHelper
public static void fill(@NotNull MatrixStack matrices, double x1, double y1, double x2, double y2, int color) {
Matrix4f matrix = matrices.peek().getPositionMatrix();
double i;
if (x1 < x2) {
i = x1;
x1 = x2;
x2 = i;
}
if (y1 < y2) {
i = y1;
y1 = y2;
y2 = i;
}
float f = (float) (color >> 24 & 0xFF) / 255.0f;
float g = (float) (color >> 16 & 0xFF) / 255.0f;
float h = (float) (color >> 8 & 0xFF) / 255.0f;
float j = (float) (color & 0xFF) / 255.0f;
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
RenderSystem.enableBlend();
RenderSystem.disableTexture();
RenderSystem.defaultBlendFunc();
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
bufferBuilder.vertex(matrix, (float) x1, (float) y2, 0.0f).color(g, h, j, f).next();
bufferBuilder.vertex(matrix, (float) x2, (float) y2, 0.0f).color(g, h, j, f).next();
bufferBuilder.vertex(matrix, (float) x2, (float) y1, 0.0f).color(g, h, j, f).next();
bufferBuilder.vertex(matrix, (float) x1, (float) y1, 0.0f).color(g, h, j, f).next();
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
RenderSystem.enableTexture();
RenderSystem.disableBlend();
}
public static void drawHollowRect(MatrixStack matrixStack, int x, int y, int width, int height, int color, int thickness) {
fill(matrixStack, x, y - thickness, x - thickness, y + height + thickness, color);
fill(matrixStack, x + width, y - thickness, x + width + thickness, y + height + thickness, color);
fill(matrixStack, x, y, x + width, y - thickness, color);
fill(matrixStack, x, y + height, x + width, y + height + thickness, color);
}
// Credit to BadGamesInc#7634 for this, actually I just realized it's from Coffee client lol so here's a link: https://github.com/business-goose/Coffee/tree/master
public static void renderRoundedQuad(@NotNull MatrixStack matrices, double fromX, double fromY, double toX, double toY, double rad, double samples, @NotNull Color c) {
int color = c.getRGB();
Matrix4f matrix = matrices.peek().getPositionMatrix();
float f = (float) (color >> 24 & 255) / 255.0F;
float g = (float) (color >> 16 & 255) / 255.0F;
float h = (float) (color >> 8 & 255) / 255.0F;
float k = (float) (color & 255) / 255.0F;
RenderSystem.enableBlend();
RenderSystem.disableTexture();
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
renderRoundedQuadInternal(matrix, g, h, k, f, fromX, fromY, toX, toY, rad, samples);
RenderSystem.enableTexture();
RenderSystem.disableBlend();
RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
}
public static void renderRoundedQuadInternal(Matrix4f matrix, float cr, float cg, float cb, float ca, double fromX, double fromY, double toX, double toY, double rad, double samples) {
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
bufferBuilder.begin(VertexFormat.DrawMode.TRIANGLE_FAN, VertexFormats.POSITION_COLOR);
double toX1 = toX - rad;
double toY1 = toY - rad;
double fromX1 = fromX + rad;
double fromY1 = fromY + rad;
double[][] map = new double[][]{new double[]{toX1, toY1}, new double[]{toX1, fromY1}, new double[]{fromX1, fromY1}, new double[]{fromX1, toY1}};
for (int i = 0; i < 4; i++) {
double[] current = map[i];
for (double r = i * 90d; r < (360 / 4d + i * 90d); r += (90 / samples)) {
float rad1 = (float) Math.toRadians(r);
float sin = (float) (Math.sin(rad1) * rad);
float cos = (float) (Math.cos(rad1) * rad);
bufferBuilder.vertex(matrix, (float) current[0] + sin, (float) current[1] + cos, 0.0F).color(cr, cg, cb, ca).next();
}
}
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
}
/**
* Wrapper method
*/
public static void drawCircle(MatrixStack matrices, double centerX, double centerY, double radius, double samples, Color color) {
drawCircle(matrices, centerX, centerY, radius, samples, color.getRGB());
}
/**
* Draws a cirlce
* @param matrices ...
* @param centerX CenterX of the Circle
* @param centerY CenterY of the circle
* @param radius "Bigness" of the circle
* @param samples How many pixels should be used
* @param color Color
*/
public static void drawCircle(MatrixStack matrices, double centerX, double centerY, double radius, double samples, int color) {
float alpha = (float) (color >> 24 & 255) / 255.0F;
float red = (float) (color >> 16 & 255) / 255.0F;
float green = (float) (color >> 8 & 255) / 255.0F;
float blue = (float) (color & 255) / 255.0F;
RenderSystem.enableBlend();
RenderSystem.disableTexture();
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
Matrix4f matrix = matrices.peek().getPositionMatrix();
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
bufferBuilder.begin(VertexFormat.DrawMode.TRIANGLE_FAN, VertexFormats.POSITION_COLOR);
for (double r = 0; r < 360; r += (360 / samples)) {
float rad1 = (float) Math.toRadians(r);
float sin = (float) (Math.sin(rad1) * radius);
float cos = (float) (Math.cos(rad1) * radius);
bufferBuilder.vertex(matrix, (float) centerX + sin, (float) centerY + cos, 0.0F).color(red, green, blue, alpha).next();
}
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
RenderSystem.enableTexture();
RenderSystem.disableBlend();
RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
}
// This is never used and I forgor I had it
public static void betterScissor(double x, double y, double x2, double y2) {
MinecraftClient mc = MinecraftClient.getInstance();
int xPercent = (int) (x / mc.getWindow().getScaledWidth());
int yPercent = (int) (y / mc.getWindow().getHeight());
int widthPercent = (int) (x2 / mc.getWindow().getWidth());
int heightPercent = (int) (y2 / mc.getWindow().getHeight());
RenderSystem.enableScissor(xPercent, yPercent, widthPercent, heightPercent);
}
/**
* Draws an image at specified coords
* @param matrices The gl context to draw with
* @param x X pos
* @param y y pos
* @param path Path to the image
*/
public static void drawTexturedRectangle(MatrixStack matrices, float x, float y, String path) {
// Bind the texture
RenderSystem.setShaderTexture(0, new Identifier("vape_menu", path));
try {
URL url = RenderUtils.class.getResource("/assets/vape_menu/" + path);
BufferedImage image = ImageIO.read(url);
DrawableHelper.drawTexture(matrices, (int) x, (int) y, 0.0f, 0.0f, image.getWidth(), image.getHeight(), image.getWidth(), image.getHeight());
} catch (Exception e) {
e.printStackTrace();
}
}
public static void drawScaledTexturedRect(MatrixStack matrices, float x, float y, float scale, String path) {
// Scale
matrices.push();
matrices.scale(scale, scale, 0);
// Bind the texture
RenderSystem.setShaderTexture(0, new Identifier("vape_menu", path));
try {
URL url = RenderUtils.class.getResource("/assets/vape_menu/" + path);
// Get dimensions of image
BufferedImage image = ImageIO.read(url);
// Draw the image
DrawableHelper.drawTexture(matrices, (int) (x / scale), (int) (y / scale), 0.0f, 0.0f, image.getWidth(), image.getHeight(), image.getWidth(), image.getHeight());
matrices.pop();
}
catch (Exception e) {
e.printStackTrace();
}
}
}
| 9,130 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
PacketHelper.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/utils/PacketHelper.java | package me.corruptionhades.vapemenu.utils;
import net.minecraft.client.MinecraftClient;
import net.minecraft.item.ItemStack;
import net.minecraft.network.Packet;
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
import net.minecraft.util.math.Vec3d;
public class PacketHelper {
public static MinecraftClient mc = MinecraftClient.getInstance();
public static void sendPacket(Packet packet) {
if(mc.player != null) {
mc.player.networkHandler.sendPacket(packet);
}
}
public static void sendPosition(Vec3d pos) {
if(mc.player != null) {
mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(pos.getX(), pos.getY(), pos.getZ(), mc.player.isOnGround()));
}
}
public static void sendItem(ItemStack item) {
int slot = 7;
mc.player.networkHandler.sendPacket(new CreativeInventoryActionC2SPacket(slot, item));
}
public static void sendItem(ItemStack item, int slot) {
mc.player.networkHandler.sendPacket(new CreativeInventoryActionC2SPacket(slot, item));
}
}
| 1,193 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
Animation.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/utils/Animation.java | package me.corruptionhades.vapemenu.utils;
// An Animation Utility class
public class Animation {
// Values for
private float end, current;
private boolean done;
public Animation(int start, int end) {
this.end = end;
this.current = start;
done = false;
}
public void update() {
update(false, 20);
}
public void update(boolean cast) {
update(cast, 20);
}
public void update(boolean cast, float speed) {
if (current != end) {
current += ((end - current) / speed);
if(cast) current = (int) current;
// Check for incrementing with float value
if(Math.round(current) == end) current = end;
}
else done = true;
}
public boolean hasEnded() {
return done;
}
public float getValue() {
return current;
}
public float getEnd() {
return end;
}
public void setValue(float current) {
this.current = current;
}
// Set the end
public void setEnd(float end) {
this.end = end;
done = false;
}
}
| 1,137 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
Theme.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/utils/Theme.java | package me.corruptionhades.vapemenu.utils;
import java.awt.*;
public class Theme {
public static Color WINDOW_COLOR;
public static Color ENABLED;
public static Color UNFOCUSED_TEXT_COLOR;
public static Color DISABLED_TEXT_COLOR;
public static Color SETTINGS_BG;
public static Color SETTINGS_HEADER;
public static Color MODULE_ENABLED_BG_HOVER;
public static Color MODULE_DISABLED_BG_HOVER;
public static Color MODULE_ENABLED_BG;
public static Color MODULE_DISABLED_BG;
public static Color MODULE_COLOR;
public static Color MODULE_TEXT;
public static Color TOGGLE_BUTTON_BG;
public static Color TOGGLE_BUTTON_FILL;
public static Color NORMAL_TEXT_COLOR;
public static Color MODE_SETTING_BG;
public static Color MODE_SETTING_FILL;
public static Color SLIDER_SETTING_BG;
public static Color CONFIG_EDIT_BG;
// This is to change the Click gui theme
public static void darkTheme() {
WINDOW_COLOR = new Color(21, 22, 25);
ENABLED = new Color(51, 112, 203);
UNFOCUSED_TEXT_COLOR = new Color(108, 109, 113);
//DISABLED_TEXT_COLOR = ;
SETTINGS_BG = new Color(32, 31, 35);
SETTINGS_HEADER = new Color(39, 38, 42);
MODULE_ENABLED_BG_HOVER = new Color(43, 41, 45);
MODULE_DISABLED_BG_HOVER = new Color(35, 35, 35);
MODULE_ENABLED_BG = new Color(36, 34, 38);
MODULE_DISABLED_BG = new Color(32, 31, 33);
MODULE_COLOR = new Color(37, 35, 39);
MODULE_TEXT = new Color(94, 95, 98);
TOGGLE_BUTTON_BG = new Color(59, 60, 65);
TOGGLE_BUTTON_FILL = new Color(29, 27, 31);
NORMAL_TEXT_COLOR = Color.white;
MODE_SETTING_BG = new Color(46, 45, 48);
MODE_SETTING_FILL = new Color(32, 31, 35);
SLIDER_SETTING_BG = new Color(73, 72, 76);
CONFIG_EDIT_BG = new Color(20, 20, 25);
}
public static void lightTheme() {
}
}
| 1,963 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
ChatUtils.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/utils/ChatUtils.java | package me.corruptionhades.vapemenu.utils;
import me.corruptionhades.vapemenu.VapeMenu;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text;
public class ChatUtils {
private MinecraftClient mc = MinecraftClient.getInstance();
// Unicode character for §
private final String paragraph = "\u00A7";
public void sendMsg(String text) {
if(mc.player != null) mc.player.sendMessage(Text.of(translate(text)));
}
public void sendMsg(Text text) {
if(mc.player != null) mc.player.sendMessage(text);
}
public void sendPrefixMsg(String text) {
if(mc.player != null) mc.player.sendMessage(Text.of(translate(VapeMenu.getPrefix()) + translate(text)));
}
public String translate(String text) {
return text.replace("&", paragraph);
}
}
| 827 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
HudConfigScreen.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/gui/HudConfigScreen.java | package me.corruptionhades.vapemenu.gui;
import me.corruptionhades.vapemenu.module.HudModule;
import me.corruptionhades.vapemenu.module.Module;
import me.corruptionhades.vapemenu.module.ModuleManager;
import me.corruptionhades.vapemenu.utils.RenderUtils;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
public class HudConfigScreen extends Screen {
// For every Hud mod there is a Draggable component, so you can drag it around
public static final List<DraggableComponent> components = new ArrayList<>();
public HudConfigScreen() {
super(Text.of("Hud Config Screen"));
}
@Override
protected void init() {
// Add a new component for all enabled Hud Modules
components.clear();
// Goes through all Modules that are Hud Modules and adds a new component
for(Module module : ModuleManager.INSTANCE.getModules()) {
if(module.isEnabled() && module instanceof HudModule hm) components.add(new DraggableComponent(hm));
}
super.init();
}
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
// Draw the Components if the corresponding Hud Module is enabled
components.forEach(drag -> {
if(drag.getModule().isEnabled())
drag.render(matrices, mouseX, mouseY);
});
super.render(matrices, mouseX, mouseY, delta);
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
components.forEach(drag -> drag.mouseClicked(mouseX, mouseY, button));
return super.mouseClicked(mouseX, mouseY, button);
}
@Override
public boolean mouseReleased(double mouseX, double mouseY, int button) {
components.forEach(drag -> drag.mouseReleased(mouseX, mouseY, button));
return super.mouseReleased(mouseX, mouseY, button);
}
}
| 2,041 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
DraggableComponent.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/gui/DraggableComponent.java | package me.corruptionhades.vapemenu.gui;
import me.corruptionhades.vapemenu.module.HudModule;
import me.corruptionhades.vapemenu.utils.RenderUtils;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.math.MatrixStack;
import java.awt.*;
public class DraggableComponent {
// The Hud Module to work with
private final HudModule module;
// Minecraft Client reference
private final MinecraftClient mc;
// If you are dragging it
private boolean dragging;
// Drag coordinates
private double dragX, dragY;
public DraggableComponent(HudModule module) {
this.module = module;
this.mc = MinecraftClient.getInstance();
// Set dragging to false default
dragging = false;
}
public void render(MatrixStack matrices, int mouseX, int mouseY) {
// Set the new position when dragging
if(dragging) {
int newX = (int) (mouseX - dragX);
int newY = (int) (mouseY - dragY);
// Make sure you're not moving it off the screen
if(newX >= 0 && newX + module.getWidth() <= mc.getWindow().getScaledWidth()) {
module.setX(newX);
}
if (newY >= 0 && newY + module.getHeight() <= mc.getWindow().getScaledHeight()) {
module.setY(newY);
}
// Only drag one component at a time
HudConfigScreen.components.forEach(c -> {
if (c != this) c.setDragging(false);
});
}
// Draw the outline
RenderUtils.drawHollowRect(matrices, module.getX(), module.getY(), module.getWidth(), module.getHeight(), new Color(0, 255, 255).getRGB(), 1);
}
public void mouseClicked(double mouseX, double mouseY, int button) {
// Enable dragging
if(isInside(mouseX, mouseY, module.getX(), module.getY(), module.getX() + module.getWidth(), module.getY() + module.getHeight()) && button == 0) {
dragging = true;
dragX = (int) (mouseX - module.getX());
dragY = (int) (mouseY - module.getY());
}
}
public void mouseReleased(double mouseX, double mouseY, int button) {
// Disable dragging
if(button == 0) dragging = false;
}
public HudModule getModule() {
return module;
}
private boolean isInside(double mouseX, double mouseY, double x, double y, double x2, double y2) {
return (mouseX > x && mouseX < x2) && (mouseY > y && mouseY < y2);
}
public void setDragging(boolean dragging) {
this.dragging = dragging;
}
}
| 2,613 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
ConfigScreen.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/gui/clickgui/ConfigScreen.java | package me.corruptionhades.vapemenu.gui.clickgui;
import me.corruptionhades.vapemenu.VapeMenu;
import me.corruptionhades.vapemenu.gui.clickgui.components.Component;
import me.corruptionhades.vapemenu.config.Config;
import me.corruptionhades.vapemenu.config.ConfigLoader;
import me.corruptionhades.vapemenu.utils.Animation;
import me.corruptionhades.vapemenu.utils.RenderUtils;
import me.corruptionhades.vapemenu.utils.Theme;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.OrderedText;
import net.minecraft.text.Text;
import java.awt.*;
import java.io.IOException;
public class ConfigScreen extends Component {
// Access to orig menu
public final VapeClickGui parent;
// Bro this animation
private Animation createNewAnimX, createNewAnimY;
// If config is added
private boolean isConfigAdded = false;
public EditConfigMenu editConfigMenu;
public ConfigScreen(VapeClickGui parent) {
this.parent = parent;
}
@Override
public void drawScreen(MatrixStack matrices, int mouseX, int mouseY, float delta) {
// Get the Clickguis coordinates
float pX = parent.windowX, pY = parent.windowY, pW = parent.width, pH = parent.height;
// "Your profiles" text
mc.textRenderer.draw(matrices, "Your Profiles", pX + 20, pY + 50, Theme.MODULE_TEXT.getRGB());
// Blue underline
RenderUtils.renderRoundedQuad(matrices, pX + 20, pY + 50 + mc.textRenderer.fontHeight, pX + 30, pY + 50 + mc.textRenderer.fontHeight + 2, 1, 20, Theme.ENABLED);
// Plus button
RenderUtils.drawScaledTexturedRect(matrices, pX + pW - 48, pY + pH - 50, 0.07f, "textures/add_button.png");
matrices.push();
matrices.scale(0.05f, 0.05f, 0);
RenderUtils.drawTexturedRectangle(matrices, (pX + pW - 35) * 20, (pY + 10) * 20, "textures/reload.png");
matrices.pop();
// Draw Configs
int offsetX = 0;
int offsetY = 0;
for(Config config : ConfigLoader.getConfigs()) {
// "Add a config" animation
if(isConfigAdded && config == ConfigLoader.lastAddedConfig) {
if(createNewAnimX != null && createNewAnimY != null) {
createNewAnimX.update(true, 3);
createNewAnimY.update(true, 3);
// Draw box
RenderUtils.renderRoundedQuad(matrices, createNewAnimX.getValue(), createNewAnimY.getValue(), createNewAnimX.getValue() + 80, createNewAnimY.getValue() + 80, 5, 20, Theme.SETTINGS_HEADER);
mc.textRenderer.draw(matrices, config.getName(), createNewAnimX.getValue() + 5, createNewAnimY.getValue() + 5, -1);
// Draw the description
drawStringWrapped(matrices, config.getDescription(), (int) createNewAnimX.getValue() + 5, (int) (createNewAnimY.getValue() + mc.textRenderer.fontHeight + 10), 70);
// Stop animation
if(createNewAnimX.hasEnded() && createNewAnimY.hasEnded()) {
createNewAnimX = null;
createNewAnimY = null;
isConfigAdded = false;
}
}
}
else {
// TODO: Maybe add a fading animation
// If the Config is selected
if (config == VapeMenu.selectedConfig) {
RenderUtils.renderRoundedQuad(matrices, pX + offsetX + 17, pY + 72 + offsetY, pX + 103 + offsetX, pY + 158 + offsetY, 5, 20, Color.WHITE);
}
RenderUtils.renderRoundedQuad(matrices, pX + offsetX + 20, pY + 75 + offsetY, pX + 100 + offsetX, pY + 155 + offsetY, 5, 20, Theme.SETTINGS_HEADER);
mc.textRenderer.draw(matrices, config.getName(), pX + offsetX + 25, pY + 80 + offsetY, -1);
// Edit Icon
matrices.push();
// With below 1 values its weird, you have to multiply by 1 / scale (1 / 0.025 = 40)
matrices.scale(0.025f, 0.025f, 0);
RenderUtils.drawTexturedRectangle(matrices, (pX + offsetX + 25) * 40, (pY + offsetY + 136) * 40, "textures/edit.png");
matrices.pop();
// Draw the description
drawStringWrapped(matrices, config.getDescription(), (int) pX + offsetX + 25, (int) pY + 85 + mc.textRenderer.fontHeight + offsetY, 70);
}
offsetX += 90;
// Max. 5 configs next to each other, so loop em down
if (offsetX >= 450) {
offsetX = 0;
offsetY = 90;
}
}
if(editConfigMenu != null) editConfigMenu.drawScreen(matrices, mouseX, mouseY, delta);
}
// ChatGPT method I had to alter a bit to draw a wrapped string
private void drawStringWrapped(MatrixStack matrices, String text, int x, int y, int boxSize) {
MinecraftClient mc = MinecraftClient.getInstance();
Text textObject = Text.of(text);
OrderedText[] lines = mc.textRenderer.wrapLines(textObject, boxSize).toArray(new OrderedText[0]);
int offset = 0;
for(OrderedText orderedText : lines) {
mc.textRenderer.draw(matrices, orderedText, x, y + offset, 0xFFFFFFFF);
offset+= mc.textRenderer.fontHeight;
}
}
@Override
public void mouseClicked(double mouseX, double mouseY, int button) {
// Just some vars
float pX = parent.windowX, pY = parent.windowY, pW = parent.width, pH = parent.height;
if(editConfigMenu != null) {
editConfigMenu.mouseClicked(mouseX, mouseY, button);
return;
}
// Add a new config
if(isHovered(pX + pW - 45, pY + pH - 45, pX + pW - 15, pY + pH - 15, mouseX, mouseY) && button == 0) {
Config newConfig = new Config("Config Name", "Config Description");
try {
newConfig.save();
} catch (IOException e) {
e.printStackTrace();
}
addConfig(newConfig);
}
// Reload
if(isHovered(pX + pW - 40, pY + 10, pX + pW - 10, pY + 40, mouseX, mouseY) && button == 0) {
try {
ConfigLoader.loadConfigs();
mc.player.sendMessage(Text.of("§aReloaded Configs!"));
} catch (IOException e) {
e.printStackTrace();
}
}
int offsetX = 0;
int offsetY = 0;
for(Config config : ConfigLoader.getConfigs()) {
// Edit the config
if(isHovered(pX + offsetX + 25, pY + offsetY + 136, pX + offsetX + 40, pY + offsetY + 150, mouseX, mouseY) && button == 0) {
editConfigMenu = new EditConfigMenu(this, config);
}
if(isHovered(pX + pW - 45, pY + pH - 45, pX + pW - 15, pY + pH - 15, mouseX, mouseY) && button == 0) {
createNewAnimX = new Animation((int) (pX + pW - 35) , (int) pX + offsetX + 20);
createNewAnimY = new Animation((int) (pY + pH - 37), (int) pY + 75 + offsetY);
}
if(isHovered(pX + offsetX + 17, pY + 72 + offsetY, pX + 103 + offsetX, pY + 158 + offsetY, mouseX, mouseY) && button == 0) {
// Before changing we have to save the one before
try {
VapeMenu.selectedConfig.save();
} catch (IOException e) {
e.printStackTrace();
}
VapeMenu.selectedConfig = config;
// *Tries* to load the config
try {
config.load();
} catch (IOException e) {
e.printStackTrace();
}
}
offsetX += 90;
// Max. 5 configs next to each other, so loop em down (you can have max 10 configs, sometime I'll make it more TODO: >10 configs
if(offsetX >= 450) {
offsetX = 0;
offsetY = 90;
}
}
}
public void addConfig(Config config) {
ConfigLoader.addConfig(config);
isConfigAdded = true;
}
@Override
public void keyPressed(int keyCode, int scanCode, int modifiers) {
if(editConfigMenu != null) editConfigMenu.keyPressed(keyCode, scanCode, modifiers);
}
@Override
public void charTyped(char chr, int modifiers) {
if(editConfigMenu != null) editConfigMenu.charTyped(chr, modifiers);
}
}
| 8,593 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
VapeClickGui.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/gui/clickgui/VapeClickGui.java | package me.corruptionhades.vapemenu.gui.clickgui;
import com.mojang.blaze3d.systems.RenderSystem;
import me.corruptionhades.vapemenu.VapeMenu;
import me.corruptionhades.vapemenu.gui.clickgui.components.ModButton;
import me.corruptionhades.vapemenu.module.Category;
import me.corruptionhades.vapemenu.module.Module;
import me.corruptionhades.vapemenu.module.ModuleManager;
import me.corruptionhades.vapemenu.utils.Animation;
import me.corruptionhades.vapemenu.utils.RenderUtils;
import me.corruptionhades.vapemenu.utils.Theme;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.util.Window;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class VapeClickGui extends Screen {
// Position saving
private static final VapeClickGui INSTANCE = new VapeClickGui();
// Minecraft reference
private final MinecraftClient mc = MinecraftClient.getInstance();
// Coords Dragging window around
private float dragX, dragY;
// True if dragging
private boolean drag = false;
// Window coordinates
public float windowX = 200, windowY = 200;
// Window size
public float width = 500, height = 310;
// Selected category
public Category selectedCategory = Category.COMBAT;
// Selected Module to edit
public Module selectedModule;
// Values for animation
public float lastPercent;
public float percent;
public float percent2;
public float lastPercent2;
public float outro;
public float lastOutro;
// Boolean wether window should close
private boolean close = false;
// Window is closed
private boolean closed;
// Mouse wheel
private double dWheel;
// Value of the Category underline
private float hy = windowY + 40;
// List of all the mod buttons
public final List<ModButton> modButtons = new ArrayList<>();
// For moving them to the side when opening settings
public int coordModX = 0;
// X coordinate of Settings Field
public float settingsFieldX;
// Animation values for Settings
public float settingsFNow, settingsF;
// Mod Scroll
private float modScrollEnd, modScrollNow;
// Wether the mods or the config menu should be shown
private ViewType viewType;
// Config Screen instance
private ConfigScreen configScreen;
private Animation transition;
protected VapeClickGui() {
super(Text.of("Vape Click gui"));
}
@Override
protected void init() {
// Initialize open animation values
percent = 1.33f;
lastPercent = 1f;
percent2 = 1.33f;
lastPercent2 = 1f;
outro = 1;
lastOutro = 1;
// Stop dragging when reopening
drag = false;
// Unselect module
selectedModule = null;
// Clear list of buttons
modButtons.clear();
// Set new buttons
float modY = 70 + modScrollNow;
for(Module module : ModuleManager.INSTANCE.getModulesByCategory(selectedCategory)) {
modButtons.add(new ModButton(module, 0, modY, this));
modY += 40;
}
viewType = ViewType.HOME;
configScreen = new ConfigScreen(this);
super.init();
}
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
super.render(matrices, mouseX, mouseY, delta);
// Get an outro value
float outro = smoothTrans(this.outro, lastOutro);
// Check if player is ingame
if (mc.currentScreen == null) {
matrices.translate(mc.getWindow().getScaledWidth() / 2, mc.getWindow().getScaledHeight() / 2, 0);
matrices.scale(outro, outro, 0);
matrices.translate(-mc.getWindow().getScaledWidth() / 2, -mc.getWindow().getScaledHeight() / 2, 0);
}
// Get percent values
percent = smoothTrans(this.percent, lastPercent);
percent2 = smoothTrans(this.percent2, lastPercent2);
if (percent > 0.98) {
// Scale window
matrices.translate(mc.getWindow().getScaledWidth() / 2, mc.getWindow().getScaledHeight() / 2, 0);
matrices.scale(percent, percent, 0);
matrices.translate(-mc.getWindow().getScaledWidth() / 2, -mc.getWindow().getScaledHeight() / 2, 0);
} else {
if (percent2 <= 1) {
matrices.translate(mc.getWindow().getScaledWidth() / 2, mc.getWindow().getScaledHeight() / 2, 0);
matrices.scale(percent2, percent2, 0);
matrices.translate(-mc.getWindow().getScaledWidth() / 2, -mc.getWindow().getScaledHeight() / 2, 0);
}
}
if(percent <= 1.5 && close) {
percent = smoothTrans(this.percent, 2);
percent2 = smoothTrans(this.percent2, 2);
}
if(percent >= 1.4 && close) {
percent = 1.5f;
closed = true;
// Set ingame focus
mc.currentScreen = null;
}
// Dragging the window
if(drag) {
// Updating window positions
if (dragX == 0 && dragY == 0) {
dragX = mouseX - windowX;
dragY = mouseY - windowY;
} else {
windowX = mouseX - dragX;
windowY = mouseY - dragY;
}
}
// Anti-Issue
else if (dragX != 0 || dragY != 0) {
dragX = 0;
dragY = 0;
}
// Draw the window corner radius
RenderUtils.renderRoundedQuad(matrices, windowX, windowY, windowX + width, windowY + height, 25, 20, Theme.WINDOW_COLOR);
// Draw the Client name
matrices.push();
// Scales the text
matrices.scale(2, 2, 0);
// Divide by 2 because scale
mc.textRenderer.draw(matrices, VapeMenu.getName(), (windowX + 20) / 2, (windowY + 20) / 2, -1);
matrices.pop();
if(viewType == ViewType.CONFIG) {
// Transition
if(transition != null) {
transition.update(true);
RenderUtils.fill(matrices, transition.getValue(), windowY, transition.getEnd() - 19, windowY + height, Theme.WINDOW_COLOR.getRGB());
if(transition.hasEnded()) transition = null;
}
configScreen.drawScreen(matrices, mouseX, mouseY, delta);
// Back button
if(isHovered(windowX + 20, windowY + height - 50, windowX + 20 + 32, windowY + height - 50 + 32, mouseX, mouseY) && configScreen.editConfigMenu == null) {
matrices.push();
RenderUtils.drawTexturedRectangle(matrices, windowX + 20, windowY + height - 50, "textures/back.png");
matrices.pop();
}
else {
matrices.push();
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
RenderSystem.setShaderColor(0.25f, 0.25f, 0.25f, 1f);
RenderUtils.drawTexturedRectangle(matrices, windowX + 20, windowY + height - 50, "textures/back.png");
RenderSystem.clearColor(1f, 1f, 1f, 1f);
matrices.pop();
}
return;
}
Window window = mc.getWindow();
// Draw the categories
RenderSystem.enableScissor((int) (windowX + 5) * 2, (int) (-windowY + (height / 2) + 55) * 2, window.getScaledWidth() + 40, window.getScaledHeight() - 10);
// Easier to see where is being scissored
//RenderUtils.fill(matrices.peek().getPositionMatrix(), window.getScaledWidth(), window.getScaledHeight(), -window.getScaledWidth(), -window.getScaledHeight(), -1);
// Only show categories when no mod is expanded
if(selectedModule == null) {
// Show Config icon
if(isHovered(windowX + 20, windowY + height - 50, windowX + 20 + 32, windowY + height - 50 + 32, mouseX, mouseY)) {
matrices.push();
RenderUtils.drawTexturedRectangle(matrices, windowX + 20, windowY + height - 50, "textures/config.png");
matrices.pop();
}
else {
matrices.push();
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
RenderSystem.setShaderColor(0.25f, 0.25f, 0.25f, 1f);
RenderUtils.drawTexturedRectangle(matrices, windowX + 20, windowY + height - 50, "textures/config.png");
matrices.pop();
}
// Category room between
float cateY = windowY + 65;
for (Category category : Category.values()) {
// If the category is selected
if (category == selectedCategory) {
// White Category name for highlighting
mc.textRenderer.draw(matrices, category.name(), windowX + 20, cateY, -1);
// Draw the Category underline
RenderUtils.renderRoundedQuad(matrices, windowX + 20, hy + mc.textRenderer.fontHeight + 2, windowX + 30, hy + mc.textRenderer.fontHeight + 4, 1, 20, Theme.ENABLED);
// Update the underline position
if (hy != cateY) {
hy += (cateY - hy) / 20;
}
} else {
// Gray-ish category name
mc.textRenderer.draw(matrices, category.name(), windowX + 20, cateY, Theme.UNFOCUSED_TEXT_COLOR.getRGB());
}
cateY += 25;
}
}
// Update setting values
if (selectedModule != null) {
if (settingsFieldX > -80) {
settingsFieldX -= 5;
}
} else {
if (settingsFieldX < 0) {
settingsFieldX += 5;
}
}
if(selectedModule != null) {
// Draw Settings field
RenderUtils.renderRoundedQuad(matrices,windowX + 430 + settingsFieldX, windowY + 60, windowX + width, windowY + height - 20, 5, 20, Theme.SETTINGS_BG);
RenderUtils.renderRoundedQuad(matrices, windowX + 430 + settingsFieldX, windowY + 60, windowX + width, windowY + 85, 5, 20, Theme.SETTINGS_HEADER);
mc.textRenderer.draw(matrices, selectedModule.getName(), windowX + 450 + settingsFieldX, windowY + 70, -1);
// Settings scroll
if (isHovered(windowX + 430 + (int) settingsFieldX, windowY + 60, windowX + width, windowY + height - 20, mouseX, mouseY)) {
if (dWheel < 0 && Math.abs(settingsF) + 170 < (selectedModule.getSettings().size() * 25)) {
settingsF -= 32;
}
if (dWheel > 0 && settingsF < 0) {
settingsF += 32;
}
}
// Update Setting animation values
if (settingsFNow != settingsF) {
settingsFNow += (settingsF - settingsFNow) / 20;
settingsFNow = (int) settingsFNow;
}
}
// Scroll
if (isHovered(windowX + 100 + settingsFieldX, windowY + 60, windowX + 425 + settingsFieldX, windowY + height, mouseX, mouseY)) {
if (dWheel < 0 && Math.abs(modScrollEnd) + 220 < (ModuleManager.INSTANCE.getModulesByCategory(selectedCategory).size() * 40)) {
modScrollEnd -= 25;
}
if (dWheel > 0 && modScrollEnd < 0) {
modScrollEnd += 25;
}
}
// Smoother scroll
if (modScrollNow != modScrollEnd) {
modScrollNow += (modScrollEnd - modScrollNow) / 20;
modScrollNow = (int) modScrollNow;
}
// Draw the Mod Buttons
float modY = 70 + modScrollNow;
for(ModButton modButton : modButtons) {
if(ModuleManager.INSTANCE.getModulesByCategory(selectedCategory).contains(modButton.getModule())) {
modButton.setY(modY);
modButton.drawScreen(matrices, mouseX, mouseY, delta);
modY += 40;
}
}
RenderSystem.disableScissor();
// Transition
if(transition != null) {
transition.update(true);
RenderUtils.fill(matrices, transition.getValue(), windowY, transition.getEnd() - 19, windowY + height, Theme.WINDOW_COLOR.getRGB());
if(transition.hasEnded()) transition = null;
}
}
// Smoothly transitions between 2 values (stolen from Lune lol, the more fps you have the faster it will be (made for optimization purposes))
public float smoothTrans(double current, double last){
return (float) (current + (last - current) / (MinecraftClient.getInstance().getCurrentFps() / 10));
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
// Drag the Window
if (isHovered(windowX, windowY, windowX + width, windowY + 20, mouseX, mouseY) && button == 0) {
drag = true;
}
// Click on the config Icon Null check so u can't leave when editing a config
if(isHovered(windowX + 20, windowY + height - 50, windowX + 20 + 32, windowY + height - 50 + 32, mouseX, mouseY) && button == 0 && selectedModule == null && configScreen.editConfigMenu == null) {
transition = new Animation((int) (windowX - 20), (int) (windowX + width + 20));
if(viewType == ViewType.CONFIG) {
viewType = ViewType.HOME;
}
else viewType = ViewType.CONFIG;
}
if(viewType == ViewType.CONFIG) {
configScreen.mouseClicked(mouseX, mouseY, button);
return super.mouseClicked(mouseX, mouseY, button);
}
// When the Category is selected
float cateY = windowY + 65;
for(Category category : Category.values()) {
if (isHovered(windowX, cateY - 8, windowX + 50, cateY + mc.textRenderer.fontHeight + 8, mouseX, mouseY) && button == 0) {
// Set the new underline position
if(category == selectedCategory) {
hy = cateY;
}
// Set new category
selectedCategory = category;
dWheel = 0;
// Update buttons to match new category
modButtons.clear();
float modY = 70 + modScrollNow;
for(Module module : ModuleManager.INSTANCE.getModulesByCategory(selectedCategory)) {
modButtons.add(new ModButton(module, 0, modY, this));
modY += 40;
}
}
cateY += 25;
}
// Mouse Clicked hook for the buttons
for(ModButton modButton : modButtons) {
if(ModuleManager.INSTANCE.getModulesByCategory(selectedCategory).contains(modButton.getModule())) {
modButton.mouseClicked(mouseX, mouseY, button);
}
}
return super.mouseClicked(mouseX, mouseY, button);
}
@Override
public boolean mouseReleased(double mouseX, double mouseY, int button) {
// Stop dragging
drag = false;
if(viewType == ViewType.CONFIG) {
configScreen.mouseReleased(mouseX, mouseY, button);
return super.mouseReleased(mouseX, mouseY, button);
}
for(ModButton modButton : modButtons) {
if(ModuleManager.INSTANCE.getModulesByCategory(selectedCategory).contains(modButton.getModule())) {
modButton.mouseReleased(mouseX, mouseY, button);
}
}
return super.mouseReleased(mouseX, mouseY, button);
}
@Override
public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
// Set Scroll value
if(isHovered(windowX + 100 + settingsFieldX, windowY + 60, windowX + 425 + settingsFieldX, windowY + height, mouseX, mouseY)) this.dWheel = amount;
return super.mouseScrolled(mouseX, mouseY, amount);
}
@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
for(ModButton mb : modButtons) {
mb.keyPressed(keyCode, scanCode, modifiers);
}
configScreen.keyPressed(keyCode, scanCode, modifiers);
return super.keyPressed(keyCode, scanCode, modifiers);
}
@Override
public boolean charTyped(char chr, int modifiers) {
for(ModButton mb : modButtons) {
mb.charTyped(chr, modifiers);
}
configScreen.charTyped(chr, modifiers);
return super.charTyped(chr, modifiers);
}
@Override
public void close() {
super.close();
// Save current config
try {
VapeMenu.selectedConfig.save();
} catch (IOException e) {
e.printStackTrace();
}
// Reload the selected config
try {
VapeMenu.selectedConfig.load();
} catch (IOException e) {
e.printStackTrace();
}
}
public boolean isHovered(float x, float y, float x2, float y2, double mouseX, double mouseY) {
return mouseX >= x && mouseX <= x2 && mouseY >= y && mouseY <= y2;
}
public static VapeClickGui getINSTANCE() {
return INSTANCE;
}
}
| 17,761 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
EditConfigMenu.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/gui/clickgui/EditConfigMenu.java | package me.corruptionhades.vapemenu.gui.clickgui;
import me.corruptionhades.vapemenu.gui.clickgui.components.TextComponent;
import me.corruptionhades.vapemenu.config.Config;
import me.corruptionhades.vapemenu.config.ConfigLoader;
import me.corruptionhades.vapemenu.utils.Animation;
import me.corruptionhades.vapemenu.utils.RenderUtils;
import me.corruptionhades.vapemenu.utils.Theme;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import java.awt.*;
import java.io.IOException;
public class EditConfigMenu extends me.corruptionhades.vapemenu.gui.clickgui.components.Component {
private final ConfigScreen parent;
private Config editing;
private final Animation animation;
private final TextComponent nameText;
private final TextComponent descriptionText;
private boolean close;
public EditConfigMenu(ConfigScreen parent, Config editing) {
this.parent = parent;
this.editing = editing;
animation = new Animation(0, 50);
nameText = new TextComponent(parent.parent, editing.getName());
descriptionText = new TextComponent(parent.parent, editing.getDescription());
close = false;
}
@Override
public void drawScreen(MatrixStack matrices, int mouseX, int mouseY, float delta) {
// Get an outro value
float pX = parent.parent.windowX, pY = parent.parent.windowY, pWidth = parent.parent.width, pHeight = parent.parent.height;
animation.update(false, 3);
// Outline
RenderUtils.renderRoundedQuad(matrices,
pX + 197 - animation.getValue(),
pY + 147 - animation.getValue(),
pX + 303 + animation.getValue(),
pY + 153 + animation.getValue(), 10, 20, Color.white);
RenderUtils.renderRoundedQuad(matrices,
pX + 200 - animation.getValue(),
pY + 150 - animation.getValue(),
pX + 300 + animation.getValue(),
pY + 150 + animation.getValue(), 10, 20, Theme.CONFIG_EDIT_BG);
// Close the editing menu
if(animation.hasEnded() && close) {
parent.editConfigMenu = null;
return;
}
if(animation.hasEnded() && !close) {
mc.textRenderer.draw(matrices, "Name", pX + 158, pY + 110, Theme.MODULE_TEXT.getRGB());
nameText.draw(matrices, pX + 155, pY + 120, 12);
mc.textRenderer.draw(matrices, "Description", pX + 158, pY + 135, Theme.MODULE_TEXT.getRGB());
descriptionText.draw(matrices, pX + 155, pY + 146, 12);
matrices.push();
matrices.scale(1.4f, 1.4f, 0);
int hover = isHovered(pX + 337, pY + 103, pX + 346, pY + 112, mouseX, mouseY) ? -1 : Theme.MODULE_TEXT.getRGB();
mc.textRenderer.draw(matrices, "x", (pX + 335) / 1.4f, (pY + 103) / 1.4f, hover);
matrices.pop();
// TODO: hover effect
mc.textRenderer.draw(matrices, "Delete", pX + 315, pY + 185, -1);
}
if(!nameText.isFocused()) editing.setName(nameText.getText());
if(!descriptionText.isFocused()) editing.setDescription(descriptionText.getText());
}
@Override
public void mouseClicked(double mouseX, double mouseY, int button) {
float pX = parent.parent.windowX, pY = parent.parent.windowY, pWidth = parent.parent.width, pHeight = parent.parent.height;
// Close
if(isHovered(pX + 337, pY + 103, pX + 346, pY + 112, mouseX, mouseY) && button == 0) {
close();
}
// Delete
if(isHovered(pX + 310, pY + 185, pX + 345, pY + 195, mouseX, mouseY) && button == 0) {
if(editing == ConfigLoader.getDefaultConfig()) {
// TODO: cannot delete default config
return;
}
editing.delete();
close();
try {
ConfigLoader.loadConfigs();
mc.player.sendMessage(Text.of("§aReloaded Configs!"));
} catch (IOException e) {
e.printStackTrace();
}
}
nameText.mouseClicked(mouseX, mouseY, button);
descriptionText.mouseClicked(mouseX, mouseY, button);
}
private void close() {
animation.setEnd(7);
close = true;
}
@Override
public void keyPressed(int keyCode, int scanCode, int modifiers) {
if(editing != ConfigLoader.getDefaultConfig()) {
nameText.keyPressed(keyCode, scanCode, modifiers);
}
descriptionText.keyPressed(keyCode, scanCode, modifiers);
}
@Override
public void charTyped(char chr, int modifiers) {
nameText.charTyped(chr, modifiers);
descriptionText.charTyped(chr, modifiers);
}
}
| 4,797 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
TextComponent.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/gui/clickgui/components/TextComponent.java | package me.corruptionhades.vapemenu.gui.clickgui.components;
import me.corruptionhades.vapemenu.gui.clickgui.VapeClickGui;
import me.corruptionhades.vapemenu.utils.RenderUtils;
import me.corruptionhades.vapemenu.utils.Theme;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.math.MatrixStack;
import java.util.ArrayList;
import java.util.List;
import static org.lwjgl.glfw.GLFW.*;
public class TextComponent {
private final VapeClickGui parent;
private String text;
private boolean focused;
private float x, y, height;
private final MinecraftClient mc = MinecraftClient.getInstance();
public TextComponent(VapeClickGui parent, String startingText) {
this.parent = parent;
this.text = startingText;
}
public void draw(MatrixStack matrices, float x, float y, float height) {
this.x = x;
this.y = y;
this.height = height;
RenderUtils.renderRoundedQuad(matrices, x , y, x + mc.textRenderer.getWidth(text) + 5, y + height, 5, 20, Theme.SETTINGS_HEADER);
mc.textRenderer.draw(matrices, text, x + 2, y + 2, -1);
}
public void keyPressed(int key, int scanCode, int modifiers) {
if(!focused) return;
boolean control = MinecraftClient.IS_SYSTEM_MAC ? modifiers == GLFW_MOD_SUPER : modifiers == GLFW_MOD_CONTROL;
if(control && key == GLFW_KEY_C) {
mc.keyboard.setClipboard(text);
return;
}
if(control && key == GLFW_KEY_X) {
mc.keyboard.setClipboard(text);
clearSelection();
}
if (key == GLFW_KEY_ENTER || key == GLFW_KEY_KP_ENTER) {
focused = false;
}
if(control && key == GLFW_KEY_V) {
String clipboard = mc.keyboard.getClipboard();
text += clipboard;
}
if(key == GLFW_KEY_BACKSPACE) {
if(text.length() <= 0) return;
StringBuilder sb = new StringBuilder(text);
sb.deleteCharAt(text.length() - 1);
text = sb.toString();
}
}
public void charTyped(char letter, int modifiers) {
if(!focused) return;
boolean control = MinecraftClient.IS_SYSTEM_MAC ? modifiers == GLFW_MOD_SUPER : modifiers == GLFW_MOD_CONTROL;
boolean shift = modifiers == GLFW_MOD_SHIFT;
if(!control && isValid(letter)) {
if(shift) {
letter = ((Character) letter).toString().toUpperCase().charAt(0);
}
text += letter;
}
}
public void mouseClicked(double mouseX, double mouseY, int button) {
focused = Component.isHovered(x, y, x + mc.textRenderer.getWidth(text) + 5, y + height, mouseX, mouseY) && button == 0;
}
public void clearSelection() {
text = "";
}
private boolean isValid(char letter) {
String chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!\"$%&/()=? _-:.,;+*/#'";
List<Character> characters = new ArrayList<>();
for (char ch : chars.toCharArray()) {
characters.add(ch);
}
return characters.contains(letter);
}
public String getText() {
return text;
}
public boolean isFocused() {
return focused;
}
public void setFocused(boolean focused) {
this.focused = focused;
}
}
| 3,379 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
Slider.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/gui/clickgui/components/Slider.java | package me.corruptionhades.vapemenu.gui.clickgui.components;
import me.corruptionhades.vapemenu.gui.clickgui.VapeClickGui;
import me.corruptionhades.vapemenu.setting.NumberSetting;
import me.corruptionhades.vapemenu.utils.RenderUtils;
import me.corruptionhades.vapemenu.utils.Theme;
import net.minecraft.client.util.math.MatrixStack;
public class Slider extends Component {
private final NumberSetting setting;
private final VapeClickGui parent;
private float x, y;
private boolean dragging = false;
public Slider(NumberSetting setting, float x, float y, VapeClickGui parent) {
this.setting = setting;
this.x = x;
this.y = y;
this.parent = parent;
}
@Override
public void drawScreen(MatrixStack matrices, int mouseX, int mouseY, float delta) {
float present = (float) (((x + parent.windowX + parent.width - 11) - (x + parent.windowX + 450 + parent.settingsFieldX))
* (((Number) setting.getValue()).floatValue() - setting.getMin())
/ (setting.getMax() - setting.getMin()));
// Setting Name
if(dragging) {
mc.textRenderer.draw(matrices, setting.getName(), parent.windowX + 445 + parent.settingsFieldX, y + 5, -1);
}
else {
mc.textRenderer.draw(matrices, setting.getName(), parent.windowX + 445 + parent.settingsFieldX, y + 5, Theme.MODULE_TEXT.getRGB());
}
// Value
mc.textRenderer.draw(matrices, "" + setting.getValue(), parent.windowX + parent.width - 20, y + 5, Theme.NORMAL_TEXT_COLOR.getRGB());
// Bg
RenderUtils.renderRoundedQuad(matrices, x + parent.windowX + 450 + parent.settingsFieldX, y + 20, x + parent.windowX + parent.width - 11, y + 21.5f, 1, 20, Theme.SLIDER_SETTING_BG);
// Slider itself
RenderUtils.renderRoundedQuad(matrices, x + parent.windowX + 450 + parent.settingsFieldX, y + 20, x + parent.windowX + 450 + parent.settingsFieldX + present, y + 21.5f, 1, 20, Theme.ENABLED);
if(dragging) {
float render2 = (float) setting.getMin();
double max = setting.getMax();
double inc = 0.1;
double valAbs = (double) mouseX - ((double) (x + parent.windowX + 450 + parent.settingsFieldX));
double perc = valAbs / (((x + parent.windowX + parent.width - 11) - (x + parent.windowX + 450 + parent.settingsFieldX)));
perc = Math.min(Math.max(0.0D, perc), 1.0D);
double valRel = (max - render2) * perc;
double val = render2 + valRel;
val = (double) Math.round(val * (1.0D / inc)) / (1.0D / inc);
setting.setValue(val);
}
}
@Override
public void mouseClicked(double mouseX, double mouseY, int button) {
if(isHovered(x + parent.windowX + 450 + parent.settingsFieldX, y + 18, x + parent.windowX + parent.width - 11, y + 23.5f, mouseX, mouseY)) {
dragging = true;
}
}
@Override
public void mouseReleased(double mouseX, double mouseY, int button) {
dragging = false;
}
public float getX() {
return x;
}
public float getY() {
return y;
}
public void setY(float y) {
this.y = y;
}
}
| 3,256 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
CheckBox.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/gui/clickgui/components/CheckBox.java | package me.corruptionhades.vapemenu.gui.clickgui.components;
import me.corruptionhades.vapemenu.gui.clickgui.VapeClickGui;
import me.corruptionhades.vapemenu.setting.BooleanSetting;
import me.corruptionhades.vapemenu.utils.Animation;
import me.corruptionhades.vapemenu.utils.RenderUtils;
import me.corruptionhades.vapemenu.utils.Theme;
import net.minecraft.client.util.math.MatrixStack;
import java.awt.*;
public class CheckBox extends Component {
private final BooleanSetting setting;
private final VapeClickGui parent;
private float x, y;
private final Animation animation;
public CheckBox(BooleanSetting setting, VapeClickGui parent, float x, float y) {
this.setting = setting;
this.parent = parent;
this.x = x;
this.y = y;
animation = new Animation(0, 100);
}
@Override
public void drawScreen(MatrixStack matrices, int mouseX, int mouseY, float delta) {
if(setting.isEnabled()) {
mc.textRenderer.draw(matrices, setting.getName(), x + parent.windowX + 445 + parent.settingsFieldX, y + 4, -1);
animation.setEnd(100);
Color color = new Color(33, 94, 181, (int) (animation.getValue() / 100 * 255));
RenderUtils.renderRoundedQuad(matrices, x + parent.windowX + parent.width - 30, y + 2, x + parent.windowX + parent.width - 10, y + 12, 4, 20, color);
// Circle
RenderUtils.drawCircle(matrices, x + parent.windowX + parent. width - 25 + 10 * (animation.getValue() / 100f), y + 7, 3.5, 10, -1);
}
else {
mc.textRenderer.draw(matrices, setting.getName(), x + parent.windowX + 445 + parent.settingsFieldX, y + 4, Theme.SLIDER_SETTING_BG.getRGB());
animation.setEnd(0);
RenderUtils.renderRoundedQuad(matrices,x + parent.windowX + parent.width - 30, y + 2, x + parent.windowX + parent.width - 10, y + 12, 4, 20, Theme.TOGGLE_BUTTON_BG);
RenderUtils.renderRoundedQuad(matrices, x + parent.windowX + parent.width - 29, y + 3, x + parent.windowX + parent.width - 11, y + 11, 3, 20, Theme.MODE_SETTING_FILL);
// Cirlce
RenderUtils.drawCircle(matrices, x + parent.windowX + parent.width - 25 + 10 * (animation.getValue() / 100f), y + 7, 3.5, 10, Theme.TOGGLE_BUTTON_BG.getRGB());
}
animation.update();
}
@Override
public void mouseClicked(double mouseX, double mouseY, int button) {
if(isHovered(x + parent.windowX + parent.width - 30, y + 2, x + parent.windowX + parent.width - 10, y + 12, mouseX, mouseY)) {
setting.toggle();
}
}
public void setY(float y) {
this.y = y;
}
}
| 2,690 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
ModButton.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/gui/clickgui/components/ModButton.java | package me.corruptionhades.vapemenu.gui.clickgui.components;
import me.corruptionhades.vapemenu.gui.clickgui.VapeClickGui;
import me.corruptionhades.vapemenu.module.Module;
import me.corruptionhades.vapemenu.module.ModuleManager;
import me.corruptionhades.vapemenu.setting.BooleanSetting;
import me.corruptionhades.vapemenu.setting.ModeSetting;
import me.corruptionhades.vapemenu.setting.NumberSetting;
import me.corruptionhades.vapemenu.setting.Setting;
import me.corruptionhades.vapemenu.utils.Animation;
import me.corruptionhades.vapemenu.utils.RenderUtils;
import me.corruptionhades.vapemenu.utils.Theme;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.math.MatrixStack;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
public class ModButton {
// Module the Mod button will use
private final Module module;
// Coords of the button
private double x, y;
// Parent access
private final VapeClickGui parent;
// Minecraft access
private final MinecraftClient mc = MinecraftClient.getInstance();
// List of all setting components
private final List<Component> components = new ArrayList<>();
// Toggle animation
private final Animation toggleAnim;
public ModButton(Module module, double x, double y, VapeClickGui parent) {
this.module = module;
this.y = y;
this.x = x;
this.parent = parent;
toggleAnim = new Animation(0, 10);
}
// Drawing method
public void drawScreen(MatrixStack matrices, int mouseX, int mouseY, float delta) {
x = parent.settingsFieldX;
// If the mouse is hovered on the module
if (isHovered(parent.windowX + (float) x + 100 + parent.coordModX, (float) (parent.windowY + y - 10), parent.windowX + (float) x + 425 + parent.coordModX, (float) (parent.windowY + y + 25), mouseX, mouseY)) {
if (module.isEnabled()) {
RenderUtils.renderRoundedQuad(matrices, parent.windowX + (float) x + 100 + parent.coordModX, parent.windowY + y - 10, parent.windowX + (float) x + 425 + parent.coordModX, parent.windowY + y + 25, 5, 20, Theme.MODULE_ENABLED_BG_HOVER);
} else {
RenderUtils.renderRoundedQuad(matrices, parent.windowX + (float) x + 100 + parent.coordModX, parent.windowY + y - 10, parent.windowX + (float) x + 425 + parent.coordModX, parent.windowY + y + 25, 5, 20, Theme.MODULE_DISABLED_BG_HOVER);
}
}
else {
if (module.isEnabled()) {
RenderUtils.renderRoundedQuad(matrices, parent.windowX + (float) x + 100 + parent.coordModX, parent.windowY + y - 10, parent.windowX + (float) x + 425 + parent.coordModX, parent.windowY + y + 25, 5, 20, Theme.MODULE_ENABLED_BG);
} else {
RenderUtils.renderRoundedQuad(matrices, parent.windowX + (float) x + 100 + parent.coordModX, parent.windowY + y - 10, parent.windowX + (float) x + 425 + parent.coordModX, parent.windowY + y + 25, 5, 20, Theme.MODULE_DISABLED_BG);
}
}
RenderUtils.renderRoundedQuad(matrices, parent.windowX + (float) x + 100 + parent.coordModX, parent.windowY + y - 10, parent.windowX + (float) x + 125 + parent.coordModX, parent.windowY + y + 25, 5, 20, Theme.MODULE_COLOR);
RenderUtils.renderRoundedQuad(matrices, parent.windowX + (float) x + 410 + parent.coordModX, parent.windowY + y - 10, parent.windowX + (float) x + 425 + parent.coordModX, parent.windowY + y + 25, 5, 20, Theme.SETTINGS_HEADER);
mc.textRenderer.draw(matrices,".", parent.windowX + (float) x + 416 + parent.coordModX, (float) (parent.windowY + y - 5), Theme.MODULE_TEXT.getRGB());
mc.textRenderer.draw(matrices,".", parent.windowX + (float) x + 416 + parent.coordModX, (float) (parent.windowY + y - 1), Theme.MODULE_TEXT.getRGB());
mc.textRenderer.draw(matrices,".", parent.windowX + (float) x + 416 + parent.coordModX, (float) (parent.windowY + y + 3), Theme.MODULE_TEXT.getRGB());
// Bob the description forth a bit TODO: align it to the Module Name's length
if (isHovered(parent.windowX + (float) x + 100 + parent.coordModX, parent.windowY + (float) y - 10, parent.windowX + (float) x + 425 + parent.coordModX, (float) (parent.windowY + y + 25), mouseX, mouseY)) {
mc.textRenderer.draw(matrices, module.getDescription() + ".", parent.windowX + (float) x + 225 + parent.coordModX, parent.windowY + (float) (y + 5), Theme.MODULE_TEXT.getRGB());
} else {
mc.textRenderer.draw(matrices, module.getDescription() + ".", parent.windowX + (float) x + 220 + parent.coordModX, parent.windowY + (float) (y + 5), Theme.MODULE_TEXT.getRGB());
}
// Update the animation value
toggleAnim.update();
if (module.isEnabled()) {
// Draw the Module name
mc.textRenderer.draw(matrices,module.getName(), parent.windowX + (float) x + 140 + parent.coordModX, (float) (parent.windowY + y + 5), Theme.NORMAL_TEXT_COLOR.getRGB());
RenderUtils.renderRoundedQuad(matrices, parent.windowX + (float) x + 100 + parent.coordModX, parent.windowY + y - 10, parent.windowX + (float) x + 125 + parent.coordModX, parent.windowY + y + 25, 5, 20, new Color(41, 117, 221, (int) ((toggleAnim.getValue() * 10) / 100f * 255)));
toggleAnim.setEnd(10);
RenderUtils.renderRoundedQuad(matrices, parent.windowX + (float) x + 380 + parent.coordModX, parent.windowY + y + 2, parent.windowX + (float) x + 400 + parent.coordModX, parent.windowY + y + 12, 4, 5, new Color(33, 94, 181, (int) ((toggleAnim.getValue() * 10) / 100f * 255)));
RenderUtils.drawCircle(matrices,parent.windowX + x + parent.coordModX + 385 + toggleAnim.getValue(), parent.windowY + y + 7, 3.5, 20, Theme.NORMAL_TEXT_COLOR.getRGB());
}
else {
mc.textRenderer.draw(matrices, module.getName(), parent.windowX + (float) x + 140 + parent.coordModX, parent.windowY + (float) (y + 5), Theme.MODULE_TEXT.getRGB());
toggleAnim.setEnd(0);
RenderUtils.renderRoundedQuad(matrices, parent.windowX + (float) x + 380 + parent.coordModX, parent.windowY + y + 2, parent.windowX + (float) x + 400 + parent.coordModX, parent.windowY + y + 12, 4, 5, Theme.TOGGLE_BUTTON_BG);
RenderUtils.renderRoundedQuad(matrices, parent.windowX + (float) x + 381 + parent.coordModX, parent.windowY + y + 3, parent.windowX + (float) x + 399 + parent.coordModX, parent.windowY + y + 11, 3, 20, Theme.TOGGLE_BUTTON_FILL);
RenderUtils.drawCircle(matrices, parent.windowX + x + parent.coordModX + 385 + toggleAnim.getValue(), parent.windowY + y + 7, 3.5, 20, Theme.TOGGLE_BUTTON_BG);
}
// Update Y Component values
float settingsY = parent.windowY + 100 + parent.settingsFNow;
for(Component component : components) {
if(component instanceof CheckBox cb) cb.setY(settingsY);
if(component instanceof Slider s) s.setY(settingsY);
if(component instanceof ModeComp m) m.setY(settingsY);
settingsY += 25;
}
// Only draw components when the module is expanded
if(module.isExpanded()) components.forEach(c -> c.drawScreen(matrices, mouseX, mouseY, delta));
}
public void mouseClicked(double mouseX, double mouseY, int button) {
// Toggle the module
if (isHovered(parent.windowX + (float) x + 100 + parent.coordModX, parent.windowY + (float) y - 10, parent.windowX + (float) x + 425 + parent.coordModX, parent.windowY + (float) y + 25, mouseX, mouseY) && button == 0) {
module.toggle();
}
// Show Settings
else if(isHovered(parent.windowX + (float) x + 100 + parent.coordModX, parent.windowY + (float) y - 10, parent.windowX + (float) x + 425 + parent.coordModX, parent.windowY + (float) y + 25, mouseX, mouseY) && button == 1) {
if(parent.selectedModule != null && parent.selectedModule != module) {
parent.selectedModule = null;
for(Module module : ModuleManager.INSTANCE.getModulesByCategory(parent.selectedCategory)) module.setExpanded(false);
}
if (parent.selectedModule != module) {
parent.settingsFieldX = 0;
parent.selectedModule = module;
components.clear();
for(Module module : ModuleManager.INSTANCE.getModulesByCategory(parent.selectedCategory)) if(module != this.module) module.setExpanded(false);
module.setExpanded(true);
float settingsY = parent.windowY + 100 + parent.settingsFNow;
for(Setting setting : module.getSettings()) {
if(setting instanceof BooleanSetting booleanSetting) {
components.add(new CheckBox(booleanSetting, parent, 0, settingsY));
}
else if(setting instanceof NumberSetting numberSetting) {
components.add(new Slider(numberSetting, 0, settingsY, parent));
}
else if(setting instanceof ModeSetting modeSetting) {
components.add(new ModeComp(modeSetting, parent, 0, settingsY));
}
settingsY += 25;
}
}
else if (parent.selectedModule == module) {
parent.selectedModule = null;
for(Module module : ModuleManager.INSTANCE.getModulesByCategory(parent.selectedCategory)) module.setExpanded(false);
}
}
if(module.isExpanded()) components.forEach(c -> c.mouseClicked(mouseX, mouseY, button));
}
public void mouseReleased(double mouseX, double mouseY, int button) {
if(module.isExpanded()) components.forEach(c -> c.mouseReleased(mouseX, mouseY, button));
}
public void keyPressed(int keyCode, int scanCode, int modifiers) {
if(module.isExpanded()) {
components.forEach(c -> c.keyPressed(keyCode, scanCode, modifiers));
}
}
public void charTyped(char chr, int modifiers) {
if(module.isExpanded()) {
components.forEach(c -> c.charTyped(chr, modifiers));
}
}
public void setY(double y) {
this.y = y;
}
public void setX(double x) {
this.x = x;
}
private boolean isHovered(float x, float y, float x2, float y2, double mouseX, double mouseY) {
return mouseX >= x && mouseX <= x2 && mouseY >= y && mouseY <= y2;
}
public Module getModule() {
return module;
}
}
| 10,650 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
ModeComp.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/gui/clickgui/components/ModeComp.java | package me.corruptionhades.vapemenu.gui.clickgui.components;
import me.corruptionhades.vapemenu.gui.clickgui.VapeClickGui;
import me.corruptionhades.vapemenu.setting.ModeSetting;
import me.corruptionhades.vapemenu.utils.RenderUtils;
import me.corruptionhades.vapemenu.utils.Theme;
import net.minecraft.client.util.math.MatrixStack;
public class ModeComp extends Component {
private final ModeSetting setting;
private final VapeClickGui parent;
private float x, y;
public ModeComp(ModeSetting setting, VapeClickGui parent, float x, float y) {
this.setting = setting;
this.parent = parent;
this.x = x;
this.y = y;
}
@Override
public void drawScreen(MatrixStack matrices, int mouseX, int mouseY, float delta) {
RenderUtils.renderRoundedQuad(matrices, x + parent.windowX + 445 + parent.settingsFieldX, y + 2, x + parent.windowX + parent.width - 5, y + 22, 2, 20, Theme.MODE_SETTING_BG);
RenderUtils.renderRoundedQuad(matrices, x + parent.windowX + 446 + parent.settingsFieldX, y + 3, x + parent.windowX + parent.width - 6, y + 21, 2, 20, Theme.MODE_SETTING_FILL);
mc.textRenderer.draw(matrices, setting.getName() + ":" + setting.getMode(), x + parent.windowX + 455 + parent.settingsFieldX, y + 10, Theme.NORMAL_TEXT_COLOR.getRGB());
mc.textRenderer.draw(matrices, ">", x + parent.windowX + parent.width - 15, y + 9, Theme.MODULE_TEXT.getRGB());
}
@Override
public void mouseClicked(double mouseX, double mouseY, int button) {
if(isHovered(x + parent.windowX + 445 + parent.settingsFieldX, y + 2, x + parent.windowX + parent.width - 5, y + 22, mouseX, mouseY) && button == 0) {
setting.cycle();
}
}
public void setY(float y) {
this.y = y;
}
}
| 1,798 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
Component.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/gui/clickgui/components/Component.java | package me.corruptionhades.vapemenu.gui.clickgui.components;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.math.MatrixStack;
public class Component {
protected final MinecraftClient mc = MinecraftClient.getInstance();
public void drawScreen(MatrixStack matrices, int mouseX, int mouseY, float delta) {}
public void mouseReleased(double mouseX, double mouseY, int button) {}
public void mouseClicked(double mouseX, double mouseY, int button) {}
public void keyPressed(int keyCode, int scanCode, int modifiers) {}
public void charTyped(char chr, int modifiers) {}
protected static boolean isHovered(float x, float y, float x2, float y2, double mouseX, double mouseY) {
return mouseX >= x && mouseX <= x2 && mouseY >= y && mouseY <= y2;
}
}
| 819 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
Command.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/command/Command.java | package me.corruptionhades.vapemenu.command;
import me.corruptionhades.vapemenu.utils.ChatUtils;
import net.minecraft.client.MinecraftClient;
import net.minecraft.util.Uuids;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
public abstract class Command {
private String name, description;
private List<String> aliases;
public ChatUtils chat = new ChatUtils();
public MinecraftClient mc = MinecraftClient.getInstance();
public Command(String name, String description, String...aliases) {
this.name = name;
this.description = description;
this.aliases = Arrays.asList(aliases);
}
public abstract void onCmd(String message, String[] args);
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<String> getAliases() {
return aliases;
}
public void setAliases(List<String> aliases) {
this.aliases = aliases;
}
public boolean isCreative() {
return mc.player.getAbilities().creativeMode;
}
public void creativeError() {
chat.sendMsg("&cYou need to be in creative mode!");
}
public void genError(Exception e) {
chat.sendMsg("&cSomething went wrong");
chat.sendMsg(e.getMessage());
}
public double[] getCoords(String x, String y, String z) {
double xCoord;
double yCoord;
double zCoord;
if(x.equalsIgnoreCase("~")) xCoord = mc.player.getX();
else xCoord = Double.parseDouble(x);
if(y.equalsIgnoreCase("~")) yCoord = mc.player.getY();
else yCoord = Double.parseDouble(y);
if(z.equalsIgnoreCase("~")) zCoord = mc.player.getZ();
else zCoord = Double.parseDouble(z);
return new double[]{xCoord, yCoord, zCoord};
}
public double getX(String txt) {
if(txt.equalsIgnoreCase("~")) return mc.player.getX();
else return Double.parseDouble(txt);
}
public double getY(String txt) {
if(txt.equalsIgnoreCase("~")) return mc.player.getY();
else return Double.parseDouble(txt);
}
public double getZ(String txt) {
if(txt.equalsIgnoreCase("~")) return mc.player.getZ();
else return Double.parseDouble(txt);
}
public int[] convertUUID(UUID uuid) {
return Uuids.toIntArray(uuid);
}
public int[] convertUUID(String txt) {
UUID uuid1 = UUID.fromString(txt);
return Uuids.toIntArray(uuid1);
}
public String coordsToText(double x, double y, double z) {
return "Pos:[" + x + "," + y + "," + z + "]";
}
public String uuidToText(UUID id) {
int[] uuid = convertUUID(id);
int one = uuid[0];
int two = uuid[1];
int three = uuid[2];
int four = uuid[3];
return "[I;" + one + "," + two + "," + three + "," + four + "]";
}
}
| 3,101 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
CommandManager.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/command/CommandManager.java | package me.corruptionhades.vapemenu.command;
import me.corruptionhades.vapemenu.command.impl.TeleportCommand;
import java.util.ArrayList;
import java.util.List;
public class CommandManager {
public static CommandManager INSTANCE = new CommandManager();
private List<Command> cmds = new ArrayList<>();
public CommandManager() {
init();
}
private void init() {
add(new TeleportCommand());
}
public void add(Command command) {
if(!cmds.contains(command)) {
cmds.add(command);
}
}
public void remove(Command command){
cmds.remove(command);
}
public List<Command> getCmds() {
return cmds;
}
}
| 705 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
TeleportCommand.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/command/impl/TeleportCommand.java | package me.corruptionhades.vapemenu.command.impl;
import me.corruptionhades.vapemenu.command.Command;
import me.corruptionhades.vapemenu.utils.PacketHelper;
import net.minecraft.util.math.Vec3d;
public class TeleportCommand extends Command {
public TeleportCommand() {
super("teleport", "Teleport", "tp");
}
@Override
public void onCmd(String message, String[] args) {
String x = args[1];
String y = args[2];
String z = args[3];
double xCoord = getX(x);
double yCoord = getX(y);
double zCoord = getX(z);
for(int i = 0; i < 8; i++) {
PacketHelper.sendPosition(mc.player.getPos());
}
// TODO: Optimize coordinates
Vec3d targetPos = new Vec3d(mc.player.getX() + xCoord, mc.player.getY() + yCoord, mc.player.getZ() + zCoord);
PacketHelper.sendPosition(targetPos);
mc.player.setPosition(targetPos);
chat.sendPrefixMsg("&7Successfully teleported!");
}
}
| 999 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
PlaceHolderModule.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/module/PlaceHolderModule.java | package me.corruptionhades.vapemenu.module;
import me.corruptionhades.vapemenu.setting.BooleanSetting;
import me.corruptionhades.vapemenu.setting.ModeSetting;
import me.corruptionhades.vapemenu.setting.NumberSetting;
public class PlaceHolderModule extends Module {
BooleanSetting booleanSetting = new BooleanSetting("Boolean", false);
NumberSetting numberSetting = new NumberSetting("Number", 1, 10, 1, 1);
ModeSetting modeSetting = new ModeSetting("Mode", "Mode1", "Mode1", "Mode2", "Mode3");
public PlaceHolderModule(String name, Category category) {
super(name, "Description ", category);
addSettings(booleanSetting, numberSetting, modeSetting);
}
}
| 693 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
Module.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/module/Module.java | package me.corruptionhades.vapemenu.module;
import me.corruptionhades.vapemenu.event.EventManager;
import me.corruptionhades.vapemenu.setting.Setting;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public abstract class Module {
private String name, description, displayName;
private int key;
private boolean enabled;
private Category category;
private boolean expanded;
protected MinecraftClient mc = MinecraftClient.getInstance();
private final List<Setting> settings = new ArrayList<>();
public Module(String name, String description, Category category) {
this.name = name;
this.description = description;
this.category = category;
this.displayName = name;
}
public void toggle() {
this.enabled = !this.enabled;
if(enabled) {
onEnable();
mc.player.sendMessage(Text.of(name + " was enabled!"));
}
else {
onDisable();
mc.player.sendMessage(Text.of(name + " was disabled!"));
}
}
public List<Setting> getSettings() {
return settings;
}
public void addSettings(Setting...settingz) {
settings.addAll(Arrays.asList(settingz));
}
public void onEnable() {EventManager.register(this);}
public void onDisable() {EventManager.unregister(this);}
public void setEnabled(boolean toggled) {
this.enabled = toggled;
if(enabled) {
onEnable();
}
else {
onDisable();
}
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getKey() {
return key;
}
public void setKey(int key) {
this.key = key;
}
public boolean isEnabled() {
return enabled;
}
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public boolean isExpanded() {
return expanded;
}
public void setExpanded(boolean expanded) {
this.expanded = expanded;
}
protected void sendMsg(String message) {
if(mc.player == null) return;
mc.player.sendMessage(Text.of(message.replace("&", "§")));
}
}
| 2,771 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
PlaceHolderHud.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/module/PlaceHolderHud.java | package me.corruptionhades.vapemenu.module;
import net.minecraft.client.util.math.MatrixStack;
public class PlaceHolderHud extends HudModule{
public PlaceHolderHud(String name, Category category) {
super(name, "Hud description", category, 0, 0, 10, 10);
}
@Override
public void draw(MatrixStack matrices) {
mc.textRenderer.draw(matrices, getDisplayName(), getX(), getY(), -1);
setWidth(mc.textRenderer.getWidth(getDisplayName()));
setHeight(mc.textRenderer.fontHeight);
}
}
| 529 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
HudModule.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/module/HudModule.java | package me.corruptionhades.vapemenu.module;
import net.minecraft.client.util.math.MatrixStack;
public abstract class HudModule extends Module {
private int x, y, width, height;
public HudModule(String name, String description, Category category, int x, int y, int width, int height) {
super(name, description, category);
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
public abstract void draw(MatrixStack matrices);
public int getX() {
return x;
}
public int getY() {
return y;
}
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
public void setX(int x) {
this.x = x;
}
public void setY(int y) {
this.y = y;
}
public void setWidth(int width) {
this.width = width;
}
public void setHeight(int height) {
this.height = height;
}
}
| 978 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
ModuleManager.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/module/ModuleManager.java | package me.corruptionhades.vapemenu.module;
import me.corruptionhades.vapemenu.module.impl.combat.Reach;
import me.corruptionhades.vapemenu.module.impl.misc.Plugins;
import me.corruptionhades.vapemenu.module.impl.movement.Fly;
import me.corruptionhades.vapemenu.module.impl.movement.Timer;
import me.corruptionhades.vapemenu.module.impl.render.Arraylist;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class ModuleManager {
private List<Module> modules = new ArrayList<>();
public static final ModuleManager INSTANCE = new ModuleManager();
public ModuleManager() {
init();
}
private void init() {
add(new Reach());
add(new Plugins());
add(new Fly());
add(new Arraylist());
add(new Timer());
}
public void add(Module m) {
modules.add(m);
}
public void remove(Module m) {
modules.remove(m);
}
public List<Module> getModules() {
return modules;
}
public Module getModuleByName(String name){
for(Module module : modules) {
if(module.getName().equals(name)) return module;
}
return null;
}
public ArrayList<Module> getModulesByCategory(Category category) {
ArrayList<Module> modules = new ArrayList<>();
for(Module m : this.modules){
if(m.getCategory().equals(category)){
modules.add(m);
}
}
return modules;
}
public Module getModuleByClass(Class<? extends Module> cls) {
for (Module m : modules) {
if (m.getClass() != cls) {
continue;
}
return m;
}
return null;
}
public List<Module> getEnabledModules() {
List<Module> enabled = new ArrayList<>();
for(Module m : getModules()) {
if(m.isEnabled()) {
enabled.add(m);
}
}
return enabled;
}
public void setModules(List<Module> modules) {
this.modules = modules;
}
}
| 2,086 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
Category.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/module/Category.java | package me.corruptionhades.vapemenu.module;
public enum Category {
COMBAT("Combat"),
MOVEMENT("Movement"),
RENDER("Render"),
PLAYER("Player"),
MISC("Misc"),
HIDDEN("Hidden");
public String name;
Category(String name) {
this.name = name;
}
}
| 288 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
Reach.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/module/impl/combat/Reach.java | package me.corruptionhades.vapemenu.module.impl.combat;
import me.corruptionhades.vapemenu.event.EventTarget;
import me.corruptionhades.vapemenu.event.impl.EventUpdate;
import me.corruptionhades.vapemenu.event.impl.HandSwingEvent;
import me.corruptionhades.vapemenu.module.Category;
import me.corruptionhades.vapemenu.module.Module;
import me.corruptionhades.vapemenu.setting.NumberSetting;
import me.corruptionhades.vapemenu.utils.PacketHelper;
import net.minecraft.block.*;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.projectile.ProjectileUtil;
import net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.EntityHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Vec3d;
import java.util.function.Predicate;
public class Reach extends Module {
private final NumberSetting maxDistance = new NumberSetting("Amount", 1, 100, 10, 1);
public Reach() {
super("Reach", "Up to 100 blocks of reach", Category.COMBAT);
addSettings(maxDistance);
}
@EventTarget
public void onUpdate(EventUpdate e) {
if(mc.options.useKey.wasPressed()) {
BlockHitResult hit = getTargetBlock((int) maxDistance.getValue());
BlockPos block = hit.getBlockPos();
Block target = mc.world.getBlockState(block).getBlock();
if(!(target instanceof ChestBlock || target instanceof EnderChestBlock || target instanceof BarrelBlock || target instanceof ShulkerBoxBlock)) {
return;
}
setDisplayName(getName() + "[" + maxDistance.getValue() + "]" + " [" + target.getName().getString() + "]");
Vec3d block_pos = new Vec3d(block.getX(), block.getY(), block.getZ());
Vec3d playerPos = mc.player.getPos();
double targetDist = targetDistance(playerPos, block_pos);
if(targetDist > 5) {
tpTo(playerPos, block_pos);
PlayerInteractBlockC2SPacket packet = new PlayerInteractBlockC2SPacket(mc.player.preferredHand, hit, 1);
PacketHelper.sendPacket(packet);
mc.player.setPosition(playerPos);
mc.player.swingHand(mc.player.preferredHand);
}
}
}
@EventTarget
public void onSwing(HandSwingEvent e) {
if(mc.options.attackKey.isPressed()) {
Entity target = getTarget((int) maxDistance.getValue());
if(target == null || target.getType().equals(EntityType.ITEM) || target.getType().equals(EntityType.EXPERIENCE_ORB)) {
return;
}
else {
setDisplayName(getName() + "[" + maxDistance.getValue() + "]" + " [" + target.getName().getString() + "]");
}
Vec3d playerPos = mc.player.getPos();
Vec3d entityPos = target.getPos();
tpTo(playerPos, entityPos);
PlayerInteractEntityC2SPacket attackPacket = PlayerInteractEntityC2SPacket.attack(target, false);
PacketHelper.sendPacket(attackPacket);
tpTo(entityPos, playerPos);
mc.player.setPosition(playerPos);
}
}
private void tpTo(Vec3d from, Vec3d to) {
double distancePerBlink = 8.0;
double targetDistance = Math.ceil(from.distanceTo(to) / distancePerBlink);
for(int i = 1; i <= targetDistance; i++) {
Vec3d tempPos = from.lerp(to, i / targetDistance);
PacketHelper.sendPosition(tempPos);
}
}
private double targetDistance(Vec3d from, Vec3d to) {
return Math.ceil(from.distanceTo(to));
}
public Entity getTarget(int max) {
Entity entity2 = mc.getCameraEntity();
Predicate<Entity> predicate = entity -> true; // Do entity checking here(ex: preventing specific entities from triggering)
Vec3d eyePos = entity2.getEyePos();
Vec3d vec3d2 = entity2.getRotationVec(mc.getTickDelta()).multiply(max);
Vec3d vec3d3 = eyePos.add(vec3d2);
Box box = entity2.getBoundingBox().stretch(vec3d2).expand(1.0);
EntityHitResult entityHitResult = ProjectileUtil.raycast(entity2, eyePos, vec3d3, box, predicate, max * max);
if(entityHitResult == null) return null;
Entity res = entityHitResult.getEntity();
return entityHitResult.getEntity();
}
public BlockHitResult getTargetBlock(int max) {
HitResult hitResult = mc.cameraEntity.raycast(max, mc.getTickDelta(), false);
if(hitResult instanceof BlockHitResult hit) {
return hit;
}
return null;
}
}
| 4,874 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
Plugins.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/module/impl/misc/Plugins.java | package me.corruptionhades.vapemenu.module.impl.misc;
import com.mojang.brigadier.suggestion.Suggestion;
import me.corruptionhades.vapemenu.event.EventTarget;
import me.corruptionhades.vapemenu.event.impl.CommandSuggestEvent;
import me.corruptionhades.vapemenu.module.Category;
import me.corruptionhades.vapemenu.module.Module;
import me.corruptionhades.vapemenu.utils.PacketHelper;
import net.minecraft.network.packet.c2s.play.RequestCommandCompletionsC2SPacket;
import net.minecraft.network.packet.s2c.play.CommandSuggestionsS2CPacket;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class Plugins extends Module {
public Plugins() {
super("Plugins", "Get the plugins on the server", Category.MISC);
}
@Override
public void onEnable() {
super.onEnable();
if(mc.player != null) {
PacketHelper.sendPacket(new RequestCommandCompletionsC2SPacket(new Random().nextInt(200), "/"));
}
}
@EventTarget
public void onCmdSuggest(CommandSuggestEvent event) {
CommandSuggestionsS2CPacket packet = event.getPacket();
List<String> plugins = new ArrayList<>();
List<Suggestion> cmdList = packet.getSuggestions().getList();
for(Suggestion s : cmdList) {
String[] cmd = s.getText().split(":");
if(cmd.length > 1) {
String pluginName = cmd[0].replace("/", "");
if(!plugins.contains(pluginName)) {
plugins.add(pluginName);
}
}
}
if(!plugins.isEmpty()) {
StringBuilder sb = new StringBuilder();
for(String s : plugins) {
if(s.equalsIgnoreCase("itemeditor")) {
sb.append("§c").append(s).append(", §a");
}
else if(s.equalsIgnoreCase("bettershulkerboxes")) {
sb.append("§c").append(s).append(", §a");
}
else if(s.equalsIgnoreCase("vulcan") || s.equalsIgnoreCase("ncp")) {
sb.append("§b").append(s).append(", §a");
}
else sb.append(s).append(", ");
}
sendMsg("&7Plugins: &a" + sb);
}
else {
sendMsg("&cNo plugins found!");
}
toggle();
}
}
| 2,363 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
Arraylist.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/module/impl/render/Arraylist.java | package me.corruptionhades.vapemenu.module.impl.render;
import me.corruptionhades.vapemenu.module.Category;
import me.corruptionhades.vapemenu.module.HudModule;
import me.corruptionhades.vapemenu.module.Module;
import me.corruptionhades.vapemenu.module.ModuleManager;
import net.minecraft.client.util.math.MatrixStack;
import java.util.List;
public class Arraylist extends HudModule {
public Arraylist() {
super("Arraylist", "Shows a lsit of enabled Modules", Category.RENDER, 0, 0, 1, 1);
}
@Override
public void draw(MatrixStack matrices) {
List<Module> enabledModules = ModuleManager.INSTANCE.getEnabledModules();
// Sort
enabledModules.sort((m1, m2) -> mc.textRenderer.getWidth(m2.getDisplayName()) - mc.textRenderer.getWidth(m1.getDisplayName()));
boolean leftHalf = getX() < (mc.getWindow().getScaledWidth() / 2);
boolean rightHalf = getX() > (mc.getWindow().getScaledWidth() / 2);
setWidth(mc.textRenderer.getWidth(enabledModules.get(0).getDisplayName()));
if((getX() + getWidth()) > mc.getWindow().getScaledWidth()) {
setX(mc.getWindow().getScaledWidth() - (getWidth()));
}
int offset = 0;
for(Module module : enabledModules) {
if(leftHalf) {
mc.textRenderer.draw(matrices, module.getDisplayName(), getX(), getY() + offset, -1);
}
else if(rightHalf) {
mc.textRenderer.draw(matrices, module.getDisplayName(), getX() + getWidth() - mc.textRenderer.getWidth(module.getDisplayName()), getY() + offset, -1);
}
offset += mc.textRenderer.fontHeight + 2;
}
setHeight(offset);
}
}
| 1,718 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
Fly.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/module/impl/movement/Fly.java | package me.corruptionhades.vapemenu.module.impl.movement;
import me.corruptionhades.vapemenu.event.EventTarget;
import me.corruptionhades.vapemenu.event.impl.EventUpdate;
import me.corruptionhades.vapemenu.module.Category;
import me.corruptionhades.vapemenu.module.Module;
import me.corruptionhades.vapemenu.setting.*;
import org.lwjgl.glfw.GLFW;
public class Fly extends Module {
ModeSetting modeSetting = new ModeSetting("Mode", "Vanilla", "Vanilla", "Hypixel", "Vulcan");
NumberSetting speed = new NumberSetting("Speed", 0.01, 1, 0.2, 0.01);
BooleanSetting warn = new BooleanSetting("Warn", true);
public Fly() {
super("Fly", "Makes you fly!", Category.MOVEMENT);
setKey(GLFW.GLFW_KEY_G);
addSettings(modeSetting, speed, warn);
}
@EventTarget
public void onUpdate(EventUpdate e) {
if(mc.player == null) return;
mc.player.getAbilities().flying = true;
mc.player.getAbilities().setFlySpeed(speed.getFloatValue());
}
@Override
public void onEnable() {
super.onEnable();
if(warn.isEnabled()) {
sendMsg("&7Warning: You can still take fall damage!");
}
if(mc.player == null) return;
mc.player.getAbilities().allowFlying = true;
}
@Override
public void onDisable() {
super.onDisable();
if(mc.player == null) return;
if(!mc.player.getAbilities().creativeMode) {
mc.player.getAbilities().allowFlying = false;
mc.player.getAbilities().flying = false;
}
mc.player.getAbilities().setFlySpeed(0.1f);
}
}
| 1,622 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
Timer.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/module/impl/movement/Timer.java | package me.corruptionhades.vapemenu.module.impl.movement;
import me.corruptionhades.vapemenu.module.Category;
import me.corruptionhades.vapemenu.module.Module;
import me.corruptionhades.vapemenu.setting.NumberSetting;
public class Timer extends Module {
public static final NumberSetting timerSpeed = new NumberSetting("Speed", 0.01, 2, 1, 0.01);
public Timer() {
super("Timer", "Change the speed of the game", Category.MOVEMENT);
addSettings(timerSpeed);
}
}
| 492 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
Event.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/event/Event.java | package me.corruptionhades.vapemenu.event;
import java.lang.reflect.InvocationTargetException;
/**
* Created by Hexeption on 18/12/2016.
*/
public abstract class Event {
/**
*
* Main events you may need:
*
* Minecraft:
* - EventKeyboard
* - EventMiddleClick
* - EventTick
*
* EntityPlayerSP:
* - EventUpdate
* - EventPreMotionUpdates
* - EventPostMotionUpdates
*
* GuiIngame:
* - EventRender2D
*
* EntityRenderer:
* - EventRender3D
*
*/
private boolean cancelled;
public enum State {
PRE("PRE", 0),
POST("POST", 1);
private State(final String string, final int number) {}
}
public Event call() {
this.cancelled = false;
call(this);
return this;
}
public boolean isCancelled() {
return cancelled;
}
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
private static void call(final Event event) {
final ArrayHelper<Data> dataList = EventManager.get(event.getClass());
if (dataList != null) {
for (final Data data : dataList) {
try {
data.target.invoke(data.source, event);
}
catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
}
| 1,469 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
Data.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/event/Data.java | package me.corruptionhades.vapemenu.event;
import java.lang.reflect.Method;
/**
* Created by Hexeption on 18/12/2016.
*/
public class Data {
public final Object source;
public final Method target;
public final byte priority;
Data(Object source, Method target, byte priority) {
this.source = source;
this.target = target;
this.priority = priority;
}
}
| 405 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
ArrayHelper.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/event/ArrayHelper.java | package me.corruptionhades.vapemenu.event;
import java.util.Iterator;
/**
* Created by Hexeption on 18/12/2016.
*/
public class ArrayHelper<T> implements Iterable<T> {
//TODO: Comment out the code.
private T[] elements;
public ArrayHelper(final T[] array) {
this.elements = array;
}
public ArrayHelper() {
this.elements = (T[]) new Object[0];
}
public void add(final T t) {
if (t != null) {
final Object[] array = new Object[this.size() + 1];
for (int i = 0; i < array.length; i++) {
if (i < this.size()) {
array[i] = this.get(i);
} else {
array[i] = t;
}
}
this.set((T[]) array);
}
}
public boolean contains(final T t) {
Object[] array;
for (int lenght = (array = this.array()).length, i = 0; i < lenght; i++) {
final T entry = (T) array[i];
if (entry.equals(t)) {
return true;
}
}
return false;
}
public void remove(final T t) {
if (this.contains(t)) {
final Object[] array = new Object[this.size() - 1];
boolean b = true;
for (int i = 0; i < this.size(); i++) {
if (b && this.get(i).equals(t)) {
b = false;
} else {
array[b ? i : (i - 1)] = this.get(i);
}
}
this.set((T[]) array);
}
}
public T[] array() {
return (T[]) this.elements;
}
public int size() {
return this.array().length;
}
public void set(final T[] array) {
this.elements = array;
}
public T get(final int index) {
return this.array()[index];
}
public void clear() {
this.elements = (T[]) new Object[0];
}
public boolean isEmpty() {
return this.size() == 0;
}
@Override
public Iterator<T> iterator() {
return new Iterator<T>() {
private int index = 0;
@Override
public boolean hasNext() {
return this.index < ArrayHelper.this.size() && ArrayHelper.this.get(this.index) != null;
}
@Override
public T next() {
return ArrayHelper.this.get(this.index++);
}
@Override
public void remove() {
ArrayHelper.this.remove(ArrayHelper.this.get(this.index));
}
};
}
} | 2,619 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
EventTarget.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/event/EventTarget.java | package me.corruptionhades.vapemenu.event;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Created by Hexeption on 18/12/2016.
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface EventTarget {
byte value() default 2;
}
| 380 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
Priority.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/event/Priority.java | package me.corruptionhades.vapemenu.event;
/**
* Created by Hexeption on 18/12/2016.
*/
public class Priority {
public static final byte FIRST = 0, SECOND = 1, THIRD = 2, FOURTH = 3, FIFTH = 4;
public static final byte[] VALUE_ARRAY;
static {
VALUE_ARRAY = new byte[]{0, 1, 2, 3, 4};
}
}
| 319 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
EventManager.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/event/EventManager.java | package me.corruptionhades.vapemenu.event;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/**
* Created by Hexeption on 18/12/2016.
*/
public class EventManager {
//TODO: Comment Event's
private static final Map<Class<? extends Event>, ArrayHelper<Data>> REGISTRY_MAP;
public static void register(final Object o) {
for (final Method method : o.getClass().getDeclaredMethods()) {
if (!isMethodBad(method)) {
register(method, o);
}
}
}
public static void register(final Object o, final Class<? extends Event> clazz) {
for (final Method method : o.getClass().getDeclaredMethods()) {
if (!isMethodBad(method, clazz)) {
register(method, o);
}
}
}
private static void register(final Method method, final Object o) {
final Class<?> clazz = method.getParameterTypes()[0];
final Data methodData = new Data(o, method, method.getAnnotation(EventTarget.class).value());
if (!methodData.target.isAccessible()) {
methodData.target.setAccessible(true);
}
if (EventManager.REGISTRY_MAP.containsKey(clazz)) {
if (!EventManager.REGISTRY_MAP.get(clazz).contains(methodData)) {
EventManager.REGISTRY_MAP.get(clazz).add(methodData);
sortListValue((Class<? extends Event>) clazz);
}
} else {
EventManager.REGISTRY_MAP.put((Class<? extends Event>) clazz, new ArrayHelper<Data>() {
{
this.add(methodData);
}
});
}
}
public static void unregister(final Object o) {
for (final ArrayHelper<Data> flexibalArray : EventManager.REGISTRY_MAP.values()) {
for (final Data methodData : flexibalArray) {
if (methodData.source.equals(o)) {
flexibalArray.remove(methodData);
}
}
}
cleanMap(true);
}
public static void unregister(final Object o, final Class<? extends Event> clazz) {
if (EventManager.REGISTRY_MAP.containsKey(clazz)) {
for (final Data methodData : EventManager.REGISTRY_MAP.get(clazz)) {
if (methodData.source.equals(o)) {
EventManager.REGISTRY_MAP.get(clazz).remove(methodData);
}
}
cleanMap(true);
}
}
public static void cleanMap(final boolean b) {
final Iterator<Map.Entry<Class<? extends Event>, ArrayHelper<Data>>> iterator = EventManager.REGISTRY_MAP.entrySet().iterator();
while (iterator.hasNext()) {
if (!b || iterator.next().getValue().isEmpty()) {
iterator.remove();
}
}
}
public static void removeEnty(final Class<? extends Event> clazz) {
final Iterator<Map.Entry<Class<? extends Event>, ArrayHelper<Data>>> iterator = EventManager.REGISTRY_MAP.entrySet().iterator();
while (iterator.hasNext()) {
if (iterator.next().getKey().equals(clazz)) {
iterator.remove();
break;
}
}
}
private static void sortListValue(final Class<? extends Event> clazz) {
final ArrayHelper<Data> flexibleArray = new ArrayHelper<Data>();
for (final byte b : Priority.VALUE_ARRAY) {
for (final Data methodData : EventManager.REGISTRY_MAP.get(clazz)) {
if (methodData.priority == b) {
flexibleArray.add(methodData);
}
}
}
EventManager.REGISTRY_MAP.put(clazz, flexibleArray);
}
private static boolean isMethodBad(final Method method) {
return method.getParameterTypes().length != 1 || !method.isAnnotationPresent(EventTarget.class);
}
private static boolean isMethodBad(final Method method, final Class<? extends Event> clazz) {
return isMethodBad(method) || method.getParameterTypes()[0].equals(clazz);
}
public static ArrayHelper<Data> get(final Class<? extends Event> clazz) {
return EventManager.REGISTRY_MAP.get(clazz);
}
public static void shutdown() {
EventManager.REGISTRY_MAP.clear();
}
static {
REGISTRY_MAP = new HashMap<>();
}
}
| 4,425 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
PacketSendEvent.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/event/impl/PacketSendEvent.java | package me.corruptionhades.vapemenu.event.impl;
import me.corruptionhades.vapemenu.event.Event;
import net.minecraft.network.Packet;
public class PacketSendEvent extends Event {
private Packet<?> packet;
public PacketSendEvent(Packet<?> packet) {
this.packet = packet;
}
public Packet<?> getPacket() {
return packet;
}
public void setPacket(Packet<?> packet) {
this.packet = packet;
}
}
| 445 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
EventUpdate.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/event/impl/EventUpdate.java | package me.corruptionhades.vapemenu.event.impl;
import me.corruptionhades.vapemenu.event.Event;
public class EventUpdate extends Event {
}
| 141 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
CommandSuggestEvent.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/event/impl/CommandSuggestEvent.java | package me.corruptionhades.vapemenu.event.impl;
import me.corruptionhades.vapemenu.event.Event;
import net.minecraft.network.packet.s2c.play.CommandSuggestionsS2CPacket;
public class CommandSuggestEvent extends Event {
private final CommandSuggestionsS2CPacket packet;
public CommandSuggestEvent(CommandSuggestionsS2CPacket packet) {
this.packet = packet;
}
public CommandSuggestionsS2CPacket getPacket() {
return packet;
}
}
| 467 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
HandSwingEvent.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/event/impl/HandSwingEvent.java | package me.corruptionhades.vapemenu.event.impl;
import me.corruptionhades.vapemenu.event.Event;
import net.minecraft.util.Hand;
public class HandSwingEvent extends Event {
private Hand hand;
public HandSwingEvent(Hand hand) {
this.hand = hand;
}
public Hand getHand() {
return hand;
}
public void setHand(Hand hand) {
this.hand = hand;
}
}
| 398 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
MinecraftClientMixin.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/mixin/MinecraftClientMixin.java | package me.corruptionhades.vapemenu.mixin;
import me.corruptionhades.vapemenu.event.impl.EventUpdate;
import net.minecraft.client.MinecraftClient;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(MinecraftClient.class)
public class MinecraftClientMixin {
@Inject(method = "tick", at = @At("HEAD"))
public void onUpdate(CallbackInfo ci) {
new EventUpdate().call();
}
}
| 561 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
InGameHudMixin.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/mixin/InGameHudMixin.java | package me.corruptionhades.vapemenu.mixin;
import me.corruptionhades.vapemenu.module.HudModule;
import me.corruptionhades.vapemenu.module.Module;
import me.corruptionhades.vapemenu.module.ModuleManager;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.hud.InGameHud;
import net.minecraft.client.util.math.MatrixStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(InGameHud.class)
public class InGameHudMixin {
@Inject(method = "render", at = @At("RETURN"), cancellable = true)
public void renderHud(MatrixStack matrices, float tickDelta, CallbackInfo ci) {
MinecraftClient mc = MinecraftClient.getInstance();
if(mc.player != null) {
for(Module module : ModuleManager.INSTANCE.getEnabledModules()) {
if(module instanceof HudModule hudModule) {
// Draws the Hud Modules to the screen
hudModule.draw(matrices);
}
}
}
}
}
| 1,155 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
RenderTickCounterMixin.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/mixin/RenderTickCounterMixin.java | package me.corruptionhades.vapemenu.mixin;
import me.corruptionhades.vapemenu.module.ModuleManager;
import me.corruptionhades.vapemenu.module.impl.movement.Timer;
import net.minecraft.client.render.RenderTickCounter;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(RenderTickCounter.class)
public class RenderTickCounterMixin {
@Shadow
public float lastFrameDuration;
@Inject(method = "beginRenderTick", at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/RenderTickCounter;prevTimeMillis:J", opcode = Opcodes.PUTFIELD))
private void onBeingRenderTick(long a, CallbackInfoReturnable<Integer> info) {
// For slowing down/speeding up the render ticks
if(ModuleManager.INSTANCE.getModuleByClass(Timer.class).isEnabled()) lastFrameDuration *= Timer.timerSpeed.getFloatValue();
}
}
| 1,041 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
ClientPlayerMixin.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/mixin/ClientPlayerMixin.java | package me.corruptionhades.vapemenu.mixin;
import me.corruptionhades.vapemenu.event.impl.HandSwingEvent;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.util.Hand;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ClientPlayerEntity.class)
public class ClientPlayerMixin {
@Inject(at = @At("HEAD"), method = "swingHand", cancellable = true)
public void swingHand(Hand hand, CallbackInfo ci) {
// Call the Hand Swing event
HandSwingEvent event = new HandSwingEvent(hand);
if(event.isCancelled()) ci.cancel();
}
}
| 749 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
ClientPlayNetworkHandlerMixin.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/mixin/ClientPlayNetworkHandlerMixin.java | package me.corruptionhades.vapemenu.mixin;
import me.corruptionhades.vapemenu.VapeMenu;
import me.corruptionhades.vapemenu.command.Command;
import me.corruptionhades.vapemenu.command.CommandManager;
import me.corruptionhades.vapemenu.event.impl.CommandSuggestEvent;
import me.corruptionhades.vapemenu.event.impl.PacketSendEvent;
import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.network.Packet;
import net.minecraft.network.packet.s2c.play.CommandSuggestionsS2CPacket;
import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ClientPlayNetworkHandler.class)
public abstract class ClientPlayNetworkHandlerMixin {
@Inject(method = "onCommandSuggestions", at = @At("TAIL"))
public void onCmdSuggest(CommandSuggestionsS2CPacket packet, CallbackInfo ci) {
new CommandSuggestEvent(packet).call();
}
@Inject(method = "sendPacket", at = @At("HEAD"), cancellable = true)
public void onSend(Packet<?> packet, CallbackInfo ci) {
PacketSendEvent pse = new PacketSendEvent(packet);
if(pse.isCancelled()) ci.cancel();
}
@Inject(method = "sendChatMessage", at = @At("HEAD"), cancellable = true)
public void sendChatMessage(String msg, CallbackInfo ci) {
StringBuilder CMD = new StringBuilder();
for (int i = 1; i < msg.toCharArray().length; ++i) {
CMD.append(msg.toCharArray()[i]);
}
String[] args = CMD.toString().split(" ");
if(msg.startsWith(VapeMenu.getCommandPrefix())) {
for(Command command : CommandManager.INSTANCE.getCmds()) {
if(args[0].equalsIgnoreCase(command.getName())) {
command.onCmd(msg, args);
ci.cancel();
break;
}
}
}
}
}
| 1,998 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |
KeyboardMixin.java | /FileExtraction/Java_unseen/CorruptionHades_VapeMenu/src/main/java/me/corruptionhades/vapemenu/mixin/KeyboardMixin.java | package me.corruptionhades.vapemenu.mixin;
import me.corruptionhades.vapemenu.VapeMenu;
import net.minecraft.client.Keyboard;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Keyboard.class)
public class KeyboardMixin {
@Inject(method = "onKey", at = @At("HEAD"), cancellable = true)
public void onKey(long window, int key, int scancode, int action, int modifiers, CallbackInfo ci) {
VapeMenu.getINSTANCE().onKeyPress(key, action);
}
}
| 629 | Java | .java | CorruptionHades/VapeMenu | 10 | 0 | 0 | 2023-03-02T19:08:15Z | 2023-08-08T17:32:12Z |