Remi a skid

This commit is contained in:
Brandon Hall 2024-07-01 20:55:25 +01:00
commit 87bad2254c
34850 changed files with 3372462 additions and 0 deletions

7
README.md Normal file
View File

@ -0,0 +1,7 @@
#Remi the skid
* Hi Remi I am disclearing hear me roar !!
* Naveråsen 9, 4580 Lyngdal, Norway
* remigabr@hotmail.com
* remig06@hotmail.com

46
Virago/.gitignore vendored Normal file
View File

@ -0,0 +1,46 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store
## Gradle MCP ##
run
run/*

10
Virago/.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# GitHub Copilot persisted chat sessions
/copilot/chatSessions

1
Virago/.idea/.name Normal file
View File

@ -0,0 +1 @@
Virago

17
Virago/.idea/gradle.xml Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

10
Virago/.idea/misc.xml Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="liberica-1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

124
Virago/.idea/uiDesigner.xml Normal file
View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

6
Virago/.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

4
Virago/README.md Normal file
View File

@ -0,0 +1,4 @@
# Virago
## Startup Configuration
Run the `run` gradle task to start the client. The run directory is `$projectRoot/run`

97
Virago/build.gradle.kts Normal file
View File

@ -0,0 +1,97 @@
plugins {
id("java")
id("com.github.johnrengelman.shadow") version "8.1.1"
}
group = "dev.revere"
version = "1.0-SNAPSHOT"
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.compilerArgs.addAll(listOf("-parameters"))
}
repositories {
mavenCentral()
maven("https://jitpack.io")
maven("https://repo.marcloud.net/")
maven("https://libraries.minecraft.net/")
maven("https://nexus.hexeption.dev/repository/strezz-central/")
}
dependencies {
implementation("oshi-project:oshi-core:1.1")
implementation("net.java.dev.jna:jna:3.4.0")
implementation("net.java.dev.jna:platform:3.4.0")
implementation("com.ibm.icu:icu4j:62.1")
implementation("net.sf.jopt-simple:jopt-simple:4.9")
implementation("com.paulscode:codecjorbis:20101023")
implementation("com.paulscode:codecwav:20101023")
implementation("com.paulscode:libraryjavasound:20101123")
implementation("com.paulscode:librarylwjglopenal:20100824")
implementation("com.paulscode:soundsystem:20120107")
implementation("io.netty:netty-all:4.0.23.Final")
implementation("com.google.guava:guava:17.0")
implementation("org.apache.commons:commons-lang3:3.8.1")
implementation("commons-io:commons-io:2.6")
implementation("commons-codec:commons-codec:1.11")
implementation("net.java.jinput:jinput:2.0.9")
implementation("net.java.jutils:jutils:1.0.0")
implementation("com.google.code.gson:gson:2.8.5")
implementation("org.apache.commons:commons-compress:1.18")
implementation("org.apache.httpcomponents:httpclient:4.5.6")
implementation("commons-logging:commons-logging:1.2")
implementation("org.apache.httpcomponents:httpcore:4.4.10")
implementation("org.apache.logging.log4j:log4j-core:2.0-beta9")
implementation("org.apache.logging.log4j:log4j-api:2.0-beta9")
implementation("org.lwjgl.lwjgl:lwjgl:2.9.3")
implementation("org.lwjgl.lwjgl:lwjgl_util:2.9.3")
implementation("com.mojang:realms:1.7.59")
implementation("com.mojang:authlib:1.5.21")
implementation("tv.twitch:twitch:6.5")
/**
* Client Dependencies
*/
shadow("com.github.Vatuu:discord-rpc:1.6.2")
implementation("com.github.Vatuu:discord-rpc:1.6.2")
implementation("org.projectlombok:lombok:1.18.30")
annotationProcessor("org.projectlombok:lombok:1.18.30")
shadow("org.reflections:reflections:0.10.2")
implementation("org.reflections:reflections:0.10.2")
shadow("org.json:json:20230227")
implementation("org.json:json:20230227")
shadow("org.java-websocket:Java-WebSocket:1.5.6")
implementation("org.java-websocket:Java-WebSocket:1.5.6")
}
tasks.register<JavaExec>("run") {
group = "gradle-mcp"
mainClass = "Start"
classpath = sourceSets.main.get().runtimeClasspath
if(System.getProperties()["os.name"].toString().lowercase().contains("windows")) {
jvmArgs("-Djava.library.path=../natives/windows")
} else {
jvmArgs("-Djava.library.path=../natives/linux")
}
workingDir = project.projectDir.resolve("run")
if(!workingDir.exists()) workingDir.mkdirs()
}
tasks.shadowJar {
dependencies {
include(dependency("com.github.Vatuu:discord-rpc:1.6.2"))
//include(dependency("com.github.JnCrMx:discord-game-sdk4j:0.5.5"))
//include(dependency("org.projectlombok:lombok"))
include(dependency("org.reflections:reflections:0.10.2"))
include(dependency("org.json:json:20230227"))
include(dependency("org.slf4j:slf4j-api"))
include(dependency("org.javassist:javassist"))
include(dependency("com.google.code.gson:gson"))
include(dependency("com.mojang:authlib"))
include(dependency("com.google.guava:guava"))
include(dependency("org.apache.logging.log4j:log4j-core"))
include(dependency("org.java-websocket:Java-WebSocket:1.5.6"))
}
}

2
Virago/gradle.properties Normal file
View File

@ -0,0 +1,2 @@
# Done to increase the memory available to Gradle.
org.gradle.jvmargs=-Xmx1G

BIN
Virago/gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,6 @@
#Tue Apr 30 13:20:28 IST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

234
Virago/gradlew vendored Normal file
View File

@ -0,0 +1,234 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

89
Virago/gradlew.bat vendored Normal file
View File

@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
rootProject.name = "Virago"

View File

@ -0,0 +1,36 @@
import java.io.File;
import java.lang.reflect.Field;
import java.util.Arrays;
import net.minecraft.client.main.Main;
public class Start
{
public static void main(String[] args)
{
Main.main(concat(new String[] {"--version", "mcp", "--accessToken", "0", "--assetsDir", new File(getMinecraftDirectory(), "assets").getAbsolutePath(), "--assetIndex", "1.8", "--userProperties", "{}"}, args));
}
public static <T> T[] concat(T[] first, T[] second)
{
T[] result = Arrays.copyOf(first, first.length + second.length);
System.arraycopy(second, 0, result, first.length, second.length);
return result;
}
public static File getMinecraftDirectory() {
String userHome = System.getProperty("user.home", ".");
String os = System.getProperty("os.name").toLowerCase();
String minecraftDir;
if (os.contains("win")) {
minecraftDir = userHome + "\\AppData\\Roaming\\.minecraft";
} else if (os.contains("mac")) {
minecraftDir = userHome + "/Library/Application Support/minecraft";
} else {
minecraftDir = userHome + "/.minecraft";
}
return new File(minecraftDir);
}
}

View File

@ -0,0 +1,128 @@
package dev.revere.virago;
import dev.revere.virago.api.event.core.EventBus;
import dev.revere.virago.api.network.packet.client.C2SUpdate;
import dev.revere.virago.api.protection.ViragoUser;
import dev.revere.virago.api.service.IService;
import dev.revere.virago.api.service.ServiceManager;
import dev.revere.virago.api.network.socket.SocketClient;
import dev.revere.virago.api.network.socket.SocketHelper;
import dev.revere.virago.client.gui.panel.PanelGUI;
import dev.revere.virago.client.modules.render.ClickGUI;
import dev.revere.virago.client.gui.newgui.IngameMenu;
import dev.revere.virago.client.gui.newgui.framework.Menu;
import dev.revere.virago.client.services.*;
import dev.revere.virago.util.Logger;
import dev.revere.virago.util.misc.DiscordRPC;
import dev.revere.virago.util.input.KeybindManager;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.Minecraft;
import org.java_websocket.handshake.ServerHandshake;
import java.io.File;
import java.net.URI;
import static dev.revere.virago.api.network.socket.SocketClient.getURL;
import static dev.revere.virago.api.network.socket.SocketClient.key;
import static dev.revere.virago.api.network.socket.SocketHelper.createSocketConnection;
/**
* @author Remi
* @project Virago
* @date 3/17/2024
*/
@Getter
@Setter
public class Virago {
@Getter private static final Virago instance = new Virago();
private final String name = "Virago";
private final String version = "1.0.0";
private final String author = "Revere";
private final File clientDir = new File(Minecraft.getMinecraft().mcDataDir, getName().toLowerCase());
private ServiceManager serviceManager;
private ViragoUser viragoUser;
private DiscordRPC discordRPC;
private Menu menu;
private IngameMenu menuImpl;
private PanelGUI panelGUI;
private EventBus eventBus;
/**
* Starts all services and registers all events
*/
public void startVirago() {
Logger.info("Starting Virago...", getClass());
this.discordRPC = new DiscordRPC();
this.discordRPC.start();
if (!clientDir.exists() && clientDir.mkdir())
Logger.info("Created client directory.", getClass());
handleEvents();
handleServices();
handleManagers();
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
if(SocketClient.jwt != null) {
createSocketConnection(URI.create(getURL("/auth/logout")), new SocketHelper.WebSocketHandler() {
@Override
public void onOpen(ServerHandshake serverHandshake) {
send(new C2SUpdate(key));
}
});
}
}));
}
/**
* Stops all services
*/
public void stopVirago() {
Logger.info("Stopping Virago...", getClass());
this.discordRPC.shutdown();
this.serviceManager.getServices().values().forEach(IService::stopService);
this.serviceManager.getServices().values().forEach(IService::destroyService);
}
/**
* Initializes all managers
*/
private void handleManagers() {
this.panelGUI = new PanelGUI();
this.menu = new Menu("", 1035, 525);
menuImpl = new IngameMenu(serviceManager.getService(ModuleService.class).getModule(ClickGUI.class), menu);
}
/**
* Initializes and registers all events
*/
private void handleEvents() {
this.eventBus = new EventBus();
this.eventBus.register(new KeybindManager());
this.eventBus.register(new DiscordRPC());
}
/**
* Initializes and starts all services
*/
private void handleServices() {
this.serviceManager = new ServiceManager();
this.serviceManager.addService(new NotificationService());
this.serviceManager.addService(new CommandService());
this.serviceManager.addService(new ModuleService());
this.serviceManager.addService(new DraggableService());
this.serviceManager.addService(new FontService());
this.serviceManager.addService(new ConfigService());
this.serviceManager.addService(new AltService());
this.serviceManager.addService(new FriendService());
this.serviceManager.addService(new CheckService());
this.serviceManager.addService(new DesignService());
this.serviceManager.getServices().values().forEach(IService::initService);
this.serviceManager.getServices().values().forEach(IService::startService);
}
}

View File

@ -0,0 +1,36 @@
package dev.revere.virago.api.alt;
import lombok.Getter;
import lombok.Setter;
import java.util.UUID;
/**
* @author Remi
* @project Virago
* @date 3/27/2024
*/
@Setter
@Getter
public class Alt {
String username;
String password;
String alias;
String type;
String uuid;
long creationDate;
public Alt(String alias, String username, String password, String type, String uuid) {
this(alias, username, password, System.currentTimeMillis(), type, uuid);
}
public Alt(String alias, String username, String password, long creationDate, String type, String uuid) {
this.username = username;
this.alias = alias;
this.password = password;
this.creationDate = creationDate;
this.type = type;
this.uuid = uuid;
}
}

View File

@ -0,0 +1,33 @@
package dev.revere.virago.api.anticheat;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.entity.player.EntityPlayer;
/**
* @author Remi
* @project Virago-Client
* @date 4/19/2024
*/
@Getter
public abstract class AbstractCheck {
private final String checkName;
private final EnumCheckType checkType;
private final String checkDescription;
public AbstractCheck() {
CheckData checkData = getClass().getAnnotation(CheckData.class);
this.checkName = checkData.name();
this.checkType = checkData.type();
this.checkDescription = checkData.description();
}
/**
* Run check for a player.
*
* @param player the player
* @return the return value
*/
public abstract boolean runCheck(EntityPlayer player);
}

View File

@ -0,0 +1,21 @@
package dev.revere.virago.api.anticheat;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author Remi
* @project Virago-Client
* @date 4/19/2024
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface CheckData {
String name();
EnumCheckType type();
String description() default "No description provided";
}

View File

@ -0,0 +1,30 @@
package dev.revere.virago.api.anticheat;
import lombok.Getter;
/**
* @author Remi
* @project Virago-Client
* @date 4/19/2024
*/
@Getter
public enum EnumCheckType {
COMBAT("Combat"),
MOVEMENT("Movement"),
OTHER("Other")
;
private final String name;
/**
* Instantiates a new Enum check type.
*
* @param name the name
*/
EnumCheckType(String name) {
this.name = name;
}
}

View File

