SC Legacy

This commit is contained in:
refactoring 2024-01-01 15:07:53 -05:00
commit 4ec5f971e6
986 changed files with 221295 additions and 0 deletions

28
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,28 @@
# Automatically build the project and run any configured tests for every push
# and submitted pull request. This can help catch issues that only occur on
# certain Java versions, and provides a first line of defence against bad commits.
name: Build
on: [push, pull_request]
jobs:
build:
strategy:
matrix:
java: [
"17" # Latest version
]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: ${{ matrix.java }}
- name: Grant execute permission
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew build

27
.gitignore vendored Normal file
View File

@ -0,0 +1,27 @@
# gradle
.gradle/
build/
out/
classes/
# eclipse
*.launch
# idea
.idea/
*.iml
*.ipr
*.iws
# vscode
.settings/
.vscode/
bin/
.classpath
.project
# fabric
run/
# macos
*.DS_Store

121
LICENSE Normal file
View File

@ -0,0 +1,121 @@
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.

71
README.md Normal file
View File

@ -0,0 +1,71 @@
# Fabric Example Mod
- [Quick start guide](#quick-start-guide)
- [Introduction to the folder structure](#introduction-to-the-folder-structure)
- [Creating your mod](#creating-your-mod)
- [Useful gradle commands](#useful-gradle-commands)
- [More info](#more-info)
- [License](#license)
## Quick start guide
### Introduction to the folder structure
**Build files:**
| File | Description |
| ------------------- | -------------------------------------------------------- |
| `build.gradle` | Configures the compilation process. |
| `gradle.properties` | Contains properties for Minecraft, fabric, and your mod. |
| `settings.gradle` | Configures the plugin repositories. |
**Fabric files:**
These files are located at `src/main/resources`.
| File | Description | Additional information |
| ----------------------- | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `fabric.mod.json` | Contains metadata about your mod. | [wiki:fabric_mod_json_spec](https://fabricmc.net/wiki/documentation:fabric_mod_json_spec) |
| `modid.mixins.json` | Contains a list of all your mixin files. | [wiki:mixin_registration](https://fabricmc.net/wiki/tutorial:mixin_registration) |
| `assets/modid/icon.png` | The icon of your mod. | [wiki:fabric_mod_json_spec#icon](https://fabricmc.net/wiki/documentation:fabric_mod_json_spec?s[]=icon#custom_fields) |
### Creating your mod
First of you must replace all occurrences of `modid` with the id of your mod.
If your mod doesn't use mixins you can safely remove the mixin entry in your `fabric.mod.json` as well as delete any `*.mixin.json` files.
This template has the legacy fabric api included in it's build script, more info about the api can be found at it's [github repo](https://github.com/Legacy-Fabric/fabric).
If you know what you are doing you can also safely remove the api from the build script as it isn't required.
### Useful gradle commands
```sh
# Compile your mod
./gradlew build
# Remove old build files
./gradlew clean
# Generate Minecraft sources
./gradlew genSources
# Launch a modded Minecraft client
./gradlew runClient
# Kill gradle if it's doing stupid things
./gradlew --stop
```
## More info
Additional tutorials and tips can be found in the [wiki](https://github.com/Legacy-Fabric/fabric-example-mod/wiki).
For more detailed setup instructions please see the [fabric wiki](https://fabricmc.net/wiki/tutorial:setup).
If you are new to fabric or Minecraft modding in general then [this wiki page](https://fabricmc.net/wiki/tutorial:primer) may help you.
## License
This template is available under the CC0 license. Feel free to learn from it and incorporate it in your own projects.

79
build.gradle Normal file
View File

@ -0,0 +1,79 @@
plugins {
id "fabric-loom" version "1.4-SNAPSHOT"
id "legacy-looming" version "1.4-SNAPSHOT" // Version must be the same as fabric-loom's
id "maven-publish"
}
base.archivesName = project.archives_base_name
version = project.mod_version
group = project.maven_group
repositories {
maven {
name = "cursed-mappings"
url = "https://raw.githubusercontent.com/BleachDev/cursed-mappings/main/"
}
}
loom {
accessWidenerPath = file("src/main/resources/silentclient.accesswidener")
}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings(legacy.yarn(project.minecraft_version, project.yarn_build))
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.legacyfabric.legacy-fabric-api:legacy-fabric-api:${project.fabric_version}"
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
tasks.withType(JavaCompile).configureEach {
// Ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
it.options.encoding = "UTF-8"
if (JavaVersion.current().isJava9Compatible()) {
it.options.release = 8
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}
jar {
from("LICENSE") {
rename { "${it}_${base.archivesName.get()}" }
}
}
// Configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
// Select the repositories you want to publish to
repositories {
// Uncomment to publish to the local maven
// mavenLocal()
}
}

17
gradle.properties Normal file
View File

@ -0,0 +1,17 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# More versions available at: https://grayray75.github.io/LegacyFabric-Versions/
minecraft_version = 1.8.9
yarn_build = mcp
loader_version = 0.15.2
# Legacy Fabric API
# Also available for mc 1.7.10, 1.8, 1.9.4, 1.10.2, 1.11.2 and 1.12.2
fabric_version = 1.9.1+1.8.9
# Mod Properties
mod_version = 1.0.0
maven_group = net.fabricmc
archives_base_name = fabric-example-mod

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

Binary file not shown.

View File

@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

249
gradlew vendored Normal file
View File

@ -0,0 +1,249 @@
#!/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/HEAD/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
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# 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
if ! command -v java >/dev/null 2>&1
then
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
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
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
# 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"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# 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" "$@"

92
gradlew.bat vendored Normal file
View File

@ -0,0 +1,92 @@
@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=.
@rem This is normally unused
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% equ 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% equ 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!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

BIN
libs/OcclusionCulling.jar Normal file

Binary file not shown.

BIN
libs/annotations-13.0.jar Normal file

Binary file not shown.

BIN
libs/caffeine-2.9.3.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
libs/json.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
libs/okhttp-3.12.12.jar Normal file

Binary file not shown.

BIN
libs/okio-1.15.0.jar Normal file

Binary file not shown.

BIN
libs/procbridge-1.1.1.jar Normal file

Binary file not shown.

BIN
libs/slick.jar Normal file

Binary file not shown.

Binary file not shown.

BIN
libs/vecmath-1.2-1.14.jar Normal file

Binary file not shown.

13
settings.gradle Normal file
View File

@ -0,0 +1,13 @@
pluginManagement {
repositories {
maven {
name = "Fabric"
url = "https://maven.fabricmc.net/"
}
maven {
name = "legacy-fabric"
url = "https://repo.legacyfabric.net/repository/legacyfabric/"
}
gradlePluginPortal()
}
}

View File

@ -0,0 +1,14 @@
package net.silentclient;
import net.fabricmc.api.ClientModInitializer;
/**
* @author refactoring
*/
public class SCEntrypoint implements ClientModInitializer {
@Override
public void onInitializeClient() {
// Things like rescources are not initialized yet.
// Proceed with caution.
}
}

View File

@ -0,0 +1,704 @@
package net.silentclient.client;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.resources.data.IMetadataSerializer;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.config.ConfigManager;
import net.silentclient.client.cosmetics.Cosmetics;
import net.silentclient.client.event.EventManager;
import net.silentclient.client.event.EventTarget;
import net.silentclient.client.event.impl.*;
import net.silentclient.client.gui.GuiError;
import net.silentclient.client.gui.UserTutorial;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.lite.GuiNews;
import net.silentclient.client.gui.lite.LiteMainMenu;
import net.silentclient.client.gui.lite.clickgui.ClickGUI;
import net.silentclient.client.gui.modmenu.ModMenu;
import net.silentclient.client.gui.silentmainmenu.MainMenuConcept;
import net.silentclient.client.gui.util.BackgroundPanorama;
import net.silentclient.client.keybinds.KeyBindManager;
import net.silentclient.client.mixin.injection.accessors.MinecraftAccessor;
import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt;
import net.silentclient.client.mods.ModInstances;
import net.silentclient.client.mods.SettingsManager;
import net.silentclient.client.mods.settings.CosmeticsMod;
import net.silentclient.client.mods.settings.FPSBoostMod;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.mods.util.PingSource;
import net.silentclient.client.mods.util.Server;
import net.silentclient.client.mods.util.Utils;
import net.silentclient.client.premium.PremiumCosmeticsGui;
import net.silentclient.client.premium.PremiumUtils;
import net.silentclient.client.skillissue.SkillIssue;
import net.silentclient.client.utils.*;
import net.silentclient.client.utils.animations.AnimationHandler;
import net.silentclient.client.utils.animations.SneakHandler;
import net.silentclient.client.utils.culling.EntityCulling;
import net.silentclient.client.utils.types.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.json.JSONObject;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GLContext;
import javax.net.ssl.HttpsURLConnection;
import java.io.*;
import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
public class Client {
public static final Logger logger = LogManager.getLogger("SC");
private final String version = "2.0.0";
private static final Client INSTANCE = new Client();
public static final Client getInstance() {
return INSTANCE;
}
private BuildData buildData = new BuildData();
private UserData userData = new UserData();
public File configDir;
private SettingsManager settingsManager;
public ConfigManager configManager;
private ModInstances modInstances;
private Gson gson;
private ScreenshotManager screenshotManager;
private Cosmetics cosmetics = new Cosmetics();
private PlayerResponse.Account account;
private SCTextureManager textureManager;
private SilentFontRenderer silentFontRenderer;
private long lastMemoryDebug = System.currentTimeMillis();
public int ping;
private static final int PING_INTERVAL = 600;
private int nextPing;
private PingSource source = PingSource.AUTO;
private boolean banerror = false;
private ResourceLocation bindingTexture = new ResourceLocation("silentclient/binding.png");
private ArrayList<ServerDataFeature> featuredServers = new ArrayList<ServerDataFeature>();
private FriendsResponse friends;
public int playersCount = 0;
private CPSTracker cpsTracker;
public static BackgroundPanorama backgroundPanorama;
private KeyBindManager keyBindManager;
private IMetadataSerializer iMetadataSerializer;
private MouseCursorHandler mouseCursorHandler;
private GlobalSettings globalSettings;
private File globalSettingsFile;
private AccountManager accountManager;
public ServerData lastServerData;
public TextUtils textUtils;
private SkillIssue skillIssue;
private PlayerResponse.BanInfo banInfo;
public static void memoryDebug(String paramString) {
LogManager.getLogger().info("-- Start Memory Debug -- " + paramString);
long l1 = Runtime.getRuntime().maxMemory();
long l2 = Runtime.getRuntime().totalMemory();
long l3 = Runtime.getRuntime().freeMemory();
LogManager.getLogger().info("Max: " + l1 + " (" + (l1 / 1000000.0D) + "MB)");
LogManager.getLogger().info("Total: " + l2 + " (" + (l2 / 1000000.0D) + "MB)");
LogManager.getLogger().info("Free: " + l3 + " (" + (l3 / 1000000.0D) + "MB)");
LogManager.getLogger().info("-- End Memory Debug -- " + paramString);
}
public void init() throws IOException {
try {
InputStream in = getClass().getResourceAsStream("/build_data.json");
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
StringBuffer content = new StringBuffer();
String inputLine;
while ((inputLine = reader.readLine()) != null) {
content.append(inputLine);
}
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
buildData = gson.fromJson(content.toString(), BuildData.class);
in.close();
} catch (Exception e1) {
Client.logger.catching(e1);
}
try {
InputStream in = new FileInputStream(new File(Minecraft.getMinecraft().mcDataDir, "silent_account.json"));
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
StringBuffer content = new StringBuffer();
String inputLine;
while ((inputLine = reader.readLine()) != null) {
content.append(inputLine);
}
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
userData = gson.fromJson(content.toString(), UserData.class);
in.close();
if(!ClientUtils.isDevelopment()) {
try {
new File(Minecraft.getMinecraft().mcDataDir, "silent_account.json").delete();
} catch (Exception err) {
}
}
} catch (Exception err) {
}
logger.info("---------[ Silent Client Initialising ]---------");
logger.info("MC Version: 1.8.9");
logger.info("SC Version: " + getFullVersion());
logger.info("Width: " + Minecraft.getMinecraft().displayWidth);
logger.info("Height: " + Minecraft.getMinecraft().displayHeight);
logger.info("Fullscreen: " + Minecraft.getMinecraft().isFullScreen());
List<GarbageCollectorMXBean> gcMxBeans = ManagementFactory.getGarbageCollectorMXBeans();
for (GarbageCollectorMXBean gcMxBean : gcMxBeans) {
logger.info("GC Name: " + gcMxBean.getName());
logger.info("GC Object Name: " + gcMxBean.getObjectName());
}
logger.info("-------------------------------------------------");
memoryDebug("CLIENT_PRE_INIT");
// if(SilentClientTweaker.hasOptifine) {
// logger.info("INITIALISING > optifine-patch");
// OptifinePatch.init();
// }
logger.info("INITIALISING > gson-builder");
this.gson = (new GsonBuilder()).registerTypeAdapterFactory(new EnumAdapterFactory()).setPrettyPrinting()
.enableComplexMapKeySerialization().create();
logger.info("INITIALISING > silent-directory");
configDir = new File(Minecraft.getMinecraft().mcDataDir, "SilentClient-Configs");
if (!configDir.exists()) {
configDir.mkdirs();
}
globalSettingsFile = new File(Minecraft.getMinecraft().mcDataDir, "silent_settings.json");
if(!globalSettingsFile.exists()) {
globalSettingsFile.createNewFile();
}
logger.info("INITIALISING > event-manager");
EventManager.register(this);
EventManager.register(SneakHandler.getInstance());
EventManager.register(AnimationHandler.getInstance());
memoryDebug("CLIENT_POST_INIT");
}
public void start() throws Throwable {
memoryDebug("CLIENT_PRE_START");
logger.info("---------[ Silent Client Starting ]--------------");
try {
logger.info("STARTING > registering-player");
Players.register();
logger.info("STARTING > sc-account");
PlayerResponse acc = updateAccount();
if(acc != null) {
Client.getInstance().setAccount(acc.getAccount());
}
logger.info("STARTING > settings-manager");
settingsManager = new SettingsManager();
logger.info("STARTING > mod-instances");
modInstances = new ModInstances();
logger.info("STARTING > global-settings");
globalSettings = new GlobalSettings();
try {
InputStream in = new FileInputStream(getGlobalSettingsFile());
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
StringBuffer content = new StringBuffer();
String inputLine;
while ((inputLine = reader.readLine()) != null) {
content.append(inputLine);
}
globalSettings.setConfig(new JSONObject(content.toString()).getString("config"));
globalSettings.setLite(new JSONObject(content.toString()).getBoolean("lite"));
globalSettings.setDisplayedTutorial(new JSONObject(content.toString()).getBoolean("displayedTutorial"));
globalSettings.setConfigsMigrated(new JSONObject(content.toString()).getBoolean("configsMigrated"));
globalSettings.setPacksPanoramaEnabled(new JSONObject(content.toString()).getBoolean("packsPanoramaEnabled"));
Client.getInstance().updateWindowTitle();
in.close();
} catch (Exception err) {
Client.logger.catching(err);
}
globalSettings.save();
Client.getInstance().updateWindowTitle();
if(!globalSettings.configsMigrated && new File(Minecraft.getMinecraft().mcDataDir, "SilentClient").exists() && new File(Minecraft.getMinecraft().mcDataDir, "SilentClient").isDirectory()) {
logger.info("STARTING > migrating-configs");
for(String file : new File(Minecraft.getMinecraft().mcDataDir, "SilentClient").list()) {
if(!new File(Minecraft.getMinecraft().mcDataDir, "SilentClient/" + file).isDirectory()) {
Client.logger.info("STARTING > migrating-configs > " + file);
FileUtils.copyFile(new File(Minecraft.getMinecraft().mcDataDir, "SilentClient/" + file), new File(Minecraft.getMinecraft().mcDataDir, "SilentClient-Configs/" + file));
}
}
globalSettings.configsMigrated = true;
globalSettings.save();
new File(Minecraft.getMinecraft().mcDataDir, "SilentClient").delete();
}
logger.info("STARTING > config-manager");
configManager = new ConfigManager();
if(OSUtil.isWindows()) {
logger.info("STARTING > raw-mouse-input");
Minecraft.getMinecraft().mouseHelper = new RawMouseHelper();
RawInputHandler.init();
}
logger.info("STARTING > texture-manager");
this.textureManager = new SCTextureManager(Minecraft.getMinecraft().getResourceManager());
logger.info("STARTING > font-renderer");
this.silentFontRenderer = new SilentFontRenderer();
logger.info("STARTING > cps-tracker");
this.cpsTracker = new CPSTracker();
EventManager.register(cpsTracker);
logger.info("STARTING > cosmetics");
cosmetics.init();
logger.info("STARTING > account-manager");
accountManager = new AccountManager();
accountManager.init();
logger.info("STARTING > entity-culling");
EventManager.register(new EntityCulling());
try {
EntityCulling.SUPPORT_NEW_GL = GLContext.getCapabilities().OpenGL33;
} catch(Exception err) {
Client.logger.catching(err);
EntityCulling.SUPPORT_NEW_GL = false;
}
EntityCulling.renderManager = Minecraft.getMinecraft().getRenderManager();
logger.info("STARTING > screenshot-manager");
EventManager.register(this.screenshotManager = new ScreenshotManager());
logger.info("STARTING > binding-textures");
Minecraft.getMinecraft().getTextureManager().bindTexture(this.getBindingTexture());
modInstances.getMods().forEach((mod) -> {
if(mod.getIcon() != null) {
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(mod.getIcon()));
}
});
logger.info("STARTING > servers");
ArrayList<FeaturedServers.FeaturedServerInfo> servers = FeaturedServers.get();
featuredServers.clear();
if(servers != null && servers != null) {
servers.forEach(server -> {
featuredServers.add(new ServerDataFeature(server.getName(), server.getIp()));
});
}
logger.info("STARTING > friends");
this.updateFriendsList();
if(Client.getInstance().getAccount() == null) {
logger.info("STARTING > ERROR: " + "Authorization Error. Try restarting the game.");
Minecraft.getMinecraft().displayGuiScreen(new GuiError("Authorization Error. Try restarting the game"));
return;
}
if(banInfo != null && banInfo.banned && !banerror) {
logger.info("STARTING > ERROR: " + "Account is banned");
Minecraft.getMinecraft().displayGuiScreen(new GuiError("Your account is banned. Reason: " + banInfo.reason));
banerror = true;
}
Client.logger.info("STARTING > mod-instances-post-init");
modInstances.postInit();
Client.logger.info("STARTING > fixing-mods");
modInstances.getMods().forEach((mod) -> {
mod.setEnabled(!mod.isEnabled());
mod.setEnabled(!mod.isEnabled());
});
Client.logger.info("STARTING > launching-detector");
Requests.post("https://api.silentclient.net/_next/launch_v2", new JSONObject().put("branch", getBuildData().getBranch()).toString());
logger.info("STARTING > promo");
String panelContent = Requests.get("https://assets.silentclient.net/client/promo.json");
if(panelContent != null) {
try {
PromoController.PromoResponse promoResponse = getGson().fromJson(panelContent, PromoController.PromoResponse.class);
PromoController.setResponse(promoResponse);
} catch (Exception err) {
logger.catching(err);
}
}
logger.info("STARTING > mouse-cursor-handler");
this.mouseCursorHandler = new MouseCursorHandler();
if(globalSettings.lite) {
Minecraft.getMinecraft().displayGuiScreen(new GuiNews());
} else {
Minecraft.getMinecraft().displayGuiScreen(new MainMenuConcept());
}
if(!Client.getInstance().getAccount().getClaimedPremiumCosmetics()) {
Client.logger.info("STARTING > premium-cosmetics");
PremiumCosmeticsResponse premiumCosmetics = PremiumUtils.getPremiumCosmetics();
if(premiumCosmetics != null) {
Minecraft.getMinecraft().displayGuiScreen(new PremiumCosmeticsGui(premiumCosmetics));
}
}
Client.logger.info("STARTING > config-manager-post-init");
configManager.postInit();
if(!globalSettings.displayedTutorial) {
Minecraft.getMinecraft().displayGuiScreen(new UserTutorial());
}
} catch(Exception err) {
Client.logger.catching(err);
logger.info("STARTING > ERROR: " + err.getMessage());
throw err;
}
Client.logger.info("STARTING > text-utils");
this.textUtils = new TextUtils(Minecraft.getMinecraft().fontRendererObj);
logger.info("STARTING > skillissue");
this.skillIssue = new SkillIssue();
logger.info("-------------------------------------------------");
memoryDebug("CLIENT_POST_INIT");
}
public void shutdown() {
logger.info("---------[ Silent Client Stopping ]--------------");
logger.info("STOPPING > silent-socket");
skillIssue.sendDetections();
Players.unregister();
logger.info("-------------------------------------------------");
}
// utils
public void updateWindowTitle() {
Display.setTitle(String.format("Silent Client%s %s (1.8.9)", Client.getInstance().getGlobalSettings() != null && Client.getInstance().getGlobalSettings().isLite() ? " Lite" : "", Client.getInstance().getFullVersion()));
}
public void updateUserInformation() {
if(Client.getInstance().getAccount() != null) {
(new Thread("updateUserInformation") {
public void run() {
PlayerResponse cosmetics = updateAccount();
if(cosmetics != null) {
Client.getInstance().setAccount(cosmetics.getAccount());
Client.getInstance().getCosmetics().setMyCapes(cosmetics.getAccount().getCosmetics().getCapes());
Client.getInstance().getCosmetics().setMyWings(cosmetics.getAccount().getCosmetics().getWings());
Client.getInstance().getCosmetics().setMyIcons(cosmetics.getAccount().getCosmetics().getIcons());
Client.getInstance().getCosmetics().setMyBandanas(cosmetics.getAccount().getCosmetics().getBandanas());
Client.getInstance().getCosmetics().setMyHats(cosmetics.getAccount().getCosmetics().getHats());
Client.getInstance().getCosmetics().setMyShields(cosmetics.getAccount().getCosmetics().getShields());
Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Shoulders").setValBoolean(cosmetics.getAccount().getCapeShoulders());
Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Type").setValString(cosmetics.getAccount().getCapeType().equals("dynamic_curved") ? "Dynamic Curved" : cosmetics.getAccount().getCapeType().equals("curved_rectangle") ? "Curved Rectangle" : "Rectangle");
if(Minecraft.getMinecraft().thePlayer != null) {
((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$setCapeType(cosmetics.getAccount().getCapeType());
((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$setShoulders(cosmetics.getAccount().getCapeShoulders());
}
}
}
}).start();
}
}
public void updateFriendsList() {
if(Client.getInstance().getAccount() != null) {
(new Thread("updateFriendsList") {
public void run() {
FriendsResponse friends = getFriendsAPI();
if(friends != null) {
Client.getInstance().setFriends(friends);
}
}
}).start();
}
}
private FriendsResponse getFriendsAPI() {
try {
URL url = new URL("https://api.silentclient.net/friends");
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("User-Agent", "SilentClient");
con.setRequestProperty("Authorization", "Bearer " + Client.getInstance().getUserData().getAccessToken());
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer content = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
Client.logger.info("Loaded friends: " + content.toString());
in.close();
con.disconnect();
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
FriendsResponse response = gson.fromJson(content.toString(), FriendsResponse.class);
return response;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
public PlayerResponse updateAccount() {
try {
String content = Requests.post("https://api.silentclient.net/account/update", new JSONObject().put("server", Minecraft.getMinecraft().getCurrentServerData() != null ? Minecraft.getMinecraft().getCurrentServerData().serverIP : null).toString());
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
PlayerResponse playerResponse = gson.fromJson(content, PlayerResponse.class);
this.banInfo = playerResponse.banInfo;
return playerResponse;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
// Events
@EventTarget
public void onTick(ClientTickEvent event) {
long l = System.currentTimeMillis();
if (l - 60000L > this.lastMemoryDebug) {
this.lastMemoryDebug = l;
if(getSettingsManager() != null && getSettingsManager().getSettingByClass(FPSBoostMod.class, "Do memory debug").getValBoolean()) {
memoryDebug("Interval: " + l);
}
this.updateUserInformation();
}
if(banInfo != null) {
if(banInfo.banned && !banerror) {
if(Minecraft.getMinecraft().theWorld != null) {
Minecraft.getMinecraft().theWorld.sendQuittingDisconnectingPacket();
Minecraft.getMinecraft().loadWorld(null);
}
Minecraft.getMinecraft().displayGuiScreen(new GuiError("Your account is banned. Reason: " + banInfo.reason));
banerror = true;
}
}
if(Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Mod Menu Keybind").isKeyDown()) {
Minecraft.getMinecraft().displayGuiScreen(Client.getInstance().getGlobalSettings().isLite() ? new ClickGUI() : new ModMenu());
}
if(source.resolve() != PingSource.MULTIPLAYER_SCREEN) {
return;
}
if(Minecraft.getMinecraft().getCurrentServerData() != null && !Minecraft.getMinecraft().isIntegratedServerRunning()) {
if(nextPing > 0) {
nextPing--;
}
else if(nextPing > -1) {
nextPing = -1;
Utils.MAIN_EXECUTOR.submit(() -> {
try {
Utils.pingServer(Minecraft.getMinecraft().getCurrentServerData().serverIP, (newPing) -> {
if(newPing != -1) {
if(ping != 0) {
ping = (ping * 3 + newPing) / 4;
}
else {
ping = newPing;
}
}
});
}
catch(UnknownHostException error) {
Client.logger.fatal("[SC]: Could not ping server", error);
}
nextPing = PING_INTERVAL;
});
}
}
}
@EventTarget
public void onMouseClick(EventClickMouse event) {
if(event.getButton() == 0) {
((MinecraftAccessor) Minecraft.getMinecraft()).setLeftClickCounter(0);
}
}
@EventTarget
public void onServerConnect(ConnectToServerEvent event) {
ping = 0;
playersCount = 0;
nextPing = 10;
this.updateUserInformation();
Client.logger.info("Update Connection Server: " + event.getServerData().serverIP);
Server.setHypixel(Server.checkIsHypixel());
Server.setRuHypixel(Server.checkIsRuHypixel());
}
@EventTarget
public void onServerDisconnect(ServerLeaveEvent event) {
ping = 0;
playersCount = 0;
nextPing = 10;
this.updateUserInformation();
Client.logger.info("Update Connection Server: null");
Server.setHypixel(Server.checkIsHypixel());
Server.setRuHypixel(Server.checkIsRuHypixel());
}
@EventTarget
public void onServerDisconnect(SingleplayerJoinEvent event) {
ping = 0;
playersCount = 0;
nextPing = 10;
this.updateUserInformation();
Client.logger.info("Update Connection Server: null");
Server.setHypixel(Server.checkIsHypixel());
Server.setRuHypixel(Server.checkIsRuHypixel());
}
// Instances
public String getApiUrl() {
return "http://localhost:" + getUserData().server_port;
}
public AccountManager getAccountManager() {
return accountManager;
}
public FriendsResponse getFriends() {
return friends;
}
public void setFriends(FriendsResponse friends) {
this.friends = friends;
}
public UserData getUserData() {
return userData;
}
public BuildData getBuildData() {
return buildData;
}
public String getVersion() {
return version;
}
public String getFullVersion() {
return "v" + version + "-" + getBuildData().getCommit() + "-" + getBuildData().getBranch();
}
public Cosmetics getCosmetics() {
return cosmetics;
}
public PlayerResponse.Account getAccount() {
return account;
}
public void setAccount(PlayerResponse.Account account) {
this.account = account;
}
public ResourceLocation getBindingTexture() {
return bindingTexture;
}
public Gson getGson() {
return gson;
}
public SCTextureManager getTextureManager() {
return textureManager;
}
public SilentFontRenderer getSilentFontRenderer() {
return silentFontRenderer;
}
public SettingsManager getSettingsManager() {
return settingsManager;
}
public ModInstances getModInstances() {
return modInstances;
}
public ConfigManager getConfigManager() {
return configManager;
}
public CPSTracker getCPSTracker() {
return cpsTracker;
}
public int getPing() {
return ping;
}
public ArrayList<ServerDataFeature> getFeaturedServers() {
return featuredServers;
}
public int getPlayersCount() {
return playersCount;
}
public ScreenshotManager getScreenshotManager() {
return screenshotManager;
}
public boolean isTest() {
return getBuildData().getBranch().equals("test");
}
public boolean isDebug() {
return getBuildData().getBranch().equals("debug");
}
public int getScaleFactor() {
return (new ScaledResolution(Minecraft.getMinecraft())).getScaleFactor();
}
public void setKeyBindManager(KeyBindManager keyBindManager) {
this.keyBindManager = keyBindManager;
}
public KeyBindManager getKeyBindManager() {
return keyBindManager;
}
public IMetadataSerializer getiMetadataSerializer() {
return iMetadataSerializer;
}
public void setiMetadataSerializer(IMetadataSerializer iMetadataSerializer) {
this.iMetadataSerializer = iMetadataSerializer;
}
public MouseCursorHandler getMouseCursorHandler() {
return mouseCursorHandler;
}
public GlobalSettings getGlobalSettings() {
return globalSettings;
}
public File getGlobalSettingsFile() {
return globalSettingsFile;
}
public GuiScreen getMainMenu() {
if(Client.getInstance().getGlobalSettings() == null) {
return new MainMenuConcept();
}
return Client.getInstance().getGlobalSettings().isLite() ? new LiteMainMenu() : new MainMenuConcept();
}
}

View File

@ -0,0 +1,11 @@
package net.silentclient.client;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.util.ResourceLocation;
public class ServerDataFeature extends ServerData {
public static final ResourceLocation STAR_ICON = new ResourceLocation("silentclient/icons/star.png");
public ServerDataFeature(String serverName, String serverIp) {
super(serverName, serverIp, false);
}
}

View File

@ -0,0 +1,455 @@
package net.silentclient.client.admin;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Util;
import net.silentclient.client.Client;
import net.silentclient.client.cosmetics.AnimatedResourceLocation;
import net.silentclient.client.cosmetics.ShieldData;
import net.silentclient.client.cosmetics.StaticResourceLocation;
import net.silentclient.client.cosmetics.gui.CosmeticsGui;
import net.silentclient.client.gui.elements.StaticButton;
import net.silentclient.client.gui.lite.clickgui.utils.GlUtils;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt;
import net.silentclient.client.mods.CustomFontRenderer;
import net.silentclient.client.mods.CustomFontRenderer.RenderMode;
import net.silentclient.client.utils.FileUtils;
import net.silentclient.client.utils.Players;
import org.lwjgl.Sys;
import org.lwjgl.input.Mouse;
import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.text.DecimalFormat;
public class AdminRender extends GuiScreen {
public static File adminRenderPath = new File(Client.getInstance().configDir, "admin-render");
// Settings
private boolean showSettings = false;
private static boolean savingPreview = false;
private float scale = 1.0F;
private int rotate = 0;
private int redBackground = 0;
private int greenBackground = 0;
private int blueBackground = 0;
// Information
private int frames = 1;
private int currentFrame = 0;
public AdminRender() {
if(Client.getInstance().getAccount().isStaff()) {
if(!adminRenderPath.exists()) {
adminRenderPath.mkdirs();
}
}
}
@Override
public void initGui() {
super.initGui();
this.showSettings = false;
AdminRender.savingPreview = false;
this.scale = 1.0F;
this.redBackground = 0;
this.greenBackground = 0;
this.blueBackground = 0;
this.rotate = 0;
loadTextureCosmetic("none");
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
super.drawScreen(mouseX, mouseY, partialTicks);
super.drawDefaultBackground();
((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$setShoulders(true);
((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$setCapeType("Rectangle");
if(((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getCape() != null) {
((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getCape().setCurrentFrame(this.currentFrame);
}
if(((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getBandana() != null) {
((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getBandana().setCurrentFrame(this.currentFrame);
}
if(((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getShield() != null && ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getShield().getTexture() != null) {
((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getShield().getTexture().setCurrentFrame(this.currentFrame);
}
CustomFontRenderer font = new CustomFontRenderer();
font.setRenderMode(RenderMode.CUSTOM);
ScaledResolution sr = new ScaledResolution(mc);
RenderUtils.drawRect(0, 0, sr.getScaledWidth(), sr.getScaledHeight(), new Color(redBackground, greenBackground, blueBackground).getRGB());
if(!AdminRender.savingPreview) {
StaticButton.render(2, 2, 50, 12, this.showSettings ? "Close" : "Settings");
if(this.showSettings) {
int settingY = 20;
int sliderLeft = 50;
// Scale
font.drawString("Scale:", 2, settingY, -1, true);
RenderUtils.drawRect(sliderLeft, settingY, 90, 9, Color.black.getRGB());
RenderUtils.drawRect(sliderLeft, settingY, 90F * (float) (scale / 5.0D), 9, -1);
boolean scaleDrag = MouseUtils.isInside(mouseX, mouseY, sliderLeft, settingY - 1, 90, 9) && Mouse.isButtonDown(0);
if (scaleDrag) {
double diff = 5.0D - 1.0F;
double mouse = MathHelper.clamp_double((mouseX - sliderLeft) / 90D, 0, 1);
double newVal = 1.0F + mouse * diff;
this.scale = (float) newVal;
}
font.drawString(new DecimalFormat("0.00").format(scale), sliderLeft + 95, settingY, -1, true);
settingY += 15;
// Rotate
font.drawString("Rotate:", 2, settingY, -1, true);
RenderUtils.drawRect(sliderLeft, settingY, 90, 9, Color.black.getRGB());
RenderUtils.drawRect(sliderLeft, settingY, 90F * (float) (rotate / 360.0D), 9, -1);
boolean rotateDrag = MouseUtils.isInside(mouseX, mouseY, sliderLeft, settingY - 1, 90, 9) && Mouse.isButtonDown(0);
if (rotateDrag) {
double diff = 360D - 0F;
double mouse = MathHelper.clamp_double((mouseX - sliderLeft) / 90D, 0, 1);
double newVal = 0 + mouse * diff;
this.rotate = (int) newVal;
}
font.drawString(new DecimalFormat("0.00").format(rotate), sliderLeft + 95, settingY, -1, true);
settingY += 15;
// Background Red
font.drawString("BG Red:", 2, settingY, -1, true);
RenderUtils.drawRect(sliderLeft, settingY, 90, 9, Color.black.getRGB());
RenderUtils.drawRect(sliderLeft, settingY, 90F * (float) (redBackground / 255.0D), 9, -1);
boolean bgRedDrag = MouseUtils.isInside(mouseX, mouseY, sliderLeft, settingY - 1, 90, 9) && Mouse.isButtonDown(0);
if (bgRedDrag) {
double diff = 255D - 0F;
double mouse = MathHelper.clamp_double((mouseX - sliderLeft) / 90D, 0, 1);
double newVal = 0 + mouse * diff;
this.redBackground = (int) newVal;
}
font.drawString(new DecimalFormat("0.00").format(redBackground), sliderLeft + 95, settingY, -1, true);
settingY += 15;
// Background Green
font.drawString("BG Green:", 2, settingY, -1, true);
RenderUtils.drawRect(sliderLeft, settingY, 90, 9, Color.black.getRGB());
RenderUtils.drawRect(sliderLeft, settingY, 90F * (float) (greenBackground / 255.0D), 9, -1);
boolean bgGreenDrag = MouseUtils.isInside(mouseX, mouseY, sliderLeft, settingY - 1, 90, 9) && Mouse.isButtonDown(0);
if (bgGreenDrag) {
double diff = 255D - 0F;
double mouse = MathHelper.clamp_double((mouseX - sliderLeft) / 90D, 0, 1);
double newVal = 0 + mouse * diff;
this.greenBackground = (int) newVal;
}
font.drawString(new DecimalFormat("0.00").format(greenBackground), sliderLeft + 95, settingY, -1, true);
settingY += 15;
// Background Blue
font.drawString("BG Blue:", 2, settingY, -1, true);
RenderUtils.drawRect(sliderLeft, settingY, 90, 9, Color.black.getRGB());
RenderUtils.drawRect(sliderLeft, settingY, 90F * (float) (blueBackground / 255.0D), 9, -1);
boolean bgBlueDrag = MouseUtils.isInside(mouseX, mouseY, sliderLeft, settingY - 1, 90, 9) && Mouse.isButtonDown(0);
if (bgBlueDrag) {
double diff = 255D - 0F;
double mouse = MathHelper.clamp_double((mouseX - sliderLeft) / 90D, 0, 1);
double newVal = 0 + mouse * diff;
this.blueBackground = (int) newVal;
}
font.drawString(new DecimalFormat("0.00").format(blueBackground), sliderLeft + 95, settingY, -1, true);
settingY += 15;
// Presets
boolean twoColumn = false;
StaticButton.render(2 + (twoColumn ? 63 : 0), settingY, 60, 12, "Store Preset");
settingY += 15;
// Loads
StaticButton.render(2 + (twoColumn ? 63 : 0), settingY, 60, 12, "Load Cape");
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
StaticButton.render(2 + (twoColumn ? 63 : 0), settingY, 60, 12, "Load Wings");
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
StaticButton.render(2 + (twoColumn ? 63 : 0), settingY, 60, 12, "Load Bandana");
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
StaticButton.render(2 + (twoColumn ? 63 : 0), settingY, 60, 12, "Load Shield");
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
StaticButton.render(2 + (twoColumn ? 65 : 0), settingY, 60, 12, "Load Round Shield");
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
StaticButton.render(2 + (twoColumn ? 65 : 0), settingY, 60, 12, "Load Hexagon Shield");
twoColumn = false;
if(((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getWings() == null) {
settingY += 20;
font.drawString("Frames: " + this.frames, 2, settingY, -1, true);
settingY += 10;
font.drawString("Current Frame: " + (this.currentFrame + 1), 2, settingY, -1, true);
settingY += 15;
StaticButton.render(2 + (twoColumn ? 63 : 0), settingY, 60, 12, "Prev Frame");
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
StaticButton.render(2 + (twoColumn ? 63 : 0), settingY, 60, 12, "Next Frame");
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
}
}
StaticButton.render(2, sr.getScaledHeight() - 14, 50, 12, "Open Textures Folder");
StaticButton.render(sr.getScaledWidth() - 52, 2, 50, 12, "Hide UI");
}
GlUtils.startScale(sr.getScaledWidth() / 2, sr.getScaledHeight() / 2 + ((int) (50 * scale)), scale);
CosmeticsGui.drawEntityOnScreen(sr.getScaledWidth() / 2, sr.getScaledHeight() / 2 + ((int) (50 * scale)), 45, 1, 1, mc.thePlayer, rotate);
GlUtils.stopScale();
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
super.mouseClicked(mouseX, mouseY, mouseButton);
ScaledResolution sr = new ScaledResolution(mc);
if(!AdminRender.savingPreview) {
if(StaticButton.isHovered(mouseX, mouseY, 2, 2, 50, 12)) {
this.showSettings = !this.showSettings;
}
if(StaticButton.isHovered(mouseX, mouseY, sr.getScaledWidth() - 52, 2, 50, 12)) {
AdminRender.savingPreview = true;
}
if(StaticButton.isHovered(mouseX, mouseY, 2, sr.getScaledHeight() - 14, 50, 12)) {
File file1 = adminRenderPath;
String s = file1.getAbsolutePath();
if (Util.getOSType() == Util.EnumOS.OSX)
{
try
{
Client.logger.info(s);
Runtime.getRuntime().exec(new String[] {"/usr/bin/open", s});
return;
}
catch (IOException ioexception1)
{
Client.logger.error((String)"Couldn\'t open file", (Throwable)ioexception1);
}
}
else if (Util.getOSType() == Util.EnumOS.WINDOWS)
{
String s1 = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[] {s});
try
{
Runtime.getRuntime().exec(s1);
return;
}
catch (IOException ioexception)
{
Client.logger.error((String)"Couldn\'t open file", (Throwable)ioexception);
}
}
boolean flag = false;
try
{
Class<?> oclass = Class.forName("java.awt.Desktop");
Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]);
oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {file1.toURI()});
}
catch (Throwable throwable)
{
Client.logger.error("Couldn\'t open link", throwable);
flag = true;
}
if (flag)
{
Client.logger.info("Opening via system class!");
Sys.openURL("file://" + s);
}
}
if(this.showSettings) {
int settingY = 95;
boolean twoColumn = false;
if(StaticButton.isHovered(mouseX, mouseY, 2, settingY, 60, 12)) {
this.scale = 3.20F;
this.rotate = 4;
this.redBackground = 19;
this.blueBackground = 19;
this.greenBackground = 19;
}
settingY += 15;
if(StaticButton.isHovered(mouseX, mouseY, 2 + (twoColumn ? 63 : 0), settingY, 60, 12)) {
loadTextureCosmetic("cape");
}
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
if(StaticButton.isHovered(mouseX, mouseY, 2 + (twoColumn ? 63 : 0), settingY, 60, 12)) {
loadTextureCosmetic("wings");
}
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
if(StaticButton.isHovered(mouseX, mouseY, 2 + (twoColumn ? 63 : 0), settingY, 60, 12)) {
loadTextureCosmetic("bandana");
}
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
if(StaticButton.isHovered(mouseX, mouseY, 2 + (twoColumn ? 63 : 0), settingY, 60, 12)) {
loadTextureCosmetic("shield", "shield");
}
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
if(StaticButton.isHovered(mouseX, mouseY, 2 + (twoColumn ? 63 : 0), settingY, 60, 12)) {
loadTextureCosmetic("shield", "roundshield");
}
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
if(StaticButton.isHovered(mouseX, mouseY, 2 + (twoColumn ? 63 : 0), settingY, 60, 12)) {
loadTextureCosmetic("shield", "hexagon_shield");
}
twoColumn = false;
if(((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getWings() == null) {
settingY += 45;
if(StaticButton.isHovered(mouseX, mouseY, 2 + (twoColumn ? 63 : 0), settingY, 60, 12)) {
this.currentFrame = (this.currentFrame - 1 >= 0 ? this.currentFrame - 1 : this.frames - 1);
}
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
if(StaticButton.isHovered(mouseX, mouseY, 2 + (twoColumn ? 63 : 0), settingY, 60, 12)) {
this.currentFrame = (this.currentFrame + 1 <= (this.frames - 1) ? this.currentFrame + 1 : 0);
}
}
}
} else {
AdminRender.savingPreview = false;
}
}
@Override
public void onGuiClosed() {
super.onGuiClosed();
Players.reload();
}
private void loadTextureCosmetic(String type) {
this.loadTextureCosmetic(type, "");
}
private void loadTextureCosmetic(String type, String model) {
((AbstractClientPlayerExt) mc.thePlayer).silent$setCape(null);
((AbstractClientPlayerExt) mc.thePlayer).silent$setCapeShoulders(null);
((AbstractClientPlayerExt) mc.thePlayer).silent$setBandana(null);
((AbstractClientPlayerExt) mc.thePlayer).silent$setHat(null);
((AbstractClientPlayerExt) mc.thePlayer).silent$setShield(null);
((AbstractClientPlayerExt) mc.thePlayer).silent$setWings(null);
this.frames = 0;
this.currentFrame = 0;
File [] pngFiles = adminRenderPath.listFiles(file -> file.isFile() && file.getName().toLowerCase().endsWith(".png"));
switch(type) {
case "cape":
((AbstractClientPlayerExt) mc.thePlayer).silent$setCape(new TestAnimatedResourceLocation(pngFiles.length - 1, 150));
((AbstractClientPlayerExt) mc.thePlayer).silent$setCapeShoulders(new StaticResourceLocation(FileUtils.fileToResourceLocation(new File(adminRenderPath, "0.png")).getResourcePath()));
this.frames = ((AbstractClientPlayerExt) mc.thePlayer).silent$getCape().getFrames();
this.currentFrame = 0;
break;
case "wings":
((AbstractClientPlayerExt) mc.thePlayer).silent$setWings(new TestAnimatedResourceLocation(pngFiles.length, 150));
this.frames = 1;
this.currentFrame = 0;
break;
case "bandana":
((AbstractClientPlayerExt) mc.thePlayer).silent$setBandana(new TestAnimatedResourceLocation(pngFiles.length, 150));
this.frames = ((AbstractClientPlayerExt) mc.thePlayer).silent$getBandana().getFrames();
this.currentFrame = 0;
break;
case "shield":
((AbstractClientPlayerExt) mc.thePlayer).silent$setShield(new ShieldData(new TestAnimatedResourceLocation(pngFiles.length, 150), model));
this.frames = ((AbstractClientPlayerExt) mc.thePlayer).silent$getShield().getTexture().getFrames();
this.currentFrame = 0;
break;
}
}
private class TestAnimatedResourceLocation extends AnimatedResourceLocation {
public TestAnimatedResourceLocation(int frames, int fpt) {
super("", frames, fpt, true);
textures = new ResourceLocation[frames];
for(int i = 0; i < frames; i++) {
Client.logger.info(new File(adminRenderPath, i + ".png").toString());
textures[i] = FileUtils.fileToResourceLocation(new File(adminRenderPath, i + ".png"));
}
}
@Override
public void update(float deltaTick) {
// Nothing =)
}
}
}

View File

@ -0,0 +1,278 @@
package net.silentclient.client.blc;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GLContext;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
public class BlcGlStateManager {
public static void a() {
// GlStateManager.get
}
public static void b() {
GlStateManager.disableAlpha();
}
public static void a(final int n, final float n2) {
GlStateManager.enableAlpha();
}
public static void c() {
GlStateManager.enableLighting();
}
public static void d() {
GlStateManager.disableLighting();
}
public static void e() {
GlStateManager.disableDepth();
}
public static void f() {
GlStateManager.enableDepth();
}
public static void a(final int n) {
GlStateManager.depthFunc(n);
}
public static void a(final boolean b) {
GlStateManager.depthMask(b);
}
public static void g() {
GlStateManager.enableBlend();
}
public static void h() {
GlStateManager.disableBlend();
}
public static void a(final int n, final int n2) {
GlStateManager.blendFunc(n, n2);
}
public static void a(final int n, final int n2, final int n3, final int n4) {
GlStateManager.tryBlendFuncSeparate(n, n2, n3, n4);
}
public static void i() {
GlStateManager.enableFog();
}
public static void j() {
GlStateManager.disableFog();
}
public static void b(final int n) {
GlStateManager.setFog(n);
}
public static void a(final float n) {
GlStateManager.setFogDensity(n);
}
public static void b(final float n) {
GlStateManager.setFogStart(n);
}
public static void c(final float n) {
GlStateManager.setFogEnd(n);
}
public static void k() {
GlStateManager.enableCull();
}
public static void l() {
GlStateManager.disableCull();
}
public static void c(final int n) {
GlStateManager.cullFace(n);
}
public static void m() {
GlStateManager.enablePolygonOffset();
}
public static void n() {
GlStateManager.disablePolygonOffset();
}
public static void a(final float n, final float n2) {
GlStateManager.doPolygonOffset(n, n2);
}
public static void o() {
GlStateManager.enableColorLogic();
}
public static void p() {
GlStateManager.disableColorLogic();
}
public static void d(final int n) {
GlStateManager.colorLogicOp(n);
}
public static void e(final int n) {
GlStateManager.setActiveTexture(n);
}
public static void q() {
GlStateManager.enableTexture2D();
}
public static void r() {
GlStateManager.disableTexture2D();
}
public static void a(final float n, final float n2, final float n3, final float n4) {
GlStateManager.color(n, n2, n3, n4);
}
public static void a(final float n, final float n2, final float n3) {
GlStateManager.color(n, n2, n3);
}
public static void s() {
GlStateManager.resetColor();
}
public static void f(final int n) {
GlStateManager.callList(n);
}
public static void t() {
GlStateManager.pushMatrix();
}
public static void u() {
GlStateManager.popMatrix();
}
public static void b(final float n, final float n2, final float n3, final float n4) {
GlStateManager.rotate(n, n2, n3, n4);
}
public static void b(final float n, final float n2, final float n3) {
GlStateManager.scale(n, n2, n3);
}
public static void a(final double n, final double n2, final double n3) {
GlStateManager.scale(n, n2, n3);
}
public static void c(final float n, final float n2, final float n3) {
GlStateManager.translate(n, n2, n3);
}
public static void b(final double n, final double n2, final double n3) {
GlStateManager.translate(n, n2, n3);
}
public static void b(final int n, final int n2, final int n3, final int n4) {
OpenGlHelper.glBlendFunc(n, n2, n3, n4);
}
public static boolean v() {
return OpenGlHelper.areShadersSupported();
}
public static void w() {
RenderHelper.enableStandardItemLighting();
}
public static void x() {
RenderHelper.disableStandardItemLighting();
}
public static void y() {
RenderHelper.enableGUIStandardItemLighting();
}
public static void g(final int n) {
GlStateManager.shadeModel(n);
}
public static boolean z() {
return GLContext.getCapabilities().OpenGL15;
}
public static boolean A() {
return GLContext.getCapabilities().OpenGL21;
}
public static void a(final int n, final IntBuffer intBuffer) {
GL11.glGetInteger(n, intBuffer);
}
public static void a(final int n, final FloatBuffer floatBuffer) {
GL11.glGetFloat(n, floatBuffer);
}
public static void h(final int n) {
GlStateManager.clear(n);
}
}

View File

@ -0,0 +1,120 @@
package net.silentclient.client.config;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.elements.Checkbox;
import net.silentclient.client.gui.elements.IconButton;
import net.silentclient.client.gui.elements.Input;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.utils.MenuBlurUtils;
import net.silentclient.client.utils.MouseCursorHandler;
import net.silentclient.client.utils.NotificationUtils;
import org.lwjgl.input.Keyboard;
import java.io.IOException;
public class AddConfigModal extends SilentScreen {
private final GuiScreen parentScreen;
private int modalWidth;
private int modalHeight;
private boolean cloneConfig;
public AddConfigModal(GuiScreen parentScreen) {
this.parentScreen = parentScreen;
this.modalWidth = 200;
this.modalHeight = 90;
}
@Override
public void initGui() {
MenuBlurUtils.loadBlur();
defaultCursor = false;
this.cloneConfig = false;
int x = width / 2 - (this.modalWidth / 2);
int y = height / 2 - (this.modalHeight / 2);
this.buttonList.add(new IconButton(1, x + this.modalWidth - 14 - 3, y + 3, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/exit.png")));
this.buttonList.add(new Button(2, x + 3, y + this.modalHeight - 23, this.modalWidth - 6, 20, "Done"));
this.silentInputs.add(new Input("Config Name"));
}
@Override
protected void actionPerformed(GuiButton button) {
super.actionPerformed(button);
switch (button.id) {
case 1:
mc.displayGuiScreen(parentScreen);
break;
case 2:
if(this.silentInputs.get(0).getValue().length() != 0) {
String result = Client.getInstance().configManager.newConfig(this.silentInputs.get(0).getValue() + ".txt", cloneConfig);
if(!result.equals("success")) {
NotificationUtils.showNotification("Error", result);
} else {
mc.displayGuiScreen(parentScreen);
}
} else {
NotificationUtils.showNotification("Error", "Please enter a Config Name");
}
break;
}
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
MenuBlurUtils.renderBackground(this);
MouseCursorHandler.CursorType cursorType = getCursor(silentInputs, buttonList);
GlStateManager.pushMatrix();
int x = width / 2 - (this.modalWidth / 2);
int y = height / 2 - (this.modalHeight / 2);
// Header
RenderUtils.drawRect(x, y, this.modalWidth, this.modalHeight, Theme.backgroundColor().getRGB());
Client.getInstance().getSilentFontRenderer().drawString("New Config", x + 3, y + 3, 14, SilentFontRenderer.FontType.TITLE);
// Content
this.silentInputs.get(0).render(mouseX, mouseY, x + 3, y + 23, this.modalWidth - 6);
Checkbox.render(mouseX, mouseY, x + 3, y + 50, "Clone Current Config", cloneConfig);
if(Checkbox.isHovered(mouseX, mouseY, x + 3, y + 50)) {
cursorType = MouseCursorHandler.CursorType.POINTER;
}
Client.getInstance().getMouseCursorHandler().enableCursor(cursorType);
super.drawScreen(mouseX, mouseY, partialTicks);
GlStateManager.popMatrix();
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
super.mouseClicked(mouseX, mouseY, mouseButton);
int x = width / 2 - (this.modalWidth / 2);
int y = height / 2 - (this.modalHeight / 2);
this.silentInputs.get(0).onClick(mouseX, mouseY, x + 3, y + 23, this.modalWidth - 6);
if(Checkbox.isHovered(mouseX, mouseY, x + 3, y + 50)) {
this.cloneConfig = !this.cloneConfig;
}
}
@Override
public void onGuiClosed() {
MenuBlurUtils.unloadBlur();
}
@Override
protected void keyTyped(char typedChar, int keyCode) {
if (keyCode == Keyboard.KEY_ESCAPE) {
mc.displayGuiScreen(parentScreen);
return;
};
this.silentInputs.get(0).onKeyTyped(typedChar, keyCode);
}
}

View File

@ -0,0 +1,289 @@
package net.silentclient.client.config;
import net.minecraft.client.Minecraft;
import net.silentclient.client.Client;
import net.silentclient.client.gui.hud.ScreenPosition;
import net.silentclient.client.gui.notification.NotificationManager;
import net.silentclient.client.mods.Mod;
import net.silentclient.client.mods.ModDraggable;
import net.silentclient.client.mods.Setting;
import net.silentclient.client.mods.player.AutoTextMod.AutoTextCommand;
import net.silentclient.client.utils.FileUtils;
import net.silentclient.client.utils.MenuBlurUtils;
import java.awt.*;
import java.io.*;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public final class ConfigManager {
public File configFile;
private Set<String> configs;
private boolean creatingDefaultConfigNeeded;
public ConfigManager() {
updateConfigs();
String config = Client.getInstance().getGlobalSettings().getConfig();
configFile = new File(Client.getInstance().configDir, config);
if(!configFile.exists()) {
creatingDefaultConfigNeeded = true;
}
this.load();
}
public void postInit() {
if(creatingDefaultConfigNeeded) {
configFile.delete();
newConfig("Default.txt", false);
}
}
public Set<String> getConfigFiles() {
return this.configs;
}
public void updateConfigs() {
Client.logger.info("Updating Config List");
this.configs = Stream.of(Client.getInstance().configDir.listFiles())
.filter(file -> !file.isDirectory())
.map(File::getName)
.collect(Collectors.toSet());
}
public void deleteConfig(String name) {
try {
new File(Client.getInstance().configDir, name).delete();
} catch (Exception err) {
err.printStackTrace();
}
updateConfigs();
}
public void loadConfig(String name) {
Client.logger.info("Loading Config: " + name);
Client.getInstance().getGlobalSettings().setConfig(name);
configFile = new File(Client.getInstance().configDir, name);
if(!configFile.exists()) {
try {
configFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
this.load();
this.save();
for(Mod m : Client.getInstance().getModInstances().getMods()) {
if(m.isEnabled()) {
m.toggle();
m.toggle();
}
}
NotificationManager.clear();
Client.getInstance().getGlobalSettings().save();
}
public String newConfig(String name, boolean clone) {
Client.logger.info("Creating Config: " + name);
File testConfig = new File(Client.getInstance().configDir, name);
if(testConfig.exists()) {
Client.logger.info("Creating Config Error: Config already exists.");
return "Config already exists.";
} else {
if(clone) {
try {
testConfig.createNewFile();
} catch (IOException e) {
Client.logger.catching(e);
return "Error: " + e.getMessage();
}
}
}
Client.getInstance().getGlobalSettings().setConfig(name);
Client.getInstance().getGlobalSettings().save();
configFile = testConfig;
if(!clone) {
Client.getInstance().getModInstances().getMods().forEach(mod -> mod.reset(true));
try {
FileUtils.exportResource("/assets/minecraft/silentclient/configs/Default.txt", String.format(Client.getInstance().configDir.toString() + "/%s", name));
} catch (Exception e) {
Client.logger.catching(e);
}
} else {
this.save();
}
this.load();
if(clone) {
for(Mod m : Client.getInstance().getModInstances().getMods()) {
if(m.isEnabled()) {
m.toggle();
m.toggle();
}
}
}
updateConfigs();
return "success";
}
public void load() {
try (BufferedReader reader = new BufferedReader(new FileReader(this.configFile))) {
String s;
Client.getInstance().getModInstances().getAutoText().commands.clear();
while((s = reader.readLine()) != null) {
String[] args = s.split(":");
if (s.toLowerCase().startsWith("mod:")) {
try {
Mod m = Client.getInstance().getModInstances().getModByName(args[1]);
if (m != null) {
m.setEnabled(Boolean.parseBoolean(args[2]));
m.setToggled(Boolean.parseBoolean(args[2]));
}
} catch (Exception err) {
err.printStackTrace();
}
}
if (s.toLowerCase().startsWith("pos:")) {
try {
Mod m = Client.getInstance().getModInstances().getModByName(args[1]);
if (m != null && m instanceof ModDraggable) {
ModDraggable md = (ModDraggable) m;
md.setPos(ScreenPosition.fromRelativePosition(Double.parseDouble(args[2]), Double.parseDouble(args[3])));
md.getPos().setRelative(Double.parseDouble(args[2]), Double.parseDouble(args[3]));
}
} catch (Exception err) {
err.printStackTrace();
}
}
if (s.toLowerCase().startsWith("set:")) {
Mod m = Client.getInstance().getModInstances().getModByName(args[2]);
if (m != null) {
Setting set = Client.getInstance().getSettingsManager().getSettingByName(m, args[1]);
if (set != null) {
if (set.isCheck()) {
try {
set.setValBoolean(Boolean.parseBoolean(args[3]));
if(set.getName() == "Menu Background Blur") {
if(Minecraft.getMinecraft().currentScreen != null) {
if(!set.getValBoolean()) {
MenuBlurUtils.unloadBlur(true);
} else {
MenuBlurUtils.loadBlur(true);
}
}
}
} catch (Exception err) {
}
}
if(set.isKeybind()) {
try {
set.setKeybind(Integer.parseInt(args[3]));
} catch (Exception err) {
}
}
if (set.isCombo()) {
try {
if(set.getOptions().contains(args[3])) {
set.setValString(args[3]);
}
} catch (Exception err) {
}
}
if (set.isSlider()) {
try {
if(Double.parseDouble(args[3]) >= set.getMin() && Double.parseDouble(args[3]) <= set.getMax()) {
set.setValDouble(Double.parseDouble(args[3]));
}
} catch (Exception err) {
}
}
if(set.isInput()) {
try {
set.setValString(args[3]);
} catch (Exception err) {
}
}
if (set.isColor()) {
try {
set.setValColor(new Color(Integer.parseInt(args[3])));
} catch (Exception err) {
}
try {
set.setChroma(Boolean.parseBoolean(args[4]));
} catch (Exception err) {
}
try {
set.setOpacity(Integer.parseInt(args[5]));
} catch (Exception err) {
}
}
}
}
}
if (s.toLowerCase().startsWith("atc:")) {
try {
Client.getInstance().getModInstances().getAutoText().addCommand(args[1], Integer.parseInt(args[2]));
} catch (Exception err) {
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
public void save() {
Client.logger.info("Saving Config: " + this.configFile.getName());
try(PrintWriter writer = new PrintWriter(this.configFile)) {
for(Mod m : Client.getInstance().getModInstances().getMods()) {
writer.println("MOD:" + m.getName() + ":" + m.isToggled());
if(m instanceof ModDraggable) {
ModDraggable md = (ModDraggable) m;
writer.println("POS:" + m.getName() + ":" + md.getPos().getRelitiveX() + ":" + md.getPos().getRelitiveY());
}
}
for(Setting set : Client.getInstance().getSettingsManager().getSettings()) {
if (set.isCheck()) {
writer.println("SET:" + set.getName() + ":" + set.getParentMod().getName() + ":" + set.getValBoolean());
}
if (set.isCombo()) {
writer.println("SET:" + set.getName() + ":" + set.getParentMod().getName() + ":" + set.getValString());
}
if (set.isSlider()) {
writer.println("SET:" + set.getName() + ":" + set.getParentMod().getName() + ":" + set.getValDouble());
}
if (set.isColor()) {
writer.println("SET:" + set.getName() + ":" + set.getParentMod().getName() + ":" + set.getClearColor().getRGB() + ":" + set.isChroma() + ":" + set.getOpacity());
}
if(set.isInput()) {
writer.println("SET:" + set.getName() + ":" + set.getParentMod().getName() + ":" + set.getValString());
}
if(set.isKeybind()) {
writer.println("SET:" + set.getName() + ":" + set.getParentMod().getName() + ":" + set.getKeybind());
}
}
for(AutoTextCommand command : Client.getInstance().getModInstances().getAutoText().getCommands()) {
writer.println("ATC:"+command.getCommand()+":"+command.getKey());
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,127 @@
package net.silentclient.client.cosmetics;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.item.ItemStack;
import net.silentclient.client.Client;
import net.silentclient.client.blc.BlcGlStateManager;
import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt;
import net.silentclient.client.mods.settings.CosmeticsMod;
public class AbstractShieldRenderer extends ModelBase implements LayerRenderer<AbstractClientPlayer> {
private final RenderPlayer playerRenderer;
public AbstractShieldRenderer(RenderPlayer playerRendererIn)
{
this.playerRenderer = playerRendererIn;
}
@Override
public void doRenderLayer(AbstractClientPlayer entity, float p_177141_2_, float p_177141_3_,
float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
if(((AbstractClientPlayerExt) entity).silent$getShield() == null || !Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Shields").getValBoolean() || entity.isInvisible() || !Client.getInstance().getCosmetics().shieldModels.containsKey(((AbstractClientPlayerExt) entity).silent$getShield().getModel()) || !Client.getInstance().getCosmetics().shieldModels.get(((AbstractClientPlayerExt) entity).silent$getShield().getModel()).loadModel()) {
return;
}
BlcGlStateManager.t();
BlcGlStateManager.s();
BlcGlStateManager.a(1.0F, 1.0F, 1.0F, 1.0F);
BlcGlStateManager.g();
BlcGlStateManager.a(770, 771);
BlcGlStateManager.q();
BlcGlStateManager.d();
BlcGlStateManager.t();
if (playerRenderer.getMainModel().bipedLeftArm.rotateAngleZ != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedLeftArm.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
}
if (playerRenderer.getMainModel().bipedLeftArm.rotateAngleY != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedLeftArm.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
}
if (playerRenderer.getMainModel().bipedLeftArm.rotateAngleX != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedLeftArm.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
}
ItemStack chestplate = entity.getCurrentArmor(2);
applyArmTransformations(((AbstractClientPlayerExt) entity).silent$getShield().getModel(), entity.isSneaking(), entity.getSkinType().equals("slim"), chestplate != null);
double d = getShieldScale(((AbstractClientPlayerExt) entity).silent$getShield().getModel());
BlcGlStateManager.a(d, d, d);
BlcGlStateManager.k();
((AbstractClientPlayerExt) entity).silent$getShield().getTexture().bindTexture();
Client.getInstance().getCosmetics().shieldModels.get(((AbstractClientPlayerExt) entity).silent$getShield().getModel()).renderModel();
BlcGlStateManager.c();
BlcGlStateManager.u();
BlcGlStateManager.c(1029);
BlcGlStateManager.l();
BlcGlStateManager.r();
BlcGlStateManager.u();
GlStateManager.enableTexture2D();
((AbstractClientPlayerExt) entity).silent$getShield().getTexture().update(partialTicks);
}
public double getShieldScale(String model) {
if(model.equals("roundshield") || model.equals("hexagon_shield") || model.equals("shield_dollar") || model.equals("zzv4shield2") || model.equals("shield_v4")) {
return 0.100;
}
return 0.007;
}
private void applyArmTransformations(String model, boolean paramBoolean1, boolean paramBoolean2, boolean chestplate) {
switch(model) {
case "shield":
GlStateManager.translate(0.33, 0.45, 0.38);
BlcGlStateManager.b(180.0f, 0.0f, 1.0f, 1.0f);
BlcGlStateManager.b(-90.0f, 1.0f, 0.0f, 0.0f);
BlcGlStateManager.b(-90.0f, 0.0f, 1.0f, 0.0f);
BlcGlStateManager.b(paramBoolean1 ? -0.5799999833106995 : -0.4000000059604645, paramBoolean1 ? -0.72 : -0.5, paramBoolean2 ? 0.13700000524520874 : 0.2);
if(chestplate) {
GlStateManager.translate(0, 0, 0.055 + (paramBoolean2 ? 0.055 : 0));
}
break;
case "roundshield":
case "zzv4shield2":
GlStateManager.translate(0.33, 0.35, 0);
BlcGlStateManager.b(-90.0F, 0.0F, 1.0F, 0.0F);
BlcGlStateManager.b(paramBoolean1 ? -0.10000000149011612D : 0.0D, paramBoolean1 ? 0.45D : 0.25D, paramBoolean2 ? -0.1399999964237213D : -0.2D);
BlcGlStateManager.b(180.0F, 0.0F, 0.0F, 1.0F);
if(chestplate) {
GlStateManager.translate(0, 0, -0.06 + (paramBoolean2 ? -0.055 : 0));
}
break;
case "hexagon_shield":
GlStateManager.translate(0.75F, 0.35, 0);
BlcGlStateManager.b(90.0F, 0.0F, 1.0F, 0.0F);
BlcGlStateManager.b(paramBoolean1 ? 0.2 : 0, paramBoolean1 ? 0.45D : 0.25D, (paramBoolean2 ? -0.28D : -0.2D) + (paramBoolean1 ? -0.02 : 0));
BlcGlStateManager.b(180.0F, 0.0F, 0.0F, 1.0F);
if(chestplate) {
GlStateManager.translate(0, 0, 0.06 + (paramBoolean2 ? 0.051 : 0));
}
break;
case "shield_dollar":
GlStateManager.translate(0.70F, 0.35, 0);
BlcGlStateManager.b(90.0F, 0.0F, 1.0F, 0.0F);
BlcGlStateManager.b(paramBoolean1 ? 0.2 : 0, paramBoolean1 ? 0.45D : 0.25D, (paramBoolean2 ? -0.265D : -0.2D) + (paramBoolean1 ? -0.02 : 0));
BlcGlStateManager.b(180.0F, 0.0F, 0.0F, 1.0F);
if(chestplate) {
GlStateManager.translate(0, 0, 0.06 + (paramBoolean2 ? 0.055 : 0));
}
break;
case "shield_v4":
GlStateManager.translate(0.33, 0.35, 0);
BlcGlStateManager.b(-90.0F, 0.0F, 1.0F, 0.0F);
BlcGlStateManager.b(paramBoolean1 ? -0.10000000149011612D : 0.0D, paramBoolean1 ? 0.45D : 0.25D, paramBoolean2 ? -0.1399999964237213D : -0.2D);
BlcGlStateManager.b(180.0F, 90.0F, 0.0F, 1.0F);
if(chestplate) {
GlStateManager.translate(0, 0, -0.06 + (paramBoolean2 ? -0.055 : 0));
}
break;
}
}
@Override
public boolean shouldCombineTextures() {
return false;
}
}

View File

@ -0,0 +1,100 @@
package net.silentclient.client.cosmetics;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.mixin.ducks.TextureManagerExt;
import net.silentclient.client.utils.TimerUtils;
import java.util.ArrayList;
public class AnimatedResourceLocation {
protected final String folder;
protected final int frames;
protected final int fpt;
private int currentFrame = 0;
private TimerUtils timer = new TimerUtils();
protected ResourceLocation[] textures;
public ArrayList<ResourceLocation> bindedFrames = new ArrayList<ResourceLocation>();
private boolean binding;
public AnimatedResourceLocation(String folder, int frames, int fpt) {
this(folder, frames, fpt, false, false);
}
public AnimatedResourceLocation(String folder, int frames, int fpt, boolean clear) {
this(folder, frames, fpt, clear, false);
}
public AnimatedResourceLocation(String folder, int frames, int fpt, boolean clear, boolean bind) {
this.folder = folder;
this.frames = frames;
this.fpt = fpt;
if(!clear) {
textures = new ResourceLocation[frames];
for(int i = 0; i < frames; i++) {
if(bind) {
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(folder + "/" + i + ".png"));
}
textures[i] = new ResourceLocation(folder + "/" + i + ".png");
}
}
}
public int getCurrentFrame() {
return currentFrame;
}
public ArrayList<ResourceLocation> getBindedFrames() {
return bindedFrames;
}
public ResourceLocation getTexture() {
return textures[currentFrame];
}
public int getFrames() {
return frames;
}
public ResourceLocation[] getTextures() {
return textures;
}
public void bindTexture() {
if(currentFrame == 0) {
binding = false;
Minecraft.getMinecraft().getTextureManager().bindTexture(this.getTexture());
return;
}
binding = ((TextureManagerExt) Minecraft.getMinecraft().getTextureManager()).waitBindTexture(new StaticResourceLocation(this.getTexture().getResourcePath()), new StaticResourceLocation(this.getTextures()[0].getResourcePath()), 1000);
}
public void setCurrentFrame(int currentFrame) {
this.currentFrame = currentFrame;
}
public void update(float deltaTick) {
if(textures.length == 1) {
currentFrame = 0;
return;
}
if(this.binding) {
return;
}
if(timer.delay(this.fpt)) {
currentFrame++;
if(currentFrame > textures.length - 1) {
currentFrame = 0;
}
timer.reset();
}
}
}

View File

@ -0,0 +1,170 @@
package net.silentclient.client.cosmetics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.HashMap;
import java.util.HashSet;
import java.util.UUID;
import javax.imageio.ImageIO;
import javax.vecmath.Vector3f;
import javax.vecmath.Vector4f;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.item.ItemStack;
import net.silentclient.client.Client;
import net.silentclient.client.blc.BlcGlStateManager;
import net.silentclient.client.mixin.injection.accessors.MinecraftAccessor;
import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt;
import net.silentclient.client.mods.settings.CosmeticsMod;
import net.silentclient.client.utils.ColorUtils;
public class BandanaRenderer extends ModelBase implements LayerRenderer<AbstractClientPlayer> {
private final RenderPlayer playerRenderer;
private static HashMap<UUID, Integer> uuidToHatLayer = new HashMap<UUID, Integer>();
private static HashSet<UUID> checkedUuids = new HashSet<UUID>();
public BandanaRenderer(RenderPlayer playerRendererIn)
{
this.playerRenderer = playerRendererIn;
}
@Override
public void doRenderLayer(AbstractClientPlayer entityIn, float p_177141_2_, float p_177141_3_,
float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
if(Client.getInstance().getCosmetics().getBandana() == null || !Client.getInstance().getCosmetics().getBandana().loadModel() || !Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Bandanas").getValBoolean() || ((AbstractClientPlayerExt) entityIn).silent$getBandana() == null || entityIn.isInvisible()) {
return;
}
GlStateManager.pushMatrix();
BlcGlStateManager.t();
BlcGlStateManager.s();
BlcGlStateManager.g();
BlcGlStateManager.a(770, 771);
BlcGlStateManager.q();
BlcGlStateManager.d();
BlcGlStateManager.t();
if(entityIn.isSneaking()) {
GlStateManager.translate(0.0f, 0.25f, 0.0f);
}
if (playerRenderer.getMainModel().bipedHead.rotateAngleZ != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedHead.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
}
if (playerRenderer.getMainModel().bipedHead.rotateAngleY != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedHead.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
}
if (playerRenderer.getMainModel().bipedHead.rotateAngleX != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedHead.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
}
double applyTransformations = this.applyTransformations();
if(((AbstractClientPlayerExt) entityIn).silent$getAccount() != null && ((AbstractClientPlayerExt) entityIn).silent$getBandana().getTexture().getResourcePath().equals("silentclient/cosmetics/bandanas/17/0.png")) {
if(((AbstractClientPlayerExt) entityIn).silent$getAccount().getBandanaColor() == 50) {
ColorUtils.setColor(ColorUtils.getChromaColor(0, 0, 1).getRGB());
} else {
ColorUtils.setColor(((AbstractClientPlayerExt) entityIn).silent$getAccount().getBandanaColor());
}
}
applyTransformations += this.manipulate(entityIn);
GlStateManager.scale(applyTransformations, applyTransformations, applyTransformations);
((AbstractClientPlayerExt) entityIn).silent$getBandana().bindTexture();
BlcGlStateManager.k();
Client.getInstance().getCosmetics().getBandana().renderModel();
BlcGlStateManager.c();
BlcGlStateManager.u();
BlcGlStateManager.c(1029);
BlcGlStateManager.l();
BlcGlStateManager.r();
BlcGlStateManager.u();
GlStateManager.enableTexture2D();
GlStateManager.popMatrix();
((AbstractClientPlayerExt) entityIn).silent$getBandana().update(partialTicks);
}
private void runSkinProcessing(final UUID uuid, final String s) {
if (BandanaRenderer.checkedUuids.contains(uuid)) {
return;
}
BandanaRenderer.checkedUuids.add(uuid);
new Thread(new Runnable() {
@Override
public void run() {
final String substring = s;
final String string = ((MinecraftAccessor) Minecraft.getMinecraft()).getFileAssets().getAbsolutePath() + "/skins/" + substring.substring(0, 2) + "/" + s;
try {
BandanaRenderer.uuidToHatLayer.put(uuid, BandanaRenderer.findMaxHatLayer(ImageIO.read(new File(string))));
BandanaRenderer.checkedUuids.remove(uuid);
}
catch (final Exception ex) {
try {
Thread.sleep(1000L);
}
catch (final InterruptedException ex2) {}
BandanaRenderer.checkedUuids.remove(uuid);
}
}
}).start();
}
public static int findMaxHatLayer(final BufferedImage bufferedImage) {
for (int i = 8, n = 8; i < 16; ++i, --n) {
for (int j = 32; j < 64; ++j) {
if (bufferedImage.getRGB(j, i) >> 24 != 0) {
return n;
}
}
}
return 0;
}
private double applyTransformations() {
GlStateManager.rotate(180.0f, 0.0f, 0.0f, 1.0f);
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
final Vector4f rotations = new Vector4f(180.0f, 0.0f, 1.0f, 0.0f);
final Vector3f translations = new Vector3f(0.0f, 0.375f, 0.0f);
GlStateManager.rotate(rotations.x, rotations.y, rotations.z, rotations.w);
GlStateManager.translate(translations.x, translations.y, translations.z);
return 0.068F;
}
private double manipulate(AbstractClientPlayer entity) {
double n = 0.0;
GlStateManager.translate(0.0, -1 * 0.06, 0.0);
ItemStack helmet = entity.getCurrentArmor(3);
if(helmet != null) {
n = 0.012;
} else {
final Integer n2 = BandanaRenderer.uuidToHatLayer.get(entity.getUniqueID());
if (n2 == null) {
this.runSkinProcessing(entity.getUniqueID(), entity.getLocationSkin().getResourcePath().replace("skins/", ""));
return n;
}
if (n2 == 0) {
return n;
}
if (n2 > 4) {
n = 0.001;
}
}
return n;
}
@Override
public boolean shouldCombineTextures() {
// TODO Auto-generated method stub
return false;
}
}

View File

@ -0,0 +1,142 @@
package net.silentclient.client.cosmetics;
import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.silentclient.client.Client;
import net.silentclient.client.mods.settings.FPSBoostMod;
import net.silentclient.client.utils.AngleUtilities;
public class CapeRenderer extends ModelBase implements LayerRenderer<AbstractClientPlayer> {
private final RenderPlayer playerRenderer;
private ModelRenderer bipedCloakShoulders;
public CapeRenderer(RenderPlayer playerRendererIn)
{
this.playerRenderer = playerRendererIn;
this.bipedCloakShoulders = new ModelRenderer(this, 0, 17);
this.bipedCloakShoulders.setTextureSize(22, 23);
this.bipedCloakShoulders.addBox(-5.0F, -1.0F, -2.0F, 2, 1, 5, 0.0F);
this.bipedCloakShoulders.addBox(3.0F, -1.0F, -2.0F, 2, 1, 5, 0.0F);
}
@Override
public void doRenderLayer(AbstractClientPlayer entitylivingbaseIn, float p_177141_2_, float p_177141_3_,
float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
if(((AbstractClientPlayerExt) entitylivingbaseIn).silent$getCape() == null) {
return;
}
if (entitylivingbaseIn.isInvisible()) {
return;
}
((AbstractClientPlayerExt) entitylivingbaseIn).silent$getDynamicCape().ticks(System.nanoTime());
String capeType = ((AbstractClientPlayerExt) entitylivingbaseIn).silent$getCapeType();
GlStateManager.pushMatrix();
((AbstractClientPlayerExt) entitylivingbaseIn).silent$getCape().bindTexture();
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);
GlStateManager.disableLighting();
GlStateManager.color(1, 1, 1);
double prevX = entitylivingbaseIn.prevChasingPosX + (entitylivingbaseIn.chasingPosX - entitylivingbaseIn.prevChasingPosX) * (double)partialTicks - (entitylivingbaseIn.prevPosX + (entitylivingbaseIn.posX - entitylivingbaseIn.prevPosX) * (double)partialTicks);
double prevY = entitylivingbaseIn.prevChasingPosY + (entitylivingbaseIn.chasingPosY - entitylivingbaseIn.prevChasingPosY) * (double)partialTicks - (entitylivingbaseIn.prevPosY + (entitylivingbaseIn.posY - entitylivingbaseIn.prevPosY) * (double)partialTicks);
double prevZ = entitylivingbaseIn.prevChasingPosZ + (entitylivingbaseIn.chasingPosZ - entitylivingbaseIn.prevChasingPosZ) * (double)partialTicks - (entitylivingbaseIn.prevPosZ + (entitylivingbaseIn.posZ - entitylivingbaseIn.prevPosZ) * (double)partialTicks);
float prevRenderYaw = entitylivingbaseIn.prevRenderYawOffset + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks;
float prevCameraYaw = entitylivingbaseIn.prevCameraYaw + (entitylivingbaseIn.cameraYaw - entitylivingbaseIn.prevCameraYaw) * partialTicks;
double distanceWalkedModified = entitylivingbaseIn.prevDistanceWalkedModified + (entitylivingbaseIn.distanceWalkedModified - entitylivingbaseIn.prevDistanceWalkedModified) * partialTicks;
final double a = AngleUtilities .a((double)(prevRenderYaw * 3.1415927f / 180.0f));
final double n2 = -AngleUtilities .b(prevRenderYaw * 3.1415927f / 180.0f);
float a2 = AngleUtilities .a((float)prevY * 10.0f, -6.0f, 32.0f);
float n3 = (float)(prevX * a + prevZ * n2) * 100.0f;
final float n4 = (float)(prevX * n2 - prevZ * a) * 100.0f;
if (n3 < 0.0f) {
n3 = 0.0f;
}
if (n3 > 165.0f) {
n3 = 165.0f;
}
if(entitylivingbaseIn.isSneaking()) {
n3 += 5.0F;
GlStateManager.translate(0.0F, 0.1F, 0.0F);
a2 += 25.0F;
GlStateManager.translate(0.0F, 0.05F, -0.0178F);
}
float n5 = a2 + (float) (AngleUtilities.a(6.0f * prevCameraYaw)) * (float) (16.0f * distanceWalkedModified);
GlStateManager.scale(0.0625f, 0.0625f, 0.0625f);
GlStateManager.translate(0.0f, 0.0f, 2.0f);
GlStateManager.rotate(6.0f + Math.min(n3 / 2.0f + n5, 90.0f), 1.0f, 0.0f, 0.0f);
GlStateManager.rotate(n4 / 2.0f, 0.0f, 0.0f, 1.0f);
GlStateManager.rotate(-n4 / 2.0f, 0.0f, 1.0f, 0.0f);
GlStateManager.rotate(-90.0f, 0.0f, 1.0f, 0.0f);
GlStateManager.rotate(180.0f, 1.0f, 0.0f, 0.0f);
if(Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Low Graphics Mode").getValBoolean()) {
capeType = "rectangle";
}
switch(capeType) {
case "dynamic_curved":
final float max = Math.max(Math.min(0.0f, n5), -3.0f);
final float min = Math.min(n3 + n5, 90.0f);
((AbstractClientPlayerExt) entitylivingbaseIn).silent$getDynamicCape().renderDynamicCape();
((AbstractClientPlayerExt) entitylivingbaseIn).silent$getDynamicCape().update(min, max, true);
break;
case "curved_rectangle":
((AbstractClientPlayerExt) entitylivingbaseIn).silent$getCurvedCape().renderStaticCape();
break;
default:
((AbstractClientPlayerExt) entitylivingbaseIn).silent$getStaticCape().renderStaticCape();
break;
}
GlStateManager.translate(0.0f, 0.0f, 0.125f);
GlStateManager.rotate(6.0f + n3 / 2.0f + n5, 1.0f, 0.0f, 0.0f);
GlStateManager.rotate(n4 / 2.0f, 0.0f, 0.0f, 1.0f);
GlStateManager.rotate(-n4 / 2.0f, 0.0f, 1.0f, 0.0f);
GlStateManager.rotate(180.0f, 0.0f, 1.0f, 0.0f);
GlStateManager.popMatrix();
if(((AbstractClientPlayerExt) entitylivingbaseIn).silent$getShoulders()) {
((AbstractClientPlayerExt) entitylivingbaseIn).silent$getCapeShoulders().bindTexture();
GlStateManager.pushMatrix();
if(entitylivingbaseIn.isSneaking()) {
GlStateManager.translate(0.0F, 0.2F, 0.0F);
GlStateManager.rotate(10.0F, 1.0F, 0.0F, 0.0F);
}
GlStateManager.rotate(-n4 / 2.0F, 0.0F, 1.0F, 0.0F);
this.bipedCloakShoulders.render(0.0625F);
GlStateManager.popMatrix();
}
GlStateManager.enableLighting();
if(((AbstractClientPlayerExt) entitylivingbaseIn).silent$getCape() != null) {
((AbstractClientPlayerExt) entitylivingbaseIn).silent$getCape().update(partialTicks);
}
}
@Override
public boolean shouldCombineTextures() {
return false;
}
}

View File

@ -0,0 +1,316 @@
package net.silentclient.client.cosmetics;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.cosmetics.model.ModelBuffer;
import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt;
import net.silentclient.client.mods.settings.CosmeticsMod;
import net.silentclient.client.utils.Players;
import net.silentclient.client.utils.Requests;
import net.silentclient.client.utils.types.PlayerResponse;
import net.silentclient.client.utils.types.PlayerResponse.Account.Cosmetics.CosmeticItem;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class Cosmetics {
public Map<Number, AnimatedResourceLocation> capes = new HashMap<>();
public Map<Number, StaticResourceLocation> capesShoulders = new HashMap<>();
public Map<Number, AnimatedResourceLocation> wings = new HashMap<>();
public Map<Number, AnimatedResourceLocation> bandanas = new HashMap<>();
public Map<Number, HatData> hats = new HashMap<>();
public Map<Number, ShieldData> shields = new HashMap<>();
public Map<Number, StaticResourceLocation> icons = new HashMap<>();
public ArrayList<CosmeticItem> myIcons = new ArrayList<CosmeticItem>();
public ArrayList<CosmeticItem> myWings = new ArrayList<CosmeticItem>();
public ArrayList<CosmeticItem> myCapes = new ArrayList<CosmeticItem>();
public ArrayList<CosmeticItem> myBandanas = new ArrayList<CosmeticItem>();
public ArrayList<CosmeticItem> myHats = new ArrayList<CosmeticItem>();
public ArrayList<CosmeticItem> myShields = new ArrayList<CosmeticItem>();
public StaticResourceLocation defaultIcon;
private ModelBuffer bandana;
public Map<String, ModelBuffer> hatModels = new HashMap<>();
public Map<String, ModelBuffer> shieldModels = new HashMap<>();
public void init() {
init(true);
}
public void init(boolean cosmeticInit) {
if(cosmeticInit) {
Client.logger.info("STARTING > cosmeitcs > bandana_model");
try {
bandana = new ModelBuffer(new ResourceLocation("silentclient/models/bandana.obj"));
} catch (Exception e) {
e.printStackTrace();
}
Client.logger.info("STARTING > cosmeitcs > default_icon");
defaultIcon = new StaticResourceLocation("silentclient/icons/player_icon.png");
PlayerResponse.Account.Cosmetics allCosmetics = getAllCosmetics();
Client.logger.info("STARTING > cosmeitcs > capes");
capes.clear();
capesShoulders.clear();
if(allCosmetics != null && allCosmetics.getCapes() != null) {
allCosmetics.getCapes().forEach((cape) -> {
capes.put(cape.getId(), new AnimatedResourceLocation("silentclient/cosmetics/capes/"+cape.getId(), cape.getFrames(), cape.getFrameDelay(), false, cape.getId() == Client.getInstance().getAccount().getSelectedCape()));
capesShoulders.put(cape.getId(), new StaticResourceLocation("silentclient/cosmetics/capes/"+cape.getId()+"/shoulders.png"));
});
}
Client.logger.info("STARTING > cosmeitcs > wings");
wings.clear();
if(allCosmetics != null && allCosmetics.getWings() != null) {
allCosmetics.getWings().forEach((wing) -> {
wings.put(wing.getId(), new AnimatedResourceLocation("silentclient/cosmetics/wings/"+ wing.getId(), wing.getFrames(), wing.getFrameDelay(), false, wing.getId() == Client.getInstance().getAccount().getSelectedWings()));
});
}
Client.logger.info("STARTING > cosmeitcs > bandanas");
bandanas.clear();
if(allCosmetics != null && allCosmetics.getBandanas() != null) {
allCosmetics.getBandanas().forEach((bandana) -> {
bandanas.put(bandana.getId(), new AnimatedResourceLocation("silentclient/cosmetics/bandanas/"+bandana.getId(), bandana.getFrames(), bandana.getFrameDelay(), false, bandana.getId() == Client.getInstance().getAccount().getSelectedBandana()));
});
}
Client.logger.info("STARTING > cosmeitcs > hats");
hats.clear();
if(allCosmetics != null && allCosmetics.getHats() != null) {
allCosmetics.getHats().forEach((hat) -> {
hats.put(hat.getId(), new HatData(new AnimatedResourceLocation("silentclient/cosmetics/hats/"+hat.getId(), hat.getFrames(), hat.getFrameDelay(), false, hat.getId() == Client.getInstance().getAccount().getSelectedHat()), hat.getModel()));
if(!hatModels.containsKey(hat.getModel())) {
try {
Client.logger.info("STARTING > cosmeitcs > hats > model > " + hat.getModel());
ModelBuffer model = new ModelBuffer(new ResourceLocation("silentclient/models/"+ hat.getModel() + ".obj"));
if(model != null) {
hatModels.put(hat.getModel(), model);
}
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
Client.logger.info("STARTING > cosmeitcs > shields");
shields.clear();
if(allCosmetics != null && allCosmetics.getShields() != null) {
allCosmetics.getShields().forEach((shield) -> {
shields.put(shield.getId(), new ShieldData(new AnimatedResourceLocation("silentclient/cosmetics/shields/"+shield.getId(), shield.getFrames(), shield.getFrameDelay(), false, shield.getId() == Client.getInstance().getAccount().getSelectedShield()), shield.getModel()));
if(!hatModels.containsKey(shield.getModel())) {
try {
Client.logger.info("STARTING > cosmeitcs > shields > model > " + shield.getModel());
ModelBuffer model = new ModelBuffer(new ResourceLocation("silentclient/models/"+ shield.getModel() + ".obj"));
if(model != null) {
shieldModels.put(shield.getModel(), model);
}
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
Client.logger.info("STARTING > cosmeitcs > icons");
icons.clear();
if(allCosmetics != null && allCosmetics.getIcons() != null) {
allCosmetics.getIcons().forEach((icon) -> {
icons.put(icon.getId(), new StaticResourceLocation("silentclient/cosmetics/icons/"+ icon.getId() + "/0.png"));
});
}
Client.logger.info("STARTING > cosmeitcs > outfits");
Outfits.loadOutfits();
}
update(false);
}
public ModelBuffer getBandana() {
return bandana;
}
public void update(boolean async) {
Client.logger.info("Loading Player Information");
if(!async) {
PlayerResponse cosmetics = getCosmetics();
if(cosmetics != null) {
Client.getInstance().setAccount(cosmetics.getAccount());
Client.getInstance().getCosmetics().setMyCapes(cosmetics.getAccount().getCosmetics().getCapes());
Client.getInstance().getCosmetics().setMyWings(cosmetics.getAccount().getCosmetics().getWings());
Client.getInstance().getCosmetics().setMyIcons(cosmetics.getAccount().getCosmetics().getIcons());
Client.getInstance().getCosmetics().setMyBandanas(cosmetics.getAccount().getCosmetics().getBandanas());
Client.getInstance().getCosmetics().setMyHats(cosmetics.getAccount().getCosmetics().getHats());
Client.getInstance().getCosmetics().setMyShields(cosmetics.getAccount().getCosmetics().getShields());
Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Shoulders").setValBoolean(cosmetics.getAccount().getCapeShoulders());
Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Type").setValString(cosmetics.getAccount().getCapeType().equals("dynamic_curved") ? "Dynamic Curved" : cosmetics.getAccount().getCapeType().equals("curved_rectangle") ? "Curved Rectangle" : "Rectangle");
if(Minecraft.getMinecraft().thePlayer != null) {
((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$setCapeType(cosmetics.getAccount().getCapeType());
((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$setShoulders(cosmetics.getAccount().getCapeShoulders());
}
}
} else {
(new Thread("update") {
public void run() {
PlayerResponse cosmetics = getCosmetics();
if(cosmetics != null) {
Client.getInstance().setAccount(cosmetics.getAccount());
Client.getInstance().getCosmetics().setMyCapes(cosmetics.getAccount().getCosmetics().getCapes());
Client.getInstance().getCosmetics().setMyWings(cosmetics.getAccount().getCosmetics().getWings());
Client.getInstance().getCosmetics().setMyIcons(cosmetics.getAccount().getCosmetics().getIcons());
Client.getInstance().getCosmetics().setMyBandanas(cosmetics.getAccount().getCosmetics().getBandanas());
Client.getInstance().getCosmetics().setMyHats(cosmetics.getAccount().getCosmetics().getHats());
Client.getInstance().getCosmetics().setMyShields(cosmetics.getAccount().getCosmetics().getShields());
Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Shoulders").setValBoolean(cosmetics.getAccount().getCapeShoulders());
Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Type").setValString(cosmetics.getAccount().getCapeType().equals("dynamic_curved") ? "Dynamic Curved" : cosmetics.getAccount().getCapeType().equals("curved_rectangle") ? "Curved Rectangle" : "Rectangle");
if(Minecraft.getMinecraft().thePlayer != null) {
((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$setCapeType(cosmetics.getAccount().getCapeType());
((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$setShoulders(cosmetics.getAccount().getCapeShoulders());
}
}
}
}).start();
}
}
public void setMyCapes(ArrayList<CosmeticItem> myCapes) {
this.myCapes = myCapes;
}
public void setMyIcons(ArrayList<CosmeticItem> myIcons) {
this.myIcons = myIcons;
}
public void setMyWings(ArrayList<CosmeticItem> myWings) {
this.myWings = myWings;
}
public void setMyBandanas(ArrayList<CosmeticItem> myBandanas) {
this.myBandanas = myBandanas;
}
public void setMyHats(ArrayList<CosmeticItem> myHats) {
this.myHats = myHats;
}
public ArrayList<CosmeticItem> getMyHats() {
return myHats;
}
public void setMyShields(ArrayList<CosmeticItem> myShields) {
this.myShields = myShields;
}
public ArrayList<CosmeticItem> getMyShields() {
return myShields;
}
public static PlayerResponse.Account.Cosmetics getAllCosmetics() {
try {
InputStream in = Client.getInstance().getClass().getResourceAsStream("/assets/minecraft/silentclient/cosmetics.json");
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
StringBuffer content = new StringBuffer();
String inputLine;
while ((inputLine = reader.readLine()) != null) {
content.append(inputLine);
}
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
in.close();
return gson.fromJson(content.toString(), PlayerResponse.Account.Cosmetics.class);
} catch (Exception e1) {
Client.logger.catching(e1);
return null;
}
}
public static PlayerResponse getCosmetics() {
try {
String content = Requests.get("https://api.silentclient.net/account");
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
PlayerResponse response = gson.fromJson(content.toString(), PlayerResponse.class);
return response;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public AnimatedResourceLocation getWingsById(int id) {
return wings.get(id);
}
public AnimatedResourceLocation getCapeById(int id) {
return capes.get(id);
}
public AnimatedResourceLocation getBandanaById(int id) {
return bandanas.get(id);
}
public HatData getHatById(int id) {;
return hats.get(id);
}
public ShieldData getShieldById(int id) {;
return shields.get(id);
}
public StaticResourceLocation getCapeShoulders(int id) {
return capesShoulders.get(id);
}
public StaticResourceLocation getIconById(int id) {
StaticResourceLocation icon = icons.get(id);
return icon != null ? icon : getDefaultIcon();
}
public StaticResourceLocation getDefaultIcon() {
return defaultIcon;
}
public ArrayList<CosmeticItem> getMyCapes() {
return myCapes;
}
public ArrayList<CosmeticItem> getMyWings() {
return myWings;
}
public ArrayList<CosmeticItem> getMyIcons() {
return myIcons;
}
public ArrayList<CosmeticItem> getMyBandanas() {
return myBandanas;
}
public static void reload(final AbstractClientPlayer player) {
Minecraft.getMinecraft().refreshResources();
Client.getInstance().getCosmetics().update(true);
Players.reload();
Players.getPlayerStatus(false, ((AbstractClientPlayerExt) player).silent$getNameClear(), EntityPlayer.getUUID(player.getGameProfile()), player);
}
}

View File

@ -0,0 +1,19 @@
package net.silentclient.client.cosmetics;
public class HatData {
private final String model;
private final AnimatedResourceLocation texture;
public HatData(AnimatedResourceLocation texture, String model) {
this.model = model;
this.texture = texture;
}
public String getModel() {
return model;
}
public AnimatedResourceLocation getTexture() {
return texture;
}
}

View File

@ -0,0 +1,270 @@
package net.silentclient.client.cosmetics;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.item.ItemStack;
import net.silentclient.client.Client;
import net.silentclient.client.blc.BlcGlStateManager;
import net.silentclient.client.mixin.injection.accessors.MinecraftAccessor;
import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt;
import net.silentclient.client.mods.settings.CosmeticsMod;
import org.lwjgl.opengl.GL11;
import javax.imageio.ImageIO;
import javax.vecmath.Vector3f;
import javax.vecmath.Vector4f;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.HashMap;
import java.util.HashSet;
import java.util.UUID;
public class HatRenderer extends ModelBase implements LayerRenderer<AbstractClientPlayer> {
private final RenderPlayer playerRenderer;
private static HashMap<UUID, Integer> uuidToHatLayer = new HashMap<UUID, Integer>();
private static HashSet<UUID> checkedUuids = new HashSet<UUID>();
public final String type;
public HatRenderer(RenderPlayer playerRendererIn, String type)
{
this.playerRenderer = playerRendererIn;
this.type = type;
}
@Override
public void doRenderLayer(AbstractClientPlayer entityIn, float p_177141_2_, float p_177141_3_,
float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
if(!Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Hats").getValBoolean() || entityIn.isInvisible()) {
return;
}
HatData data = null;
switch(type) {
case "hat":
data = ((AbstractClientPlayerExt) entityIn).silent$getHat();
break;
case "mask":
data = ((AbstractClientPlayerExt) entityIn).silent$getMask();
break;
case "neck":
data = ((AbstractClientPlayerExt) entityIn).silent$getNeck();
break;
}
if(data == null || !Client.getInstance().getCosmetics().hatModels.containsKey(data.getModel()) || !Client.getInstance().getCosmetics().hatModels.get(data.getModel()).loadModel()) {
return;
}
GlStateManager.pushMatrix();
BlcGlStateManager.t();
BlcGlStateManager.s();
BlcGlStateManager.g();
BlcGlStateManager.a(770, 771);
BlcGlStateManager.q();
BlcGlStateManager.d();
BlcGlStateManager.t();
if(entityIn.isSneaking()) {
GlStateManager.translate(0.0f, data.getModel().equals("gold_chain") ? 0.2f : 0.25f, 0.0f);
}
switch(data.getModel()) {
case "gold_chain":
if (playerRenderer.getMainModel().bipedBody.rotateAngleZ != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedBody.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
}
if (playerRenderer.getMainModel().bipedBody.rotateAngleY != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedBody.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
}
if (playerRenderer.getMainModel().bipedBody.rotateAngleX != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedBody.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
}
break;
default:
if (playerRenderer.getMainModel().bipedHead.rotateAngleZ != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedHead.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
}
if (playerRenderer.getMainModel().bipedHead.rotateAngleY != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedHead.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
}
if (playerRenderer.getMainModel().bipedHead.rotateAngleX != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedHead.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
}
break;
}
double applyTransformations = this.applyTransformations(data.getModel());
applyTransformations += this.manipulate(entityIn, data.getModel());
GlStateManager.scale(applyTransformations, applyTransformations, applyTransformations);
data.getTexture().bindTexture();
BlcGlStateManager.k();
Client.getInstance().getCosmetics().hatModels.get(data.getModel()).renderModel();
BlcGlStateManager.c();
BlcGlStateManager.u();
BlcGlStateManager.c(1029);
BlcGlStateManager.l();
BlcGlStateManager.r();
BlcGlStateManager.u();
GlStateManager.popMatrix();
GlStateManager.enableTexture2D();
data.getTexture().update(partialTicks);
}
private void runSkinProcessing(final UUID uuid, final String s) {
if (HatRenderer.checkedUuids.contains(uuid)) {
return;
}
HatRenderer.checkedUuids.add(uuid);
new Thread(new Runnable() {
@Override
public void run() {
final String substring = s;
final String string = ((MinecraftAccessor) Minecraft.getMinecraft()).getFileAssets().getAbsolutePath() + "/skins/" + substring.substring(0, 2) + "/" + s;
try {
HatRenderer.uuidToHatLayer.put(uuid, HatRenderer.findMaxHatLayer(ImageIO.read(new File(string))));
HatRenderer.checkedUuids.remove(uuid);
}
catch (final Exception ex) {
try {
Thread.sleep(1000L);
}
catch (final InterruptedException ex2) {}
HatRenderer.checkedUuids.remove(uuid);
}
}
}).start();
}
public static int findMaxHatLayer(final BufferedImage bufferedImage) {
for (int i = 8, n = 8; i < 16; ++i, --n) {
for (int j = 32; j < 64; ++j) {
if (bufferedImage.getRGB(j, i) >> 24 != 0) {
return n;
}
}
}
return 0;
}
private double applyTransformations(String model) {
GlStateManager.rotate(180.0f, 0.0f, 0.0f, 1.0f);
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
Vector4f rotations = new Vector4f(180.0f, 0.0f, 1.0f, 0.0f);
Vector3f translations = null;
double scale = 0.068F;
switch(model) {
case "halo":
case "halo2":
case "sharp_halo":
translations = new Vector3f(0.65f, 0.65f, 0.65f);
scale = 0.08f;
break;
case "cowboy":
translations = new Vector3f(0.0f, 0.5f, 0.0f);
scale = 0.0101f;
break;
case "snapback":
rotations = new Vector4f(180.0f, 90.0f, 1.0f, 0.0f);
translations = new Vector3f(0.0f, 1.5f, 0.0f);
scale = 1;
break;
case "crown":
rotations = null;
translations = new Vector3f(0.08f, 0.4f, 0.0f);
break;
case "flowersnew":
translations = new Vector3f(0.0f, 0.275f, 0.0f);
break;
}
if(rotations != null) {
GlStateManager.rotate(rotations.x, rotations.y, rotations.z, rotations.w);
}
if(translations != null) {
GlStateManager.translate(translations.x, translations.y, translations.z);
}
return scale;
}
private double manipulate(AbstractClientPlayer entity, String model) {
double n = 0.0;
ItemStack helmet = entity.getCurrentArmor(3);
ItemStack chestplate = entity.getCurrentArmor(2);
if(chestplate != null && model.equals("gold_chain")) {
return 0.018;
}
if(helmet != null) {
switch(model) {
case "sombrero":
GL11.glTranslatef(0.0f, 0.065f, 0.0f);
break;
case "cowboy":
GL11.glTranslatef(0.0f, 0.18f, 0.0f);
break;
case "crown_v2":
GL11.glTranslatef(0.0f, 0.15f, 0.0f);
break;
case "panda":
n = 0.018;
GL11.glTranslatef(0.0f, -0.1f, 0.0f);
break;
case "flowersnew":
n = 0.012;
break;
case "zekich_hat":
GL11.glTranslatef(0.0f, 0.01f, 0.0f);
break;
case "gaming_headset":
n = 0.018;
break;
case "snapback":
n = 0.25;
GL11.glTranslatef(0.0f, 0.3f, 0.0f);
break;
}
} else {
final Integer n2 = HatRenderer.uuidToHatLayer.get(entity.getUniqueID());
if (n2 == null) {
this.runSkinProcessing(entity.getUniqueID(), entity.getLocationSkin().getResourcePath().replace("skins/", ""));
return n;
}
if (n2 == 0) {
return n;
}
switch(model) {
case "sombrero":
GL11.glTranslatef(0.0f, 0.04f, 0.0f);
break;
case "bunny_laying_hat":
GL11.glTranslatef(0.0f, -0.06f, 0.0f);
break;
case "zekich_hat":
GL11.glTranslatef(0.0f, -0.05f, 0.0f);
break;
}
}
return n;
}
@Override
public boolean shouldCombineTextures() {
return false;
}
}

View File

@ -0,0 +1,116 @@
package net.silentclient.client.cosmetics;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.silentclient.client.Client;
import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt;
import net.silentclient.client.utils.Players;
import net.silentclient.client.utils.Requests;
import java.io.*;
import java.util.ArrayList;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Outfits {
public static File outfitsDir;
public static ArrayList<Outfit> outfits = new ArrayList<>();
public static void loadOutfits() {
outfits.clear();
if(outfitsDir == null) {
outfitsDir = new File(Minecraft.getMinecraft().mcDataDir, "SilentClient-Cosmetic-Outfits");
}
if(!outfitsDir.exists()) {
outfitsDir.mkdirs();
}
Set<String> outfitsNames = Stream.of(outfitsDir.listFiles())
.filter(file -> !file.isDirectory())
.map(File::getName)
.collect(Collectors.toSet());
outfitsNames.forEach((name) -> {
Client.logger.info("Loading Cosmetic Outfit: " + name);
try {
InputStream in = new FileInputStream(new File(outfitsDir, name));
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
StringBuffer content = new StringBuffer();
String inputLine;
while ((inputLine = reader.readLine()) != null) {
content.append(inputLine);
}
outfits.add(Client.getInstance().getGson().fromJson(content.toString(), Outfit.class));
in.close();
} catch (Exception err) {
Client.logger.catching(err);
}
});
}
public static void createOutfit(Outfit outfit) {
Client.logger.info("Creating Outfit: " + outfit.name);
try {
File outfitFile = new File(outfitsDir, outfit.name + ".json");
if(!outfitFile.exists()) {
outfitFile.createNewFile();
}
FileOutputStream outputStream = new FileOutputStream(outfitFile);
byte[] strToBytes = Client.getInstance().getGson().toJson(outfit).getBytes();
outputStream.write(strToBytes);
outputStream.close();
outfits.add(outfit);
} catch (Exception err) {
Client.logger.catching(err);
}
}
public static void loadOutfit(Outfit outfit) {
Client.logger.info("Loading Outfit: " + outfit.name);
Requests.post("https://api.silentclient.net/account/load_outfit", Client.getInstance().getGson().toJson(outfit));
Client.getInstance().updateUserInformation();
Players.reload();
if(Minecraft.getMinecraft().thePlayer != null) {
Players.getPlayerStatus(false, ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getNameClear(), EntityPlayer.getUUID(Minecraft.getMinecraft().thePlayer.getGameProfile()), Minecraft.getMinecraft().thePlayer);
}
}
public static ArrayList<Outfit> getOutfits() {
return outfits;
}
public static void deleteOutfit(Outfit outfit) {
outfits.remove(outfit);
try {
new File(outfitsDir, outfit.name + ".json").delete();
} catch (Exception err) {
Client.logger.catching(err);
}
}
public static class Outfit {
public final String name;
public final int selected_cape;
public final int selected_wings;
public final int selected_icon;
public final int selected_bandana;
public final int selected_hat;
public final int selected_neck;
public final int selected_mask;
public final int selected_shield;
public Outfit(String name, int selected_cape, int selected_wings, int selected_icon, int selected_bandana, int selected_hat, int selected_neck, int selected_mask, int selected_shield) {
this.name = name;
this.selected_cape = selected_cape;
this.selected_wings = selected_wings;
this.selected_icon = selected_icon;
this.selected_bandana = selected_bandana;
this.selected_hat = selected_hat;
this.selected_neck = selected_neck;
this.selected_mask = selected_mask;
this.selected_shield = selected_shield;
}
}
}

View File

@ -0,0 +1,19 @@
package net.silentclient.client.cosmetics;
public class ShieldData {
private final String model;
private final AnimatedResourceLocation texture;
public ShieldData(AnimatedResourceLocation texture, String model) {
this.model = model;
this.texture = texture;
}
public String getModel() {
return model;
}
public AnimatedResourceLocation getTexture() {
return texture;
}
}

View File

@ -0,0 +1,119 @@
package net.silentclient.client.cosmetics;
import org.lwjgl.opengl.GL11;
import net.silentclient.client.cosmetics.dynamiccurved.Box;
public class StaticCape {
private final float curvePoints;
private final float horizCurve;
private final float vertCurve;
private Integer staticCloakCallList = null;
public StaticCape(float paramFloat1, float paramFloat2, float paramFloat3) {
this.curvePoints = paramFloat1;
this.horizCurve = paramFloat2;
this.vertCurve = paramFloat3;
}
public void init() {
this.staticCloakCallList = Integer.valueOf(GL11.glGenLists(1));
float f1 = 22.0F;
float f2 = 23.0F;
float f3 = 1.0F / f2;
float f4 = 17.0F / f2;
float f5 = 1.0F / f1;
float f6 = 11.0F / f1;
float f7 = 12.0F / f1;
float f8 = 22.0F / f1;
float f9 = 21.0F / f1;
Box b1 = new Box(0.0F, 0.0F, 5.0F);
Box b2 = new Box(0.0F + this.horizCurve, -16.0F + this.vertCurve, 5.0F);
Box b3 = new Box(0.0F + this.horizCurve, -16.0F + this.vertCurve, -5.0F);
Box b4 = new Box(0.0F, 0.0F, -5.0F);
Box b5 = new Box(1.0F, 0.0F, 5.0F);
Box b6 = new Box(1.0F + this.horizCurve, -16.0F + this.vertCurve, 5.0F);
Box b7 = new Box(1.0F + this.horizCurve, -16.0F + this.vertCurve, -5.0F);
Box b8 = new Box(1.0F, 0.0F, -5.0F);
Box b9 = new Box(0.0F, -10.0F, -5.0F);
Box b10 = new Box(0.0F, -10.0F, -5.0F);
GL11.glNewList(this.staticCloakCallList.intValue(), 4864);
GL11.glBegin(5);
byte b;
for (b = 0; b <= this.curvePoints; b++) {
float f10 = b / this.curvePoints;
float f11 = (1.0F - f10) * (1.0F - f10) * b7.a + 2.0F * (1.0F - f10) * f10 * b9.a + f10 * f10 * b8.a;
float f12 = (1.0F - f10) * (1.0F - f10) * b7.b + 2.0F * (1.0F - f10) * f10 * b9.b + f10 * f10 * b8.b;
GL11.glTexCoord2f(f5, f4 - (f4 - f3) * f10);
GL11.glVertex3f(f11, f12, b5.c);
GL11.glTexCoord2f(f6, f4 - (f4 - f3) * f10);
GL11.glVertex3f(f11, f12, b8.c);
}
GL11.glTexCoord2f(f5, f3);
GL11.glVertex3f(b5.a, b5.b, b5.c);
GL11.glTexCoord2f(f6, f3);
GL11.glVertex3f(b8.a, b8.b, b8.c);
GL11.glTexCoord2f(f5, 0.0F);
GL11.glVertex3f(b1.a, b1.b, b1.c);
GL11.glTexCoord2f(f6, 0.0F);
GL11.glVertex3f(b4.a, b4.b, b4.c);
for (b = 0; b <= this.curvePoints; b++) {
float f10 = b / this.curvePoints;
float f11 = (1.0F - f10) * (1.0F - f10) * b4.a + 2.0F * (1.0F - f10) * f10 * b10.a + f10 * f10 * b3.a;
float f12 = (1.0F - f10) * (1.0F - f10) * b4.b + 2.0F * (1.0F - f10) * f10 * b10.b + f10 * f10 * b3.b;
GL11.glTexCoord2f(f7, f3 + (f4 - f3) * f10);
GL11.glVertex3f(f11, f12, b8.c);
f11 = (1.0F - f10) * (1.0F - f10) * b8.a + 2.0F * (1.0F - f10) * f10 * b9.a + f10 * f10 * b7.a;
f12 = (1.0F - f10) * (1.0F - f10) * b8.b + 2.0F * (1.0F - f10) * f10 * b9.b + f10 * f10 * b7.b;
GL11.glTexCoord2f(f6, f3 + (f4 - f3) * f10);
GL11.glVertex3f(f11, f12, b8.c);
}
GL11.glTexCoord2f(f9, 0.0F);
GL11.glVertex3f(b7.a, b7.b, b7.c);
GL11.glTexCoord2f(f6, 0.0F);
GL11.glVertex3f(b6.a, b6.b, b6.c);
GL11.glTexCoord2f(f9, f3);
GL11.glVertex3f(b3.a, b3.b, b3.c);
GL11.glTexCoord2f(f6, f3);
GL11.glVertex3f(b2.a, b2.b, b2.c);
for (b = 0; b <= this.curvePoints; b++) {
float f10 = b / this.curvePoints;
float f11 = (1.0F - f10) * (1.0F - f10) * b3.a + 2.0F * (1.0F - f10) * f10 * b10.a + f10 * f10 * b4.a;
float f12 = (1.0F - f10) * (1.0F - f10) * b3.b + 2.0F * (1.0F - f10) * f10 * b10.b + f10 * f10 * b4.b;
GL11.glTexCoord2f(f7, f4 - (f4 - f3) * f10);
GL11.glVertex3f(f11, f12, b8.c);
GL11.glTexCoord2f(f8, f4 - (f4 - f3) * f10);
GL11.glVertex3f(f11, f12, b5.c);
}
for (b = 0; b <= this.curvePoints; b++) {
float f10 = b / this.curvePoints;
if (b == 0) {
float f13 = (1.0F - f10) * (1.0F - f10) * b4.a + 2.0F * (1.0F - f10) * f10 * b10.a + f10 * f10 * b3.a;
float f14 = (1.0F - f10) * (1.0F - f10) * b4.b + 2.0F * (1.0F - f10) * f10 * b10.b + f10 * f10 * b3.b;
GL11.glTexCoord2f(0.0F, f3 + (f4 - f3) * f10);
GL11.glVertex3f(f13, f14, b5.c);
GL11.glTexCoord2f(0.0F, f3 + (f4 - f3) * f10);
GL11.glVertex3f(f13, f14, b5.c);
}
float f11 = (1.0F - f10) * (1.0F - f10) * b8.a + 2.0F * (1.0F - f10) * f10 * b9.a + f10 * f10 * b7.a;
float f12 = (1.0F - f10) * (1.0F - f10) * b8.b + 2.0F * (1.0F - f10) * f10 * b9.b + f10 * f10 * b7.b;
GL11.glTexCoord2f(f5, f3 + (f4 - f3) * f10);
GL11.glVertex3f(f11, f12, b5.c);
f11 = (1.0F - f10) * (1.0F - f10) * b4.a + 2.0F * (1.0F - f10) * f10 * b10.a + f10 * f10 * b3.a;
f12 = (1.0F - f10) * (1.0F - f10) * b4.b + 2.0F * (1.0F - f10) * f10 * b10.b + f10 * f10 * b3.b;
GL11.glTexCoord2f(0.0F, f3 + (f4 - f3) * f10);
GL11.glVertex3f(f11, f12, b5.c);
}
GL11.glEnd();
GL11.glEndList();
}
public void renderStaticCape() {
if (this.staticCloakCallList == null)
init();
GL11.glCallList(this.staticCloakCallList.intValue());
}
}

View File

@ -0,0 +1,24 @@
package net.silentclient.client.cosmetics;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
public class StaticResourceLocation {
private ResourceLocation location;
public StaticResourceLocation(ResourceLocation location) {
this.location = location;
}
public StaticResourceLocation(String path) {
this.location = new ResourceLocation(path);
}
public ResourceLocation getLocation() {
return location;
}
public void bindTexture() {
Minecraft.getMinecraft().getTextureManager().bindTexture(location);
}
}

View File

@ -0,0 +1,46 @@
package net.silentclient.client.cosmetics.dynamiccurved;
public class Box {
public float a;
public float b;
public float c;
public Box(float f, float f1, float f2)
{
this.a = f;
this.b = f1;
this.c = f2;
}
public Box a(float f, float f1, float f2)
{
this.a = f;
this.b = f1;
this.c = f2;
return this;
}
public Box a(Box bx)
{
float f = (float)Math.sqrt((double)this.a());
return bx == null ? new Box(this.a / f, this.b / f, this.c / f) : bx.a(this.a / f, this.b / f, this.c / f);
}
public float a()
{
return this.a * this.a + this.b * this.b + this.c * this.c;
}
public static Box a(Box b1, Box b2, Box b3)
{
if (b3 == null)
{
return new Box(b1.a + b2.a, b1.b + b2.b, b1.c + b2.c);
}
else
{
b3.a(b1.a + b2.a, b1.b + b2.b, b1.c + b2.c);
return b3;
}
}
}

View File

@ -0,0 +1,250 @@
package net.silentclient.client.cosmetics.dynamiccurved;
import java.nio.FloatBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.ARBVertexBufferObject;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL15;
public class DynamicCape {
private long COUNTER = 0L;
private long lastNanoTime = 0L;
private int vertexVbo;
private int textureVbo;
private FloatBuffer vertexBuffer = BufferUtils.createFloatBuffer(294);
private FloatBuffer textureBuffer;
private int vertexCount = 0;
private float lastHorz = 0.0F;
private float lastVert = 0.0F;
private float lastAmplitude = 0.0F;
private boolean deleted = false;
public DynamicCape() {
this.vertexBuffer.flip();
this.vertexVbo = GL15.glGenBuffers();
GL15.glBindBuffer(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, this.vertexVbo);
GL15.glBufferData(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, (FloatBuffer) this.vertexBuffer, ARBVertexBufferObject.GL_DYNAMIC_DRAW_ARB);
this.textureBuffer = BufferUtils.createFloatBuffer(196);
this.textureBuffer.flip();
this.textureVbo = GL15.glGenBuffers();
GL15.glBindBuffer(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, this.textureVbo);
GL15.glBufferData(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, (FloatBuffer) this.textureBuffer, ARBVertexBufferObject.GL_STATIC_DRAW_ARB);
GL15.glBindBuffer(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 0);
}
public void ticks(long i) {
if (i - lastNanoTime > 16666666L) {
lastNanoTime = i;
++COUNTER;
}
}
public void update(float f, float f1, boolean flag) {
f = f / 55.0F;
float f2 = (float) COUNTER / 10.0F;
float f3 = f;
float f4 = 1.5F;
if (!this.deleted) {
if (flag || f != this.lastHorz || f1 != this.lastVert || this.lastAmplitude != f || f != 0.0F) {
this.lastAmplitude = f;
this.vertexBuffer.clear();
this.vertexCount = 0;
if (flag) {
this.textureBuffer.clear();
}
float f5 = 22.0F;
float f6 = 23.0F;
float f7 = 1.0F / f6;
float f8 = 17.0F / f6;
float f9 = 1.0F / f5;
float f10 = 11.0F / f5;
float f11 = 12.0F / f5;
float f12 = 22.0F / f5;
Box b = new Box(0.0F, 0.0F, 5.0F);
Box box1 = new Box(0.0F, -16.0F, 5.0F);
Box box2 = new Box(0.0F, -16.0F, -5.0F);
Box box3 = new Box(0.0F, 0.0F, -5.0F);
Box box4 = new Box(1.0F, 0.0F, 5.0F);
Box box5 = new Box(1.0F, -16.0F, 5.0F);
Box box6 = new Box(1.0F, -16.0F, -5.0F);
Box box7 = new Box(1.0F, 0.0F, -5.0F);
Box box8 = new Box(0.0F, -10.0F, -5.0F);
Box box9 = new Box(0.0F, -10.0F, -5.0F);
float f14 = 10.0F;
boolean flag1 = true;
float f15 = (float) Math.sin(Math.PI * (double) f4 + (double) f2) * f;
float f16 = -f15;
for (int i = 0; (float) i <= f14; ++i) {
float f17 = (float) i / f14;
float f18 = (1.0F - f17) * (1.0F - f17) * box6.a + 2.0F * (1.0F - f17) * f17 * box8.a + f17 * f17 * box7.a;
float f19 = (1.0F - f17) * (1.0F - f17) * box6.b + 2.0F * (1.0F - f17) * f17 * box8.b + f17 * f17 * box7.b;
if (flag1) {
f18 = (float) Math.sin((double) f17 * Math.PI * (double) f4 + (double) f2) * f3 + 1.0F + f16;
}
if (flag) {
this.textureBuffer.put(new float[]{f9, f8 - (f8 - f7) * f17});
this.textureBuffer.put(new float[]{f10, f8 - (f8 - f7) * f17});
}
this.vertexBuffer.put(new float[]{f18, f19, box4.c});
this.vertexBuffer.put(new float[]{f18, f19, box7.c});
this.vertexCount += 2;
}
if (flag) {
this.textureBuffer.put(new float[]{0.045454547F, 0.04347826F});
this.textureBuffer.put(new float[]{0.5F, 0.04347826F});
this.textureBuffer.put(new float[]{0.045454547F, 0.0F});
this.textureBuffer.put(new float[]{0.5F, 0.0F});
}
this.vertexBuffer.put(new float[]{box4.a, box4.b, box4.c});
this.vertexBuffer.put(new float[]{box7.a, box7.b, box7.c});
this.vertexBuffer.put(new float[]{b.a, b.b, b.c});
this.vertexBuffer.put(new float[]{box3.a, box3.b, box3.c});
this.vertexCount += 4;
for (int j = 0; (float) j <= f14; ++j) {
float f22 = (float) j / f14;
float f26 = (1.0F - f22) * (1.0F - f22) * box3.b + 2.0F * (1.0F - f22) * f22 * box9.b + f22 * f22 * box2.b;
float f23 = (float) Math.sin((double) (1.0F - f22) * Math.PI * (double) f4 + (double) f2) * f3 + f16;
if (flag) {
this.textureBuffer.put(new float[]{f11, f7 + (f8 - f7) * f22});
this.textureBuffer.put(new float[]{f10, f7 + (f8 - f7) * f22});
}
this.vertexBuffer.put(new float[]{f23, f26, box7.c});
f23 = (1.0F - f22) * (1.0F - f22) * box7.a + 2.0F * (1.0F - f22) * f22 * box8.a + f22 * f22 * box6.a;
f26 = (1.0F - f22) * (1.0F - f22) * box7.b + 2.0F * (1.0F - f22) * f22 * box8.b + f22 * f22 * box6.b;
if (flag1) {
f23 = (float) Math.sin((double) (1.0F - f22) * Math.PI * (double) f4 + (double) f2) * f3 + 1.0F + f16;
}
this.vertexBuffer.put(new float[]{f23, f26, box7.c});
this.vertexCount += 2;
}
if (flag) {
this.textureBuffer.put(new float[]{0.95454544F, 0.0F});
this.textureBuffer.put(new float[]{0.5F, 0.0F});
this.textureBuffer.put(new float[]{0.95454544F, 0.04347826F});
this.textureBuffer.put(new float[]{0.5F, 0.04347826F});
}
float f21 = 0.0F;
if (flag1) {
f21 = (float) Math.sin(0.0D * (double) f4 + (double) f2) * f3 + f16;
}
this.vertexBuffer.put(new float[]{box6.a + f21, box6.b, box6.c});
this.vertexBuffer.put(new float[]{box5.a + f21, box5.b, box5.c});
this.vertexBuffer.put(new float[]{box2.a + f21, box2.b, box2.c});
this.vertexBuffer.put(new float[]{box1.a + f21, box1.b, box1.c});
this.vertexCount += 4;
for (int k = 0; (float) k <= f14; ++k) {
float f24 = (float) k / f14;
float f27 = (1.0F - f24) * (1.0F - f24) * box2.a + 2.0F * (1.0F - f24) * f24 * box9.a + f24 * f24 * box3.a;
float f20 = (1.0F - f24) * (1.0F - f24) * box2.b + 2.0F * (1.0F - f24) * f24 * box9.b + f24 * f24 * box3.b;
if (flag1) {
f27 = (float) Math.sin((double) f24 * Math.PI * (double) f4 + (double) f2) * f3 + f16;
}
if (flag) {
this.textureBuffer.put(new float[]{f11, f8 - (f8 - f7) * f24});
this.textureBuffer.put(new float[]{f12, f8 - (f8 - f7) * f24});
}
this.vertexBuffer.put(new float[]{f27, f20, box7.c});
this.vertexBuffer.put(new float[]{f27, f20, box4.c});
this.vertexCount += 2;
}
for (int l = 0; (float) l <= f14; ++l) {
float f25 = (float) l / f14;
if (l == 0) {
float f28 = (1.0F - f25) * (1.0F - f25) * box3.a + 2.0F * (1.0F - f25) * f25 * box9.a + f25 * f25 * box2.a;
float f30 = (1.0F - f25) * (1.0F - f25) * box3.b + 2.0F * (1.0F - f25) * f25 * box9.b + f25 * f25 * box2.b;
if (flag) {
this.textureBuffer.put(new float[]{0.0F, f7 + (f8 - f7) * f25});
this.textureBuffer.put(new float[]{0.0F, f7 + (f8 - f7) * f25});
}
this.vertexBuffer.put(new float[]{f28, f30, box4.c});
this.vertexBuffer.put(new float[]{f28, f30, box4.c});
this.vertexCount += 2;
}
float f29 = (float) Math.sin((double) (1.0F - f25) * Math.PI * (double) f4 + (double) f2) * f3 + 1.0F + f16;
float f31 = (1.0F - f25) * (1.0F - f25) * box7.b + 2.0F * (1.0F - f25) * f25 * box8.b + f25 * f25 * box6.b;
if (flag) {
this.textureBuffer.put(new float[]{f9, f7 + (f8 - f7) * f25});
this.textureBuffer.put(new float[]{0.0F, f7 + (f8 - f7) * f25});
}
this.vertexBuffer.put(new float[]{f29, f31, box4.c});
f29 = (1.0F - f25) * (1.0F - f25) * box3.a + 2.0F * (1.0F - f25) * f25 * box9.a + f25 * f25 * box2.a;
f31 = (1.0F - f25) * (1.0F - f25) * box3.b + 2.0F * (1.0F - f25) * f25 * box9.b + f25 * f25 * box2.b;
if (flag1) {
f29 = (float) Math.sin((double) (1.0F - f25) * Math.PI * (double) f4 + (double) f2) * f3 + f16;
}
this.vertexBuffer.put(new float[]{f29, f31, box4.c});
this.vertexCount += 2;
}
this.vertexBuffer.flip();
GL15.glBindBuffer(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, this.vertexVbo);
GL15.glBufferData(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, (FloatBuffer) this.vertexBuffer, ARBVertexBufferObject.GL_DYNAMIC_DRAW_ARB);
if (flag) {
this.textureBuffer.flip();
GL15.glBindBuffer(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, this.textureVbo);
GL15.glBufferData(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, (FloatBuffer) this.textureBuffer, ARBVertexBufferObject.GL_STATIC_DRAW_ARB);
}
GL15.glBindBuffer(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 0);
this.lastHorz = f;
this.lastVert = f1;
}
}
}
public void renderDynamicCape() {
if (!this.deleted) {
GL15.glBindBuffer(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, this.vertexVbo);
GL11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0L);
GL15.glBindBuffer(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, this.textureVbo);
GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 0, 0L);
GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
GL11.glDrawArrays(GL11.GL_TRIANGLE_STRIP, 0, this.vertexCount);
GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
GL15.glBindBuffer(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 0);
}
}
public void deleteData() {
this.deleted = true;
GL15.glDeleteBuffers(this.vertexVbo);
GL15.glDeleteBuffers(this.textureVbo);
}
}

View File

@ -0,0 +1,511 @@
package net.silentclient.client.cosmetics.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.elements.Input;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.gui.theme.button.DefaultButtonTheme;
import net.silentclient.client.gui.theme.button.SelectedButtonTheme;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.mods.settings.CosmeticsMod;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.utils.MenuBlurUtils;
import net.silentclient.client.utils.MouseCursorHandler;
import net.silentclient.client.utils.ScrollHelper;
import net.silentclient.client.utils.Sounds;
import net.silentclient.client.utils.types.PlayerResponse.Account.Cosmetics.CosmeticItem;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
public class CosmeticsGui extends SilentScreen {
public static String selectedCategory = "capes";
private int rotate = 0;
private ScrollHelper scrollHelper = new ScrollHelper();
@Override
public void initGui() {
rotate = 144;
defaultCursor = false;
if(mc.thePlayer == null) {
Client.backgroundPanorama.updateWidthHeight(this.width, this.height);
} else {
MenuBlurUtils.loadBlur();
}
this.silentInputs.add(new Input("Search"));
CosmeticsGui.selectedCategory = "capes";
Client.getInstance().updateUserInformation();
int categoryOffsetY = 25;
int addX = 190;
int addY = 110;
int x = (width / 2) - addX;
int y = (height / 2) - addY;
int height = addY * 2;
int tabId = 1;
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 18, "Capes", false, selectedCategory == "capes" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
categoryOffsetY +=23;
tabId++;
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 18, "Wings", false, selectedCategory == "wings" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
categoryOffsetY +=23;
tabId++;
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 18, "Bandanas", false, selectedCategory == "bandanas" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
categoryOffsetY +=23;
tabId++;
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 18, "Hats", false, selectedCategory == "hats" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
categoryOffsetY +=23;
tabId++;
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 18, "Shields", false, selectedCategory == "shields" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
categoryOffsetY +=23;
tabId++;
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 18, "Icons", false, selectedCategory == "icons" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
tabId++;
this.buttonList.add(new Button(tabId, x + 5, (y + height) - 24, 75, 18, "Store"));
this.buttonList.add(new Button(88, x + 380 - 140, (y + height) - 24, 135, 18, "Outfits"));
}
@Override
public void onGuiClosed() {
if(Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Menu Background Blur").getValBoolean()) {
Minecraft.getMinecraft().entityRenderer.loadEntityShader(null);
}
super.onGuiClosed();
}
@Override
protected void actionPerformed(GuiButton button) {
super.actionPerformed(button);
if(button instanceof Button) {
switch (button.id) {
case 1:
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof Button) {
((Button) oldButton).setTheme(new DefaultButtonTheme());
}
});
((Button) button).setTheme(new SelectedButtonTheme());
selectedCategory = "capes";
rotate = 144;
scrollHelper.resetScroll();
break;
case 2:
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof Button) {
((Button) oldButton).setTheme(new DefaultButtonTheme());
}
});
((Button) button).setTheme(new SelectedButtonTheme());
selectedCategory = "wings";
rotate = 144;
scrollHelper.resetScroll();
break;
case 3:
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof Button) {
((Button) oldButton).setTheme(new DefaultButtonTheme());
}
});
((Button) button).setTheme(new SelectedButtonTheme());
selectedCategory = "bandanas";
rotate = 340;
scrollHelper.resetScroll();
break;
case 4:
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof Button) {
((Button) oldButton).setTheme(new DefaultButtonTheme());
}
});
((Button) button).setTheme(new SelectedButtonTheme());
selectedCategory = "hats";
rotate = 340;
scrollHelper.resetScroll();
break;
case 5:
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof Button) {
((Button) oldButton).setTheme(new DefaultButtonTheme());
}
});
((Button) button).setTheme(new SelectedButtonTheme());
selectedCategory = "shields";
rotate = 340;
scrollHelper.resetScroll();
break;
case 6:
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof Button) {
((Button) oldButton).setTheme(new DefaultButtonTheme());
}
});
((Button) button).setTheme(new SelectedButtonTheme());
selectedCategory = "icons";
scrollHelper.resetScroll();
break;
}
this.silentInputs.get(0).setValue("");
}
if(button.id == 7) {
try {
Class<?> oclass = Class.forName("java.awt.Desktop");
Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]);
oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {new URI("https://store.silentclient.net/")});
} catch (Throwable err) {
err.printStackTrace();
}
}
if(button.id == 88) {
mc.displayGuiScreen(new OutfitsGui(this));
}
}
private ArrayList<CosmeticItem> getItems() {
ArrayList<CosmeticItem> items;
ArrayList<CosmeticItem> searchItems = new ArrayList<>();
if(selectedCategory == "capes") {
items = Client.getInstance().getCosmetics().getMyCapes();
} else if(selectedCategory == "wings") {
items = Client.getInstance().getCosmetics().getMyWings();
} else if(selectedCategory == "bandanas") {
items = Client.getInstance().getCosmetics().getMyBandanas();
} else if(selectedCategory == "hats") {
items = Client.getInstance().getCosmetics().getMyHats();
} else if(selectedCategory == "shields") {
items = Client.getInstance().getCosmetics().getMyShields();
} else {
items = Client.getInstance().getCosmetics().getMyIcons();
}
if(this.silentInputs.get(0).getValue().trim().equals("")) {
return items;
} else {
for(CosmeticItem item : items) {
if(item.getName().trim().toLowerCase().contains(this.silentInputs.get(0).getValue().toLowerCase().trim())) {
searchItems.add(item);
}
}
return searchItems;
}
}
private ArrayList<Number> getFavoriteItems() {
ArrayList<Number> items;
if(selectedCategory == "capes") {
items = Client.getInstance().getAccount().getFavoriteCosmetics().capes;
} else if(selectedCategory == "wings") {
items = Client.getInstance().getAccount().getFavoriteCosmetics().wings;
} else if(selectedCategory == "bandanas") {
items = Client.getInstance().getAccount().getFavoriteCosmetics().bandanas;
} else if(selectedCategory == "hats") {
items = Client.getInstance().getAccount().getFavoriteCosmetics().hats;
} else if(selectedCategory == "shields") {
items = Client.getInstance().getAccount().getFavoriteCosmetics().shields;
} else {
items = Client.getInstance().getAccount().getFavoriteCosmetics().icons;
}
return items;
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
MouseCursorHandler.CursorType cursorType = getCursor(silentInputs, buttonList);
if(mc.thePlayer == null) {
GlStateManager.disableAlpha();
Client.backgroundPanorama.renderSkybox(mouseX, mouseY, partialTicks);
GlStateManager.enableAlpha();
if(Client.getInstance().getGlobalSettings().isLite()) {
this.drawGradientRect(0, 0, this.width, this.height, new Color(0, 0, 0, 127).getRGB(), new Color(0, 0, 0, 200).getRGB());
} else {
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
}
} else {
MenuBlurUtils.renderBackground(this);
}
int addX = 190;
int addY = 110;
int x = (width / 2) - addX;
int y = (height / 2) - addY;
int width = addX * 2;
int height = addY * 2;
int modOffsetY = 25;
int modIndex = 1;
//Draw background
RenderUtil.drawRoundedRect(x, y, width, height, 10, Theme.backgroundColor().getRGB());
ArrayList<CosmeticItem> items = null;
ArrayList<Number> selected_item = new ArrayList<>();
boolean can_show = true;
String error_text = "";
items = getItems();
selected_item.clear();
if(selectedCategory == "capes") {
selected_item.add(Client.getInstance().getAccount().getSelectedCape());
can_show = Client.getInstance().getAccount().customCape() ? false : Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Capes").getValBoolean();
error_text = Client.getInstance().getAccount().customCape() ? "Please disable Custom Cape in Silent+ settings" : Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Capes").getValBoolean() ? "" : "Please enable Capes in the cosmetics settings";
} else if(selectedCategory == "wings") {
selected_item.add(Client.getInstance().getAccount().getSelectedWings());
can_show = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Wings").getValBoolean();
error_text = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Wings").getValBoolean() ? "" : "Please enable Wings in the cosmetics settings";
} else if(selectedCategory == "bandanas") {
selected_item.add(Client.getInstance().getAccount().getSelectedBandana());
can_show = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Bandanas").getValBoolean();
error_text = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Bandanas").getValBoolean() ? "" : "Please enable Bandanas in the cosmetics settings";
} else if(selectedCategory == "hats") {
selected_item.add(Client.getInstance().getAccount().getSelectedHat());
selected_item.add(Client.getInstance().getAccount().getSelectedMask());
selected_item.add(Client.getInstance().getAccount().getSelectedNeck());
can_show = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Hats").getValBoolean();
error_text = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Hats").getValBoolean() ? "" : "Please enable Hats in the cosmetics settings";
} else if(selectedCategory == "shields") {
selected_item.add(Client.getInstance().getAccount().getSelectedShield());
can_show = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Shields").getValBoolean();
error_text = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Shields").getValBoolean() ? "" : "Please enable Shields in the cosmetics settings";
} else {
selected_item.add(Client.getInstance().getAccount().getSelectedIcon());
can_show = Client.getInstance().getAccount().plusIcon() ? false : true;
error_text = Client.getInstance().getAccount().plusIcon() ? "Please disable Plus Nametag Icon in Silent+ settings" : "";
}
if(can_show) {
scrollHelper.setStep(5);
scrollHelper.setElementsHeight((items != null ? items.size() : 0) * 35);
scrollHelper.setMaxScroll(height - 25);
scrollHelper.setSpeed(100);
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_SCISSOR_TEST);
ScaledResolution r = new ScaledResolution(mc);
int s = r.getScaleFactor();
int translatedY = r.getScaledHeight() - (y + 25) - (height - 25);
GL11.glScissor(x * s, translatedY * s, width * s, (height - 25) * s);
if(items != null) {
for(CosmeticItem m : items) {
RenderUtil.drawRoundedOutline(x + 100, y + modOffsetY + scrollHelper.getScroll(), 135, 28, 10, 2, selected_item.contains(m.getId()) ? new Color(32, 252, 3).getRGB() : new Color(252, 3, 3).getRGB());
if(MouseUtils.isInside(mouseX, mouseY, x + 100, y + modOffsetY + scrollHelper.getScroll(), 135, 28)) {
cursorType = MouseCursorHandler.CursorType.POINTER;
}
GL11.glDisable((int) 2929);
GL11.glEnable((int) 3042);
GL11.glDepthMask((boolean) false);
OpenGlHelper.glBlendFunc((int) 770, (int) 771, (int) 1, (int) 0);
GL11.glColor4f((float) 1.0f, (float) 1.0f, (float) 1.0f, 1f);
GL11.glDepthMask((boolean) true);
GL11.glDisable((int) 3042);
GL11.glEnable((int) 2929);
Client.getInstance().getSilentFontRenderer().drawString(m.getName(), x + 110, y + modOffsetY + 10 + scrollHelper.getScroll() - 3, 14, SilentFontRenderer.FontType.TITLE, 100);
boolean favorite = false;
for(Number i : getFavoriteItems()) {
if(i.intValue() == m.getId()) {
favorite = true;
}
}
RenderUtil.drawImage(favorite ? new ResourceLocation("silentclient/icons/star.png") : new ResourceLocation("silentclient/icons/star_outline.png"), x + 100 + 120, y + modOffsetY + scrollHelper.getScroll() + 8, 12, 12, false);
modOffsetY+= 35;
modIndex += 1;
}
}
GL11.glDisable(GL11.GL_SCISSOR_TEST);
GL11.glPopMatrix();
RenderUtil.drawImage(new ResourceLocation("silentclient/transparent.png"), x, y, 30, 30, false);
if(mc.thePlayer != null && selectedCategory != "icons") {
drawEntityOnScreen(x + 310, y + 175, 60, 1, 1, mc.thePlayer, rotate);
boolean drag = MouseUtils.isInside(mouseX, mouseY, x + 265, y + 50, 90, 150) && Mouse.isButtonDown(0);
if (drag) {
double diff = 360 - 0;
double mouse = MathHelper.clamp_double((mouseX - (x + 265)) / 90D, 0, 1);
double newVal = 0 + mouse * diff;
rotate = (int) newVal;
}
}
}
RenderUtil.drawImage(new ResourceLocation("silentclient/logos/logo.png"), x + 5, y + 5, 77, 15);
Client.getInstance().getSilentFontRenderer().drawString("Cosmetics", x + 100, (int) (y + 5), 14, SilentFontRenderer.FontType.TITLE);
super.drawScreen(mouseX, mouseY, partialTicks);
if(mc.thePlayer == null && can_show && selectedCategory != "icons") {
Client.getInstance().getSilentFontRenderer().drawString("Preview not available", x + 100 + 160, y + 100 - 3, 14, SilentFontRenderer.FontType.TITLE);
}
if(!can_show) {
Client.getInstance().getSilentFontRenderer().drawString(error_text, x + ((width - 90) / 2) - 15, y + (height / 3) + 20 - 3, 14, SilentFontRenderer.FontType.TITLE);
}
if(selectedCategory == "icons" && can_show) {
RenderUtil.drawImage(Client.getInstance().getAccount().getSelectedIcon() != 0 && !Client.getInstance().getAccount().plusIcon() ? Client.getInstance().getCosmetics().getIconById(Client.getInstance().getAccount().getSelectedIcon()).getLocation() : new ResourceLocation(Client.getInstance().getAccount().plusIcon() ? "silentclient/icons/plus_icon.png" : "silentclient/icons/player_icon.png"), x + 285, y + ((height / 2) - 25), 50, 50, false);
}
Client.getInstance().getMouseCursorHandler().enableCursor(cursorType);
if(can_show) {
this.silentInputs.get(0).render(mouseX, mouseY, x + width - 140, y + 2, 135);
}
}
public void updateScreen()
{
Client.backgroundPanorama.tickPanorama();
}
public static void drawEntityOnScreen(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase ent, int rotate)
{
GlStateManager.enableColorMaterial();
GlStateManager.pushMatrix();
GlStateManager.translate((float)posX, (float)posY, 50.0F);
GlStateManager.scale((float)(-scale), (float)scale, (float)scale);
GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(rotate, 0.0F, 1.0F, 0.0F);
float f = ent.renderYawOffset;
float f1 = ent.rotationYaw;
float f2 = ent.rotationPitch;
float f3 = ent.prevRotationYawHead;
float f4 = ent.rotationYawHead;
GlStateManager.rotate(135.0F, 0, 1.0F, 0.0F);
GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
ent.renderYawOffset = (float)Math.atan((double)(mouseX / 40.0F)) * 20.0F;
ent.rotationYaw = (float)Math.atan((double)(mouseX / 40.0F)) * 40.0F;
ent.rotationPitch = -((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F;
ent.rotationYawHead = ent.rotationYaw;
ent.prevRotationYawHead = ent.rotationYaw;
GlStateManager.translate(0.0F, 0.0F, 0.0F);
RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
rendermanager.setPlayerViewY(180.0F);
rendermanager.setRenderShadow(false);
rendermanager.renderEntityWithPosYaw(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
rendermanager.setRenderShadow(true);
ent.renderYawOffset = f;
ent.rotationYaw = f1;
ent.rotationPitch = f2;
ent.prevRotationYawHead = f3;
ent.rotationYawHead = f4;
GlStateManager.popMatrix();
GlStateManager.disableLighting();
GlStateManager.disableRescaleNormal();
GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GlStateManager.disableTexture2D();
GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
}
@Override
public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
super.mouseClicked(mouseX, mouseY, mouseButton);
int addX = 190;
int addY = 110;
int x = (width / 2) - addX;
int y = (height / 2) - addY;
int width = addX * 2;
int modOffsetY = 25;
ArrayList<CosmeticItem> items = getItems();
boolean can_show = true;
if(selectedCategory == "capes") {
can_show = Client.getInstance().getAccount().customCape() ? false : Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Capes").getValBoolean();
} else if(selectedCategory == "wings") {
can_show = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Wings").getValBoolean();
} else if(selectedCategory == "bandanas") {
can_show = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Bandanas").getValBoolean();
} else if(selectedCategory == "hats") {
can_show = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Hats").getValBoolean();
}else if(selectedCategory == "shields") {
can_show = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Shields").getValBoolean();
} else {
can_show = Client.getInstance().getAccount().plusIcon() ? false : true;
}
if(items != null && can_show) {
this.silentInputs.get(0).onClick(mouseX, mouseY, x + width - 140, y + 2, 135);
for(CosmeticItem m : items) {
if(MouseUtils.isInside(mouseX, mouseY, x + 100 + 120, y + modOffsetY + scrollHelper.getScroll() + 8, 12, 12)) {
Client.getInstance().getAccount().updateFavorite(m.getId(), selectedCategory);
} else if(MouseUtils.isInside(mouseX, mouseY,x + 100, y + modOffsetY + scrollHelper.getScroll(), 135, 28) && mouseButton == 0) {
Sounds.playButtonSound();
if(selectedCategory == "capes") {
Client.getInstance().getAccount().setSelectedCape(m.getId());
} else if(selectedCategory == "wings") {
Client.getInstance().getAccount().setSelectedWings(m.getId());
} else if(selectedCategory == "bandanas") {
Client.getInstance().getAccount().setSelectedBandana(m.getId());
} else if(selectedCategory == "hats") {
Client.getInstance().getAccount().setSelectedHat(m.getId(), m.getModel().equals("gold_chain") ? "neck" : (m.getModel().equals("facemask") || m.getModel().equals("wichtiger_glasses")) ? "mask" : "hat");
} else if(selectedCategory == "shields") {
Client.getInstance().getAccount().setSelectedShield(m.getId());
} else {
Client.getInstance().getAccount().setSelectedIcon(m.getId());
}
}
modOffsetY+= 35;
}
}
}
@Override
protected void keyTyped(char typedChar, int keyCode) {
super.keyTyped(typedChar, keyCode);
boolean can_show = true;
if(selectedCategory == "capes") {
can_show = Client.getInstance().getAccount().customCape() ? false : Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Capes").getValBoolean();
} else if(selectedCategory == "wings") {
can_show = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Wings").getValBoolean();
} else if(selectedCategory == "bandanas") {
can_show = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Bandanas").getValBoolean();
} else if(selectedCategory == "hats") {
can_show = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Hats").getValBoolean();
} else {
can_show = Client.getInstance().getAccount().plusIcon() ? false : true;
}
if(can_show) {
this.silentInputs.get(0).onKeyTyped(typedChar, keyCode);
if(this.silentInputs.get(0).isFocused()) {
this.scrollHelper.resetScroll();
}
}
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
}

View File

@ -0,0 +1,130 @@
package net.silentclient.client.cosmetics.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.cosmetics.Outfits;
import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.elements.IconButton;
import net.silentclient.client.gui.elements.Input;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.utils.MenuBlurUtils;
import net.silentclient.client.utils.NotificationUtils;
import org.lwjgl.input.Keyboard;
import java.awt.*;
import java.io.IOException;
public class NewOutfitModal extends SilentScreen {
private final GuiScreen parentScreen;
private int modalWidth;
private int modalHeight;
public NewOutfitModal(GuiScreen parentScreen) {
this.parentScreen = parentScreen;
this.modalWidth = 200;
this.modalHeight = 70;
}
@Override
public void initGui() {
if(mc.thePlayer == null) {
Client.backgroundPanorama.updateWidthHeight(this.width, this.height);
} else {
MenuBlurUtils.loadBlur();
}
int x = width / 2 - (this.modalWidth / 2);
int y = height / 2 - (this.modalHeight / 2);
this.buttonList.add(new IconButton(1, x + this.modalWidth - 14 - 3, y + 3, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/exit.png")));
this.buttonList.add(new Button(2, x + 3, y + this.modalHeight - 23, this.modalWidth - 6, 20, "Done"));
this.silentInputs.add(new Input("Outfit Name"));
}
@Override
protected void actionPerformed(GuiButton button) {
super.actionPerformed(button);
switch (button.id) {
case 1:
mc.displayGuiScreen(parentScreen);
break;
case 2:
if(this.silentInputs.get(0).getValue().trim().length() == 0) {
NotificationUtils.showNotification("Error", "Please enter a Outfit Name");
break;
}
if(Outfits.getOutfits().stream().filter((c) -> c.name.equals(this.silentInputs.get(0).getValue().trim())).findAny().isPresent()) {
NotificationUtils.showNotification("Error", "Outfit already exists.");
break;
}
Outfits.createOutfit(new Outfits.Outfit(this.silentInputs.get(0).getValue(), Client.getInstance().getAccount().selected_cape, Client.getInstance().getAccount().selected_wings, Client.getInstance().getAccount().selected_icon, Client.getInstance().getAccount().selected_bandana, Client.getInstance().getAccount().selected_hat, Client.getInstance().getAccount().selected_neck, Client.getInstance().getAccount().selected_mask, Client.getInstance().getAccount().selected_shield));
mc.displayGuiScreen(parentScreen);
break;
}
}
@Override
public void updateScreen() {
super.updateScreen();
if(mc.thePlayer == null) {
Client.backgroundPanorama.tickPanorama();
}
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
if(mc.thePlayer == null) {
GlStateManager.disableAlpha();
Client.backgroundPanorama.renderSkybox(mouseX, mouseY, partialTicks);
GlStateManager.enableAlpha();
if(Client.getInstance().getGlobalSettings().isLite()) {
this.drawGradientRect(0, 0, this.width, this.height, new Color(0, 0, 0, 127).getRGB(), new Color(0, 0, 0, 200).getRGB());
} else {
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
}
} else {
MenuBlurUtils.renderBackground(this);
}
GlStateManager.pushMatrix();
int x = width / 2 - (this.modalWidth / 2);
int y = height / 2 - (this.modalHeight / 2);
// Header
RenderUtils.drawRect(x, y, this.modalWidth, this.modalHeight, Theme.backgroundColor().getRGB());
Client.getInstance().getSilentFontRenderer().drawString("New Outfit", x + 3, y + 3, 14, SilentFontRenderer.FontType.TITLE);
// Content
this.silentInputs.get(0).render(mouseX, mouseY, x + 3, y + 23, this.modalWidth - 6);
super.drawScreen(mouseX, mouseY, partialTicks);
GlStateManager.popMatrix();
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
super.mouseClicked(mouseX, mouseY, mouseButton);
int x = width / 2 - (this.modalWidth / 2);
int y = height / 2 - (this.modalHeight / 2);
this.silentInputs.get(0).onClick(mouseX, mouseY, x + 3, y + 23, this.modalWidth - 6);
}
@Override
public void onGuiClosed() {
MenuBlurUtils.unloadBlur();
}
@Override
protected void keyTyped(char typedChar, int keyCode) {
if (keyCode == Keyboard.KEY_ESCAPE) {
mc.displayGuiScreen(parentScreen);
return;
};
this.silentInputs.get(0).onKeyTyped(typedChar, keyCode);
}
}

View File

@ -0,0 +1,255 @@
package net.silentclient.client.cosmetics.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.cosmetics.Outfits;
import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.gui.elements.IconButton;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.utils.MenuBlurUtils;
import net.silentclient.client.utils.MouseCursorHandler;
import net.silentclient.client.utils.ScrollHelper;
import net.silentclient.client.utils.types.PlayerResponse;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.io.IOException;
public class OutfitsGui extends SilentScreen {
private final GuiScreen parentScreen;
private int outfitIndex = 0;
private ScrollHelper scrollHelper = new ScrollHelper();
public OutfitsGui(GuiScreen parentScreen) {
this.parentScreen = parentScreen;
}
@Override
public void initGui() {
super.initGui();
defaultCursor = false;
if(mc.thePlayer == null) {
Client.backgroundPanorama.updateWidthHeight(this.width, this.height);
} else {
MenuBlurUtils.loadBlur();
}
int width = 255;
int height = 200;
int x = this.width / 2 - (width / 2);
int y = this.height / 2 - (height / 2);
this.buttonList.add(new IconButton(0, x + width - 14 - 3, y + 3, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/exit.png")));
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
MouseCursorHandler.CursorType cursorType = getCursor(silentInputs, buttonList);
if(mc.thePlayer == null) {
GlStateManager.disableAlpha();
Client.backgroundPanorama.renderSkybox(mouseX, mouseY, partialTicks);
GlStateManager.enableAlpha();
if(Client.getInstance().getGlobalSettings().isLite()) {
this.drawGradientRect(0, 0, this.width, this.height, new Color(0, 0, 0, 127).getRGB(), new Color(0, 0, 0, 200).getRGB());
} else {
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
}
} else {
MenuBlurUtils.renderBackground(this);
}
int width = 255;
int height = 200;
int x = this.width / 2 - (width / 2);
int y = this.height / 2 - (height / 2);
scrollHelper.setStep(5);
scrollHelper.setElementsHeight((float) Math.ceil((Outfits.getOutfits().size() + 3) / 3) * 85);
scrollHelper.setMaxScroll(height - 20);
scrollHelper.setSpeed(100);
scrollHelper.setFlag(true);
float scrollY = scrollHelper.getScroll();
RenderUtil.drawRoundedRect(x, y, width, height, 4, Theme.backgroundColor().getRGB());
Client.getInstance().getSilentFontRenderer().drawString(x + 3, y + 3, "Outfits", 14, SilentFontRenderer.FontType.TITLE);
super.drawScreen(mouseX, mouseY, partialTicks);
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_SCISSOR_TEST);
ScaledResolution r = new ScaledResolution(Minecraft.getMinecraft());
int s = r.getScaleFactor();
int listHeight = height - 20;
int translatedY = r.getScaledHeight() - y - 20 - listHeight;
GL11.glScissor(0 * s, translatedY * s, this.width * s, listHeight * s);
int outfitX = x + 3;
float outfitY = y + 20 + scrollY;
int outfitIndex = 0;
boolean isCreateHovered = MouseUtils.isInside(mouseX, mouseY, outfitX, outfitY, 80, 80);
if(isCreateHovered) {
cursorType = MouseCursorHandler.CursorType.POINTER;
RenderUtil.drawRoundedRect(outfitX, outfitY, 80, 80, 3, new Color(255, 255, 255, 30).getRGB());
}
RenderUtil.drawRoundedOutline(outfitX, outfitY, 80, 80, 3, 1, Theme.borderColor().getRGB());
Client.getInstance().getSilentFontRenderer().drawCenteredString("Create New Outfit", outfitX + 40, (int) (outfitY + 40 - 6), 12, SilentFontRenderer.FontType.TITLE);
outfitX += 83;
outfitIndex += 1;
this.outfitIndex = 1;
for(Outfits.Outfit outfit : Outfits.getOutfits()) {
boolean isHovered = MouseUtils.isInside(mouseX, mouseY, outfitX, outfitY, 80, 80) && !MouseUtils.isInside(mouseX, mouseY, outfitX + 80 - 3 - 10, outfitY + 3, 10, 10);
if(isHovered) {
cursorType = MouseCursorHandler.CursorType.POINTER;
RenderUtil.drawRoundedRect(outfitX, outfitY, 80, 80, 3, new Color(255, 255, 255, 30).getRGB());
}
if(MouseUtils.isInside(mouseX, mouseY, outfitX + 80 - 3 - 10, outfitY + 3, 10, 10)) {
cursorType = MouseCursorHandler.CursorType.POINTER;
}
RenderUtil.drawRoundedOutline(outfitX, outfitY, 80, 80, 3, 1, Theme.borderColor().getRGB());
Client.getInstance().getSilentFontRenderer().drawString(outfit.name, outfitX + 3, (int) (outfitY + 3), 12, SilentFontRenderer.FontType.TITLE, 64);
RenderUtil.drawImage(new ResourceLocation("silentclient/icons/trash-icon.png"), outfitX + 80 - 3 - 10, outfitY + 3, 10, 10);
int cosmeticY = (int) (outfitY + 18);
if(outfit.selected_cape != 0 && Client.getInstance().getCosmetics().getMyCapes().stream().filter((c) -> c.id == outfit.selected_cape).findFirst().isPresent() && (cosmeticY - outfitY) <= 62) {
PlayerResponse.Account.Cosmetics.CosmeticItem item = Client.getInstance().getCosmetics().getMyCapes().stream().filter((c) -> c.id == outfit.selected_cape).findFirst().get();
Client.getInstance().getSilentFontRenderer().drawString(item.name, outfitX + 3, cosmeticY, 10, SilentFontRenderer.FontType.TITLE, 75);
cosmeticY += 10;
}
if(outfit.selected_wings != 0 && Client.getInstance().getCosmetics().getMyWings().stream().filter((c) -> c.id == outfit.selected_wings).findFirst().isPresent() && (cosmeticY - outfitY) <= 62) {
PlayerResponse.Account.Cosmetics.CosmeticItem item = Client.getInstance().getCosmetics().getMyWings().stream().filter((c) -> c.id == outfit.selected_wings).findFirst().get();
Client.getInstance().getSilentFontRenderer().drawString(item.name, outfitX + 3, cosmeticY, 10, SilentFontRenderer.FontType.TITLE, 75);
cosmeticY += 10;
}
if(outfit.selected_bandana != 0 && Client.getInstance().getCosmetics().getMyBandanas().stream().filter((c) -> c.id == outfit.selected_bandana).findFirst().isPresent() && (cosmeticY - outfitY) <= 62) {
PlayerResponse.Account.Cosmetics.CosmeticItem item = Client.getInstance().getCosmetics().getMyBandanas().stream().filter((c) -> c.id == outfit.selected_bandana).findFirst().get();
Client.getInstance().getSilentFontRenderer().drawString(item.name, outfitX + 3, cosmeticY, 10, SilentFontRenderer.FontType.TITLE, 75);
cosmeticY += 10;
}
if(outfit.selected_hat != 0 && Client.getInstance().getCosmetics().getMyHats().stream().filter((c) -> c.id == outfit.selected_hat).findFirst().isPresent() && (cosmeticY - outfitY) <= 62) {
PlayerResponse.Account.Cosmetics.CosmeticItem item = Client.getInstance().getCosmetics().getMyHats().stream().filter((c) -> c.id == outfit.selected_hat).findFirst().get();
Client.getInstance().getSilentFontRenderer().drawString(item.name, outfitX + 3, cosmeticY, 10, SilentFontRenderer.FontType.TITLE, 75);
cosmeticY += 10;
}
if(outfit.selected_neck != 0 && Client.getInstance().getCosmetics().getMyHats().stream().filter((c) -> c.id == outfit.selected_neck).findFirst().isPresent() && (cosmeticY - outfitY) <= 62) {
PlayerResponse.Account.Cosmetics.CosmeticItem item = Client.getInstance().getCosmetics().getMyHats().stream().filter((c) -> c.id == outfit.selected_neck).findFirst().get();
Client.getInstance().getSilentFontRenderer().drawString(item.name, outfitX + 3, cosmeticY, 10, SilentFontRenderer.FontType.TITLE, 75);
cosmeticY += 10;
}
if(outfit.selected_mask != 0 && Client.getInstance().getCosmetics().getMyHats().stream().filter((c) -> c.id == outfit.selected_mask).findFirst().isPresent() && (cosmeticY - outfitY) <= 62) {
PlayerResponse.Account.Cosmetics.CosmeticItem item = Client.getInstance().getCosmetics().getMyHats().stream().filter((c) -> c.id == outfit.selected_mask).findFirst().get();
Client.getInstance().getSilentFontRenderer().drawString(item.name, outfitX + 3, cosmeticY, 10, SilentFontRenderer.FontType.TITLE, 75);
cosmeticY += 10;
}
if(outfit.selected_shield != 0 && Client.getInstance().getCosmetics().getMyShields().stream().filter((c) -> c.id == outfit.selected_shield).findFirst().isPresent() && (cosmeticY - outfitY) <= 62) {
PlayerResponse.Account.Cosmetics.CosmeticItem item = Client.getInstance().getCosmetics().getMyShields().stream().filter((c) -> c.id == outfit.selected_shield).findFirst().get();
Client.getInstance().getSilentFontRenderer().drawString(item.name, outfitX + 3, cosmeticY, 10, SilentFontRenderer.FontType.TITLE, 75);
cosmeticY += 10;
}
if(outfit.selected_icon != 0 && Client.getInstance().getCosmetics().getMyIcons().stream().filter((c) -> c.id == outfit.selected_icon).findFirst().isPresent() && (cosmeticY - outfitY) <= 62) {
PlayerResponse.Account.Cosmetics.CosmeticItem item = Client.getInstance().getCosmetics().getMyIcons().stream().filter((c) -> c.id == outfit.selected_icon).findFirst().get();
Client.getInstance().getSilentFontRenderer().drawString(item.name, outfitX + 3, cosmeticY, 10, SilentFontRenderer.FontType.TITLE, 75);
}
this.outfitIndex += 1;
outfitIndex += 1;
if(outfitIndex == 3) {
outfitIndex = 0;
outfitX = x + 3;
outfitY += 85;
} else {
outfitX += 83;
}
}
Client.getInstance().getMouseCursorHandler().enableCursor(cursorType);
GL11.glDisable(GL11.GL_SCISSOR_TEST);
GL11.glPopMatrix();
}
@Override
protected void actionPerformed(GuiButton button) {
super.actionPerformed(button);
if(button.id == 0) {
mc.displayGuiScreen(parentScreen);
}
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
super.mouseClicked(mouseX, mouseY, mouseButton);
int width = 255;
int height = 200;
int x = this.width / 2 - (width / 2);
int y = this.height / 2 - (height / 2);
int outfitX = x + 3;
float outfitY = (int) (y + 20 + scrollHelper.getScroll());
int outfitIndex = 0;
if(MouseUtils.isInside(mouseX, mouseY, outfitX, outfitY, 80, 80)) {
mc.displayGuiScreen(new NewOutfitModal(this));
return;
}
outfitX += 83;
outfitIndex += 1;
for(Outfits.Outfit outfit : Outfits.getOutfits()) {
boolean isHovered = MouseUtils.isInside(mouseX, mouseY, outfitX, outfitY, 80, 80) && !MouseUtils.isInside(mouseX, mouseY, outfitX + 80 - 3 - 10, outfitY + 3, 10, 10);
if(isHovered) {
Outfits.loadOutfit(outfit);
mc.displayGuiScreen(parentScreen);
break;
}
if(MouseUtils.isInside(mouseX, mouseY, outfitX + 80 - 3 - 10, outfitY + 3, 10, 10)) {
Outfits.deleteOutfit(outfit);
break;
}
outfitIndex += 1;
if(outfitIndex == 3) {
outfitIndex = 0;
outfitX = x + 3;
outfitY += 85;
} else {
outfitX += 83;
}
}
}
@Override
public void updateScreen() {
super.updateScreen();
if(mc.thePlayer == null) {
Client.backgroundPanorama.tickPanorama();
}
}
@Override
protected void keyTyped(char typedChar, int keyCode) {
if (keyCode == Keyboard.KEY_ESCAPE) {
mc.displayGuiScreen(parentScreen);
}
}
@Override
public void onGuiClosed() {
super.onGuiClosed();
MenuBlurUtils.unloadBlur();
}
}

View File

@ -0,0 +1,70 @@
package net.silentclient.client.cosmetics.model;
public class Face
{
private final int[] vertexIndices;
private final int[] normalIndices;
private final int[] textureCoordinateIndices;
private Material material;
public Material getMaterial() {
return this.material;
}
public boolean hasNormals() {
return this.normalIndices[0] != -1;
}
public boolean hasTextureCoordinates() {
return this.textureCoordinateIndices[0] != -1;
}
public int[] getVertexIndices() {
return this.vertexIndices;
}
public int[] getTextureCoordinateIndices() {
return this.textureCoordinateIndices;
}
public int[] getNormalIndices() {
return this.normalIndices;
}
public Face(final int[] array) {
this.vertexIndices = new int[] { -1, -1, -1, -1 };
this.normalIndices = new int[] { -1, -1, -1, -1 };
this.textureCoordinateIndices = new int[] { -1, -1, -1, -1 };
this.vertexIndices[0] = array[0];
this.vertexIndices[1] = array[1];
this.vertexIndices[2] = array[2];
}
public Face(final int[] array, final int[] array2) {
this.vertexIndices = new int[] { -1, -1, -1, -1 };
this.normalIndices = new int[] { -1, -1, -1, -1 };
this.textureCoordinateIndices = new int[] { -1, -1, -1, -1 };
this.vertexIndices[0] = array[0];
this.vertexIndices[1] = array[1];
this.vertexIndices[2] = array[2];
this.normalIndices[0] = array2[0];
this.normalIndices[1] = array2[1];
this.normalIndices[2] = array2[2];
}
public Face(final int[] array, final int[] array2, final int[] array3, final Material material) {
this.vertexIndices = new int[] { -1, -1, -1, -1 };
this.normalIndices = new int[] { -1, -1, -1, -1 };
this.textureCoordinateIndices = new int[] { -1, -1, -1, -1 };
this.vertexIndices[0] = array[0];
this.vertexIndices[1] = array[1];
this.vertexIndices[2] = array[2];
this.textureCoordinateIndices[0] = array3[0];
this.textureCoordinateIndices[1] = array3[1];
this.textureCoordinateIndices[2] = array3[2];
this.normalIndices[0] = array2[0];
this.normalIndices[1] = array2[1];
this.normalIndices[2] = array2[2];
this.material = material;
}
}

View File

@ -0,0 +1,5 @@
package net.silentclient.client.cosmetics.model;
public class Material {
}

View File

@ -0,0 +1,52 @@
package net.silentclient.client.cosmetics.model;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;
import java.util.List;
public class Model
{
private String name;
private List<ModelBuffer.Vertex3f> vertices;
private List<ModelBuffer.Vertex2f> textureCoordinates;
private List<ModelBuffer.Vertex3f> normals;
private List<Face> faces;
private Map<String, Material> materials;
public Model() {
this.vertices = new ArrayList<ModelBuffer.Vertex3f>();
this.textureCoordinates = new ArrayList<ModelBuffer.Vertex2f>();
this.normals = new ArrayList<ModelBuffer.Vertex3f>();
this.faces = new ArrayList<Face>();
this.materials = new HashMap<String, Material>();
}
public void setName(final String name) {
this.name = name;
}
public String getName() {
return name;
}
public List<ModelBuffer.Vertex3f> getVertices() {
return this.vertices;
}
public List<ModelBuffer.Vertex2f> getTextureCoordinates() {
return this.textureCoordinates;
}
public List<ModelBuffer.Vertex3f> getNormals() {
return this.normals;
}
public List<Face> getFaces() {
return this.faces;
}
public Map<String, Material> getMaterials() {
return this.materials;
}
}

View File

@ -0,0 +1,221 @@
package net.silentclient.client.cosmetics.model;
import java.nio.FloatBuffer;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL15;
import net.minecraft.util.ResourceLocation;
public class ModelBuffer
{
private static final ExecutorService EXECUTOR_SERVICE;
private final ResourceLocation location;
private final boolean flipUVs;
private Model model;
private Integer bufferId;
private Future<FutureResult> loaded;
private int totalVertices;
public ModelBuffer(final ResourceLocation aj) {
this(aj, false);
}
public ModelBuffer(final ResourceLocation location, final boolean flipUVs) {
this.location = location;
this.flipUVs = flipUVs;
}
public boolean loadModel() {
if (this.isLoaded()) {
return true;
}
if (this.loaded != null && this.loaded.isDone()) {
FloatBuffer access$000;
try {
final FutureResult futureResult = this.loaded.get();
access$000 = futureResult.getBuffer();
this.model = futureResult.getModel();
this.totalVertices = futureResult.getTotalVertices();
}
catch (final Exception cause) {
throw new RuntimeException(cause);
}
this.bufferId = GL15.glGenBuffers();
GL15.glBindBuffer(34962, (int)this.bufferId);
GL15.glBufferData(34962, access$000, 35044);
GL15.glBindBuffer(34962, 0);
return true;
}
if (this.model == null && this.loaded == null) {
this.loaded = ModelBuffer.EXECUTOR_SERVICE.submit((Callable<FutureResult>)new Callable<FutureResult>() {
@Override
public FutureResult call() {
final Model loadModel = ModelLoader.loadModel(ModelBuffer.this.location, ModelBuffer.this.flipUVs);
final int n = loadModel.getFaces().size() * 3;
final FloatBuffer floatBuffer = BufferUtils.createFloatBuffer(n * 8);
for (final Face face : loadModel.getFaces()) {
final Vertex3f[] array = { loadModel.getNormals().get(face.getNormalIndices()[0] - 1), loadModel.getNormals().get(face.getNormalIndices()[1] - 1), loadModel.getNormals().get(face.getNormalIndices()[2] - 1) };
final Vertex2f[] array2 = { loadModel.getTextureCoordinates().get(face.getTextureCoordinateIndices()[0] - 1), loadModel.getTextureCoordinates().get(face.getTextureCoordinateIndices()[1] - 1), loadModel.getTextureCoordinates().get(face.getTextureCoordinateIndices()[2] - 1) };
final Vertex3f[] array3 = { loadModel.getVertices().get(face.getVertexIndices()[0] - 1), loadModel.getVertices().get(face.getVertexIndices()[1] - 1), loadModel.getVertices().get(face.getVertexIndices()[2] - 1) };
for (int i = 0; i < 3; ++i) {
floatBuffer.put(new float[] { array3[i].getX(), array3[i].getY(), array3[i].getZ() });
floatBuffer.put(new float[] { array2[i].getX(), array2[i].getY() });
floatBuffer.put(new float[] { array[i].getX(), array[i].getY(), array[i].getZ() });
}
}
floatBuffer.flip();
return new FutureResult(loadModel, floatBuffer, n);
}
});
}
return false;
}
public void renderModel() {
if (!this.isLoaded()) {
this.loadModel();
}
else {
GL15.glBindBuffer(34962, (int)this.bufferId);
GL11.glVertexPointer(3, 5126, 32, 0L);
GL11.glEnableClientState(32884);
GL11.glTexCoordPointer(2, 5126, 32, 12L);
GL11.glEnableClientState(32888);
GL11.glNormalPointer(5126, 32, 20L);
GL11.glEnableClientState(32885);
GL11.glDrawArrays(4, 0, this.totalVertices);
GL11.glDisableClientState(32884);
GL11.glDisableClientState(32888);
GL11.glDisableClientState(32885);
GL15.glBindBuffer(34962, 0);
}
}
public void deleteData() {
if (this.loaded != null) {
if (this.loaded.isDone()) {
GL15.glDeleteBuffers((int)this.bufferId);
}
else {
this.loaded.cancel(true);
}
}
this.bufferId = null;
this.model = null;
this.loaded = null;
}
private boolean isLoaded() {
return this.bufferId != null;
}
static {
EXECUTOR_SERVICE = Executors.newSingleThreadExecutor();
}
public static class Vertex2f
{
public float x;
public float y;
public Vertex2f(final float n, final float n2) {
this.set(n, n2);
}
public void set(final float x, final float y) {
this.x = x;
this.y = y;
}
public float getX() {
return this.x;
}
public float getY() {
return this.y;
}
public void setX(final float x) {
this.x = x;
}
public void setY(final float y) {
this.y = y;
}
}
public static class Vertex3f
{
public float x;
public float y;
public float z;
public Vertex3f() {
}
public Vertex3f(final float n, final float n2, final float n3) {
this.set(n, n2, n3);
}
public void set(final float x, final float y, final float z) {
this.x = x;
this.y = y;
this.z = z;
}
public float getX() {
return this.x;
}
public void setX(final float x) {
this.x = x;
}
public float getY() {
return this.y;
}
public void setY(final float y) {
this.y = y;
}
public float getZ() {
return this.z;
}
public void setZ(final float z) {
this.z = z;
}
}
private static class FutureResult
{
private Model model;
private FloatBuffer buffer;
private int totalVertices;
private FutureResult(final Model model, final FloatBuffer buffer, final int totalVertices) {
this.model = model;
this.buffer = buffer;
this.totalVertices = totalVertices;
}
private Model getModel() {
return this.model;
}
private FloatBuffer getBuffer() {
return this.buffer;
}
private int getTotalVertices() {
return this.totalVertices;
}
}
}

View File

@ -0,0 +1,97 @@
package net.silentclient.client.cosmetics.model;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
public class ModelLoader
{
private static ModelBuffer.Vertex2f parseTextureCoord(final String s, final boolean b) {
final String[] split = s.split(" ");
final float floatValue = Float.valueOf(split[1]);
final float floatValue2 = Float.valueOf(split[2]);
return new ModelBuffer.Vertex2f(floatValue, b ? (1.0f - floatValue2) : floatValue2);
}
private static ModelBuffer.Vertex3f parseVertex(final String s) {
final String[] split = s.split(" ");
return new ModelBuffer.Vertex3f(Float.valueOf(split[1]), Float.valueOf(split[2]), Float.valueOf(split[3]));
}
private static ModelBuffer.Vertex3f parseNormal(final String s) {
final String[] split = s.split(" ");
return new ModelBuffer.Vertex3f(Float.valueOf(split[1]), Float.valueOf(split[2]), Float.valueOf(split[3]));
}
private static Face parseFace(final boolean b, final boolean b2, final String s) {
final String[] split = s.split(" ");
final int[] array = { Integer.parseInt(split[1].split("/")[0]), Integer.parseInt(split[2].split("/")[0]), Integer.parseInt(split[3].split("/")[0]) };
if (b2) {
return new Face(array, new int[] { Integer.parseInt(split[1].split("/")[2]), Integer.parseInt(split[2].split("/")[2]), Integer.parseInt(split[3].split("/")[2]), 0 }, new int[] { Integer.parseInt(split[1].split("/")[1]), Integer.parseInt(split[2].split("/")[1]), Integer.parseInt(split[3].split("/")[1]), 0 }, null);
}
if (b) {
return new Face(array, new int[] { Integer.parseInt(split[1].split("/")[2]), Integer.parseInt(split[2].split("/")[2]), Integer.parseInt(split[3].split("/")[2]), 0 });
}
return new Face(array);
}
public static Model loadModel(final ResourceLocation aj) {
return loadModel(aj, false);
}
public static Model loadModel(final ResourceLocation aj, final boolean b) {
InputStream a = null;
try {
a = Minecraft.getMinecraft().getResourceManager().getResource(aj).getInputStream();
final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(a));
final Model model = new Model();
String line;
while ((line = bufferedReader.readLine()) != null) {
final String s = line.split(" ")[0];
if (!s.equals("#")) {
if (line.startsWith("#")) {
continue;
}
if (s.equals("o")) {
model.setName(line.split(" ")[1]);
}
else if (s.equals("v")) {
model.getVertices().add(parseVertex(line));
}
else if (s.equals("vn")) {
model.getNormals().add(parseNormal(line));
}
else if (s.equals("f")) {
model.getFaces().add(parseFace(model.getNormals().size() > 0, model.getTextureCoordinates().size() > 0, line));
}
else {
if (!s.equals("vt")) {
continue;
}
model.getTextureCoordinates().add(parseTextureCoord(line, b));
}
}
}
bufferedReader.close();
return model;
}
catch (final Exception ex) {
ex.printStackTrace();
Client.logger.error("MODEL LOADER ERROR: " + ex.getMessage());
}
finally {
if (a != null) {
try {
a.close();
}
catch (final IOException ex2) {}
}
}
return null;
}
}

View File

@ -0,0 +1,114 @@
package net.silentclient.client.cosmetics.wings;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.entity.Entity;
import net.silentclient.client.Client;
import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt;
import net.silentclient.client.mods.settings.CosmeticsMod;
import org.lwjgl.opengl.GL11;
public class WingsModel implements LayerRenderer<AbstractClientPlayer> {
private static ModelRenderer wing;
private static ModelRenderer wingTip;
boolean flying;
private final ModelDragonWings modelDragonWings;
public WingsModel(RenderPlayer player) {
this.flying = false;
this.modelDragonWings = new ModelDragonWings(player);
final int bw = this.modelDragonWings.textureWidth;
final int bh = this.modelDragonWings.textureHeight;
this.modelDragonWings.textureWidth = 256;
this.modelDragonWings.textureHeight = 256;
(wing = new ModelRenderer(this.modelDragonWings, "wing")).setRotationPoint(-12.0f, 5.0f, 2.0f);
wing.addBox("bone", -56.0f, -4.0f, -4.0f, 56, 8, 8);
wing.addBox("skin", -56.0f, 0.0f, 2.0f, 56, 0, 56);
wing.isHidden = true;
(wingTip = new ModelRenderer(this.modelDragonWings, "wingTip")).setRotationPoint(-56.0f, 0.0f, 0.0f);
wingTip.isHidden = true;
wingTip.addBox("bone", -56.0f, -2.0f, -2.0f, 56, 4, 4);
wingTip.addBox("skin", -56.0f, 0.0f, 2.0f, 56, 0, 56);
wing.addChild(wingTip);
this.modelDragonWings.textureWidth = bw;
this.modelDragonWings.textureWidth = bh;
}
private class ModelDragonWings extends ModelBase {
public ModelDragonWings(RenderPlayer player) {
this.setTextureOffset("wingTip.bone", 112, 136);
this.setTextureOffset("wing.skin", -56, 88);
this.setTextureOffset("wing.bone", 112, 88);
this.setTextureOffset("wingTip.skin", -56, 144);
}
@Override
public void render(final Entity entityIn, final float limbSwing, final float limbSwingAmount, final float ageInTicks, final float netHeadYaw, final float headPitch, final float scale) {
super.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
GlStateManager.pushMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
GlStateManager.scale(Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Wings Scale").getValDouble(), Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Wings Scale").getValDouble(), Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Wings Scale").getValDouble());
float f1 = 0.0f;
if (Minecraft.getMinecraft().thePlayer.capabilities.isFlying) {
f1 = ageInTicks / 200.0f;
}
else {
f1 = ageInTicks / 80.0f;
}
((AbstractClientPlayerExt) entityIn).silent$getWings().bindTexture();
if (!entityIn.onGround || flying) {
flying = true;
}
GlStateManager.scale(0.15, 0.15, 0.15);
GlStateManager.translate(0.0, -0.3, 1.1);
if(entityIn.isSneaking()) {
GlStateManager.translate(-0.04F, 1.1F + 0.2F, -0.04F);
}
GlStateManager.rotate(50.0f, -50.0f, 0.0f, 0.0f);
for (int i = 0; i < 2; ++i) {
final float f2 = f1 * 9.141593f * 2.0f;
wing.rotateAngleX = 0.125f - (float)Math.cos(f2) * 0.2f;
wing.rotateAngleY = 0.25f;
wing.rotateAngleZ = (float)(Math.sin(f2) + 1.225) * 0.3f;
wingTip.rotateAngleZ = -(float)(Math.sin(f2 + 2.0f) + 0.5) * 0.75f;
wing.isHidden = false;
wingTip.isHidden = false;
if (!entityIn.isInvisible()) {
GlStateManager.pushMatrix();
GlStateManager.disableLighting();
wing.render(scale);
GlStateManager.popMatrix();
}
wing.isHidden = false;
wingTip.isHidden = false;
if (i == 0) {
GlStateManager.scale(-1.0f, 1.0f, 1.0f);
}
}
GlStateManager.popMatrix();
}
}
@Override
public boolean shouldCombineTextures() {
return false;
}
@Override
public void doRenderLayer(final AbstractClientPlayer player, final float limbSwing, final float limbSwingAmount, final float partialTicks, final float ageInTicks, final float HeadYaw, final float headPitch, final float scale) {
if (((AbstractClientPlayerExt) player).silent$getWings() != null && Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Wings").getValBoolean()) {
if (!player.isInvisible()) {
GlStateManager.pushMatrix();
this.modelDragonWings.render(player, limbSwing, limbSwingAmount, ageInTicks, HeadYaw, headPitch, scale);
this.modelDragonWings.setRotationAngles(scale, limbSwing, limbSwingAmount, ageInTicks, HeadYaw, headPitch, player);
GL11.glPopMatrix();
}
}
}
}

View File

@ -0,0 +1,32 @@
package net.silentclient.client.emotes;
import net.minecraft.client.model.ModelBiped;
import net.silentclient.client.emotes.animation.EmoteSimpleAnimation;
public class DabEmote {
private EmoteSimpleAnimation bipedRightArm = new EmoteSimpleAnimation();
private EmoteSimpleAnimation bipedLeftArm = new EmoteSimpleAnimation();
private EmoteSimpleAnimation bipedHead = new EmoteSimpleAnimation();
private EmoteSimpleAnimation modelRightArm = new EmoteSimpleAnimation();
private EmoteSimpleAnimation modelRightArmWear = new EmoteSimpleAnimation();
private EmoteSimpleAnimation modelLeftArm = new EmoteSimpleAnimation();
private EmoteSimpleAnimation modelLeftArmWear = new EmoteSimpleAnimation();
private EmoteSimpleAnimation modelHead = new EmoteSimpleAnimation();
private EmoteSimpleAnimation modelHeadWear = new EmoteSimpleAnimation();
public void initEmoteBiped(ModelBiped modelBiped) {
bipedHead.getX().setValue(modelBiped.bipedHead.rotateAngleX);
bipedHead.getY().setValue(modelBiped.bipedHead.rotateAngleY);
bipedHead.getZ().setValue(modelBiped.bipedHead.rotateAngleZ);
bipedRightArm.getX().setValue(modelBiped.bipedRightArm.rotateAngleX);
bipedRightArm.getY().setValue(modelBiped.bipedRightArm.rotateAngleY);
bipedRightArm.getZ().setValue(modelBiped.bipedRightArm.rotateAngleZ);
bipedLeftArm.getX().setValue(modelBiped.bipedLeftArm.rotateAngleX);
bipedLeftArm.getY().setValue(modelBiped.bipedLeftArm.rotateAngleY);
bipedLeftArm.getZ().setValue(modelBiped.bipedLeftArm.rotateAngleZ);
}
public void renderEmoteBiped(ModelBiped modelBiped) {
}
}

View File

@ -0,0 +1,21 @@
package net.silentclient.client.emotes.animation;
import net.silentclient.client.gui.animation.SimpleAnimation;
public class EmoteSimpleAnimation {
private SimpleAnimation xAnimation = new SimpleAnimation(0);
private SimpleAnimation yAnimation = new SimpleAnimation(0);
private SimpleAnimation zAnimation = new SimpleAnimation(0);
public SimpleAnimation getX() {
return xAnimation;
}
public SimpleAnimation getY() {
return yAnimation;
}
public SimpleAnimation getZ() {
return zAnimation;
}
}

View File

@ -0,0 +1,21 @@
package net.silentclient.client.event;
import java.util.ArrayList;
public class Event {
public Event call() {
final ArrayList<EventData> dataList = EventManager.get(this.getClass());
if(dataList != null) {
for(EventData data : dataList) {
try {
data.target.invoke(data.source, this);
} catch(Exception e) {
e.printStackTrace();
}
}
}
return this;
}
}

View File

@ -0,0 +1,13 @@
package net.silentclient.client.event;
public class EventCancelable extends Event {
private boolean cancelled = false;
public boolean isCancelable() {
return cancelled;
}
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
}

View File

@ -0,0 +1,15 @@
package net.silentclient.client.event;
import java.lang.reflect.Method;
public class EventData {
public final Object source;
public final Method target;
public final byte priority;
public EventData(Object source, Method target, byte priority) {
this.source = source;
this.target = target;
this.priority = priority;
}
}

View File

@ -0,0 +1,133 @@
package net.silentclient.client.event;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class EventManager {
private static final Map<Class<? extends Event>, ArrayList<EventData>> REGISTRY_MAP = new HashMap<Class<? extends Event>, ArrayList<EventData>>();
private static void sortListValue(final Class<? extends Event> clazz) {
final ArrayList<EventData> flexableArray = new ArrayList<EventData>();
for(final byte b : EventPriority.VALUE_ARRAY) {
for(EventData methodData : EventManager.REGISTRY_MAP.get(clazz)) {
if(methodData.priority == b) {
flexableArray.add(methodData);
}
}
}
EventManager.REGISTRY_MAP.put(clazz, flexableArray);
}
private static boolean isMethodBad(final Method method) {
return method.getParameterTypes().length != 1 || !method.isAnnotationPresent(EventTarget.class);
}
private static boolean isMethodBad(final Method method, final Class<? extends Event> clazz) {
return isMethodBad(method) || method.getParameterTypes()[0].equals(clazz);
}
public static ArrayList<EventData> get(final Class<? extends Event> clazz){
return REGISTRY_MAP.get(clazz);
}
public static void cleanMap(final boolean removeOnlyEmptyValues) {
final Iterator<Map.Entry<Class<? extends Event>, ArrayList<EventData>>> iterator = EventManager.REGISTRY_MAP.entrySet().iterator();
while(iterator.hasNext()) {
if(!removeOnlyEmptyValues || iterator.next().getValue().isEmpty()) {
iterator.remove();
}
}
}
public static void unregister(final Object o, final Class<? extends Event> clazz) {
if(REGISTRY_MAP.containsKey(clazz)) {
for(final EventData methodData : REGISTRY_MAP.get(clazz)) {
if(methodData.source.equals(o)) {
REGISTRY_MAP.get(clazz).remove(methodData);
}
}
}
cleanMap(true);
}
public static void unregister(final Object o) {
for(ArrayList<EventData> flexableArray : REGISTRY_MAP.values()) {
for(int i = flexableArray.size() -1; i >= 0; i--) {
if(flexableArray.get(i).source.equals(o)) {
flexableArray.remove(i);
}
}
}
cleanMap(true);
}
@SuppressWarnings("unchecked")
public static void register(final Method method, final Object o) {
final Class<?> clazz = method.getParameterTypes()[0];
final EventData methodData = new EventData(o, method, method.getAnnotation(EventTarget.class).value());
if(!methodData.target.isAccessible()) {
methodData.target.setAccessible(true);
}
if(REGISTRY_MAP.containsKey(clazz)) {
if(!REGISTRY_MAP.get(clazz).contains(methodData)) {
REGISTRY_MAP.get(clazz).add(methodData);
sortListValue((Class<? extends Event>) clazz);
}
}
else {
REGISTRY_MAP.put((Class<? extends Event>) clazz, new ArrayList<EventData>() {
private static final long serialVersionUID = 1L;
{
this.add(methodData);
}
});
}
}
public static void register(final Object o, final Class<? extends Event> clazz) {
for(final Method method : o.getClass().getMethods()) {
if(!isMethodBad(method, clazz)) {
register(method, o);
}
}
}
public static void register(Object o) {
for(final Method method : o.getClass().getMethods()) {
if(!isMethodBad(method)) {
register(method, o);
}
}
}
}

View File

@ -0,0 +1,9 @@
package net.silentclient.client.event;
public class EventPriority {
public static final byte FIRST = 0, SECOND = 1, THIRD = 2, FOURTH = 3, FIRTH = 4;
public static final byte[] VALUE_ARRAY = new byte[] { FIRST, SECOND, THIRD, FOURTH, FIRTH };
}

View File

@ -0,0 +1,12 @@
package net.silentclient.client.event;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface EventTarget {
byte value() default EventPriority.THIRD;
}

View File

@ -0,0 +1,7 @@
package net.silentclient.client.event.impl;
import net.silentclient.client.event.Event;
public class ClientTickEvent extends Event {
}

View File

@ -0,0 +1,17 @@
package net.silentclient.client.event.impl;
import net.minecraft.client.multiplayer.ServerData;
import net.silentclient.client.event.Event;
public class ConnectToServerEvent extends Event {
private final ServerData serverData;
public ConnectToServerEvent(ServerData serverData) {
this.serverData = serverData;
}
public ServerData getServerData() {
return serverData;
}
}

View File

@ -0,0 +1,22 @@
package net.silentclient.client.event.impl;
import net.minecraft.entity.Entity;
import net.silentclient.client.event.Event;
public class EntityAttackEvent extends Event {
private final Entity victim;
private final Entity player;
public EntityAttackEvent(Entity victim, Entity player) {
this.victim = victim;
this.player = player;
}
public Entity getVictim() {
return victim;
}
public Entity getPlayer() {
return player;
}
}

View File

@ -0,0 +1,16 @@
package net.silentclient.client.event.impl;
import net.minecraft.entity.Entity;
import net.silentclient.client.event.Event;
public class EntityDamageEvent extends Event {
private Entity entity;
public EntityDamageEvent(Entity entity) {
this.entity = entity;
}
public Entity getEntity() {
return entity;
}
}

View File

@ -0,0 +1,30 @@
package net.silentclient.client.event.impl;
import net.minecraft.entity.Entity;
import net.silentclient.client.event.EventCancelable;
public class EntityJoinLevelEvent extends EventCancelable {
private final boolean loadedFromDisk;
private final Entity entity;
public EntityJoinLevelEvent(Entity entity)
{
this(entity, false);
}
public EntityJoinLevelEvent(Entity entity, boolean loadedFromDisk)
{
this.entity = entity;
this.loadedFromDisk = loadedFromDisk;
}
public Entity getEntity()
{
return entity;
}
public boolean loadedFromDisk()
{
return loadedFromDisk;
}
}

View File

@ -0,0 +1,39 @@
package net.silentclient.client.event.impl;
import net.silentclient.client.event.Event;
public class EventCameraRotation extends Event {
private float yaw;
private float pitch;
private float roll;
public EventCameraRotation(float yaw, float pitch, float roll) {
this.yaw = yaw;
this.pitch = pitch;
this.roll = roll;
}
public float getYaw() {
return yaw;
}
public void setYaw(float yaw) {
this.yaw = yaw;
}
public float getPitch() {
return pitch;
}
public void setPitch(float pitch) {
this.pitch = pitch;
}
public float getRoll() {
return roll;
}
public void setRoll(float roll) {
this.roll = roll;
}
}

View File

@ -0,0 +1,15 @@
package net.silentclient.client.event.impl;
import net.silentclient.client.event.Event;
public class EventClickMouse extends Event {
private final int button;
public EventClickMouse(int button) {
this.button = button;
}
public int getButton() {
return button;
}
}

View File

@ -0,0 +1,19 @@
package net.silentclient.client.event.impl;
import net.silentclient.client.event.Event;
public class EventDebugFps extends Event {
private int fps;
public EventDebugFps(int fps) {
this.fps = fps;
}
public int getFps() {
return fps;
}
public void setFps(int fps) {
this.fps = fps;
}
}

View File

@ -0,0 +1,26 @@
package net.silentclient.client.event.impl;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.silentclient.client.event.Event;
public class EventFovUpdate extends Event {
private AbstractClientPlayer entity;
private float fov;
public EventFovUpdate(AbstractClientPlayer entity, float fov) {
this.entity = entity;
this.fov = fov;
}
public float getFov() {
return fov;
}
public void setFov(float fov) {
this.fov = fov;
}
public AbstractClientPlayer getEntity() {
return entity;
}
}

View File

@ -0,0 +1,49 @@
package net.silentclient.client.event.impl;
import net.silentclient.client.event.Event;
public class EventHitOverlay extends Event {
private float red;
private float green;
private float blue;
private float alpha;
public EventHitOverlay(float red, float green, float blue, float alpha) {
this.red = red;
this.green = green;
this.blue = blue;
this.alpha = alpha;
}
public float getRed() {
return red;
}
public void setRed(float red) {
this.red = red;
}
public float getGreen() {
return green;
}
public void setGreen(float green) {
this.green = green;
}
public float getBlue() {
return blue;
}
public void setBlue(float blue) {
this.blue = blue;
}
public float getAlpha() {
return alpha;
}
public void setAlpha(float alpha) {
this.alpha = alpha;
}
}

View File

@ -0,0 +1,55 @@
package net.silentclient.client.event.impl;
import net.silentclient.client.event.EventCancelable;
public class EventPlaySound extends EventCancelable {
private String soundName;
private float volume;
private float pitch;
private float originalVolume;
private float originalPitch;
public EventPlaySound(String soundName, float volume, float pitch, float originalVolume, float originalPitch) {
this.soundName = soundName;
this.volume = volume;
this.pitch = pitch;
this.originalVolume = originalVolume;
this.originalPitch = originalPitch;
}
public float getVolume() {
return volume;
}
public void setVolume(float volume) {
this.volume = volume;
}
public float getPitch() {
return pitch;
}
public void setPitch(float pitch) {
this.pitch = pitch;
}
public float getOriginalVolume() {
return originalVolume;
}
public void setOriginalVolume(float originalVolume) {
this.originalVolume = originalVolume;
}
public float getOriginalPitch() {
return originalPitch;
}
public void setOriginalPitch(float originalPitch) {
this.originalPitch = originalPitch;
}
public String getSoundName() {
return soundName;
}
}

View File

@ -0,0 +1,21 @@
package net.silentclient.client.event.impl;
import net.silentclient.client.event.EventCancelable;
public class EventPlayerHeadRotation extends EventCancelable {
private float yaw;
private float pitch;
public EventPlayerHeadRotation(float yaw, float pitch) {
this.yaw = yaw;
this.pitch = pitch;
}
public float getYaw() {
return yaw;
}
public float getPitch() {
return pitch;
}
}

View File

@ -0,0 +1,20 @@
package net.silentclient.client.event.impl;
import net.minecraft.network.Packet;
import net.silentclient.client.event.EventCancelable;
public class EventReceivePacket extends EventCancelable {
private Packet<?> packet;
public EventReceivePacket(Packet<?> packet) {
this.packet = packet;
}
public Packet<?> getPacket() {
return packet;
}
public void setPacket(Packet<?> packet) {
this.packet = packet;
}
}

View File

@ -0,0 +1,15 @@
package net.silentclient.client.event.impl;
import net.silentclient.client.event.EventCancelable;
public class EventRender3D extends EventCancelable {
private float partialTicks;
public EventRender3D(float partialTicks) {
this.partialTicks = partialTicks;
}
public float getPartialTicks() {
return partialTicks;
}
}

View File

@ -0,0 +1,7 @@
package net.silentclient.client.event.impl;
import net.silentclient.client.event.EventCancelable;
public class EventRenderCrosshair extends EventCancelable {
}

View File

@ -0,0 +1,7 @@
package net.silentclient.client.event.impl;
import net.silentclient.client.event.Event;
public class EventRenderDamageTint extends Event {
}

View File

@ -0,0 +1,44 @@
package net.silentclient.client.event.impl;
import net.minecraft.entity.Entity;
import net.silentclient.client.event.EventCancelable;
public class EventRenderHitbox extends EventCancelable {
private Entity entity;
private double x, y, z;
private float entityYaw;
private float partialTicks;
public EventRenderHitbox(Entity entity, double x, double y, double z, float entityYaw, float partialTicks) {
this.entity = entity;
this.x = x;
this.y = y;
this.z = z;
this.entityYaw = entityYaw;
this.partialTicks = partialTicks;
}
public Entity getEntity() {
return entity;
}
public double getX() {
return x;
}
public double getY() {
return y;
}
public double getZ() {
return z;
}
public float getEntityYaw() {
return entityYaw;
}
public float getPartialTicks() {
return partialTicks;
}
}

View File

@ -0,0 +1,15 @@
package net.silentclient.client.event.impl;
import net.silentclient.client.event.EventCancelable;
public class EventScrollMouse extends EventCancelable {
private int amount;
public EventScrollMouse(int amount) {
this.amount = amount;
}
public int getAmount() {
return amount;
}
}

View File

@ -0,0 +1,15 @@
package net.silentclient.client.event.impl;
import net.silentclient.client.event.EventCancelable;
public class EventSendMessage extends EventCancelable {
private final String message;
public EventSendMessage(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
}

View File

@ -0,0 +1,20 @@
package net.silentclient.client.event.impl;
import net.minecraft.network.Packet;
import net.silentclient.client.event.EventCancelable;
public class EventSendPacket extends EventCancelable {
private Packet<?> packet;
public EventSendPacket(Packet<?> packet) {
this.packet = packet;
}
public Packet<?> getPacket() {
return packet;
}
public void setPacket(Packet<?> packet) {
this.packet = packet;
}
}

View File

@ -0,0 +1,30 @@
package net.silentclient.client.event.impl;
import net.silentclient.client.event.Event;
public class EventText extends Event {
private String text;
private String outputText;
public EventText(String text) {
this.text = text;
this.outputText = text;
}
public String getText() {
return this.text;
}
public String getOutputText() {
return this.outputText;
}
public String replace(String src, String target) {
this.outputText = text.replace(src, target);
return this.outputText;
}
public void setOutputText(String outputText) {
this.outputText = outputText;
}
}

View File

@ -0,0 +1,40 @@
package net.silentclient.client.event.impl;
import net.minecraft.item.ItemStack;
import net.silentclient.client.event.Event;
public class EventTransformFirstPersonItem extends Event {
private ItemStack itemToRender;
private float equipProgress;
private float swingProgress;
public EventTransformFirstPersonItem(ItemStack itemToRender, float equipProgress, float swingProgress) {
this.itemToRender = itemToRender;
this.equipProgress = equipProgress;
this.swingProgress = swingProgress;
}
public ItemStack getItemToRender() {
return itemToRender;
}
public void setItemToRender(ItemStack itemToRender) {
this.itemToRender = itemToRender;
}
public float getEquipProgress() {
return equipProgress;
}
public void setEquipProgress(float equipProgress) {
this.equipProgress = equipProgress;
}
public float getSwingProgress() {
return swingProgress;
}
public void setSwingProgress(float swingProgress) {
this.swingProgress = swingProgress;
}
}

View File

@ -0,0 +1,19 @@
package net.silentclient.client.event.impl;
import net.silentclient.client.event.Event;
public class EventZoomFov extends Event {
private float fov;
public EventZoomFov(float fov) {
this.fov = fov;
}
public float getFov() {
return fov;
}
public void setFov(float fov) {
this.fov = fov;
}
}

View File

@ -0,0 +1,16 @@
package net.silentclient.client.event.impl;
import net.silentclient.client.event.EventCancelable;
public class KeyEvent extends EventCancelable {
private final int key;
public KeyEvent(int key) {
this.key = key;
}
public int getKey() {
return key;
}
}

View File

@ -0,0 +1,16 @@
package net.silentclient.client.event.impl;
import net.minecraft.client.multiplayer.WorldClient;
import net.silentclient.client.event.Event;
public class LoadWorldEvent extends Event {
private final WorldClient world;
public LoadWorldEvent(WorldClient world) {
this.world = world;
}
public WorldClient getWorld() {
return world;
}
}

View File

@ -0,0 +1,16 @@
package net.silentclient.client.event.impl;
import net.minecraft.util.IChatComponent;
import net.silentclient.client.event.EventCancelable;
public class NewMessageEvent extends EventCancelable {
private final IChatComponent message;
public NewMessageEvent(IChatComponent message) {
this.message = message;
}
public IChatComponent getMessage() {
return message;
}
}

View File

@ -0,0 +1,7 @@
package net.silentclient.client.event.impl;
import net.silentclient.client.event.Event;
public class RenderEvent extends Event {
}

View File

@ -0,0 +1,30 @@
package net.silentclient.client.event.impl;
import net.minecraft.client.renderer.entity.RendererLivingEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.silentclient.client.event.EventCancelable;
public class RenderLivingEvent extends EventCancelable {
private Entity entity;
public double x;
public double y;
public double z;
private RendererLivingEntity<EntityLivingBase> renderer;
public RenderLivingEvent(Entity entity, double x, double y, double z, RendererLivingEntity<EntityLivingBase> renderer) {
this.entity = entity;
this.x = x;
this.y = y;
this.z = z;
this.renderer = renderer;
}
public Entity getEntity() {
return entity;
}
public RendererLivingEntity<EntityLivingBase> getRenderer() {
return renderer;
}
}

View File

@ -0,0 +1,7 @@
package net.silentclient.client.event.impl;
import net.silentclient.client.event.EventCancelable;
public class RenderTickEvent extends EventCancelable {
}

View File

@ -0,0 +1,15 @@
package net.silentclient.client.event.impl;
import net.silentclient.client.event.EventCancelable;
public class RunCommandEvent extends EventCancelable {
private final String command;
public RunCommandEvent(String command) {
this.command = command;
}
public String getCommand() {
return command;
}
}

View File

@ -0,0 +1,6 @@
package net.silentclient.client.event.impl;
import net.silentclient.client.event.Event;
public class ServerLeaveEvent extends Event {
}

View File

@ -0,0 +1,6 @@
package net.silentclient.client.event.impl;
import net.silentclient.client.event.Event;
public class SingleplayerJoinEvent extends Event {
}

View File

@ -0,0 +1,66 @@
package net.silentclient.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.silentclient.client.Client;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.font.SilentFontRenderer;
import java.awt.*;
import java.io.IOException;
public class GuiError extends GuiScreen {
private final String error;
public GuiError(String error) {
this.error = error;
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
GlStateManager.disableAlpha();
Client.backgroundPanorama.renderSkybox(mouseX, mouseY, partialTicks);
GlStateManager.enableAlpha();
if(Client.getInstance().getGlobalSettings().isLite()) {
this.drawGradientRect(0, 0, this.width, this.height, new Color(0, 0, 0, 127).getRGB(), new Color(0, 0, 0, 200).getRGB());
} else {
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
Client.getInstance().getSilentFontRenderer().drawString("Error", (this.width / 2) - (Client.getInstance().getSilentFontRenderer().getStringWidth("Error", 14, SilentFontRenderer.FontType.HEADER) / 2), this.height / 3 - 3, 14, SilentFontRenderer.FontType.HEADER);
Client.getInstance().getSilentFontRenderer().drawString(error, (this.width / 2) - (Client.getInstance().getSilentFontRenderer().getStringWidth(error, 14, SilentFontRenderer.FontType.TITLE) / 2), this.height / 2 - 3, 14, SilentFontRenderer.FontType.TITLE);
super.drawScreen(mouseX, mouseY, partialTicks);
}
@Override
public void initGui() {
Client.backgroundPanorama.updateWidthHeight(this.width, this.height);
this.buttonList.add(new Button(1, (this.width / 2) - (98 / 2), this.height - 30, 98, 20, "Quit Game"));
super.initGui();
}
@Override
protected void actionPerformed(GuiButton button) {
if(button.id == 1) {
this.mc.shutdown();
}
}
public void updateScreen()
{
Client.backgroundPanorama.tickPanorama();
}
/**
* Returns true if this GUI should pause the game when it is displayed in single-player
*/
public boolean doesGuiPauseGame()
{
return false;
}
}

View File

@ -0,0 +1,39 @@
package net.silentclient.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.silentclient.client.gui.multiplayer.SilentMultiplayerGui;
import java.io.IOException;
public class GuiMultiplayerInGame extends SilentMultiplayerGui {
public GuiMultiplayerInGame(GuiScreen parentScreen) {
super(parentScreen);
}
@Override
protected void actionPerformed(GuiButton button) {
if(button.id == 1) {
disconnect();
}
super.actionPerformed(button);
}
@Override
public void connectToSelected() {
disconnect();
super.connectToSelected();
}
private void disconnect() {
if(this.mc.theWorld != null) {
this.mc.theWorld.sendQuittingDisconnectingPacket();
this.mc.loadWorld(null);
this.mc.displayGuiScreen(null);
this.setParentScreen(null);
}
}
}

View File

@ -0,0 +1,27 @@
package net.silentclient.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiScreenServerList;
import net.minecraft.client.multiplayer.ServerData;
import java.io.IOException;
public class GuiScreenServerListInGame extends GuiScreenServerList {
public GuiScreenServerListInGame(GuiScreen p_i1031_1_, ServerData p_i1031_2_) {
super(p_i1031_1_, p_i1031_2_);
}
@Override
protected void actionPerformed(GuiButton button) {
if(button.id == 0) {
if(this.mc.theWorld != null) {
this.mc.theWorld.sendQuittingDisconnectingPacket();
this.mc.loadWorld(null);
this.mc.displayGuiScreen(null);
}
}
super.actionPerformed(button);
}
}

View File

@ -0,0 +1,77 @@
package net.silentclient.client.gui;
import java.io.IOException;
import net.silentclient.client.utils.MenuBlurUtils;
import org.lwjgl.input.Keyboard;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.elements.IconButton;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.theme.Theme;
public class ModalBase extends GuiScreen {
private final GuiScreen parentScreen;
private final int modalWidth;
private final int modalHeight;
private final String modalTitle;
public ModalBase(GuiScreen parentScreen, String modalTitle) {
this(parentScreen, modalTitle, 200, 90);
}
public ModalBase(GuiScreen parentScreen, String modalTitle, int modalWidth, int modalHeight) {
this.parentScreen = parentScreen;
this.modalWidth = modalWidth;
this.modalHeight = modalHeight;
this.modalTitle = modalTitle;
}
@Override
public void initGui() {
MenuBlurUtils.loadBlur();
int x = width / 2 - (this.modalWidth / 2);
int y = height / 2 - (this.modalHeight / 2);
this.buttonList.add(new IconButton(0, x + this.modalWidth - 14 - 3, y + 3, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/exit.png")));
}
@Override
protected void actionPerformed(GuiButton button) {
if(button.id == 0) {
mc.displayGuiScreen(parentScreen);
}
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
MenuBlurUtils.renderBackground(this);
RenderUtils.drawRect(this.getContentX(), this.getContentY(), this.modalWidth, this.modalHeight, Theme.backgroundColor().getRGB());
Client.getInstance().getSilentFontRenderer().drawString(this.modalTitle, this.getContentX() + 3, this.getContentY() + 3, 14, SilentFontRenderer.FontType.TITLE);
super.drawScreen(mouseX, mouseY, partialTicks);
}
public int getContentX() {
return width / 2 - (this.modalWidth / 2);
}
public int getContentY() {
return height / 2 - (this.modalHeight / 2);
}
@Override
public void onGuiClosed() {
MenuBlurUtils.unloadBlur();
}
@Override
protected void keyTyped(char typedChar, int keyCode) {
if (keyCode == Keyboard.KEY_ESCAPE) {
mc.displayGuiScreen(parentScreen);
};
}
}

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