@ -0,0 +1,19 @@
package dev.revere.virago.api.command;
import dev.revere.virago.api.module.EnumModuleType;
import dev.revere.virago.api.module.ModuleData;
import lombok.Getter;
/**
* @author Remi
* @project Virago
* @date 3/21/2024
*/
@Getter
public abstract class AbstractCommand {
private final String[] aliases = getClass().getAnnotation(CommandData.class).aliases();
private final String description = getClass().getAnnotation(CommandData.class).description();
private final String syntax = getClass().getAnnotation(CommandData.class).syntax();
public abstract void executeCommand(String line, String[] args);
}

View File

@ -0,0 +1,22 @@
package dev.revere.virago.api.command;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author Remi
* @project Virago
* @date 3/21/2024
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface CommandData {
String[] aliases();
String description();
String syntax();
}

View File

@ -0,0 +1,104 @@
package dev.revere.virago.api.draggable;
import dev.revere.virago.api.module.AbstractModule;
import dev.revere.virago.util.render.RenderUtils;
import lombok.Getter;
import lombok.Setter;
import java.awt.*;
/**
* @author Remi
* @project Virago
* @date 3/23/2024
*/
@Setter
@Getter
public class Draggable {
private AbstractModule module;
private float initialX;
private float initialY;
private float startX;
private float startY;
private float x;
private float y;
private float width;
private float height;
private boolean dragging;
private String name;
/**
* Constructor for the Draggable.
*
* @param module The module.
* @param name The name.
* @param initialX The initial x position.
* @param initialY The initial y position.
*/
public Draggable(AbstractModule module, String name, float initialX, float initialY) {
this.module = module;
this.name = name;
this.x = initialX;
this.y = initialY;
this.initialX = initialX;
this.initialY = initialY;
}
/**
* Draws the draggable.
*
* @param mouseX The x position of the mouse.
* @param mouseY The y position of the mouse.
*/
public final void draw(float mouseX, float mouseY) {
if(!this.module.isEnabled()) return;
if (dragging) {
x = (mouseX - startX);
y = (mouseY - startY);
}
}
/**
* Handles the click event.
*
* @param mouseX The x position of the mouse.
* @param mouseY The y position of the mouse.
* @param button The button.
*/
public final void onClick(float mouseX, float mouseY, int button) {
if(!this.module.isEnabled()) return;
if (hovered(mouseX, mouseY) && button == 0 && !dragging) {
dragging = true;
startX = (int) (mouseX - x);
startY = (int) (mouseY - y);
}
}
/**
* Handles the release event.
*
* @param button The button.
*/
public final void onRelease(int button) {
if(!this.module.isEnabled()) return;
if (button == 0) {
dragging = false;
}
}
/**
* Checks if the mouse is hovering over the draggable.
*
* @param mouseX The x position of the mouse.
* @param mouseY The y position of the mouse.
* @return True if the mouse is hovering over the draggable.
*/
public boolean hovered(float mouseX, float mouseY) {
return mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + height;
}
}

View File

@ -0,0 +1,15 @@
package dev.revere.virago.api.event;
import lombok.Getter;
import lombok.Setter;
/**
* @author Remi
* @project nigger
* @date 3/28/2024
*/
@Setter
@Getter
public class Event {
private boolean isCancelled;
}

View File

@ -0,0 +1,128 @@
package dev.revere.virago.api.event.core;
import dev.revere.virago.api.event.Event;
import dev.revere.virago.api.event.handler.EventExecutable;
import dev.revere.virago.api.event.handler.EventHandler;
import dev.revere.virago.api.event.handler.EventObject;
import dev.revere.virago.api.event.handler.Listener;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.util.ArrayList;
import java.util.Comparator;
/**
* @author Remi
* @project nigger
* @date 3/28/2024
*/
public class EventBus {
//List of the objects registered in the event system
private final ArrayList<EventObject> objects = new ArrayList<>();
/**
* Register an object in the event system with priority
*
* @param object the object to register
* @param eventPriority priority in the event system
*/
public void register(final Object object, final EventPriority eventPriority) {
if (isRegistered(object)) return;
final EventObject eventObject = new EventObject(object, eventPriority);
for (final Method method : object.getClass().getDeclaredMethods()) {
if (!method.isAnnotationPresent(EventHandler.class)) continue;
if (method.getParameterCount() <= 0) continue;
eventObject.getEventExecutables().add(new EventExecutable(method));
}
for (final Field field : object.getClass().getDeclaredFields()) {
if (!field.isAnnotationPresent(EventHandler.class)) continue;
try {
field.setAccessible(true);
if (!(field.get(object) instanceof Listener)) continue;
} catch (IllegalAccessException e) {
e.printStackTrace();
}
eventObject.getEventExecutables().add(new EventExecutable(field));
}
objects.add(eventObject);
objects.sort(Comparator.comparingInt(o1 -> o1.getEventPriority().getPriority()));
}
/**
* Method used for calling events
*
* @param event the event that should be called
*/
@SuppressWarnings("unchecked")
public void call(final Event event) {
try {
for (final EventObject eventObject : objects)
for (final EventExecutable eventExecutable : eventObject.getEventExecutables()) {
if (eventExecutable.getField() != null) {
try {
eventExecutable.getField().setAccessible(true);
if (eventExecutable.getField().getGenericType() instanceof ParameterizedType) {
ParameterizedType type = (ParameterizedType) eventExecutable.getField().getGenericType();
if (type.getActualTypeArguments().length > 0) {
if (type.getActualTypeArguments()[0] == event.getClass() || type.getActualTypeArguments()[0] == Event.class)
((Listener<Event>) eventExecutable.getField().get(eventObject.getObject())).call(event);
}
}
} catch (Exception ignored) {}
}
if (eventExecutable.getMethod() != null) {
if (isValidMethod(eventExecutable.getMethod(), event.getClass()) ||
isValidMethod(eventExecutable.getMethod(), Event.class)) {
try {
eventExecutable.getMethod().setAccessible(true);
eventExecutable.getMethod().invoke(eventObject.getObject(), event);
} catch (Exception ignored) {
}
}
}
}
} catch (Exception ignored) {
}
}
/**
* Register an object in the event system without priority
*
* @param object the object to register
*/
public void register(final Object object) {
register(object, EventPriority.DEFAULT);
}
/**
* Unregister an object from the event system
*
* @param object the object to unregister
*/
public void unregister(final Object object) {
if (!isRegistered(object)) return;
objects.removeIf(o -> o.getObject().equals(object));
}
/**
* Method used to check whether an object is registered in the event system
*
* @param object the object to check
*/
public boolean isRegistered(final Object object) {
return objects.stream().anyMatch(o -> o.getObject().equals(object));
}
/**
* Method used to check whether a method is valid for the event system
*
* @param method the method that should be checked
*/
public boolean isValidMethod(final Method method, final Class<?> clazz) {
for (final Class<?> parameter : method.getParameterTypes())
if (clazz == parameter && method.getParameterCount() == 1) return true;
return false;
}
}

View File

@ -0,0 +1,23 @@
package dev.revere.virago.api.event.core;
import lombok.Getter;
/**
* @author Remi
* @project nigger
* @date 3/28/2024
*/
@Getter
public enum EventPriority {
LOWEST(0),
LOWER(1),
DEFAULT(2),
HIGHER(3),
HIGHEST(4);
private final int priority;
EventPriority(int priority) {
this.priority = priority;
}
}

View File

@ -0,0 +1,35 @@
package dev.revere.virago.api.event.handler;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
/**
* @author Remi
* @project nigger
* @date 3/28/2024
*/
public class EventExecutable {
private final Method method;
private final Field field;
public EventExecutable(final Method method, final Field field) {
this.method = method;
this.field = field;
}
public EventExecutable(final Method method) {
this(method, null);
}
public EventExecutable(final Field field) {
this(null, field);
}
public Field getField() {
return field;
}
public Method getMethod() {
return method;
}
}

View File

@ -0,0 +1,15 @@
package dev.revere.virago.api.event.handler;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author Remi
* @project nigger
* @date 3/28/2024
*/
@Target({ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface EventHandler {}

View File

@ -0,0 +1,35 @@
package dev.revere.virago.api.event.handler;
import dev.revere.virago.api.event.core.EventPriority;
import java.util.ArrayList;
/**
* @author Remi
* @project nigger
* @date 3/28/2024
*/
public class EventObject {
private final Object object;
private final EventPriority eventPriority;
private final ArrayList<EventExecutable> eventExecutables;
public EventObject(Object object, EventPriority eventPriority) {
this.object = object;
this.eventPriority = eventPriority;
this.eventExecutables = new ArrayList<>();
}
public Object getObject() {
return object;
}
public EventPriority getEventPriority() {
return eventPriority;
}
public ArrayList<EventExecutable> getEventExecutables() {
return eventExecutables;
}
}

View File

@ -0,0 +1,19 @@
package dev.revere.virago.api.event.handler;
import dev.revere.virago.api.event.Event;
/**
* @author Remi
* @project nigger
* @date 3/28/2024
*/
public interface Listener<T extends Event> {
/**
* Method for calling an event
*
* @param event event that should be called
*/
void call(final T event);
}

View File

@ -0,0 +1,236 @@
package dev.revere.virago.api.font;
import dev.revere.virago.util.Logger;
import lombok.Getter;
import net.minecraft.client.renderer.texture.DynamicTexture;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
/**
* @author Remi
* @project Virago
* @date 3/19/2024
*/
@Getter
public class CFont {
private float imgSize = 512;
protected CharData[] charData = new CharData[256];
protected Font font;
protected boolean antiAlias;
protected boolean fractionalMetrics;
protected int fontHeight = -1;
protected int charOffset = 0;
protected DynamicTexture tex;
/**
* Constructor for the CFont class
*
* @param font The font to use
* @param antiAlias Whether or not to use anti-aliasing
* @param fractionalMetrics Whether or not to use fractional metrics
*/
public CFont(Font font, boolean antiAlias, boolean fractionalMetrics) {
this.font = font;
this.antiAlias = antiAlias;
this.fractionalMetrics = fractionalMetrics;
tex = setupTexture(font, antiAlias, fractionalMetrics, this.charData);
}
/**
* Constructor for the CFont class
*
* @param font The font to use
* @param antiAlias Whether or not to use anti-aliasing
* @param fractionalMetrics Whether or not to use fractional metrics
* @param charData The character data
*/
protected DynamicTexture setupTexture(Font font, boolean antiAlias, boolean fractionalMetrics, CharData[] chars) {
BufferedImage img = generateFontImage(font, antiAlias, fractionalMetrics, chars);
try {
return new DynamicTexture(img);
} catch (Exception e) {
Logger.err("Error loading font texture, using fallback font", e.getClass());
}
return null;
}
/**
* Generates the font image
*
* @param font The font to use
* @param antiAlias Whether or not to use anti-aliasing
* @param fractionalMetrics Whether or not to use fractional metrics
* @param chars The character data
* @return The generated font image
*/
protected BufferedImage generateFontImage(Font font, boolean antiAlias, boolean fractionalMetrics, CharData[] chars) {
int imgSize = (int) this.imgSize;
BufferedImage bufferedImage = new BufferedImage(imgSize, imgSize, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = (Graphics2D) bufferedImage.getGraphics();
g.setFont(font);
g.setColor(new Color(255, 255, 255, 0));
g.fillRect(0, 0, imgSize, imgSize);
g.setColor(Color.WHITE);
g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, fractionalMetrics ? RenderingHints.VALUE_FRACTIONALMETRICS_ON : RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, antiAlias ? RenderingHints.VALUE_TEXT_ANTIALIAS_ON : RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, antiAlias ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF);
FontMetrics fontMetrics = g.getFontMetrics();
int charHeight = 0;
int positionX = 0;
int positionY = 1;
for (int i = 0; i < chars.length; i++) {
char ch = (char) i;
CharData charData = new CharData();
Rectangle2D dimensions = fontMetrics.getStringBounds(String.valueOf(ch), g);
charData.width = (dimensions.getBounds().width + 8);
charData.height = dimensions.getBounds().height;
if (positionX + charData.width >= imgSize) {
positionX = 0;
positionY += charHeight;
charHeight = 0;
}
if (charData.height > charHeight) {
charHeight = charData.height;
}
charData.storedX = positionX;
charData.storedY = positionY;
if (charData.height > this.fontHeight) {
this.fontHeight = charData.height;
}
chars[i] = charData;
g.drawString(String.valueOf(ch), positionX + 2, positionY + fontMetrics.getAscent());
positionX += charData.width;
}
return bufferedImage;
}
/**
* Draws a character on the screen as a quad
*
* @param chars The character data
* @param c The character to draw
* @param x The x position to draw the character
* @param y The y position to draw the character
* @throws ArrayIndexOutOfBoundsException If the character is out of bounds
*/
public void drawChar(CharData[] chars, char c, float x, float y) throws ArrayIndexOutOfBoundsException {
try {
drawQuad(x, y, chars[c].width, chars[c].height, chars[c].storedX, chars[c].storedY, chars[c].width, chars[c].height);
} catch (Exception e) {
Logger.err("Error drawing character", e.getClass());
}
}
/**
* Draws a quad on the screen
*
* @param x The x position to draw the quad
* @param y The y position to draw the quad
* @param width The width of the quad
* @param height The height of the quad
* @param srcX The x position of the texture
* @param srcY The y position of the texture
* @param srcWidth The width of the texture
* @param srcHeight The height of the texture
*/
protected void drawQuad(float x, float y, float width, float height, float srcX, float srcY, float srcWidth, float srcHeight) {
float renderSRCX = srcX / imgSize;
float renderSRCY = srcY / imgSize;
float renderSRCWidth = srcWidth / imgSize;
float renderSRCHeight = srcHeight / imgSize;
GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY);
GL11.glVertex2d(x + width, y);
GL11.glTexCoord2f(renderSRCX, renderSRCY);
GL11.glVertex2d(x, y);
GL11.glTexCoord2f(renderSRCX, renderSRCY + renderSRCHeight);
GL11.glVertex2d(x, y + height);
GL11.glTexCoord2f(renderSRCX, renderSRCY + renderSRCHeight);
GL11.glVertex2d(x, y + height);
GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY + renderSRCHeight);
GL11.glVertex2d(x + width, y + height);
GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY);
GL11.glVertex2d(x + width, y);
}
/**
* Function to get the height of the font
*
* @return The height of the font
*/
public int getHeight() {
return (this.fontHeight - 8) / 2;
}
/**
* Function to get the width of a string
*
* @param text The string to get the width of
* @return The width of the string
*/
public int getStringWidth(String text) {
int width = 0;
for (char c : text.toCharArray()) {
if ((c < this.charData.length) && (c >= 0)) {
width += this.charData[c].width - 8 + this.charOffset;
}
}
return width / 2;
}
/**
* Function to set the anti-aliasing of the font
*
* @param antiAlias Whether or not to use anti-aliasing
*/
public void setAntiAlias(boolean antiAlias) {
if (this.antiAlias != antiAlias) {
this.antiAlias = antiAlias;
tex = setupTexture(this.font, antiAlias, this.fractionalMetrics, this.charData);
}
}
/**
* Function to set the fractional metrics of the font
*
* @param fractionalMetrics Whether or not to use fractional metrics
*/
public void setFractionalMetrics(boolean fractionalMetrics) {
if (this.fractionalMetrics != fractionalMetrics) {
this.fractionalMetrics = fractionalMetrics;
tex = setupTexture(this.font, this.antiAlias, fractionalMetrics, this.charData);
}
}
/**
* Function to set the font of the font
*
* @param font The font to use
*/
public void setFont(Font font) {
this.font = font;
tex = setupTexture(font, this.antiAlias, this.fractionalMetrics, this.charData);
}
protected class CharData {
public int width;
public int height;
public int storedX;
public int storedY;
protected CharData() {}
}
}

View File

@ -0,0 +1,591 @@
package dev.revere.virago.api.font;
import dev.revere.virago.util.Logger;
import dev.revere.virago.util.shader.Shader;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL20;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
/**
* @author Remi
* @project Virago
* @date 3/19/2024
*/
public class FontRenderer extends CFont {
protected CFont.CharData[] boldChars = new CFont.CharData[256];
protected CFont.CharData[] italicChars = new CFont.CharData[256];
protected CFont.CharData[] boldItalicChars = new CFont.CharData[256];
private final int[] colorCode = new int[32];
/**
* The constructor for the FontRenderer
*
* @param font The font to use
* @param antiAlias Whether or not to use anti-aliasing
* @param fractionalMetrics Whether or not to use fractional metrics
*/
public FontRenderer(Font font, boolean antiAlias, boolean fractionalMetrics) {
super(font, antiAlias, fractionalMetrics);
setupMinecraftColorCodes();
setupBoldItalicIDs();
}
/**
* Draws a string
*
* @param text The text to draw
* @param x The x position to draw the text
* @param y The y position to draw the text
* @param color The color of the text
*/
public float drawString(String text, float x, float y, int color) {
return drawString(text, x, y, color, false);
}
/**
* Draws a string
*
* @param text The text to draw
* @param x The x position to draw the text
* @param y The y position to draw the text
* @param color The color of the text
*/
public float drawString(String text, double x, double y, int color) {
return drawString(text, x, y, color, false);
}
/**
* Draws glowing text using shaders from RoundedUtils.
*
* @param text The text to draw
* @param x The x position to draw the text
* @param y The y position to draw the text
* @param color The color of the text
* @param glowColor The color of the glow
*/
public void drawGlowingText(String text, double x, double y, int color, int glowColor, float radius, float offsetAmount) {
// Use the glow shader from RoundedUtils
Shader glowShader = new Shader(new ResourceLocation("virago/shader/glowingText.frag"));
// Bind the glow shader
/*glowShader.init();
// Set uniform variables
glowShader.setupUniform("glowColor");
glowShader.setupUniform("glowRadius");
glowShader.setupUniform("offsetAmount");
GL20.glUniform4f(glowShader.getUniform("glowColor"),
((glowColor >> 16) & 0xFF) / 255f,
((glowColor >> 8) & 0xFF) / 255f,
(glowColor & 0xFF) / 255f,
((glowColor >> 24) & 0xFF) / 255f);
GL20.glUniform1f(GL20.glGetUniformLocation(glowShader.getProgram(), "glowRadius"), radius);
GL20.glUniform1f(GL20.glGetUniformLocation(glowShader.getProgram(), "offsetAmount"), offsetAmount);*/
// Draw the text using FontRenderer's drawString method
drawString(text, x, y, color);
// Unbind the shader
glowShader.finish();
}
/**
* Draws a string with a shadow
*
* @param text The text to draw
* @param x The x position to draw the text
* @param y The y position to draw the text
* @param color The color of the text
*/
public float drawStringWithShadow(String text, float x, float y, int color) {
float shadowWidth = drawString(text, x + 0.5, y + 0.5, color, true);
return Math.max(shadowWidth, drawString(text, x, y, color, false));
}
/**
* Draws a string with a shadow
*
* @param text The text to draw
* @param x The x position to draw the text
* @param y The y position to draw the text
* @param color The color of the text
*/
public float drawStringWithShadow(String text, double x, double y, int color) {
float shadowWidth = drawString(text, x + 0.5, y + 0.5, color, true);
return Math.max(shadowWidth, drawString(text, x, y, color, false));
}
/**
* Draws a centered string
*
* @param text The text to draw
* @param x The x position to draw the text
* @param y The y position to draw the text
* @param color The color of the text
*/
public float drawCenteredString(String text, float x, float y, int color) {
return drawString(text, x - getStringWidth(text) / 2, y, color);
}
/**
* Draws a centered string
*
* @param text The text to draw
* @param x The x position to draw the text
* @param y The y position to draw the text
* @param color The color of the text
*/
public float drawCenteredString(String text, double x, double y, int color) {
return drawString(text, x - getStringWidth(text) / 2, y, color);
}
/**
* Draws a centered string with a shadow
*
* @param text The text to draw
* @param x The x position to draw the text
* @param y The y position to draw the text
* @param color The color of the text
*/
public float drawCenteredStringWithShadow(String text, float x, float y, int color) {
float shadowWidth = drawString(text, x - getStringWidth(text) / 2 + 1D, y + 1D, color, true);
return drawString(text, x - getStringWidth(text) / 2, y, color);
}
/**
* Draws a centered string with a shadow
*
* @param text The text to draw
* @param x The x position to draw the text
* @param y The y position to draw the text
* @param color The color of the text
*/
public float drawCenteredStringWithShadow(String text, double x, double y, int color) {
float shadowWidth = drawString(text, x - getStringWidth(text) / 2 + 1D, y + 1D, color, true);
return drawString(text, x - getStringWidth(text) / 2, y, color);
}
/**
* Draws a string with a shadow if the shadow boolean is true
*
* @param text The text to draw
* @param x The x position to draw the text
* @param y The y position to draw the text
* @param color The color of the text
* @param shadow Whether or not to draw a shadow
*/
public float drawString(String text, double x, double y, int color, boolean shadow) {
x -= 1;
if (text == null) {
return 0.0F;
}
if (color == 553648127) {
color = 16777215;
}
if ((color & 0xFC000000) == 0) {
color |= -16777216;
}
if (shadow) {
color = (color & 0xFCFCFC) >> 2 | color & new Color(20, 20, 20, 210).getRGB();
}
CFont.CharData[] currentData = this.charData;
float alpha = (color >> 24 & 0xFF) / 255.0F;
boolean bold = false;
boolean italic = false;
boolean strikethrough = false;
boolean underline = false;
x *= 2.0D;
y = (y - 3.0D) * 2.0D;
GL11.glPushMatrix();
GlStateManager.scale(0.5D, 0.5D, 0.5D);
GlStateManager.enableBlend();
GlStateManager.blendFunc(770, 771);
GlStateManager.color((color >> 16 & 0xFF) / 255.0F, (color >> 8 & 0xFF) / 255.0F, (color & 0xFF) / 255.0F, alpha);
int size = text.length();
GlStateManager.enableTexture2D();
GlStateManager.bindTexture(tex.getGlTextureId());
GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex.getGlTextureId());
for (int i = 0; i < size; i++) {
char character = text.charAt(i);
if ((String.valueOf(character).equals("\247")) && (i < size)) {
int colorIndex = 21;
try {
colorIndex = "0123456789abcdefklmnor".indexOf(text.charAt(i + 1));
} catch (Exception e) {
e.printStackTrace();
}
if (colorIndex < 16) {
bold = false;
italic = false;
underline = false;
strikethrough = false;
GlStateManager.bindTexture(tex.getGlTextureId());
currentData = this.charData;
if ((colorIndex < 0) || (colorIndex > 15)) {
colorIndex = 15;
}
if (shadow) {
colorIndex += 16;
}
int colorcode = this.colorCode[colorIndex];
GlStateManager.color((colorcode >> 16 & 0xFF) / 255.0F, (colorcode >> 8 & 0xFF) / 255.0F, (colorcode & 0xFF) / 255.0F, alpha);
} else if (colorIndex == 16) {
} else if (colorIndex == 17) {
bold = true;
if (italic) {
GlStateManager.bindTexture(texItalicBold.getGlTextureId());
currentData = this.boldItalicChars;
} else {
GlStateManager.bindTexture(texBold.getGlTextureId());
currentData = this.boldChars;
}
} else if (colorIndex == 18) {
strikethrough = true;
} else if (colorIndex == 19) {
underline = true;
} else if (colorIndex == 20) {
italic = true;
if (bold) {
GlStateManager.bindTexture(texItalicBold.getGlTextureId());
currentData = this.boldItalicChars;
} else {
GlStateManager.bindTexture(texItalic.getGlTextureId());
currentData = this.italicChars;
}
} else if (colorIndex == 21) {
bold = false;
italic = false;
underline = false;
strikethrough = false;
GlStateManager.color((color >> 16 & 0xFF) / 255.0F, (color >> 8 & 0xFF) / 255.0F, (color & 0xFF) / 255.0F, alpha);
GlStateManager.bindTexture(tex.getGlTextureId());
currentData = this.charData;
}
i++;
} else if ((character < currentData.length) && (character >= 0)) {
GL11.glBegin(GL11.GL_TRIANGLES);
drawChar(currentData, character, (float) x, (float) y);
GL11.glEnd();
if (strikethrough) {
drawLine(x, y + currentData[character].height / 2, x + currentData[character].width - 8.0D, y + currentData[character].height / 2, 1.0F);
}
if (underline) {
drawLine(x, y + currentData[character].height - 2.0D, x + currentData[character].width - 8.0D, y + currentData[character].height - 2.0D, 1.0F);
}
x += currentData[character].width - 8 + this.charOffset;
}
}
GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_DONT_CARE);
GL11.glPopMatrix();
return (float) x / 2.0F;
}
/**
* Fetches the width of a string
*
* @param text The text to get the width of
*/
@Override
public int getStringWidth(String text) {
if (text == null) {
return 0;
}
int width = 0;
CFont.CharData[] currentData = this.charData;
boolean bold = false;
boolean italic = false;
int size = text.length();
for (int i = 0; i < size; i++) {
char character = text.charAt(i);
if ((String.valueOf(character).equals("§")) && (i < size)) {
int colorIndex = "0123456789abcdefklmnor".indexOf(character);
if (colorIndex < 16) {
bold = false;
italic = false;
} else if (colorIndex == 17) {
bold = true;
if (italic) {
currentData = this.boldItalicChars;
} else {
currentData = this.boldChars;
}
} else if (colorIndex == 20) {
italic = true;
if (bold) {
currentData = this.boldItalicChars;
} else {
currentData = this.italicChars;
}
} else if (colorIndex == 21) {
bold = false;
italic = false;
currentData = this.charData;
}
i++;
} else if ((character < currentData.length) && (character >= 0)) {
width += currentData[character].width - 8 + this.charOffset;
}
}
return width / 2;
}
/**
* Fetches the width of a string
*
* @param text The text to get the width of
*/
public int getStringWidthCust(String text) {
if (text == null) {
return 0;
}
int width = 0;
CFont.CharData[] currentData = this.charData;
boolean bold = false;
boolean italic = false;
int size = text.length();
for (int i = 0; i < size; i++) {
char character = text.charAt(i);
if ((String.valueOf(character).equals("§")) && (i < size)) {
int colorIndex = "0123456789abcdefklmnor".indexOf(character);
if (colorIndex < 16) {
bold = false;
italic = false;
} else if (colorIndex == 17) {
bold = true;
if (italic) {
currentData = this.boldItalicChars;
} else {
currentData = this.boldChars;
}
} else if (colorIndex == 20) {
italic = true;
if (bold) {
currentData = this.boldItalicChars;
} else {
currentData = this.italicChars;
}
} else if (colorIndex == 21) {
bold = false;
italic = false;
currentData = this.charData;
}
i++;
} else if ((character < currentData.length) && (character >= 0)) {
width += currentData[character].width - 8 + this.charOffset;
}
}
return (width - this.charOffset) / 2;
}
/**
* Sets the font
*
* @param font The font to set
*/
public void setFont(Font font) {
super.setFont(font);
setupBoldItalicIDs();
}
/**
* Sets the anti-aliasing
*
* @param antiAlias Whether or not to use anti-aliasing
*/
public void setAntiAlias(boolean antiAlias) {
super.setAntiAlias(antiAlias);
setupBoldItalicIDs();
}
/**
* Sets the fractional metrics
*
* @param fractionalMetrics Whether or not to use fractional metrics
*/
public void setFractionalMetrics(boolean fractionalMetrics) {
super.setFractionalMetrics(fractionalMetrics);
setupBoldItalicIDs();
}
public DynamicTexture texBold;
public DynamicTexture texItalic;
public DynamicTexture texItalicBold;
/**
* Sets up the bold/italic IDs
*/
private void setupBoldItalicIDs() {
try {
texBold = setupTexture(this.font.deriveFont(1), this.antiAlias, this.fractionalMetrics, this.boldChars);
texItalic = setupTexture(this.font.deriveFont(2), this.antiAlias, this.fractionalMetrics, this.italicChars);
texItalicBold = setupTexture(this.font.deriveFont(3), this.antiAlias, this.fractionalMetrics, this.boldItalicChars);
} catch (Exception e) {
Logger.err("Error setting up bold/italic fonts", e.getClass());
}
}
/**
* Draws a line
*
* @param x The x position to draw the line
* @param y The y position to draw the line
* @param x1 The x position to draw the line to
* @param y1 The y position to draw the line to
* @param width The width of the line
*/
private void drawLine(double x, double y, double x1, double y1, float width) {
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glLineWidth(width);
GL11.glBegin(GL11.GL_LINES);
GL11.glVertex2d(x, y);
GL11.glVertex2d(x1, y1);
GL11.glEnd();
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
/**
* Wraps words
*
* @param text The text to wrap
* @param width The width to wrap the text at
*/
public List<String> wrapWords(String text, double width) {
List<String> finalWords = new ArrayList<>();
if (getStringWidth(text) > width) {
String[] words = text.split(" ");
StringBuilder currentWord = new StringBuilder();
char lastColorCode = 65535;
for (String word : words) {
for (int i = 0; i < word.toCharArray().length; i++) {
char c = word.toCharArray()[i];
if ((String.valueOf(c).equals("§")) && (i < word.toCharArray().length - 1)) {
lastColorCode = word.toCharArray()[(i + 1)];
}
}
if (getStringWidth(currentWord + word + " ") < width) {
currentWord.append(word).append(" ");
} else {
finalWords.add(currentWord.toString());
currentWord = new StringBuilder(lastColorCode + word + " ");
}
}
if (currentWord.length() > 0) if (getStringWidth(currentWord.toString()) < width) {
finalWords.add(lastColorCode + currentWord.toString() + " ");
} else {
finalWords.addAll(formatString(currentWord.toString(), width));
}
} else {
finalWords.add(text);
}
return finalWords;
}
/**
* Formats a string
*
* @param string The string to format
* @param width The width to format the string at
*/
public List<String> formatString(String string, double width) {
List<String> finalWords = new ArrayList<>();
String currentWord = "";
char lastColorCode = 65535;
char[] chars = string.toCharArray();
for (int i = 0; i < chars.length; i++) {
char c = chars[i];
if ((String.valueOf(c).equals("§")) && (i < chars.length - 1))
{
lastColorCode = chars[(i + 1)];
}
if (getStringWidth(currentWord + c) < width) {
currentWord = currentWord + c;
} else {
finalWords.add(currentWord);
currentWord = lastColorCode + String.valueOf(c);
}
}
if (!currentWord.isEmpty()) {
finalWords.add(currentWord);
}
return finalWords;
}
/**
* Sets up the Minecraft color codes
*/
private void setupMinecraftColorCodes() {
for (int index = 0; index < 32; index++) {
int noClue = (index >> 3 & 0x1) * 85;
int red = (index >> 2 & 0x1) * 170 + noClue;
int green = (index >> 1 & 0x1) * 170 + noClue;
int blue = (index >> 0 & 0x1) * 170 + noClue;
if (index == 6) {
red += 85;
}
if (index >= 16) {
red /= 4;
green /= 4;
blue /= 4;
}
this.colorCode[index] = ((red & 0xFF) << 16 | (green & 0xFF) << 8 | blue & 0xFF);
}
}
}

View File

@ -0,0 +1,199 @@
package dev.revere.virago.api.module;
import dev.revere.virago.Virago;
import dev.revere.virago.api.setting.Setting;
import dev.revere.virago.client.modules.render.Notifications;
import dev.revere.virago.client.notification.NotificationType;
import dev.revere.virago.client.services.ModuleService;
import dev.revere.virago.client.services.NotificationService;
import dev.revere.virago.util.animation.Animation;
import dev.revere.virago.util.animation.Easing;
import dev.revere.virago.util.input.BindType;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.Minecraft;
import net.minecraft.util.EnumChatFormatting;
import org.lwjgl.input.Keyboard;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
/**
* @author Remi
* @project Virago
* @date 3/17/2024
*/
@Getter
@Setter
public abstract class AbstractModule {
// The Minecraft instance.
public static final Minecraft mc = Minecraft.getMinecraft();
// The name, description, and type of the module.
private final String name = getClass().getAnnotation(ModuleData.class).name();
private final String displayName = getClass().getAnnotation(ModuleData.class).displayName();
private final String description = getClass().getAnnotation(ModuleData.class).description();
private final EnumModuleType type = getClass().getAnnotation(ModuleData.class).type();
private boolean isHidden = getClass().getAnnotation(ModuleData.class).isHidden();
// The settings for all the modules.
private final List<Setting<?>> settings = new ArrayList<>();
// The state of the module (enabled or disabled).
private boolean enabled;
// The key binding for the module.
private int key = Keyboard.CHAR_NONE;
// The type of key binding (e.g., toggle, hold).
private BindType bindType = BindType.TOGGLE;
private String metaData = "";
private final Animation animation = new Animation(() -> 250.0f, false, () -> Easing.CUBIC_IN_OUT);
/**
* AbstractModule constructor to initialize the module.
*/
public AbstractModule() {
init();
}
/**
* Toggles the module
*/
public void toggle() {
enabled = !enabled;
if (enabled) {
Notifications notifications = Virago.getInstance().getServiceManager().getService(ModuleService.class).getModule(Notifications.class);
if (notifications.isEnabled() && notifications.moduleNotifications.getValue()) {
Virago.getInstance().getServiceManager().getService(NotificationService.class).notify(NotificationType.YES, "Enabled Module", this.getDisplayName());
}
onEnable();
} else {
Notifications notifications = Virago.getInstance().getServiceManager().getService(ModuleService.class).getModule(Notifications.class);
if (notifications.isEnabled() && notifications.moduleNotifications.getValue()) {
Virago.getInstance().getServiceManager().getService(NotificationService.class).notify(NotificationType.NO, "Disabled Module", this.getDisplayName());
}
onDisable();
}
}
/**
* Toggles the module without notifications
*/
public void toggleSilent() {
enabled = !enabled;
if (enabled) {
onEnable();
} else {
onDisable();
}
}
/**
* Set whether the module is toggled on or off.
*
* @param toggled true to toggle the module on, false to toggle it off.
*/
public void setEnabled(boolean toggled) {
enabled = toggled;
if (toggled) {
Notifications notifications = Virago.getInstance().getServiceManager().getService(ModuleService.class).getModule(Notifications.class);
if (notifications.isEnabled() && notifications.moduleNotifications.getValue()) {
Virago.getInstance().getServiceManager().getService(NotificationService.class).notify(NotificationType.YES, "Enabled Module", this.getDisplayName());
}
onEnable();
} else {
Notifications notifications = Virago.getInstance().getServiceManager().getService(ModuleService.class).getModule(Notifications.class);
if (notifications.isEnabled() && notifications.moduleNotifications.getValue()) {
Virago.getInstance().getServiceManager().getService(NotificationService.class).notify(NotificationType.NO, "Disabled Module", this.getDisplayName());
}
onDisable();
}
}
/**
* Set whether the module is toggled on or off.
*
* @param toggled true to toggle the module on, false to toggle it off.
*/
public void setEnabledSilent(boolean toggled) {
enabled = toggled;
if (toggled) {
onEnable();
} else {
onDisable();
}
}
/**
* Retrieves the annotation value of a field.
*
* @param field The field to retrieve the annotation from.
* @param annotationClass The annotation class.
* @param <T> The type of the annotation.
* @return The annotation value or null if the annotation is not present.
*/
private <T extends Annotation> T getAnnotation(Field field, Class<T> annotationClass) {
if (field.isAnnotationPresent(annotationClass)) {
return field.getAnnotation(annotationClass);
}
return null;
}
/**
* Retrieves the setting hierarchy.
*
* @return The setting hierarchy.
*/
public List<Setting<?>> getSettingHierarchy() {
List<Setting<?>> hierarchy = new ArrayList<>();
for (Setting<?> setting : settings) {
hierarchy.add(setting);
hierarchy.addAll(setting.getHierarchy());
}
return hierarchy;
}
/**
* Called when the module is initialized.
* Override this method to perform actions when the module is initialized.
*/
public void init() {}
/**
* Called when the module is enabled.
* Override this method to perform actions when the module is enabled.
*/
public void onEnable() {
Virago.getInstance().getEventBus().register(this);
}
/**
* Called when the module is disabled.
* Override this method to perform actions when the module is disabled.
*/
public void onDisable() {
Virago.getInstance().getEventBus().unregister(this);
}
/**
* Checks if the module is bound to a key.
*
* @return true if the module is bound, false otherwise.
*/
public boolean isBound() {
return key != Keyboard.CHAR_NONE;
}
}

View File

@ -0,0 +1,29 @@
package dev.revere.virago.api.module;
import lombok.Getter;
/**
* @author Remi
* @project Virago
* @date 3/17/2024
*/
@Getter
public enum EnumModuleType {
COMBAT("Combat"),
MOVEMENT("Movement"),
RENDER("Render"),
PLAYER("Player"),
MISC("Misc");
private final String name;
/**
* EnumModuleType constructor to initialize the module type.
*
* @param name the name of the module type
*/
EnumModuleType(String name) {
this.name = name;
}
}

View File

@ -0,0 +1,27 @@
package dev.revere.virago.api.module;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author Remi
* @project Virago
* @date 3/17/2024
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface ModuleData {
String name();
String displayName();
String description();
EnumModuleType type();
boolean isHidden() default false;
}

View File

@ -0,0 +1,48 @@
package dev.revere.virago.api.network.packet.client;
import lombok.var;
import java.util.Objects;
public final class C2SChat {
private final String content;
private final String jwt;
public C2SChat(
String content,
String jwt
) {
this.content = content;
this.jwt = jwt;
}
public String content() {
return content;
}
public String jwt() {
return jwt;
}
@Override
public boolean equals(Object obj) {
if (obj == this) return true;
if (obj == null || obj.getClass() != this.getClass()) return false;
var that = (C2SChat) obj;
return Objects.equals(this.content, that.content) &&
Objects.equals(this.jwt, that.jwt);
}
@Override
public int hashCode() {
return Objects.hash(content, jwt);
}
@Override
public String toString() {
return "C2SChat[" +
"content=" + content + ", " +
"jwt=" + jwt + ']';
}
}

View File

@ -0,0 +1,38 @@
package dev.revere.virago.api.network.packet.client;
import lombok.var;
import java.util.Objects;
public final class C2SLogin {
private final String licenseKey;
public C2SLogin(
String licenseKey
) {
this.licenseKey = licenseKey;
}
public String licenseKey() {
return licenseKey;
}
@Override
public boolean equals(Object obj) {
if (obj == this) return true;
if (obj == null || obj.getClass() != this.getClass()) return false;
var that = (C2SLogin) obj;
return Objects.equals(this.licenseKey, that.licenseKey);
}
@Override
public int hashCode() {
return Objects.hash(licenseKey);
}
@Override
public String toString() {
return "C2SLogin[" +
"licenseKey=" + licenseKey + ']';
}
}

View File

@ -0,0 +1,39 @@
package dev.revere.virago.api.network.packet.client;
import lombok.var;
import java.util.Objects;
public final class C2SUpdate {
private final String licenseKey;
public C2SUpdate(
String licenseKey
) {
this.licenseKey = licenseKey;
}
public String licenseKey() {
return licenseKey;
}
@Override
public boolean equals(Object obj) {
if (obj == this) return true;
if (obj == null || obj.getClass() != this.getClass()) return false;
var that = (C2SUpdate) obj;
return Objects.equals(this.licenseKey, that.licenseKey);
}
@Override
public int hashCode() {
return Objects.hash(licenseKey);
}
@Override
public String toString() {
return "C2SUpdateC[" +
"licenseKey=" + licenseKey + ']';
}
}

View File

@ -0,0 +1,74 @@
package dev.revere.virago.api.network.packet.server;
import lombok.var;
import java.util.Objects;
public final class S2CChat {
private final String code;
private final String author;
private final String rank;
private final String content;
private final Long timestamp;
public S2CChat(
String code,
String author,
String rank,
String content,
Long timestamp
) {
this.code = code;
this.author = author;
this.rank = rank;
this.content = content;
this.timestamp = timestamp;
}
public String code() {
return code;
}
public String author() {
return author;
}
public String rank() {
return rank;
}
public String content() {
return content;
}
public Long timestamp() {
return timestamp;
}
@Override
public boolean equals(Object obj) {
if (obj == this) return true;
if (obj == null || obj.getClass() != this.getClass()) return false;
var that = (S2CChat) obj;
return Objects.equals(this.code, that.code) &&
Objects.equals(this.author, that.author) &&
Objects.equals(this.rank, that.rank) &&
Objects.equals(this.content, that.content) &&
Objects.equals(this.timestamp, that.timestamp);
}
@Override
public int hashCode() {
return Objects.hash(code, author, rank, content, timestamp);
}
@Override
public String toString() {
return "S2CChat[" +
"code=" + code + ", " +
"author=" + author + ", " +
"rank=" + rank + ", " +
"content=" + content + ", " +
"timestamp=" + timestamp + ']';
}
}

View File

@ -0,0 +1,48 @@
package dev.revere.virago.api.network.packet.server;
import lombok.var;
import java.util.Objects;
public final class S2CChatReply {
private final String message;
private final boolean success;
public S2CChatReply(
String message,
boolean success
) {
this.message = message;
this.success = success;
}
public String message() {
return message;
}
public boolean success() {
return success;
}
@Override
public boolean equals(Object obj) {
if (obj == this) return true;
if (obj == null || obj.getClass() != this.getClass()) return false;
var that = (S2CChatReply) obj;
return Objects.equals(this.message, that.message) &&
this.success == that.success;
}
@Override
public int hashCode() {
return Objects.hash(message, success);
}
@Override
public String toString() {
return "S2CChatReply[" +
"message=" + message + ", " +
"success=" + success + ']';
}
}

View File

@ -0,0 +1,47 @@
package dev.revere.virago.api.network.packet.server;
import lombok.var;
import java.util.Objects;
public final class S2CLogin {
private final String code;
private final String jwtToken;
public S2CLogin(
String code,
String jwtToken
) {
this.code = code;
this.jwtToken = jwtToken;
}
public String code() {
return code;
}
public String jwtToken() {
return jwtToken;
}
@Override
public boolean equals(Object obj) {
if (obj == this) return true;
if (obj == null || obj.getClass() != this.getClass()) return false;
var that = (S2CLogin) obj;
return Objects.equals(this.code, that.code) &&
Objects.equals(this.jwtToken, that.jwtToken);
}
@Override
public int hashCode() {
return Objects.hash(code, jwtToken);
}
@Override
public String toString() {
return "S2CLogin[" +
"code=" + code + ", " +
"jwtToken=" + jwtToken + ']';
}
}

View File

@ -0,0 +1,92 @@
package dev.revere.virago.api.network.socket;
import dev.revere.virago.Virago;
import dev.revere.virago.api.network.packet.client.C2SLogin;
import dev.revere.virago.api.network.packet.client.C2SUpdate;
import dev.revere.virago.api.network.packet.server.S2CChat;
import dev.revere.virago.api.network.packet.server.S2CLogin;
import dev.revere.virago.api.protection.rank.Rank;
import dev.revere.virago.client.modules.misc.IRC;
import dev.revere.virago.client.services.ModuleService;
import dev.revere.virago.util.Logger;
import lombok.var;
import net.minecraft.client.Minecraft;
import net.minecraft.util.EnumChatFormatting;
import org.java_websocket.handshake.ServerHandshake;
import java.net.URI;
import java.util.Objects;
import static dev.revere.virago.api.network.socket.SocketHelper.createSocketConnection;
public class SocketClient {
public static String jwt;
private static String URL = "wss://virago-websocket.revere.dev";
private static String DEV = "ws://localhost:7376";
public static String key = "";
public static void init(String licenseKey) {
key = licenseKey;
createSocketConnection(URI.create(getURL("/auth/login")), new SocketHelper.WebSocketHandler() {
@Override
public void onOpen(ServerHandshake serverHandshake) {
send(new C2SLogin(licenseKey));
}
@Override
public void onMessage(String s) {
var packet = deserialize(s, S2CLogin.class);
if(packet.code().equals("200")) {
jwt = packet.jwtToken();
} else {
Minecraft.theMinecraft = null;
log("Result code: %s. Failure. " + packet.code());
}
}
});
refresh();
}
public static void refresh() {
createSocketConnection(URI.create(getURL("/chat/update")), new SocketHelper.WebSocketHandler() {
@Override
public void onOpen(ServerHandshake serverHandshake) {
send(new C2SUpdate(key));
}
@Override
public void onMessage(String s) {
var packet = deserialize(s, S2CChat.class);
if (Virago.getInstance().getServiceManager().getService(ModuleService.class).getModule(IRC.class).isEnabled()) {
Logger.addChatMessageNoPrefix(
String.format(
"%s[%sIRC%s]%s %s[%s%s%s]%s %s%s: %s%s",
EnumChatFormatting.DARK_GRAY, EnumChatFormatting.DARK_AQUA, EnumChatFormatting.DARK_GRAY, EnumChatFormatting.RESET,
EnumChatFormatting.DARK_GRAY,
Objects.requireNonNull(Rank.getRank(packet.rank())).getColor(),
packet.rank(),
EnumChatFormatting.DARK_GRAY,
EnumChatFormatting.RESET,
Objects.requireNonNull(Rank.getRank(packet.rank())).getColor(),
packet.author(),
EnumChatFormatting.RESET,
packet.content()
)
);
}
}
@Override
public void onClose(int i, String s, boolean b) {
refresh();
}
});
}
public static String getURL(String path) {
return String.format("%s%s", URL, path);
}
}

View File

@ -0,0 +1,82 @@
package dev.revere.virago.api.network.socket;
import com.google.gson.Gson;
import lombok.Setter;
import org.java_websocket.client.WebSocketClient;
import org.java_websocket.handshake.ServerHandshake;
import java.net.URI;
public class SocketHelper {
public static void createSocketConnection(URI uri, WebSocketHandler handler) {
WebSocketClient client = new WebSocketClient(uri) {
@Override
public void onOpen(ServerHandshake serverHandshake) {
handler.onOpen(serverHandshake);
}
@Override
public void onMessage(String s) {
handler.onMessage(s);
}
@Override
public void onClose(int i, String s, boolean b) {
handler.onClose(i, s, b);
}
@Override
public void onError(Exception e) {
handler.onError(e);
}
};
handler.setClient(client);
client.connect();
}
@Setter
public static class WebSocketHandler {
private WebSocketClient client;
private static final Gson gson = new Gson();
public void onOpen(ServerHandshake serverHandshake) {}
public void onMessage(String s) {}
public void onClose(int i, String s, boolean b) {}
public void onError(Exception e) {}
/**
* Send an object to the client.
* It will be serialized into JSON.
* @param object The object to send.
*/
protected void send(Object object) {
client.send(gson.toJson(object));
}
/**
* Deserialize the packet from JSON.
* @param packet The packet as a string
* @param clazz The packet type
* @return The deserialized packet
* @param <T> The type of the packet
*/
protected <T> T deserialize(String packet, Class<T> clazz) {
return gson.fromJson(packet, clazz);
}
/**
* Log to the console.
*/
protected void log(String value) {
System.out.printf("[SOCKET] [LOG]: %s\n", value);
}
/**
* Close the current session.
*/
protected void close() {
client.close();
}
}
}

View File

@ -0,0 +1,20 @@
package dev.revere.virago.api.protection;
import dev.revere.virago.api.protection.rank.Rank;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
/**
* @author Remi
* @project Virago
* @date 3/20/2024
*/
@Setter
@Getter
@AllArgsConstructor
public class ViragoUser {
private final String username;
private final String uid;
private final Rank rank;
}

View File

@ -0,0 +1,375 @@
package dev.revere.virago.api.protection.auth;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import dev.revere.virago.Virago;
import dev.revere.virago.api.network.socket.SocketClient;
import dev.revere.virago.api.protection.ViragoUser;
import dev.revere.virago.api.protection.rank.Rank;
import dev.revere.virago.client.gui.menu.CustomGuiMainMenu;
import dev.revere.virago.client.gui.menu.GuiLicenceKey;
import dev.revere.virago.client.gui.menu.GuiSelectDesign;
import dev.revere.virago.util.Logger;
import lombok.var;
import net.minecraft.client.Minecraft;
import javax.net.ssl.HttpsURLConnection;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.time.Instant;
import java.util.Base64;
import java.util.Enumeration;
import java.util.Scanner;
/**
* @author Remi
* @project Virago
* @date 3/20/2024
*/
public class Safelock {
private final String productKey;
private final String server;
private final String authorization;
private static final String UNKNOWN = "unknown";
private static String OS = System.getProperty("os.name").toLowerCase();
public Safelock(String licenseKey, String validationServer, String authorization) {
this.productKey = licenseKey;
this.server = validationServer;
this.authorization = authorization;
}
public boolean nigger() {
String[] respo = nigger4();
if (respo[0].equals("2") && Boolean.parseBoolean(respo[3])) {
return Boolean.parseBoolean(respo[3]);
} else if (respo[0].equals("3") && Boolean.parseBoolean(respo[3]) && Boolean.parseBoolean(respo[3])) {
return Boolean.parseBoolean(respo[3]);
} else {
return Boolean.parseBoolean(respo[3]);
}
}
private String nigger2(String productKey) throws IOException {
URL url = new URL(server);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("User-Agent", "Safelock");
con.setDoInput(true);
con.setDoOutput(true);
con.setUseCaches(false);
String outString = "{\"hwid\":\"password\",\"licensekey\":\"avain\",\"product\":\"NiceCar\",\"version\":\"dogpoop\"}";
outString = outString
.replaceAll("password", getNigger2())
.replaceAll("avain", productKey)
.replaceAll("NiceCar", Virago.getInstance().getName())
.replaceAll("dogpoop", Virago.getInstance().getVersion());
byte[] out = outString.getBytes(StandardCharsets.UTF_8);
con.setRequestProperty("Authorization", this.authorization);
con.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
con.connect();
try (OutputStream os = con.getOutputStream()) {
os.write(out);
}
if (!url.getHost().equals(con.getURL().getHost())) return "successful_authentication";
try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
String inputLine;
StringBuilder response = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
return response.toString();
}
}
private String nigger3(String productKey) throws IOException {
URL url = new URL(server);
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("User-Agent", "Safelock");
con.setDoInput(true);
con.setDoOutput(true);
con.setUseCaches(false);
String outString = "{\"hwid\":\"password\",\"licensekey\":\"avain\",\"product\":\"NiceCar\",\"version\":\"dogpoop\"}";
outString = outString
.replaceAll("password", getNigger2())
.replaceAll("avain", productKey)
.replaceAll("NiceCar", Virago.getInstance().getName())
.replaceAll("dogpoop", Virago.getInstance().getVersion());
byte[] out = outString.getBytes(StandardCharsets.UTF_8);
con.setRequestProperty("Authorization", this.authorization);
con.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
con.connect();
try (OutputStream os = con.getOutputStream()) {
os.write(out);
}
if (!url.getHost().equals(con.getURL().getHost())) return "successful_authentication";
try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
String inputLine;
StringBuilder response = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
return response.toString();
}
}
public String[] nigger4() {
try {
String response;
if (server.contains("http")) {
response = nigger2(productKey);
} else {
response = nigger3(productKey);
}
if (!response.contains("{")) {
GuiLicenceKey.status = "AUTHENTICATION FAILED";
return new String[]{"1", "ODD_RESULT", "420"};
}
String hash = null;
String version = null;
String rank = null;
String clientName = null;
Gson gson = new Gson();
var json = gson.fromJson(response, JsonObject.class);
String neekeri = json.get("status_msg").getAsString();
String status = json.get("status_overview").getAsString();
String statusCode = json.get("status_code").getAsString();
if (status.contains("success")) {
hash = json.get("status_id").toString().replaceAll("^\"|\"$", "").trim();
version = json.get("version").toString();
rank = json.get("tier").getAsString();
clientName = json.get("clientname").getAsString();
}
if (hash != null && version != null) {
String[] aa = hash.split("694201337");
String hashed = aa[0];
String decoded = new String(Base64.getDecoder().decode(hashed));
if (!decoded.equals(productKey.substring(0, 2) + productKey.substring(productKey.length() - 2) + authorization.substring(0, 2))) {
GuiLicenceKey.status = "AUTHENTICATION FAILED";
return new String[]{"1", "FAILED_AUTHENTICATION", statusCode, String.valueOf(false)};
}
String time = String.valueOf(Instant.now().getEpochSecond());
String unix = time.substring(0, time.length() - 2);
long t = Long.parseLong(unix);
long hashT = Long.parseLong(aa[1]);
if (Math.abs(t - hashT) > 1) {
GuiLicenceKey.status = "AUTHENTICATION FAILED";
return new String[]{"1", "FAILED_AUTHENTICATION", statusCode, String.valueOf(false)};
}
}
int statusLength = status.length();
if (version != null && !version.equals("\"" + Virago.getInstance().getVersion() + "\"")
&& status.contains("success") && response.contains("success")
&& String.valueOf(statusLength).equals("7")) {
GuiLicenceKey.status = "OUTDATED | LATEST VER: " + version.replaceAll("^\"|\"$", "");
return new String[]{"3", "OUTDATED_VERSION#" + version, statusCode, String.valueOf(true)};
}
if (neekeri.contains("BLACKLISTED")) {
GuiLicenceKey.status = "YOU ARE BLACKLISTED";
return new String[]{"1", neekeri, statusCode, String.valueOf(false)};
}
statusLength = status.length();
if (!isValidLength(statusLength)) {
GuiLicenceKey.status = "AUTHENTICATION FAILED";
return new String[]{"1", neekeri, statusCode, String.valueOf(false)};
}
final boolean valid = status.contains("success") && response.contains("success") && String.valueOf(statusLength).equals("7");
GuiLicenceKey.isAuthorized = valid;
if (valid) {
Logger.info(Rank.getRank(rank) + " " + clientName, getClass());
Virago.getInstance().setViragoUser(new ViragoUser(clientName, "0001", Rank.getRank(rank)));
SocketClient.init(productKey);
Virago.getInstance().getDiscordRPC().update("Virago Client v" + Virago.getInstance().getVersion() + " | " + clientName, "discord.gg/virago");
Minecraft.getMinecraft().displayGuiScreen(new GuiSelectDesign());
}
return new String[]{valid ? "2" : "1", neekeri, statusCode, String.valueOf(valid)};
} catch (IOException ex) {
if (ex.getMessage().contains("429")) {
GuiLicenceKey.status = "RATE_LIMITED";
return new String[]{"1", "ERROR", "You are being rate limited because of sending too many requests", String.valueOf(false)};
}
ex.printStackTrace();
GuiLicenceKey.status = "ERROR";
return new String[]{"1", "ERROR", ex.getMessage(), String.valueOf(false)};
}
}
public boolean isValidLength(int reps) {
return reps == 7;
}
public boolean isValidLength22(int reps) {
return reps == 11;
}
public boolean isValidLength222(int reps) {
return reps == 44;
}
public boolean isValidLength2222(int reps) {
return reps == 48;
}
public String getNigger1() throws SocketException {
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
StringBuilder sb = new StringBuilder();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface ni = networkInterfaces.nextElement();
byte[] hardwareAddress = ni.getHardwareAddress();
if (hardwareAddress != null) {
for (byte address : hardwareAddress) {
sb.append(String.format("%02X", address));
}
return sb.toString();
}
}
return null;
}
public static String getNigger2() {
try {
if (isNigger1()) {
return getNigger5();
} else if (isNigger2()) {
return getNigger4();
} else if (isNigger3()) {
return getNigger3();
} else {
return UNKNOWN;
}
} catch (Exception e) {
return UNKNOWN;
}
}
private static boolean isNigger1() {
return (OS.contains("win"));
}
private static boolean isNigger2() {
return (OS.contains("mac"));
}
private static boolean isNigger3() {
return (OS.contains("inux"));
}
private static String getNigger3() throws FileNotFoundException, NoSuchAlgorithmException {
File machineId = new File("/var/lib/dbus/machine-id");
if (!machineId.exists()) {
machineId = new File("/etc/machine-id");
}
if (!machineId.exists()) {
return UNKNOWN;
}
Scanner scanner = null;
try {
scanner = new Scanner(machineId);
String id = scanner.useDelimiter("\\A").next();
return hexStringify(sha256Hash(id.getBytes()));
} finally {
if (scanner != null) {
scanner.close();
}
}
}
private static String getNigger4() throws SocketException, NoSuchAlgorithmException {
NetworkInterface networkInterface = NetworkInterface.getByName("en0");
byte[] hardwareAddress = networkInterface.getHardwareAddress();
return hexStringify(sha256Hash(hardwareAddress));
}
private static String getNigger5() throws IOException, NoSuchAlgorithmException {
Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec(new String[]{"wmic", "csproduct", "get", "UUID"});
String result = null;
InputStream is = process.getInputStream();
Scanner sc = new Scanner(process.getInputStream());
try {
while (sc.hasNext()) {
String next = sc.next();
if (next.contains("UUID")) {
result = sc.next().trim();
break;
}
}
} finally {
is.close();
}
return result == null ? UNKNOWN : hexStringify(sha256Hash(result.getBytes()));
}
/**
* Compute the SHA-256 hash of the given byte array
*
* @param data the byte array to hash
* @return the hashed byte array
* @throws NoSuchAlgorithmException
*/
public static byte[] sha256Hash(byte[] data) throws NoSuchAlgorithmException {
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
return messageDigest.digest(data);
}
/**
* Convert a byte array to its hex-string
*
* @param data the byte array to convert
* @return the hex-string of the byte array
*/
public static String hexStringify(byte[] data) {
StringBuilder stringBuilder = new StringBuilder();
for (byte singleByte : data) {
stringBuilder.append(Integer.toString((singleByte & 0xff) + 0x100, 16).substring(1));
}
return stringBuilder.toString();
}
}

View File

@ -0,0 +1,130 @@
package dev.revere.virago.api.protection.rank;
import lombok.Getter;
import net.minecraft.util.EnumChatFormatting;
/**
* @author Remi
* @project Virago
* @date 3/20/2024
*/
@Getter
public enum Rank {
USER("User", EnumChatFormatting.WHITE),
TESTER("Tester", EnumChatFormatting.YELLOW),
MEDIA("Media", EnumChatFormatting.GOLD),
STAFF("Staff", EnumChatFormatting.LIGHT_PURPLE),
DEVELOPER("Developer", EnumChatFormatting.AQUA),
CONSOLE("#", EnumChatFormatting.DARK_RED)
;
private final String rankName;
private final EnumChatFormatting color;
Rank(String rankName, EnumChatFormatting color) {
this.rankName = rankName;
this.color = color;
}
/**
* Is staff boolean.
*
* @return the boolean
*/
public boolean isStaff() {
return this == STAFF;
}
/**
* Is developer boolean.
*
* @return the boolean
*/
public boolean isDeveloper() {
return this == DEVELOPER;
}
/**
* Is tester boolean.
*
* @return the boolean
*/
public boolean isTester() {
return this == TESTER;
}
/**
* Is media boolean.
*
* @return the boolean
*/
public boolean isMedia() {
return this == MEDIA;
}
/**
* Is user boolean.
*
* @return the boolean
*/
public boolean isUser() {
return this == USER;
}
/**
* Is higher than boolean.
*
* @param rank the rank
* @return the boolean
*/
public boolean isHigherThan(Rank rank) {
return this.ordinal() > rank.ordinal();
}
/**
* Is lower than boolean.
*
* @param rank the rank
* @return the boolean
*/
public boolean isLowerThan(Rank rank) {
return this.ordinal() < rank.ordinal();
}
/**
* Is higher or equal boolean.
*
* @param rank the rank
* @return the boolean
*/
public boolean isHigherOrEqual(Rank rank) {
return this.ordinal() >= rank.ordinal();
}
/**
* Is lower or equal boolean.
*
* @param rank the rank
* @return the boolean
*/
public boolean isLowerOrEqual(Rank rank) {
return this.ordinal() <= rank.ordinal();
}
/**
* Gets a rank by name.
*
* @param name the name
* @return the rank
*/
public static Rank getRank(String name) {
for (Rank rank : values()) {
if (rank.getRankName().equalsIgnoreCase(name)) {
return rank;
}
}
return null;
}
}

View File

@ -0,0 +1,30 @@
package dev.revere.virago.api.service;
/**
* @author Remi
* @project Virago
* @date 3/17/2024
*/
public interface IService {
/**
* Initializes the service.
*/
default void initService() {}
/**
* Starts the service.
*/
default void startService() {}
/**
* Stops the service.
*/
default void stopService() {}
/**
* Destroys the service.
* Save tasks must be performed here.
* This method is called when all other activities are done.
*/
default void destroyService() {}
}

View File

@ -0,0 +1,35 @@
package dev.revere.virago.api.service;
import lombok.Getter;
import java.util.LinkedHashMap;
/**
* @author Remi
* @project Virago
* @date 3/17/2024
*/
public class ServiceManager {
@Getter
private final LinkedHashMap<Class<?>, IService> services = new LinkedHashMap<>();
/**
* Get the instance of a service by class
*
* @param service the class of the service
* @param <T> the type of the service
* @return the instance of the service
*/
public <T extends IService> T getService(Class<T> service) {
return (T) services.get(service);
}
/**
* Add a new service to the map
*
* @param serviceInstance the instance of the service
*/
public void addService(IService serviceInstance) {
services.put(serviceInstance.getClass(), serviceInstance);
}
}

View File

@ -0,0 +1,157 @@
package dev.revere.virago.api.setting;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Supplier;
/**
* @author Remi
* @project Virago
* @date 3/22/2024
*/
@Setter
@Getter
public class Setting<T> {
@Getter private final String name;
@Getter private String description = "";
private Supplier<Boolean> visibility = () -> true;
@Getter private Setting<?> parent = null;
@Getter private List<Setting<?>> children = new ArrayList<>();
@Getter protected T value;
@Getter private T defaultValue;
@Getter private T minimum;
@Getter private T maximum;
@Getter private T incrementation;
@Getter private int index = 0;
public Setting(String name, T value) {
this.name = name;
this.value = value;
this.defaultValue = value;
if (getValue() instanceof Enum<?>) {
index = ((Enum<?>) value).ordinal();
}
}
/**
* Get the mode of the setting.
*
* @param previous If the mode should be the previous mode.
* @return The mode.
*/
public T getMode(boolean previous) {
if (getValue() instanceof Enum<?>) {
Enum<?> enumeration = (Enum<?>) getValue();
String[] values = Arrays.stream(enumeration.getClass().getEnumConstants()).map(Enum::name).toArray(String[]::new);
if (!previous) {
index = index + 1 > values.length - 1 ? 0 : index + 1;
} else {
index = index - 1 < 0 ? values.length - 1 : index - 1;
}
return (T) Enum.valueOf(enumeration.getClass(), values[index]);
}
return null;
}
/**
* Set the minimum value of the setting.
*
* @param minimum The minimum value.
* @return The setting.
*/
public Setting<T> minimum(T minimum) {
this.minimum = minimum;
return this;
}
/**
* Set the maximum value of the setting.
*
* @param maximum The maximum value.
* @return The setting.
*/
public Setting<T> maximum(T maximum) {
this.maximum = maximum;
return this;
}
/**
* Set the incrementation value of the setting.
*
* @param incrementation The incrementation value.
* @return The setting.
*/
public Setting<T> incrementation(T incrementation) {
this.incrementation = incrementation;
return this;
}
/**
* Set the description of the setting.
*
* @param description The description.
* @return The setting.
*/
public Setting<T> describedBy(String description) {
this.description = description;
return this;
}
/**
* Set the visibility of the setting.
*
* @param visibility The visibility.
* @return The setting.
*/
public Setting<T> visibleWhen(Supplier<Boolean> visibility) {
this.visibility = visibility;
return this;
}
/**
* Set the parent of the setting.
*
* @param parent The parent.
* @return The setting.
*/
public Setting<T> childOf(Setting<?> parent) {
this.parent = parent;
this.parent.children.add(this);
return this;
}
public String getPath() {
return getParent() == null ? getName() : getParent().getPath() + getName();
}
public List<Setting<?>> getHierarchy() {
List<Setting<?>> hierarchy = new ArrayList<>();
for (Setting<?> subsetting : getChildren()) {
hierarchy.add(subsetting);
hierarchy.addAll(subsetting.getHierarchy());
}
return hierarchy;
}
public boolean isVisible() {
return visibility.get();
}
}

View File

@ -0,0 +1,23 @@
package dev.revere.virago.client.checks.combat;
import dev.revere.virago.api.anticheat.AbstractCheck;
import dev.revere.virago.api.anticheat.CheckData;
import dev.revere.virago.api.anticheat.EnumCheckType;
import net.minecraft.entity.player.EntityPlayer;
/**
* @author Zion
* @project Virago-Client
* @date 4/19/2024
*/
@CheckData(name = "Invalid", description = "Checks for invalid rotations", type = EnumCheckType.COMBAT)
public class InvalidCheck extends AbstractCheck {
@Override
public boolean runCheck(EntityPlayer player) {
if(player.rotationPitch > 90.0F) {
return true;
} else {
return Math.round(player.motionX) > 5.0F || Math.round(player.motionY) > 5.0F || Math.round(player.motionZ) > 5.0F;
}
}
}

View File

@ -0,0 +1,19 @@
package dev.revere.virago.client.checks.combat;
import dev.revere.virago.api.anticheat.AbstractCheck;
import dev.revere.virago.api.anticheat.CheckData;
import dev.revere.virago.api.anticheat.EnumCheckType;
import net.minecraft.entity.player.EntityPlayer;
/**
* @author Remi
* @project Virago-Client
* @date 4/19/2024
*/
@CheckData(name = "Velocity", description = "Checks for velocity modifications.", type = EnumCheckType.COMBAT)
public class VelocityCheck extends AbstractCheck {
@Override
public boolean runCheck(EntityPlayer player) {
return false;
}
}

View File

@ -0,0 +1,28 @@
package dev.revere.virago.client.checks.movement;
import dev.revere.virago.api.anticheat.AbstractCheck;
import dev.revere.virago.api.anticheat.CheckData;
import dev.revere.virago.api.anticheat.EnumCheckType;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
/**
* @author Zion
* @project Virago-Client
* @date 4/19/2024
*/
@CheckData(name = "Speed", description = "Checks for speed modifications.", type = EnumCheckType.MOVEMENT)
public class SpeedCheck extends AbstractCheck {
@Override
public boolean runCheck(EntityPlayer player) {
if(!player.capabilities.isFlying) {
String motionX = String.valueOf(player.motionX);
if(player.isBlocking() && player.onGround && (player.motionX > 0.1F || motionX.startsWith("0.1"))) return true;
if(player.isSneaking() && player.onGround && player.motionZ > 0.05F) return true;
if(player.onGround && Math.round(player.motionY) != 0L) return true;
}
return player.isSneaking() && player.onGround && !player.velocityChanged && player.hurtTime != 0;
}
}

View File

@ -0,0 +1,53 @@
package dev.revere.virago.client.commands;
import dev.revere.virago.Virago;
import dev.revere.virago.api.command.AbstractCommand;
import dev.revere.virago.api.command.CommandData;
import dev.revere.virago.client.notification.NotificationType;
import dev.revere.virago.client.services.ModuleService;
import dev.revere.virago.client.services.NotificationService;
import dev.revere.virago.util.Logger;
import org.lwjgl.input.Keyboard;
/**
* @author Remi
* @project Virago
* @date 3/21/2024
*/
@CommandData(aliases = {"bind"}, description = "Bind a module to a key", syntax = "<add/remove> <module> <key>")
public class BindCommand extends AbstractCommand {
@Override
public void executeCommand(String line, String[] args) {
NotificationService notificationService = Virago.getInstance().getServiceManager().getService(NotificationService.class);
ModuleService moduleService = Virago.getInstance().getServiceManager().getService(ModuleService.class);
if (args.length < 3) {
notificationService.notify(NotificationType.NO, "Command Manager", "Please follow the syntax! " + getSyntax());
return;
}
String action = args[1];
String moduleName = args[2];
if (moduleService.getModuleByName(moduleName) == null) {
notificationService.notify(NotificationType.NO, "Command Manager", "Module not found!");
return;
}
if (action.equalsIgnoreCase("add")) {
if (args.length < 4) {
notificationService.notify(NotificationType.NO, "Command Manager", "Please provide a key!");
return;
}
String key = args[3];
moduleService.getModuleByName(moduleName).setKey(Keyboard.getKeyIndex(key.toUpperCase()));
notificationService.notify(NotificationType.YES, "Command Manager", "Bound " + moduleName + " to " + key);
} else if (action.equalsIgnoreCase("remove")) {
moduleService.getModuleByName(moduleName).setKey(Keyboard.KEY_NONE);
notificationService.notify(NotificationType.YES, "Command Manager", "Unbound " + moduleName);
} else {
notificationService.notify(NotificationType.NO, "Command Manager", "Invalid action! " + getSyntax());
}
}
}

View File

@ -0,0 +1,87 @@
package dev.revere.virago.client.commands;
import dev.revere.virago.Virago;
import dev.revere.virago.api.command.AbstractCommand;
import dev.revere.virago.api.command.CommandData;
import dev.revere.virago.client.notification.NotificationType;
import dev.revere.virago.client.services.ConfigService;
import dev.revere.virago.client.services.NotificationService;
import dev.revere.virago.util.Logger;
import java.io.File;
/**
* @author Remi
* @project Virago-Client
* @date 4/6/2024
*/
@CommandData(aliases = {"config", "c"}, description = "Manage client configuration", syntax = "<load/save/delete/list>")
public class ConfigCommand extends AbstractCommand {
@Override
public void executeCommand(String line, String[] args) {
NotificationService notificationService = Virago.getInstance().getServiceManager().getService(NotificationService.class);
ConfigService service = Virago.getInstance().getServiceManager().getService(ConfigService.class);
if (args.length < 2) {
notificationService.notify(NotificationType.NO, "Config Manager", "Please provide an option! " + getSyntax());
return;
}
if (args.length < 3 && !"list".equals(args[1])) {
if ("load".equals(args[1]) || "delete".equals(args[1]) || "save".equals(args[1])) {
notificationService.notify(NotificationType.NO, "Config Manager", "Please provide a config name!");
return;
}
return;
}
String action = args[1];
if ("list".equals(action)) {
listConfigs();
return;
}
String name = args[2];
switch (action) {
case "load":
if (service.configExists(name)) {
service.loadConfig(name);
notificationService.notify(NotificationType.YES, "Config Manager", "Successfully loaded config " + name);
} else {
notificationService.notify(NotificationType.NO, "Config Manager", "Config " + name + " does not exist");
}
break;
case "save":
service.saveConfig(name);
notificationService.notify(NotificationType.YES, "Config Manager", "Successfully saved config " + name);
break;
case "delete":
if (service.configExists(name)) {
service.deleteConfig(name);
notificationService.notify(NotificationType.YES, "Config Manager", "Successfully deleted config " + name);
} else {
notificationService.notify(NotificationType.NO, "Config Manager", "Config " + name + " does not exist");
}
break;
}
}
private void listConfigs() {
NotificationService notificationService = Virago.getInstance().getServiceManager().getService(NotificationService.class);
ConfigService service = Virago.getInstance().getServiceManager().getService(ConfigService.class);
File[] configs = service.listConfigs();
if (configs != null && configs.length > 0) {
StringBuilder message = new StringBuilder("Available configs: ");
for (File config : configs) {
message.append(config.getName()).append(", ");
}
message.delete(message.length() - 2, message.length());
Logger.addChatMessage(message.toString().replace(".json", ""));
} else {
notificationService.notify(NotificationType.NO, "Config Manager", "No configs found");
}
}
}

View File

@ -0,0 +1,82 @@
package dev.revere.virago.client.commands;
import dev.revere.virago.Virago;
import dev.revere.virago.api.command.AbstractCommand;
import dev.revere.virago.api.command.CommandData;
import dev.revere.virago.client.notification.NotificationType;
import dev.revere.virago.client.services.FriendService;
import dev.revere.virago.client.services.ModuleService;
import dev.revere.virago.client.services.NotificationService;
import dev.revere.virago.util.Logger;
import net.optifine.Log;
/**
* @author Remi
* @project Virago
* @date 3/21/2024
*/
@CommandData(aliases = {"friend"}, description = "Toggle a module", syntax = "<add/remove/list/clear> <player>")
public class FriendCommand extends AbstractCommand {
@Override
public void executeCommand(String line, String[] args) {
FriendService service = Virago.getInstance().getServiceManager().getService(FriendService.class);
NotificationService notificationService = Virago.getInstance().getServiceManager().getService(NotificationService.class);
if (args.length < 2) {
notificationService.notify(NotificationType.NO, "Command Manager", "Please provide an option! " + getSyntax());
return;
}
if (args.length < 3 && !"list".equals(args[1]) && !args[1].equalsIgnoreCase("clear")) {
if ("remove".equals(args[1]) || "add".equals(args[1])) {
notificationService.notify(NotificationType.NO, "Command Manager", "Please provide a player!");
return;
}
return;
}
String option = args[1].toLowerCase();
switch(option) {
case "remove": {
String player = args[2];
if(!service.isFriend(player)) {
notificationService.notify(NotificationType.NO, "Command Manager", "You do not have " + player + " as a friend.");
break;
}
service.removeFriend(player);
notificationService.notify(NotificationType.YES, "Command Manager", "You have removed " + player + " from your friend list.");
break;
}
case "add": {
String player = args[2];
if(service.isFriend(player)) {
notificationService.notify(NotificationType.NO, "Command Manager", "You already have " + player + " as a friend.");
break;
}
service.addFriend(player);
notificationService.notify(NotificationType.YES, "Command Manager", "You have added " + player + " to your friend list.");
break;
}
case "list": {
if (service.getFriends().isEmpty()) {
notificationService.notify(NotificationType.NO, "Command Manager", "You do not have any friends.");
break;
}
Logger.addChatMessage("Friends: " + service.getFriends().toString().replace("[", "").replace("]", ""));
break;
}
case "clear": {
service.getFriends().clear();
notificationService.notify(NotificationType.YES, "Command Manager", "You have cleared your friends list.");
break;
}
}
}
}

View File

@ -0,0 +1,29 @@
package dev.revere.virago.client.commands;
import dev.revere.virago.Virago;
import dev.revere.virago.api.command.AbstractCommand;
import dev.revere.virago.api.command.CommandData;
import dev.revere.virago.client.services.CommandService;
import dev.revere.virago.util.Logger;
/**
* @author Remi
* @project Virago
* @date 3/21/2024
*/
@CommandData(aliases = {"help"}, description = "Display a list of commands", syntax = "help")
public class HelpCommand extends AbstractCommand {
@Override
public void executeCommand(String line, String[] args) {
Logger.addChatMessage("\u00a77\u00a7m------------------------");
for (AbstractCommand command : Virago.getInstance().getServiceManager().getService(CommandService.class).getCommands().values()) {
String aliases = String.join(", ", command.getAliases());
String description = command.getDescription();
String syntax = command.getSyntax();
Logger.addChatMessage("\u00a73" + aliases + " \u00a7f" + syntax + " \u00a77-\u00a7f " + description);
}
Logger.addChatMessage("\u00a77\u00a7m------------------------");
}
}

View File

@ -0,0 +1,43 @@
package dev.revere.virago.client.commands;
import dev.revere.virago.Virago;
import dev.revere.virago.api.command.AbstractCommand;
import dev.revere.virago.api.command.CommandData;
import dev.revere.virago.client.notification.NotificationType;
import dev.revere.virago.client.services.ModuleService;
import dev.revere.virago.client.services.NotificationService;
import dev.revere.virago.util.Logger;
/**
* @author Remi
* @project Virago-Client
* @date 4/13/2024
*/
@CommandData(aliases = {"hide"}, description = "Hide a module", syntax = "<module>")
public class HideCommand extends AbstractCommand {
@Override
public void executeCommand(String line, String[] args) {
ModuleService moduleService = Virago.getInstance().getServiceManager().getService(ModuleService.class);
NotificationService notificationService = Virago.getInstance().getServiceManager().getService(NotificationService.class);
if (args.length < 2) {
notificationService.notify(NotificationType.NO, "Command Manager", "Please provide a module name!");
return;
}
String moduleName = args[1].replace("&", " ");
if (moduleService.getModuleByName(moduleName) == null) {
notificationService.notify(NotificationType.NO, "Command Manager", "Module not found!");
return;
}
if (moduleService.getModuleByName(moduleName).isHidden()) {
moduleService.getModuleByName(moduleName).setHidden(false);
notificationService.notify(NotificationType.YES, "Command Manager", "Module " + moduleName + " is now visible");
} else {
moduleService.getModuleByName(moduleName).setHidden(true);
notificationService.notify(NotificationType.YES, "Command Manager", "Module " + moduleName + " is now hidden");
}
}
}

View File

@ -0,0 +1,35 @@
package dev.revere.virago.client.commands;
import dev.revere.virago.Virago;
import dev.revere.virago.api.command.AbstractCommand;
import dev.revere.virago.api.command.CommandData;
import dev.revere.virago.client.notification.NotificationType;
import dev.revere.virago.client.services.CommandService;
import dev.revere.virago.client.services.NotificationService;
import dev.revere.virago.util.Logger;
import net.minecraft.client.Minecraft;
import java.awt.*;
import java.awt.datatransfer.StringSelection;
/**
* @author Zion
* @project Virago-Client
* @date 28/04/2024
*/
@CommandData(aliases = {"name"}, description = "Copy your name to clipboard.", syntax = "help")
public class NameCommand extends AbstractCommand {
@Override
public void executeCommand(String line, String[] args) {
String sessionName = Minecraft.getMinecraft().getSession().getUsername();
copyToClipboard(sessionName);
Virago.getInstance().getServiceManager().getService(NotificationService.class).notify(NotificationType.INFO, "Name Copied", "Copied " + sessionName + " to clipboard");
}
private void copyToClipboard(String toCopy) {
StringSelection selection = new StringSelection(toCopy);
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, null);
}
}

View File

@ -0,0 +1,27 @@
package dev.revere.virago.client.commands;
import dev.revere.virago.Virago;
import dev.revere.virago.api.command.AbstractCommand;
import dev.revere.virago.api.command.CommandData;
import dev.revere.virago.client.notification.NotificationType;
import dev.revere.virago.client.services.ModuleService;
import dev.revere.virago.client.services.NotificationService;
import dev.revere.virago.util.Logger;
import org.lwjgl.input.Keyboard;
import java.awt.*;
/**
* @author Remi
* @project Virago
* @date 3/21/2024
*/
@CommandData(aliases = {"setting"}, description = "Change a setting", syntax = "<module> <setting> <value>")
public class SettingCommand extends AbstractCommand {
@Override
public void executeCommand(String line, String[] args) {
NotificationService notificationService = Virago.getInstance().getServiceManager().getService(NotificationService.class);
notificationService.notify(NotificationType.ERROR, "Command Manager", "This command is not yet implemented.");
}
}

View File

@ -0,0 +1,40 @@
package dev.revere.virago.client.commands;
import dev.revere.virago.Virago;
import dev.revere.virago.api.command.AbstractCommand;
import dev.revere.virago.api.command.CommandData;
import dev.revere.virago.client.notification.NotificationType;
import dev.revere.virago.client.services.ModuleService;
import dev.revere.virago.client.services.NotificationService;
import dev.revere.virago.util.Logger;
/**
* @author Remi
* @project Virago
* @date 3/21/2024
*/
@CommandData(aliases = {"toggle", "t"}, description = "Toggle a module", syntax = "<module>")
public class ToggleCommand extends AbstractCommand {
@Override
public void executeCommand(String line, String[] args) {
ModuleService moduleService = Virago.getInstance().getServiceManager().getService(ModuleService.class);
NotificationService notificationService = Virago.getInstance().getServiceManager().getService(NotificationService.class);
if (args.length < 2) {
notificationService.notify(NotificationType.NO, "Command Manager", "Please provide a module name!");
return;
}
String moduleName = args[1].replace("&", " ");
if (moduleService.getModuleByName(moduleName) == null) {
notificationService.notify(NotificationType.NO, "Command Manager", "Module not found!");
return;
}
String toggled = moduleService.getModuleByName(moduleName).isEnabled() ? "disabled" : "enabled";
moduleService.getModuleByName(moduleName).toggleSilent();
notificationService.notify(NotificationType.YES, "Command Manager", "Module " + moduleName + " is now " + toggled);
}
}

View File

@ -0,0 +1,16 @@
package dev.revere.virago.client.events.attack;
import dev.revere.virago.api.event.Event;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.entity.Entity;
@Getter
@Setter
public class AttackEvent extends Event {
private Entity target;
public AttackEvent(Entity target) {
this.target = target;
}
}

View File

@ -0,0 +1,11 @@
package dev.revere.virago.client.events.game;
import dev.revere.virago.api.event.Event;
/**
* @author Remi
* @project Virago
* @date 3/17/2024
*/
public class TickEvent extends Event {
}

View File

@ -0,0 +1,25 @@
package dev.revere.virago.client.events.input;
import dev.revere.virago.api.event.Event;
import lombok.Getter;
import lombok.Setter;
/**
* @author Remi
* @project Virago
* @date 3/17/2024
*/
@Getter
@Setter
public class KeyDownEvent extends Event {
private int key;
/**
* KeyDownEvent constructor to initialize the event.
*
* @param key the key that was pressed
*/
public KeyDownEvent(int key) {
this.key = key;
}
}

View File

@ -0,0 +1,25 @@
package dev.revere.virago.client.events.input;
import dev.revere.virago.api.event.Event;
import lombok.Getter;
import lombok.Setter;
/**
* @author Remi
* @project Virago
* @date 3/17/2024
*/
@Getter
@Setter
public class KeyUpEvent extends Event {
private int key;
/**
* KeyUpEvent constructor to initialize the event.
*
* @param key the key that was released
*/
public KeyUpEvent(int key) {
this.key = key;
}
}

View File

@ -0,0 +1,31 @@
package dev.revere.virago.client.events.packet;
import dev.revere.virago.api.event.Event;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.network.Packet;
/**
* @author Remi
* @project nigger
* @date 3/28/2024
*/
@Setter
@Getter
public class PacketEvent extends Event {
private final EventState eventState;
private Packet packet;
public PacketEvent(EventState eventState, Packet packet) {
this.eventState = eventState;
this.packet = packet;
}
public enum EventState{
RECEIVING,
SENDING
}
public <T extends Packet> T getPacket() {
return (T) packet;
}
}

View File

@ -0,0 +1,32 @@
package dev.revere.virago.client.events.packet;
import dev.revere.virago.api.event.Event;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.network.play.client.C03PacketPlayer;
/**
* @author Remi
* @project Virago-Client
* @date 4/7/2024
*/
@Setter
@Getter
public class TeleportEvent extends Event {
private C03PacketPlayer packetPlayer;
private double posX;
private double posY;
private double posZ;
private float yaw;
private float pitch;
public TeleportEvent(C03PacketPlayer packetPlayer, double posX, double posY, double posZ, float yaw, float pitch) {
this.packetPlayer = packetPlayer;
this.posX = posX;
this.posY = posY;
this.posZ = posZ;
this.yaw = yaw;
this.pitch = pitch;
}
}

View File

@ -0,0 +1,30 @@
package dev.revere.virago.client.events.player;
import dev.revere.virago.api.event.Event;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.entity.Entity;
import net.minecraft.util.Vec3;
/**
* @author Remi
* @project Virago
* @date 3/18/2024
*/
@Setter
@Getter
public class EventEntityOptionalForce extends Event {
private Entity entity;
private Vec3 minor;
/**
* EventEntityOptionalForce constructor to initialize the event.
*
* @param e the entity that was forced
* @param vec3 the vector that was forced
*/
public EventEntityOptionalForce(Entity e, Vec3 vec3) {
this.entity = e;
this.minor = vec3;
}
}

View File

@ -0,0 +1,13 @@
package dev.revere.virago.client.events.player;
import dev.revere.virago.api.event.Event;
import lombok.Getter;
@Getter
public class IRCEvent extends Event {
private final String message;
public IRCEvent(String message) {
this.message = message;
}
}

View File

@ -0,0 +1,6 @@
package dev.revere.virago.client.events.player;
import dev.revere.virago.api.event.Event;
public class JoinEvent extends Event {
}

View File

@ -0,0 +1,6 @@
package dev.revere.virago.client.events.player;
import dev.revere.virago.api.event.Event;
public class LeaveEvent extends Event {
}

View File

@ -0,0 +1,31 @@
package dev.revere.virago.client.events.player;
import dev.revere.virago.api.event.Event;
import lombok.Getter;
import lombok.Setter;
/**
* @author Remi
* @project Virago
* @date 3/17/2024
*/
@Setter
@Getter
public class MoveEvent extends Event {
private double x;
private double y;
private double z;
/**
* MoveEvent constructor to initialize the event.
*
* @param x the x position of the player
* @param y the y position of the player
* @param z the z position of the player
*/
public MoveEvent(double x, double y, double z) {
this.x = x;
this.y = y;
this.z = z;
}
}

View File

@ -0,0 +1,40 @@
package dev.revere.virago.client.events.player;
import dev.revere.virago.api.event.Event;
import lombok.Getter;
import lombok.Setter;
/**
* @author Remi
* @project Virago
* @date 3/17/2024
*/
@Setter
@Getter
public class PostMotionEvent extends Event {
private float yaw;
private float pitch;
private boolean ground;
private double x;
private double y;
private double z;
/**
* PreUpdateEvent constructor to initialize the event.
*
* @param yaw the yaw of the player
* @param pitch the pitch of the player
* @param x the x position of the player
* @param y the y position of the player
* @param z the z position of the player
* @param ground the ground state of the player
*/
public PostMotionEvent(float yaw, float pitch, double x, double y, double z, boolean ground) {
this.yaw = yaw;
this.pitch = pitch;
this.x = x;
this.y = y;
this.z = z;
this.ground = ground;
}
}

View File

@ -0,0 +1,45 @@
package dev.revere.virago.client.events.player;
import dev.revere.virago.api.event.Event;
import lombok.Getter;
import lombok.Setter;
/**
* @author Remi
* @project Virago
* @date 3/17/2024
*/
@Setter
@Getter
public class PreMotionEvent extends Event {
private float yaw;
private float pitch;
private boolean ground;
private double x;
private double y;
private double z;
/**
* PreUpdateEvent constructor to initialize the event.
*
* @param yaw the yaw of the player
* @param pitch the pitch of the player
* @param x the x position of the player
* @param y the y position of the player
* @param z the z position of the player
* @param ground the ground state of the player
*/
public PreMotionEvent(float yaw, float pitch, double x, double y, double z, boolean ground) {
this.yaw = yaw;
this.pitch = pitch;
this.x = x;
this.y = y;
this.z = z;
this.ground = ground;
}
public void setRotations(float[] rotations) {
this.yaw = rotations[0];
this.pitch = rotations[1];
}
}

View File

@ -0,0 +1,11 @@
package dev.revere.virago.client.events.player;
import dev.revere.virago.api.event.Event;
/**
* @author Remi
* @project Virago
* @date 5/1/2024
*/
public class SafeWalkEvent extends Event {
}

View File

@ -0,0 +1,23 @@
package dev.revere.virago.client.events.player;
import dev.revere.virago.api.event.Event;
import lombok.Data;
/**
* @author Remi
* @project Virago
* @date 3/26/2024
*/
@Data
public class StrafeEvent extends Event {
private float forward, strafe, friction, attributeSpeed, yaw, pitch;
public StrafeEvent(float forward, float strafe, float friction, float attributeSpeed, float yaw, float pitch) {
this.forward = forward;
this.strafe = strafe;
this.friction = friction;
this.attributeSpeed = attributeSpeed;
this.yaw = yaw;
this.pitch = pitch;
}
}

View File

@ -0,0 +1,64 @@
package dev.revere.virago.client.events.player;
import dev.revere.virago.api.event.Event;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.Minecraft;
/**
* @author Remi
* @project Virago
* @date 3/17/2024
*/
@Setter
@Getter
public class UpdateEvent extends Event {
private boolean onGround;
private float yaw;
private float pitch;
private double y;
private boolean pre;
/**
* UpdateEvent constructor to initialize the event.
*
* @param yaw the yaw of the player
* @param pitch the pitch of the player
* @param y the y position of the player
* @param onGround the ground state of the player
* @param pre the pre state of the player
*/
public UpdateEvent(float yaw, float pitch, double y, boolean onGround, boolean pre) {
this.yaw = yaw;
this.pitch = pitch;
this.y = y;
this.onGround = onGround;
this.pre = pre;
}
/**
* UpdateEvent constructor to initialize the event.
*
* @param yaw the yaw of the player
* @param pitch the pitch of the player
* @param y the y position of the player
* @param onGround the ground state of the player
*/
public UpdateEvent(float yaw, float pitch, double y, boolean onGround) {
this.yaw = yaw;
this.pitch = pitch;
this.y = y;
this.onGround = onGround;
}
/**
* Set the yaw of the player.
*
* @param yaw the yaw of the player
*/
public void setYaw(float yaw) {
Minecraft.getMinecraft().thePlayer.renderYawOffset = yaw;
Minecraft.getMinecraft().thePlayer.rotationYawHead = yaw;
this.yaw = yaw;
}
}

View File

@ -0,0 +1,10 @@
package dev.revere.virago.client.events.player;
import dev.revere.virago.api.event.Event;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class WorldChangeEvent extends Event {}

Some files were not shown because too many files have changed in this diff Show More