mirror of
https://github.com/refactorinqq/SLC-1.8.9.git
synced 2024-11-10 07:11:31 +01:00
(feat) add client files
This commit is contained in:
parent
2974616d81
commit
d3aa906327
BIN
autobuilder/assets/1.8.9.jar
Normal file
BIN
autobuilder/assets/1.8.9.jar
Normal file
Binary file not shown.
BIN
autobuilder/assets/asm-tree-5.2.jar
Normal file
BIN
autobuilder/assets/asm-tree-5.2.jar
Normal file
Binary file not shown.
BIN
autobuilder/assets/launchwrapper.jar
Normal file
BIN
autobuilder/assets/launchwrapper.jar
Normal file
Binary file not shown.
79
autobuilder/config
Normal file
79
autobuilder/config
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
{
|
||||||
|
"input": "",
|
||||||
|
"output": "",
|
||||||
|
"script": "function isRemappingEnabledForClass(node) {\n return false;\n}\nfunction isObfuscatorEnabledForClass(node) {\n return true;\n}",
|
||||||
|
"libraries": [],
|
||||||
|
"Crasher": {
|
||||||
|
"Enabled": false
|
||||||
|
},
|
||||||
|
"InvokeDynamic": {
|
||||||
|
"Enabled": false
|
||||||
|
},
|
||||||
|
"HWIDPRotection": {
|
||||||
|
"Enabled": false,
|
||||||
|
"HWID": "1E278E35CF919B35ECF8EF40D7A39FB2"
|
||||||
|
},
|
||||||
|
"Optimizer": {
|
||||||
|
"Enabled": false,
|
||||||
|
"Replace String.equals()": false,
|
||||||
|
"Replace String.equalsIgnoreCase()": false,
|
||||||
|
"Optimize static string calls": false
|
||||||
|
},
|
||||||
|
"LineNumberRemover": {
|
||||||
|
"Enabled": true,
|
||||||
|
"Rename local variables": false,
|
||||||
|
"Remove Line Numbers": true,
|
||||||
|
"Remove Debug Names": true,
|
||||||
|
"Add Local Variables": true,
|
||||||
|
"New SourceFile Name": ""
|
||||||
|
},
|
||||||
|
"StringEncryption": {
|
||||||
|
"Enabled": false,
|
||||||
|
"HideStrings": false,
|
||||||
|
"AES": false
|
||||||
|
},
|
||||||
|
"NumberObfuscation": {
|
||||||
|
"Enabled": false,
|
||||||
|
"Extract to Array": true,
|
||||||
|
"Obfuscate Zero": true,
|
||||||
|
"Shift": false,
|
||||||
|
"And": false,
|
||||||
|
"Multiple Instructions": true
|
||||||
|
},
|
||||||
|
"ReferenceProxy": {
|
||||||
|
"Enabled": false
|
||||||
|
},
|
||||||
|
"ShuffleMembers": {
|
||||||
|
"Enabled": false
|
||||||
|
},
|
||||||
|
"InnerClassRemover": {
|
||||||
|
"Enabled": false,
|
||||||
|
"Remap": false,
|
||||||
|
"Remove Metadata": true
|
||||||
|
},
|
||||||
|
"NameObfuscation": {
|
||||||
|
"Enabled": false
|
||||||
|
},
|
||||||
|
"Packager": {
|
||||||
|
"Enabled": false,
|
||||||
|
"Use MainClass from the JAR manifest": true,
|
||||||
|
"Main class": "org.example.Main"
|
||||||
|
},
|
||||||
|
"FlowObfuscator": {
|
||||||
|
"Enabled": true,
|
||||||
|
"Mangle Comparisons": true,
|
||||||
|
"Replace GOTO": true,
|
||||||
|
"Replace If": true,
|
||||||
|
"Bad POP": true,
|
||||||
|
"Bad Concat": true,
|
||||||
|
"Mangle Switches": false,
|
||||||
|
"Mangle Return": false,
|
||||||
|
"Mangle Local Variables": false
|
||||||
|
},
|
||||||
|
"HideMembers": {
|
||||||
|
"Enabled": false
|
||||||
|
},
|
||||||
|
"Inlining": {
|
||||||
|
"Enabled": false
|
||||||
|
}
|
||||||
|
}
|
160
autobuilder/index.js
Normal file
160
autobuilder/index.js
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
const fs = require("fs");
|
||||||
|
const fse = require("fs-extra");
|
||||||
|
const { unzip } = require("./utils");
|
||||||
|
const { zip } = require("zip-a-folder");
|
||||||
|
const axios = require("axios");
|
||||||
|
const FormData = require("form-data");
|
||||||
|
|
||||||
|
const assetsPaths = {
|
||||||
|
"1.8.9": "./assets/1.8.9.jar",
|
||||||
|
libs: "../libs",
|
||||||
|
wrapper: "./assets/launchwrapper.jar",
|
||||||
|
};
|
||||||
|
const jarsPaths = {};
|
||||||
|
|
||||||
|
const tempPaths = {
|
||||||
|
default: "./temp",
|
||||||
|
jar: "./temp/jar/",
|
||||||
|
};
|
||||||
|
|
||||||
|
const buildPath = "./build";
|
||||||
|
|
||||||
|
async function build() {
|
||||||
|
const version = process.argv[3];
|
||||||
|
const branch = process.argv[5];
|
||||||
|
const commit = process.argv[7];
|
||||||
|
const login = process.env.LOGIN;
|
||||||
|
const password = process.env.PASSWORD;
|
||||||
|
if (!version) {
|
||||||
|
console.log("Please, enter a version");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!branch) {
|
||||||
|
console.log("Please, enter a branch");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!commit) {
|
||||||
|
console.log("Please, enter a branch");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!login || !password) {
|
||||||
|
console.log("Please, enter login and password");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log(
|
||||||
|
`Silent Client AutoBuilder (MC Version: ${version}, branch: ${branch})`
|
||||||
|
);
|
||||||
|
console.log("Checking Jars");
|
||||||
|
if (!fs.existsSync(`./jars/Client.jar`)) {
|
||||||
|
console.error("JAR file does not exist.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log("Checking assets");
|
||||||
|
if (!fs.existsSync(assetsPaths[version])) {
|
||||||
|
console.error("Assets file does not exist.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log("Cleaning up temp directory");
|
||||||
|
try {
|
||||||
|
await fs.promises.rm(tempPaths.default, {
|
||||||
|
recursive: true,
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
} catch {}
|
||||||
|
|
||||||
|
console.log("Extracting JAR");
|
||||||
|
await unzip(`./jars/Client.jar`, tempPaths.jar);
|
||||||
|
console.log("Extracting Wrapper");
|
||||||
|
await unzip(assetsPaths.wrapper, tempPaths.jar);
|
||||||
|
|
||||||
|
const libs = await fs.promises.readdir(assetsPaths.libs);
|
||||||
|
for (const lib of libs) {
|
||||||
|
console.log(`Extracting ${lib}`);
|
||||||
|
await unzip(assetsPaths.libs + `/${lib}`, tempPaths.jar);
|
||||||
|
}
|
||||||
|
console.log(`Extracting asm-tree-5.2.jar`);
|
||||||
|
await unzip("./assets/asm-tree-5.2.jar", tempPaths.jar);
|
||||||
|
|
||||||
|
console.log("Cleaning up extra files in JAR");
|
||||||
|
try {
|
||||||
|
await fs.promises.rm(tempPaths.jar + "App.class", {
|
||||||
|
recursive: true,
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
} catch {}
|
||||||
|
try {
|
||||||
|
await fs.promises.rm(tempPaths.jar + "Start.class", {
|
||||||
|
recursive: true,
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
} catch {}
|
||||||
|
try {
|
||||||
|
await fs.promises.rm(tempPaths.jar + ".DS_Store", {
|
||||||
|
recursive: true,
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
} catch {}
|
||||||
|
try {
|
||||||
|
await fs.promises.rm(tempPaths.jar + "build_data.json", {
|
||||||
|
recursive: true,
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
} catch {}
|
||||||
|
await fs.promises.writeFile(
|
||||||
|
tempPaths.jar + "build_data.json",
|
||||||
|
JSON.stringify({
|
||||||
|
commit,
|
||||||
|
branch,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log("Cleaning up build directory");
|
||||||
|
try {
|
||||||
|
await fs.promises.rm(buildPath, {
|
||||||
|
recursive: true,
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
} catch {}
|
||||||
|
await fs.promises.mkdir(buildPath, { recursive: true });
|
||||||
|
|
||||||
|
console.log("Building JAR File");
|
||||||
|
await zip(tempPaths.jar, buildPath + `/client-${version}.jar`);
|
||||||
|
|
||||||
|
console.log("Uploading build to Silent Client Servers");
|
||||||
|
try {
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append(
|
||||||
|
"jar",
|
||||||
|
fs.createReadStream(buildPath + `/client-${version}.jar`)
|
||||||
|
);
|
||||||
|
formData.append("version", commit);
|
||||||
|
formData.append("branch", branch);
|
||||||
|
formData.append("commit", commit);
|
||||||
|
formData.append("description", "");
|
||||||
|
formData.append("mcVersion", version);
|
||||||
|
formData.append("sendToTelegram", "0");
|
||||||
|
|
||||||
|
const { data: auth } = await axios.post(
|
||||||
|
"https://api.silentclient.net/auth/login",
|
||||||
|
{ email: login, password: password }
|
||||||
|
);
|
||||||
|
|
||||||
|
await axios.post(
|
||||||
|
"https://api.silentclient.net/updates/update_version",
|
||||||
|
formData,
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${auth.auth.token}`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(`Error: ${error}`);
|
||||||
|
console.log(error.response.data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("Build completed successfully!");
|
||||||
|
}
|
||||||
|
|
||||||
|
build();
|
9
autobuilder/obfuscationScript.js
Normal file
9
autobuilder/obfuscationScript.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
function isRemappingEnabledForClass(node) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function isObfuscatorEnabledForClass(node) {
|
||||||
|
return (
|
||||||
|
node.name.startsWith("net/silentclient") &&
|
||||||
|
!node.name.startsWith("net/silentclient/client/mixin")
|
||||||
|
);
|
||||||
|
}
|
BIN
autobuilder/obfuscator.jar
Normal file
BIN
autobuilder/obfuscator.jar
Normal file
Binary file not shown.
13
autobuilder/package.json
Normal file
13
autobuilder/package.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"name": "autobuilder",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "index.js",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^1.4.0",
|
||||||
|
"form-data": "^4.0.0",
|
||||||
|
"fs-extra": "^11.1.1",
|
||||||
|
"jszip": "^3.10.1",
|
||||||
|
"zip-a-folder": "^1.1.5"
|
||||||
|
}
|
||||||
|
}
|
37
autobuilder/utils.js
Normal file
37
autobuilder/utils.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
const JSZip = require("jszip");
|
||||||
|
const fs = require("fs");
|
||||||
|
const path = require("path");
|
||||||
|
|
||||||
|
async function unzip(file, dir) {
|
||||||
|
const sep = process.platform === "darwin" ? "/" : "\\";
|
||||||
|
const fileContent = fs.readFileSync(file);
|
||||||
|
|
||||||
|
const jszip = new JSZip();
|
||||||
|
const result = await jszip.loadAsync(fileContent);
|
||||||
|
const keys = Object.keys(result.files);
|
||||||
|
|
||||||
|
for (let key of keys) {
|
||||||
|
const item = result.files[key];
|
||||||
|
|
||||||
|
if (item.dir) {
|
||||||
|
if (!fs.existsSync(dir + item.name.replace("/", sep))) {
|
||||||
|
await fs.promises.mkdir(dir + item.name.replace("/", sep), {
|
||||||
|
recursive: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let dirname = path.dirname(dir + item.name.replace("/", sep));
|
||||||
|
if (!fs.existsSync(dirname)) {
|
||||||
|
await fs.promises.mkdir(dirname, { recursive: true });
|
||||||
|
}
|
||||||
|
await fs.promises.writeFile(
|
||||||
|
dir + item.name.replace("/", sep),
|
||||||
|
Buffer.from(await item.async("arraybuffer"))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
unzip,
|
||||||
|
};
|
444
autobuilder/yarn.lock
Normal file
444
autobuilder/yarn.lock
Normal file
@ -0,0 +1,444 @@
|
|||||||
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||||
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
archiver-utils@^2.1.0:
|
||||||
|
version "2.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/archiver-utils/-/archiver-utils-2.1.0.tgz#e8a460e94b693c3e3da182a098ca6285ba9249e2"
|
||||||
|
integrity sha512-bEL/yUb/fNNiNTuUz979Z0Yg5L+LzLxGJz8x79lYmR54fmTIb6ob/hNQgkQnIUDWIFjZVQwl9Xs356I6BAMHfw==
|
||||||
|
dependencies:
|
||||||
|
glob "^7.1.4"
|
||||||
|
graceful-fs "^4.2.0"
|
||||||
|
lazystream "^1.0.0"
|
||||||
|
lodash.defaults "^4.2.0"
|
||||||
|
lodash.difference "^4.5.0"
|
||||||
|
lodash.flatten "^4.4.0"
|
||||||
|
lodash.isplainobject "^4.0.6"
|
||||||
|
lodash.union "^4.6.0"
|
||||||
|
normalize-path "^3.0.0"
|
||||||
|
readable-stream "^2.0.0"
|
||||||
|
|
||||||
|
archiver@^5.3.1:
|
||||||
|
version "5.3.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/archiver/-/archiver-5.3.1.tgz#21e92811d6f09ecfce649fbefefe8c79e57cbbb6"
|
||||||
|
integrity sha512-8KyabkmbYrH+9ibcTScQ1xCJC/CGcugdVIwB+53f5sZziXgwUh3iXlAlANMxcZyDEfTHMe6+Z5FofV8nopXP7w==
|
||||||
|
dependencies:
|
||||||
|
archiver-utils "^2.1.0"
|
||||||
|
async "^3.2.3"
|
||||||
|
buffer-crc32 "^0.2.1"
|
||||||
|
readable-stream "^3.6.0"
|
||||||
|
readdir-glob "^1.0.0"
|
||||||
|
tar-stream "^2.2.0"
|
||||||
|
zip-stream "^4.1.0"
|
||||||
|
|
||||||
|
async@^3.2.3:
|
||||||
|
version "3.2.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/async/-/async-3.2.4.tgz#2d22e00f8cddeb5fde5dd33522b56d1cf569a81c"
|
||||||
|
integrity sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==
|
||||||
|
|
||||||
|
asynckit@^0.4.0:
|
||||||
|
version "0.4.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
|
||||||
|
integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==
|
||||||
|
|
||||||
|
axios@^1.4.0:
|
||||||
|
version "1.4.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/axios/-/axios-1.4.0.tgz#38a7bf1224cd308de271146038b551d725f0be1f"
|
||||||
|
integrity sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==
|
||||||
|
dependencies:
|
||||||
|
follow-redirects "^1.15.0"
|
||||||
|
form-data "^4.0.0"
|
||||||
|
proxy-from-env "^1.1.0"
|
||||||
|
|
||||||
|
balanced-match@^1.0.0:
|
||||||
|
version "1.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
|
||||||
|
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
|
||||||
|
|
||||||
|
base64-js@^1.3.1:
|
||||||
|
version "1.5.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
|
||||||
|
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
|
||||||
|
|
||||||
|
bl@^4.0.3:
|
||||||
|
version "4.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a"
|
||||||
|
integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==
|
||||||
|
dependencies:
|
||||||
|
buffer "^5.5.0"
|
||||||
|
inherits "^2.0.4"
|
||||||
|
readable-stream "^3.4.0"
|
||||||
|
|
||||||
|
brace-expansion@^1.1.7:
|
||||||
|
version "1.1.11"
|
||||||
|
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
|
||||||
|
integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==
|
||||||
|
dependencies:
|
||||||
|
balanced-match "^1.0.0"
|
||||||
|
concat-map "0.0.1"
|
||||||
|
|
||||||
|
brace-expansion@^2.0.1:
|
||||||
|
version "2.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae"
|
||||||
|
integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==
|
||||||
|
dependencies:
|
||||||
|
balanced-match "^1.0.0"
|
||||||
|
|
||||||
|
buffer-crc32@^0.2.1, buffer-crc32@^0.2.13:
|
||||||
|
version "0.2.13"
|
||||||
|
resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242"
|
||||||
|
integrity sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==
|
||||||
|
|
||||||
|
buffer@^5.5.0:
|
||||||
|
version "5.7.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0"
|
||||||
|
integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==
|
||||||
|
dependencies:
|
||||||
|
base64-js "^1.3.1"
|
||||||
|
ieee754 "^1.1.13"
|
||||||
|
|
||||||
|
combined-stream@^1.0.8:
|
||||||
|
version "1.0.8"
|
||||||
|
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
|
||||||
|
integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==
|
||||||
|
dependencies:
|
||||||
|
delayed-stream "~1.0.0"
|
||||||
|
|
||||||
|
compress-commons@^4.1.0:
|
||||||
|
version "4.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/compress-commons/-/compress-commons-4.1.1.tgz#df2a09a7ed17447642bad10a85cc9a19e5c42a7d"
|
||||||
|
integrity sha512-QLdDLCKNV2dtoTorqgxngQCMA+gWXkM/Nwu7FpeBhk/RdkzimqC3jueb/FDmaZeXh+uby1jkBqE3xArsLBE5wQ==
|
||||||
|
dependencies:
|
||||||
|
buffer-crc32 "^0.2.13"
|
||||||
|
crc32-stream "^4.0.2"
|
||||||
|
normalize-path "^3.0.0"
|
||||||
|
readable-stream "^3.6.0"
|
||||||
|
|
||||||
|
concat-map@0.0.1:
|
||||||
|
version "0.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
||||||
|
integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==
|
||||||
|
|
||||||
|
core-util-is@~1.0.0:
|
||||||
|
version "1.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85"
|
||||||
|
integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==
|
||||||
|
|
||||||
|
crc-32@^1.2.0:
|
||||||
|
version "1.2.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/crc-32/-/crc-32-1.2.2.tgz#3cad35a934b8bf71f25ca524b6da51fb7eace2ff"
|
||||||
|
integrity sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==
|
||||||
|
|
||||||
|
crc32-stream@^4.0.2:
|
||||||
|
version "4.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/crc32-stream/-/crc32-stream-4.0.2.tgz#c922ad22b38395abe9d3870f02fa8134ed709007"
|
||||||
|
integrity sha512-DxFZ/Hk473b/muq1VJ///PMNLj0ZMnzye9thBpmjpJKCc5eMgB95aK8zCGrGfQ90cWo561Te6HK9D+j4KPdM6w==
|
||||||
|
dependencies:
|
||||||
|
crc-32 "^1.2.0"
|
||||||
|
readable-stream "^3.4.0"
|
||||||
|
|
||||||
|
delayed-stream@~1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
|
||||||
|
integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==
|
||||||
|
|
||||||
|
end-of-stream@^1.4.1:
|
||||||
|
version "1.4.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0"
|
||||||
|
integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==
|
||||||
|
dependencies:
|
||||||
|
once "^1.4.0"
|
||||||
|
|
||||||
|
follow-redirects@^1.15.0:
|
||||||
|
version "1.15.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13"
|
||||||
|
integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==
|
||||||
|
|
||||||
|
form-data@^4.0.0:
|
||||||
|
version "4.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452"
|
||||||
|
integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==
|
||||||
|
dependencies:
|
||||||
|
asynckit "^0.4.0"
|
||||||
|
combined-stream "^1.0.8"
|
||||||
|
mime-types "^2.1.12"
|
||||||
|
|
||||||
|
fs-constants@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad"
|
||||||
|
integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==
|
||||||
|
|
||||||
|
fs-extra@^11.1.1:
|
||||||
|
version "11.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.1.1.tgz#da69f7c39f3b002378b0954bb6ae7efdc0876e2d"
|
||||||
|
integrity sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==
|
||||||
|
dependencies:
|
||||||
|
graceful-fs "^4.2.0"
|
||||||
|
jsonfile "^6.0.1"
|
||||||
|
universalify "^2.0.0"
|
||||||
|
|
||||||
|
fs.realpath@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
|
||||||
|
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==
|
||||||
|
|
||||||
|
glob@^7.1.4:
|
||||||
|
version "7.2.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b"
|
||||||
|
integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==
|
||||||
|
dependencies:
|
||||||
|
fs.realpath "^1.0.0"
|
||||||
|
inflight "^1.0.4"
|
||||||
|
inherits "2"
|
||||||
|
minimatch "^3.1.1"
|
||||||
|
once "^1.3.0"
|
||||||
|
path-is-absolute "^1.0.0"
|
||||||
|
|
||||||
|
graceful-fs@^4.1.6, graceful-fs@^4.2.0:
|
||||||
|
version "4.2.11"
|
||||||
|
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3"
|
||||||
|
integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==
|
||||||
|
|
||||||
|
ieee754@^1.1.13:
|
||||||
|
version "1.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
|
||||||
|
integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
|
||||||
|
|
||||||
|
immediate@~3.0.5:
|
||||||
|
version "3.0.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b"
|
||||||
|
integrity sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==
|
||||||
|
|
||||||
|
inflight@^1.0.4:
|
||||||
|
version "1.0.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
|
||||||
|
integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==
|
||||||
|
dependencies:
|
||||||
|
once "^1.3.0"
|
||||||
|
wrappy "1"
|
||||||
|
|
||||||
|
inherits@2, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3:
|
||||||
|
version "2.0.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
|
||||||
|
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
|
||||||
|
|
||||||
|
isarray@~1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
|
||||||
|
integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==
|
||||||
|
|
||||||
|
jsonfile@^6.0.1:
|
||||||
|
version "6.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"
|
||||||
|
integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==
|
||||||
|
dependencies:
|
||||||
|
universalify "^2.0.0"
|
||||||
|
optionalDependencies:
|
||||||
|
graceful-fs "^4.1.6"
|
||||||
|
|
||||||
|
jszip@^3.10.1:
|
||||||
|
version "3.10.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/jszip/-/jszip-3.10.1.tgz#34aee70eb18ea1faec2f589208a157d1feb091c2"
|
||||||
|
integrity sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==
|
||||||
|
dependencies:
|
||||||
|
lie "~3.3.0"
|
||||||
|
pako "~1.0.2"
|
||||||
|
readable-stream "~2.3.6"
|
||||||
|
setimmediate "^1.0.5"
|
||||||
|
|
||||||
|
lazystream@^1.0.0:
|
||||||
|
version "1.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/lazystream/-/lazystream-1.0.1.tgz#494c831062f1f9408251ec44db1cba29242a2638"
|
||||||
|
integrity sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==
|
||||||
|
dependencies:
|
||||||
|
readable-stream "^2.0.5"
|
||||||
|
|
||||||
|
lie@~3.3.0:
|
||||||
|
version "3.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/lie/-/lie-3.3.0.tgz#dcf82dee545f46074daf200c7c1c5a08e0f40f6a"
|
||||||
|
integrity sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==
|
||||||
|
dependencies:
|
||||||
|
immediate "~3.0.5"
|
||||||
|
|
||||||
|
lodash.defaults@^4.2.0:
|
||||||
|
version "4.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c"
|
||||||
|
integrity sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==
|
||||||
|
|
||||||
|
lodash.difference@^4.5.0:
|
||||||
|
version "4.5.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/lodash.difference/-/lodash.difference-4.5.0.tgz#9ccb4e505d486b91651345772885a2df27fd017c"
|
||||||
|
integrity sha512-dS2j+W26TQ7taQBGN8Lbbq04ssV3emRw4NY58WErlTO29pIqS0HmoT5aJ9+TUQ1N3G+JOZSji4eugsWwGp9yPA==
|
||||||
|
|
||||||
|
lodash.flatten@^4.4.0:
|
||||||
|
version "4.4.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/lodash.flatten/-/lodash.flatten-4.4.0.tgz#f31c22225a9632d2bbf8e4addbef240aa765a61f"
|
||||||
|
integrity sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==
|
||||||
|
|
||||||
|
lodash.isplainobject@^4.0.6:
|
||||||
|
version "4.0.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb"
|
||||||
|
integrity sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==
|
||||||
|
|
||||||
|
lodash.union@^4.6.0:
|
||||||
|
version "4.6.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/lodash.union/-/lodash.union-4.6.0.tgz#48bb5088409f16f1821666641c44dd1aaae3cd88"
|
||||||
|
integrity sha512-c4pB2CdGrGdjMKYLA+XiRDO7Y0PRQbm/Gzg8qMj+QH+pFVAoTp5sBpO0odL3FjoPCGjK96p6qsP+yQoiLoOBcw==
|
||||||
|
|
||||||
|
mime-db@1.52.0:
|
||||||
|
version "1.52.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70"
|
||||||
|
integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==
|
||||||
|
|
||||||
|
mime-types@^2.1.12:
|
||||||
|
version "2.1.35"
|
||||||
|
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a"
|
||||||
|
integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==
|
||||||
|
dependencies:
|
||||||
|
mime-db "1.52.0"
|
||||||
|
|
||||||
|
minimatch@^3.1.1:
|
||||||
|
version "3.1.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
|
||||||
|
integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==
|
||||||
|
dependencies:
|
||||||
|
brace-expansion "^1.1.7"
|
||||||
|
|
||||||
|
minimatch@^5.1.0:
|
||||||
|
version "5.1.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96"
|
||||||
|
integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==
|
||||||
|
dependencies:
|
||||||
|
brace-expansion "^2.0.1"
|
||||||
|
|
||||||
|
normalize-path@^3.0.0:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65"
|
||||||
|
integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==
|
||||||
|
|
||||||
|
once@^1.3.0, once@^1.4.0:
|
||||||
|
version "1.4.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
|
||||||
|
integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==
|
||||||
|
dependencies:
|
||||||
|
wrappy "1"
|
||||||
|
|
||||||
|
pako@~1.0.2:
|
||||||
|
version "1.0.11"
|
||||||
|
resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf"
|
||||||
|
integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==
|
||||||
|
|
||||||
|
path-is-absolute@^1.0.0:
|
||||||
|
version "1.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
|
||||||
|
integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==
|
||||||
|
|
||||||
|
process-nextick-args@~2.0.0:
|
||||||
|
version "2.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"
|
||||||
|
integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==
|
||||||
|
|
||||||
|
proxy-from-env@^1.1.0:
|
||||||
|
version "1.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
|
||||||
|
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==
|
||||||
|
|
||||||
|
readable-stream@^2.0.0, readable-stream@^2.0.5, readable-stream@~2.3.6:
|
||||||
|
version "2.3.8"
|
||||||
|
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b"
|
||||||
|
integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==
|
||||||
|
dependencies:
|
||||||
|
core-util-is "~1.0.0"
|
||||||
|
inherits "~2.0.3"
|
||||||
|
isarray "~1.0.0"
|
||||||
|
process-nextick-args "~2.0.0"
|
||||||
|
safe-buffer "~5.1.1"
|
||||||
|
string_decoder "~1.1.1"
|
||||||
|
util-deprecate "~1.0.1"
|
||||||
|
|
||||||
|
readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0:
|
||||||
|
version "3.6.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967"
|
||||||
|
integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==
|
||||||
|
dependencies:
|
||||||
|
inherits "^2.0.3"
|
||||||
|
string_decoder "^1.1.1"
|
||||||
|
util-deprecate "^1.0.1"
|
||||||
|
|
||||||
|
readdir-glob@^1.0.0:
|
||||||
|
version "1.1.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/readdir-glob/-/readdir-glob-1.1.2.tgz#b185789b8e6a43491635b6953295c5c5e3fd224c"
|
||||||
|
integrity sha512-6RLVvwJtVwEDfPdn6X6Ille4/lxGl0ATOY4FN/B9nxQcgOazvvI0nodiD19ScKq0PvA/29VpaOQML36o5IzZWA==
|
||||||
|
dependencies:
|
||||||
|
minimatch "^5.1.0"
|
||||||
|
|
||||||
|
safe-buffer@~5.1.0, safe-buffer@~5.1.1:
|
||||||
|
version "5.1.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
|
||||||
|
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==
|
||||||
|
|
||||||
|
safe-buffer@~5.2.0:
|
||||||
|
version "5.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
|
||||||
|
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
|
||||||
|
|
||||||
|
setimmediate@^1.0.5:
|
||||||
|
version "1.0.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285"
|
||||||
|
integrity sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==
|
||||||
|
|
||||||
|
string_decoder@^1.1.1:
|
||||||
|
version "1.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e"
|
||||||
|
integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==
|
||||||
|
dependencies:
|
||||||
|
safe-buffer "~5.2.0"
|
||||||
|
|
||||||
|
string_decoder@~1.1.1:
|
||||||
|
version "1.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8"
|
||||||
|
integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==
|
||||||
|
dependencies:
|
||||||
|
safe-buffer "~5.1.0"
|
||||||
|
|
||||||
|
tar-stream@^2.2.0:
|
||||||
|
version "2.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287"
|
||||||
|
integrity sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==
|
||||||
|
dependencies:
|
||||||
|
bl "^4.0.3"
|
||||||
|
end-of-stream "^1.4.1"
|
||||||
|
fs-constants "^1.0.0"
|
||||||
|
inherits "^2.0.3"
|
||||||
|
readable-stream "^3.1.1"
|
||||||
|
|
||||||
|
universalify@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717"
|
||||||
|
integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==
|
||||||
|
|
||||||
|
util-deprecate@^1.0.1, util-deprecate@~1.0.1:
|
||||||
|
version "1.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
|
||||||
|
integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==
|
||||||
|
|
||||||
|
wrappy@1:
|
||||||
|
version "1.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
||||||
|
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==
|
||||||
|
|
||||||
|
zip-a-folder@^1.1.5:
|
||||||
|
version "1.1.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/zip-a-folder/-/zip-a-folder-1.1.5.tgz#9c3176e844bc1305338717fab765edac4839b778"
|
||||||
|
integrity sha512-w6I4mvWc6D0Q4pdzCSFbQih/ezYBdjwGZVbWRRFMOYcOdtE9TONZ7YtXCPnHj4XJQmXQxTOWcRGnPYxRn+d0mw==
|
||||||
|
dependencies:
|
||||||
|
archiver "^5.3.1"
|
||||||
|
|
||||||
|
zip-stream@^4.1.0:
|
||||||
|
version "4.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/zip-stream/-/zip-stream-4.1.0.tgz#51dd326571544e36aa3f756430b313576dc8fc79"
|
||||||
|
integrity sha512-zshzwQW7gG7hjpBlgeQP9RuyPGNxvJdzR8SUM3QhxCnLjWN2E7j3dOvpeDcQoETfHx0urRS7EtmVToql7YpU4A==
|
||||||
|
dependencies:
|
||||||
|
archiver-utils "^2.1.0"
|
||||||
|
compress-commons "^4.1.0"
|
||||||
|
readable-stream "^3.6.0"
|
@ -14,5 +14,5 @@ forge_version=11.15.1.2318
|
|||||||
|
|
||||||
# Properties
|
# Properties
|
||||||
mod_version = 1.0.0
|
mod_version = 1.0.0
|
||||||
maven_group = dev.refactoring
|
maven_group = net.silentclient
|
||||||
archives_base_name = referenceloader
|
archives_base_name = silentclient
|
BIN
lib/LWJGL-Patched-bf1d105853.jar
Normal file
BIN
lib/LWJGL-Patched-bf1d105853.jar
Normal file
Binary file not shown.
BIN
lib/OcclusionCulling.jar
Normal file
BIN
lib/OcclusionCulling.jar
Normal file
Binary file not shown.
BIN
lib/annotations-13.0.jar
Normal file
BIN
lib/annotations-13.0.jar
Normal file
Binary file not shown.
BIN
lib/asm-5.0.3.jar
Normal file
BIN
lib/asm-5.0.3.jar
Normal file
Binary file not shown.
BIN
lib/caffeine-2.9.3.jar
Normal file
BIN
lib/caffeine-2.9.3.jar
Normal file
Binary file not shown.
BIN
lib/checker-qual-3.19.0.jar
Normal file
BIN
lib/checker-qual-3.19.0.jar
Normal file
Binary file not shown.
BIN
lib/engine.io-client-1.0.2.jar
Normal file
BIN
lib/engine.io-client-1.0.2.jar
Normal file
Binary file not shown.
BIN
lib/error_prone_annotations-2.10.0.jar
Normal file
BIN
lib/error_prone_annotations-2.10.0.jar
Normal file
Binary file not shown.
BIN
lib/joml-1.10.5.jar
Normal file
BIN
lib/joml-1.10.5.jar
Normal file
Binary file not shown.
BIN
lib/json.jar
Normal file
BIN
lib/json.jar
Normal file
Binary file not shown.
BIN
lib/kotlin-annotation-processing-maven-1.8.22.jar
Normal file
BIN
lib/kotlin-annotation-processing-maven-1.8.22.jar
Normal file
Binary file not shown.
BIN
lib/kotlin-stdlib-1.8.22.jar
Normal file
BIN
lib/kotlin-stdlib-1.8.22.jar
Normal file
Binary file not shown.
BIN
lib/kotlin-stdlib-common-1.8.22.jar
Normal file
BIN
lib/kotlin-stdlib-common-1.8.22.jar
Normal file
Binary file not shown.
BIN
lib/lwjgl-nanovg-natives-macos-arm64.jar
Normal file
BIN
lib/lwjgl-nanovg-natives-macos-arm64.jar
Normal file
Binary file not shown.
BIN
lib/lwjgl-nanovg-natives-macos.jar
Normal file
BIN
lib/lwjgl-nanovg-natives-macos.jar
Normal file
Binary file not shown.
BIN
lib/lwjgl-nanovg-natives-windows-x86.jar
Normal file
BIN
lib/lwjgl-nanovg-natives-windows-x86.jar
Normal file
Binary file not shown.
BIN
lib/lwjgl-nanovg-natives-windows.jar
Normal file
BIN
lib/lwjgl-nanovg-natives-windows.jar
Normal file
Binary file not shown.
BIN
lib/lwjgl-natives-macos-arm64.jar
Normal file
BIN
lib/lwjgl-natives-macos-arm64.jar
Normal file
Binary file not shown.
BIN
lib/lwjgl-natives-macos.jar
Normal file
BIN
lib/lwjgl-natives-macos.jar
Normal file
Binary file not shown.
BIN
lib/lwjgl-natives-windows-x86.jar
Normal file
BIN
lib/lwjgl-natives-windows-x86.jar
Normal file
Binary file not shown.
BIN
lib/lwjgl-natives-windows.jar
Normal file
BIN
lib/lwjgl-natives-windows.jar
Normal file
Binary file not shown.
BIN
lib/lwjgl-stb-natives-macos-arm64.jar
Normal file
BIN
lib/lwjgl-stb-natives-macos-arm64.jar
Normal file
Binary file not shown.
BIN
lib/lwjgl-stb-natives-macos.jar
Normal file
BIN
lib/lwjgl-stb-natives-macos.jar
Normal file
Binary file not shown.
BIN
lib/lwjgl-stb-natives-windows-x86.jar
Normal file
BIN
lib/lwjgl-stb-natives-windows-x86.jar
Normal file
Binary file not shown.
BIN
lib/lwjgl-stb-natives-windows.jar
Normal file
BIN
lib/lwjgl-stb-natives-windows.jar
Normal file
Binary file not shown.
BIN
lib/lwjgl-tinyfd-natives-macos-arm64.jar
Normal file
BIN
lib/lwjgl-tinyfd-natives-macos-arm64.jar
Normal file
Binary file not shown.
BIN
lib/lwjgl-tinyfd-natives-macos.jar
Normal file
BIN
lib/lwjgl-tinyfd-natives-macos.jar
Normal file
Binary file not shown.
BIN
lib/lwjgl-tinyfd-natives-windows-x86.jar
Normal file
BIN
lib/lwjgl-tinyfd-natives-windows-x86.jar
Normal file
Binary file not shown.
BIN
lib/lwjgl-tinyfd-natives-windows.jar
Normal file
BIN
lib/lwjgl-tinyfd-natives-windows.jar
Normal file
Binary file not shown.
BIN
lib/okhttp-3.12.12.jar
Normal file
BIN
lib/okhttp-3.12.12.jar
Normal file
Binary file not shown.
BIN
lib/okio-1.15.0.jar
Normal file
BIN
lib/okio-1.15.0.jar
Normal file
Binary file not shown.
BIN
lib/procbridge-1.1.1.jar
Normal file
BIN
lib/procbridge-1.1.1.jar
Normal file
Binary file not shown.
BIN
lib/slick.jar
Normal file
BIN
lib/slick.jar
Normal file
Binary file not shown.
BIN
lib/socket.io-client-1.0.2.jar
Normal file
BIN
lib/socket.io-client-1.0.2.jar
Normal file
Binary file not shown.
BIN
lib/vecmath-1.2-1.14.jar
Normal file
BIN
lib/vecmath-1.2-1.14.jar
Normal file
Binary file not shown.
@ -0,0 +1,35 @@
|
|||||||
|
package me.djtheredstoner.lwjgl;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GLContext;
|
||||||
|
import org.lwjgl.system.FunctionProvider;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
|
public class Lwjgl2FunctionProvider implements FunctionProvider {
|
||||||
|
|
||||||
|
private final Method m_getFunctionAddress;
|
||||||
|
|
||||||
|
public Lwjgl2FunctionProvider() {
|
||||||
|
try {
|
||||||
|
m_getFunctionAddress = GLContext.class.getDeclaredMethod("getFunctionAddress", String.class);
|
||||||
|
m_getFunctionAddress.setAccessible(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getFunctionAddress(CharSequence functionName) {
|
||||||
|
try {
|
||||||
|
return (long) m_getFunctionAddress.invoke(null, functionName.toString());
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getFunctionAddress(ByteBuffer byteBuffer) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
}
|
715
src/main/java/net/silentclient/client/Client.java
Normal file
715
src/main/java/net/silentclient/client/Client.java
Normal file
@ -0,0 +1,715 @@
|
|||||||
|
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.minecraft.util.Session;
|
||||||
|
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.SilentClientTweaker;
|
||||||
|
import net.silentclient.client.mixin.accessors.MinecraftAccessor;
|
||||||
|
import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt;
|
||||||
|
import net.silentclient.client.mixin.ducks.MinecraftExt;
|
||||||
|
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.nanovg.UI;
|
||||||
|
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.1.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());
|
||||||
|
if(ClientUtils.isDevelopment()) {
|
||||||
|
Session session = new Session(account.original_username, AccountManager.nameToUuid(account.original_username), "0", "legacy");
|
||||||
|
((MinecraftExt) Minecraft.getMinecraft()).setSession(session);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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 > ui");
|
||||||
|
UI.init();
|
||||||
|
logger.info("STARTING > servers");
|
||||||
|
ArrayList<FeaturedServers.FeaturedServerInfo> servers = FeaturedServers.get();
|
||||||
|
featuredServers.clear();
|
||||||
|
if(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().getCosmetics().setMyEmotes(cosmetics.getAccount().getCosmetics().getEmotes());
|
||||||
|
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("TEST2");
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
19
src/main/java/net/silentclient/client/ServerDataFeature.java
Normal file
19
src/main/java/net/silentclient/client/ServerDataFeature.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetData() {
|
||||||
|
this.field_78841_f = false;
|
||||||
|
this.pingToServer = 0;
|
||||||
|
this.populationInfo = null;
|
||||||
|
this.playerList = null;
|
||||||
|
this.serverMOTD = null;
|
||||||
|
}
|
||||||
|
}
|
455
src/main/java/net/silentclient/client/admin/AdminRender.java
Normal file
455
src/main/java/net/silentclient/client/admin/AdminRender.java
Normal 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) throws IOException {
|
||||||
|
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 =)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
278
src/main/java/net/silentclient/client/blc/BlcGlStateManager.java
Normal file
278
src/main/java/net/silentclient/client/blc/BlcGlStateManager.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
120
src/main/java/net/silentclient/client/config/AddConfigModal.java
Normal file
120
src/main/java/net/silentclient/client/config/AddConfigModal.java
Normal 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) throws IOException {
|
||||||
|
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) throws IOException {
|
||||||
|
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) throws IOException {
|
||||||
|
if (keyCode == Keyboard.KEY_ESCAPE) {
|
||||||
|
mc.displayGuiScreen(parentScreen);
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.silentInputs.get(0).onKeyTyped(typedChar, keyCode);
|
||||||
|
}
|
||||||
|
}
|
324
src/main/java/net/silentclient/client/config/ConfigManager.java
Normal file
324
src/main/java/net/silentclient/client/config/ConfigManager.java
Normal file
@ -0,0 +1,324 @@
|
|||||||
|
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.Arrays;
|
||||||
|
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.isCellGrid()) {
|
||||||
|
try {
|
||||||
|
set.setCells(stringToBooleanArray(args[3]));
|
||||||
|
} catch (Exception ignored) {}
|
||||||
|
}
|
||||||
|
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 static String booleanArrayToString(boolean[][] cells) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (boolean[] row : cells) {
|
||||||
|
for (boolean cell : row) {
|
||||||
|
sb.append(cell ? '1' : '0');
|
||||||
|
}
|
||||||
|
sb.append('/');
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean[][] stringToBooleanArray(String input) {
|
||||||
|
String[] rows = input.trim().split("/");
|
||||||
|
int numRows = rows.length;
|
||||||
|
int numCols = rows[0].length();
|
||||||
|
boolean[][] result = new boolean[numRows][numCols];
|
||||||
|
|
||||||
|
for (int i = 0; i < numRows; i++) {
|
||||||
|
for (int j = 0; j < numCols; j++) {
|
||||||
|
result[i][j] = rows[i].charAt(j) == '1';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
if(set.isCellGrid()) {
|
||||||
|
writer.println("SET:" + set.getName() + ":" + set.getParentMod().getName() + ":" + booleanArrayToString(set.getCells()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(AutoTextCommand command : Client.getInstance().getModInstances().getAutoText().getCommands()) {
|
||||||
|
writer.println("ATC:"+command.getCommand()+":"+command.getKey());
|
||||||
|
}
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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.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;
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
336
src/main/java/net/silentclient/client/cosmetics/Cosmetics.java
Normal file
336
src/main/java/net/silentclient/client/cosmetics/Cosmetics.java
Normal file
@ -0,0 +1,336 @@
|
|||||||
|
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 Map<Number, CosmeticItem> emotes = 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 ArrayList<CosmeticItem> myEmotes = 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 > emotes");
|
||||||
|
emotes.clear();
|
||||||
|
if(allCosmetics != null && allCosmetics.getEmotes() != null) {
|
||||||
|
allCosmetics.getEmotes().forEach((emote) -> {
|
||||||
|
emotes.put(emote.getId(), emote);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
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().getCosmetics().setMyEmotes(cosmetics.getAccount().getCosmetics().getEmotes());
|
||||||
|
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().getCosmetics().setMyEmotes(cosmetics.getAccount().getCosmetics().getEmotes());
|
||||||
|
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 ArrayList<CosmeticItem> getMyEmotes() {
|
||||||
|
return myEmotes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMyEmotes(ArrayList<CosmeticItem> myEmotes) {
|
||||||
|
this.myEmotes = myEmotes;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
19
src/main/java/net/silentclient/client/cosmetics/HatData.java
Normal file
19
src/main/java/net/silentclient/client/cosmetics/HatData.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
270
src/main/java/net/silentclient/client/cosmetics/HatRenderer.java
Normal file
270
src/main/java/net/silentclient/client/cosmetics/HatRenderer.java
Normal 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.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;
|
||||||
|
}
|
||||||
|
}
|
116
src/main/java/net/silentclient/client/cosmetics/Outfits.java
Normal file
116
src/main/java/net/silentclient/client/cosmetics/Outfits.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
119
src/main/java/net/silentclient/client/cosmetics/StaticCape.java
Normal file
119
src/main/java/net/silentclient/client/cosmetics/StaticCape.java
Normal 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());
|
||||||
|
}
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
@ -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) throws IOException {
|
||||||
|
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(200);
|
||||||
|
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) throws IOException {
|
||||||
|
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) throws IOException {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
@ -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) throws IOException {
|
||||||
|
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) throws IOException {
|
||||||
|
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) throws IOException {
|
||||||
|
if (keyCode == Keyboard.KEY_ESCAPE) {
|
||||||
|
mc.displayGuiScreen(parentScreen);
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.silentInputs.get(0).onKeyTyped(typedChar, keyCode);
|
||||||
|
}
|
||||||
|
}
|
@ -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(200);
|
||||||
|
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) throws IOException {
|
||||||
|
super.actionPerformed(button);
|
||||||
|
if(button.id == 0) {
|
||||||
|
mc.displayGuiScreen(parentScreen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
|
||||||
|
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) throws IOException {
|
||||||
|
if (keyCode == Keyboard.KEY_ESCAPE) {
|
||||||
|
mc.displayGuiScreen(parentScreen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGuiClosed() {
|
||||||
|
super.onGuiClosed();
|
||||||
|
MenuBlurUtils.unloadBlur();
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
package net.silentclient.client.cosmetics.model;
|
||||||
|
|
||||||
|
public class Material {
|
||||||
|
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,545 @@
|
|||||||
|
package net.silentclient.client.emotes;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EnumPlayerModelParts;
|
||||||
|
import net.minecraft.item.*;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.silentclient.client.Client;
|
||||||
|
import net.silentclient.client.emotes.animation.Animation;
|
||||||
|
import net.silentclient.client.emotes.animation.AnimationMesh;
|
||||||
|
import net.silentclient.client.emotes.animation.AnimationMeshConfig;
|
||||||
|
import net.silentclient.client.emotes.animation.model.ActionPlayback;
|
||||||
|
import net.silentclient.client.emotes.animation.model.AnimatorConfig;
|
||||||
|
import net.silentclient.client.emotes.animation.model.AnimatorHeldItemConfig;
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJAction;
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJBone;
|
||||||
|
import net.silentclient.client.emotes.emoticons.Emote;
|
||||||
|
import net.silentclient.client.emotes.socket.EmoteSocket;
|
||||||
|
import net.silentclient.client.hooks.NameTagRenderingHooks;
|
||||||
|
import org.joml.Matrix4f;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
import org.lwjgl.BufferUtils;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import java.nio.Buffer;
|
||||||
|
import java.nio.FloatBuffer;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class AnimatorController {
|
||||||
|
public static final FloatBuffer matrix = BufferUtils.createFloatBuffer(16);
|
||||||
|
public static final float[] buffer = new float[16];
|
||||||
|
private static final Map<String, ResourceLocation> ARMOR_TEXTURE_RES_MAP = Maps.newHashMap();
|
||||||
|
private static final ResourceLocation ENCHANTED_ITEM_GLINT_RES = new ResourceLocation("textures/misc/enchanted_item_glint.png");
|
||||||
|
public Animation animation;
|
||||||
|
public ActionPlayback emote;
|
||||||
|
public Emote entry;
|
||||||
|
public List<Runnable> runnables = new ArrayList<>();
|
||||||
|
public AnimatorConfig userConfig;
|
||||||
|
public boolean resetThirdView = false;
|
||||||
|
public ItemStack itemSlot = null;
|
||||||
|
public float itemSlotScale = 0.0F;
|
||||||
|
public boolean right = true;
|
||||||
|
public RenderPlayer renderPlayer;
|
||||||
|
private final Minecraft mc;
|
||||||
|
private double prevX;
|
||||||
|
private double prevY;
|
||||||
|
private double prevZ;
|
||||||
|
private int counter = 0;
|
||||||
|
private boolean slimCheck;
|
||||||
|
private final Vector4f result = new Vector4f();
|
||||||
|
private final Matrix4f rotate = new Matrix4f();
|
||||||
|
private final EmoteAccessor accessor;
|
||||||
|
|
||||||
|
public AnimatorController(Animation animationx, AnimatorConfig animatorconfig) {
|
||||||
|
this.animation = animationx;
|
||||||
|
this.userConfig = new AnimatorConfig();
|
||||||
|
this.userConfig.copy(animatorconfig);
|
||||||
|
this.mc = Minecraft.getMinecraft();
|
||||||
|
this.accessor = new EmoteAccessor(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector4f calcPosition(EntityLivingBase entitylivingbase, BOBJBone bobjbone, float f, float f1, float f2, float f3) {
|
||||||
|
float f4 = (float) Math.PI;
|
||||||
|
this.result.set(f, f1, f2, 1.0F);
|
||||||
|
bobjbone.mat.transform(this.result);
|
||||||
|
this.rotate.identity();
|
||||||
|
this.rotate.rotateY((180.0F - entitylivingbase.renderYawOffset + 180.0F) / 180.0F * (float) Math.PI);
|
||||||
|
this.rotate.transform(this.result);
|
||||||
|
this.result.mul(this.userConfig.scale);
|
||||||
|
float f5 = (float) (entitylivingbase.lastTickPosX + (entitylivingbase.posX - entitylivingbase.lastTickPosX) * (double) f3);
|
||||||
|
float f6 = (float) (entitylivingbase.lastTickPosY + (entitylivingbase.posY - entitylivingbase.lastTickPosY) * (double) f3);
|
||||||
|
float f7 = (float) (entitylivingbase.lastTickPosZ + (entitylivingbase.posZ - entitylivingbase.lastTickPosZ) * (double) f3);
|
||||||
|
this.result.x += f5;
|
||||||
|
this.result.y += f6;
|
||||||
|
this.result.z += f7;
|
||||||
|
return this.result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean renderHook(RenderPlayer render, AbstractClientPlayer abstractclientplayer, double d0, double d1, double d2, float f1, boolean flag) {
|
||||||
|
this.renderPlayer = render;
|
||||||
|
if (this.isEmoting()) {
|
||||||
|
AnimationMeshConfig body = this.userConfig.meshes.get("body");
|
||||||
|
if (body != null) {
|
||||||
|
ResourceLocation rs = abstractclientplayer.getLocationSkin();
|
||||||
|
AnimationMeshConfig headWear = this.userConfig.meshes.get("headwear");
|
||||||
|
AnimationMeshConfig bodyWear = this.userConfig.meshes.get("bodywear");
|
||||||
|
AnimationMeshConfig leftArmWear = this.userConfig.meshes.get("left_armwear");
|
||||||
|
AnimationMeshConfig leftLegWear = this.userConfig.meshes.get("left_legwear");
|
||||||
|
AnimationMeshConfig rightArmWear = this.userConfig.meshes.get("right_armwear");
|
||||||
|
AnimationMeshConfig rightLegWear = this.userConfig.meshes.get("right_legwear");
|
||||||
|
if (body.texture == null
|
||||||
|
|| !rs.getResourceDomain().equals(body.texture.getResourceDomain())
|
||||||
|
|| !rs.getResourcePath().equals(body.texture.getResourcePath())) {
|
||||||
|
body.texture = rs;
|
||||||
|
headWear.texture = body.texture;
|
||||||
|
bodyWear.texture = body.texture;
|
||||||
|
leftArmWear.texture = body.texture;
|
||||||
|
leftLegWear.texture = body.texture;
|
||||||
|
rightArmWear.texture = body.texture;
|
||||||
|
rightLegWear.texture = body.texture;
|
||||||
|
}
|
||||||
|
|
||||||
|
headWear.visible = abstractclientplayer.isWearing(EnumPlayerModelParts.HAT);
|
||||||
|
bodyWear.visible = abstractclientplayer.isWearing(EnumPlayerModelParts.JACKET);
|
||||||
|
leftArmWear.visible = abstractclientplayer.isWearing(EnumPlayerModelParts.LEFT_SLEEVE);
|
||||||
|
leftLegWear.visible = abstractclientplayer.isWearing(EnumPlayerModelParts.LEFT_PANTS_LEG);
|
||||||
|
rightArmWear.visible = abstractclientplayer.isWearing(EnumPlayerModelParts.RIGHT_SLEEVE);
|
||||||
|
rightLegWear.visible = abstractclientplayer.isWearing(EnumPlayerModelParts.RIGHT_PANTS_LEG);
|
||||||
|
if (!abstractclientplayer.isInvisible()) {
|
||||||
|
rightLegWear.alpha = 1.0F;
|
||||||
|
body.visible = true;
|
||||||
|
} else if (!abstractclientplayer.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer)) {
|
||||||
|
rightLegWear.alpha = 0.15F;
|
||||||
|
body.visible = true;
|
||||||
|
} else {
|
||||||
|
rightLegWear.visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.slimCheck && !abstractclientplayer.getSkinType().equals("default")) {
|
||||||
|
this.animation = PlayerModelManager.get().alex;
|
||||||
|
this.userConfig.copy(PlayerModelManager.get().alexConfig);
|
||||||
|
if (this.entry != null) {
|
||||||
|
this.entry.startAnimation(this.accessor);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.slimCheck = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOBJArmature bobjarmature = this.animation.data.armatures.get("Armature");
|
||||||
|
this.render(abstractclientplayer, bobjarmature, d0, d1, d2, f1);
|
||||||
|
if (flag) {
|
||||||
|
this.renderNameTag(abstractclientplayer, d0, d1, d2, bobjarmature);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.isEmoting();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderNameTag(AbstractClientPlayer abstractclientplayer, double d0, double d1, double d2, BOBJArmature var8) {
|
||||||
|
double d4 = 64.0;
|
||||||
|
String s = abstractclientplayer.getDisplayName().getFormattedText();
|
||||||
|
NameTagRenderingHooks.renderNametag(abstractclientplayer, s, d0, d1, d2, (int) d4, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void render(AbstractClientPlayer player, BOBJArmature armature, double d0, double d1, double d2, float f) {
|
||||||
|
if (this.animation != null && this.animation.meshes.size() > 0) {
|
||||||
|
float f1 = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * f;
|
||||||
|
float f2 = this.userConfig.scale;
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glTranslated(d0, d1, d2);
|
||||||
|
GL11.glScalef(f2, f2, f2);
|
||||||
|
GL11.glRotatef(180.0F - f1 - 180.0F, 0.0F, 1.0F, 0.0F);
|
||||||
|
this.renderAnimation(player, armature, f1, f);
|
||||||
|
if (this.entry != null && !Minecraft.getMinecraft().isGamePaused()) {
|
||||||
|
int i = (int) this.emote.getTick(0.0F);
|
||||||
|
this.entry.progressAnimation(this.accessor, armature, i, f);
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderAnimation(AbstractClientPlayer abstractclientplayer, BOBJArmature bobjarmature, float f, float f1) {
|
||||||
|
for (BOBJArmature bobjarmature1 : this.animation.data.armatures.values()) {
|
||||||
|
if (bobjarmature1.enabled) {
|
||||||
|
BOBJBone bobjbone1 = bobjarmature1.bones.get(this.userConfig.head);
|
||||||
|
if (bobjbone1 != null) {
|
||||||
|
float f3 = abstractclientplayer.prevRotationYawHead + (abstractclientplayer.rotationYawHead - abstractclientplayer.prevRotationYawHead) * f1;
|
||||||
|
float f2 = abstractclientplayer.prevRotationPitch + (abstractclientplayer.rotationPitch - abstractclientplayer.prevRotationPitch) * f1;
|
||||||
|
f3 = (f - f3) / 180.0F * (float) Math.PI;
|
||||||
|
f2 = f2 / 180.0F * (float) Math.PI;
|
||||||
|
bobjbone1.rotateX = f2;
|
||||||
|
bobjbone1.rotateY = f3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.emote != null) {
|
||||||
|
this.emote.apply(bobjarmature1, f1);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (BOBJBone bone : bobjarmature1.orderedBones) {
|
||||||
|
bobjarmature1.matrices[bone.index] = bone.compute();
|
||||||
|
bone.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (AnimationMesh animationmesh : this.animation.meshes) {
|
||||||
|
if (animationmesh.armature.enabled) {
|
||||||
|
animationmesh.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glEnable(32826);
|
||||||
|
this.renderMeshes(abstractclientplayer, f1);
|
||||||
|
GL11.glDisable(32826);
|
||||||
|
this.renderItems(abstractclientplayer, bobjarmature);
|
||||||
|
this.renderHead(abstractclientplayer, bobjarmature.bones.get(this.userConfig.head));
|
||||||
|
this.renderCosmetic(this.renderPlayer, abstractclientplayer, bobjarmature);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderCosmetic(RenderPlayer renderPlayer, Entity entityIn, BOBJArmature bobjarmature) {
|
||||||
|
if (entityIn instanceof EntityPlayer) {
|
||||||
|
EntityPlayer var4 = (EntityPlayer) entityIn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderMeshes(EntityLivingBase entitylivingbase, float f) {
|
||||||
|
AnimationMeshConfig animationmeshconfig = this.userConfig.meshes.get("armor_helmet");
|
||||||
|
AnimationMeshConfig animationmeshconfig1 = this.userConfig.meshes.get("armor_chest");
|
||||||
|
AnimationMeshConfig animationmeshconfig2 = this.userConfig.meshes.get("armor_leggings");
|
||||||
|
AnimationMeshConfig animationmeshconfig3 = this.userConfig.meshes.get("armor_feet");
|
||||||
|
if (animationmeshconfig != null) {
|
||||||
|
this.updateArmorSlot(animationmeshconfig, entitylivingbase, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (animationmeshconfig1 != null) {
|
||||||
|
this.updateArmorSlot(animationmeshconfig1, entitylivingbase, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (animationmeshconfig2 != null) {
|
||||||
|
this.updateArmorSlot(animationmeshconfig2, entitylivingbase, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (animationmeshconfig3 != null) {
|
||||||
|
this.updateArmorSlot(animationmeshconfig3, entitylivingbase, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (AnimationMesh animationmesh : this.animation.meshes) {
|
||||||
|
if (animationmesh.armature.enabled) {
|
||||||
|
animationmesh.render(this.userConfig.meshes.get(animationmesh.name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (AnimationMesh animationmesh1 : this.animation.meshes) {
|
||||||
|
if (animationmesh1.name.startsWith("armor_")) {
|
||||||
|
ItemStack itemstack = null;
|
||||||
|
String var10 = animationmesh1.name;
|
||||||
|
switch (var10) {
|
||||||
|
case "armor_helmet":
|
||||||
|
itemstack = entitylivingbase.getEquipmentInSlot(4);
|
||||||
|
break;
|
||||||
|
case "armor_chest":
|
||||||
|
itemstack = entitylivingbase.getEquipmentInSlot(3);
|
||||||
|
break;
|
||||||
|
case "armor_leggings":
|
||||||
|
itemstack = entitylivingbase.getEquipmentInSlot(2);
|
||||||
|
break;
|
||||||
|
case "armor_feet":
|
||||||
|
itemstack = entitylivingbase.getEquipmentInSlot(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemstack != null && itemstack.getItem() instanceof ItemArmor && itemstack.isItemEnchanted()) {
|
||||||
|
this.renderMeshGlint(animationmesh1, (float) entitylivingbase.ticksExisted + f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderMeshGlint(AnimationMesh animationmesh, float f) {
|
||||||
|
this.mc.getTextureManager().bindTexture(ENCHANTED_ITEM_GLINT_RES);
|
||||||
|
GlStateManager.enableBlend();
|
||||||
|
GlStateManager.depthFunc(514);
|
||||||
|
GlStateManager.depthMask(false);
|
||||||
|
|
||||||
|
for (int i = 0; i < 2; ++i) {
|
||||||
|
float f1 = 0.5F;
|
||||||
|
GlStateManager.color(f1, f1, f1, 1.0F);
|
||||||
|
GlStateManager.disableLighting();
|
||||||
|
GlStateManager.blendFunc(768, 1);
|
||||||
|
float f2 = 0.76F;
|
||||||
|
GlStateManager.color(0.5F * f2, 0.25F * f2, 0.8F * f2, 1.0F);
|
||||||
|
GlStateManager.matrixMode(5890);
|
||||||
|
GlStateManager.loadIdentity();
|
||||||
|
float f3 = 0.33333334F;
|
||||||
|
GlStateManager.scale(f3, f3, f3);
|
||||||
|
GlStateManager.rotate(30.0F - (float) i * 60.0F, 0.0F, 0.0F, 1.0F);
|
||||||
|
GlStateManager.translate(0.0F, f * (0.001F + (float) i * 0.003F) * 20.0F, 0.0F);
|
||||||
|
GlStateManager.matrixMode(5888);
|
||||||
|
animationmesh.render(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
GlStateManager.matrixMode(5890);
|
||||||
|
GlStateManager.loadIdentity();
|
||||||
|
GlStateManager.matrixMode(5888);
|
||||||
|
GlStateManager.enableLighting();
|
||||||
|
GlStateManager.depthMask(true);
|
||||||
|
GlStateManager.depthFunc(515);
|
||||||
|
GlStateManager.disableBlend();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateArmorSlot(AnimationMeshConfig animationmeshconfig, EntityLivingBase entitylivingbase, int i) {
|
||||||
|
ItemStack itemstack = entitylivingbase.getEquipmentInSlot(i);
|
||||||
|
if (itemstack != null && itemstack.getItem() instanceof ItemArmor) {
|
||||||
|
ItemArmor itemarmor = (ItemArmor) itemstack.getItem();
|
||||||
|
animationmeshconfig.visible = true;
|
||||||
|
animationmeshconfig.texture = this.getArmorResource(itemarmor, this.isLegSlot(i), null);
|
||||||
|
animationmeshconfig.color = itemarmor.getColor(itemstack);
|
||||||
|
} else {
|
||||||
|
animationmeshconfig.visible = false;
|
||||||
|
animationmeshconfig.color = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isLegSlot(int i) {
|
||||||
|
return i == 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ResourceLocation getArmorResource(ItemArmor itemarmor, boolean flag, String s) {
|
||||||
|
String s1 = String.format(
|
||||||
|
"textures/models/armor/%s_layer_%d%s.png", itemarmor.getArmorMaterial().getName(), flag ? 2 : 1, s == null ? "" : String.format("_%s", s)
|
||||||
|
);
|
||||||
|
ResourceLocation aj = ARMOR_TEXTURE_RES_MAP.get(s1);
|
||||||
|
if (aj == null) {
|
||||||
|
aj = new ResourceLocation(s1);
|
||||||
|
ARMOR_TEXTURE_RES_MAP.put(s1, aj);
|
||||||
|
}
|
||||||
|
|
||||||
|
return aj;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderHead(EntityLivingBase entitylivingbase, BOBJBone bobjbone) {
|
||||||
|
ItemStack itemstack = entitylivingbase.getEquipmentInSlot(4);
|
||||||
|
if (itemstack != null && bobjbone != null) {
|
||||||
|
Item item = itemstack.getItem();
|
||||||
|
if (!(item instanceof ItemArmor) || ((ItemArmor) item).armorType != 4) {
|
||||||
|
GlStateManager.pushMatrix();
|
||||||
|
this.setupMatrix(bobjbone);
|
||||||
|
GlStateManager.translate(0.0F, 0.25F, 0.0F);
|
||||||
|
if (!(item instanceof ItemSkull)) {
|
||||||
|
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
|
||||||
|
} else {
|
||||||
|
GlStateManager.translate(0.0F, 0.05F, 0.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
GlStateManager.scale(0.625F, 0.625F, 0.625F);
|
||||||
|
this.mc.getItemRenderer().renderItem(entitylivingbase, itemstack, ItemCameraTransforms.TransformType.HEAD);
|
||||||
|
GlStateManager.popMatrix();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderItems(EntityLivingBase entitylivingbase, BOBJArmature bobjarmature) {
|
||||||
|
if (this.userConfig.renderHeldItems) {
|
||||||
|
float f = this.userConfig.scaleItems;
|
||||||
|
ItemStack itemstack = entitylivingbase.getHeldItem();
|
||||||
|
if (this.itemSlot != null) {
|
||||||
|
if (this.itemSlotScale > 0.0F) {
|
||||||
|
for (AnimatorHeldItemConfig animatorhelditemconfig : this.right ? this.userConfig.rightHands.values() : this.userConfig.leftHands.values()) {
|
||||||
|
this.renderItem(
|
||||||
|
entitylivingbase,
|
||||||
|
this.itemSlot,
|
||||||
|
bobjarmature,
|
||||||
|
animatorhelditemconfig,
|
||||||
|
animatorhelditemconfig.boneName,
|
||||||
|
ItemCameraTransforms.TransformType.THIRD_PERSON,
|
||||||
|
f * this.itemSlotScale,
|
||||||
|
this.right
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (itemstack != null && this.userConfig.rightHands != null) {
|
||||||
|
for (AnimatorHeldItemConfig animatorhelditemconfig1 : this.userConfig.rightHands.values()) {
|
||||||
|
this.renderItem(
|
||||||
|
entitylivingbase,
|
||||||
|
itemstack,
|
||||||
|
bobjarmature,
|
||||||
|
animatorhelditemconfig1,
|
||||||
|
animatorhelditemconfig1.boneName,
|
||||||
|
ItemCameraTransforms.TransformType.THIRD_PERSON,
|
||||||
|
f,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderItem(
|
||||||
|
EntityLivingBase entitylivingbase,
|
||||||
|
ItemStack itemstack,
|
||||||
|
BOBJArmature bobjarmature,
|
||||||
|
AnimatorHeldItemConfig animatorhelditemconfig,
|
||||||
|
String s,
|
||||||
|
ItemCameraTransforms.TransformType itemcameratransforms$transformtype,
|
||||||
|
float f,
|
||||||
|
boolean flag
|
||||||
|
) {
|
||||||
|
Item item = itemstack.getItem();
|
||||||
|
BOBJBone bobjbone = bobjarmature.bones.get(s);
|
||||||
|
if (bobjbone != null) {
|
||||||
|
GlStateManager.pushMatrix();
|
||||||
|
this.setupMatrix(bobjbone);
|
||||||
|
if (!flag) {
|
||||||
|
GlStateManager.translate(0.0625F * (2.0F - 3.0F * (1.0F - this.itemSlotScale)), -0.125F, 0.1875F);
|
||||||
|
GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
|
||||||
|
GlStateManager.rotate(-45.0F, 0.0F, 1.0F, 0.0F);
|
||||||
|
} else {
|
||||||
|
GlStateManager.translate(0.0F, -0.0625F, 0.0625F);
|
||||||
|
}
|
||||||
|
|
||||||
|
GlStateManager.scale(f * animatorhelditemconfig.scaleX, f * animatorhelditemconfig.scaleY, f * animatorhelditemconfig.scaleZ);
|
||||||
|
if (item instanceof ItemBlock && Block.getBlockFromItem(item).getRenderType() == 2) {
|
||||||
|
GlStateManager.translate(0.0F, 0.1875F, -0.3125F);
|
||||||
|
GlStateManager.rotate(20.0F, 1.0F, 0.0F, 0.0F);
|
||||||
|
GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F);
|
||||||
|
GlStateManager.scale(-0.375F, -0.375F, 0.375F);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.mc.getItemRenderer().renderItem(entitylivingbase, itemstack, itemcameratransforms$transformtype);
|
||||||
|
GlStateManager.popMatrix();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(EntityLivingBase entitylivingbase) {
|
||||||
|
for (Runnable runnable : this.runnables) {
|
||||||
|
runnable.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.runnables.clear();
|
||||||
|
if (this.emote != null && this.counter <= 0) {
|
||||||
|
this.emote.update();
|
||||||
|
double d2 = entitylivingbase.posX - this.prevX;
|
||||||
|
double d0 = entitylivingbase.posY - this.prevY;
|
||||||
|
double d1 = entitylivingbase.posZ - this.prevZ;
|
||||||
|
boolean flag = d2 * d2 + d0 * d0 + d1 * d1 > 0.0025000000000000005;
|
||||||
|
boolean flag1 = entitylivingbase.isSwingInProgress && entitylivingbase.swingProgress == 0.0F && !entitylivingbase.isPlayerSleeping();
|
||||||
|
boolean flag2 = entitylivingbase.isSneaking() || flag || flag1;
|
||||||
|
if (this.emote.isFinished() || flag2) {
|
||||||
|
this.accessor.entity = entitylivingbase;
|
||||||
|
boolean repeat = true;
|
||||||
|
if(Client.getInstance().getAccount().getUsername().equalsIgnoreCase(entitylivingbase.getName())) {
|
||||||
|
if ((flag && !Client.getInstance().getSettingsManager().getSettingByClass(EmotesMod.class, "Enable Running in Emotes").getValBoolean()) || (flag1 || entitylivingbase.isSneaking())) {
|
||||||
|
this.resetEmote(0);
|
||||||
|
EmoteSocket.get().endEmote();
|
||||||
|
repeat = false;
|
||||||
|
}
|
||||||
|
if (!flag2) {
|
||||||
|
if(!Client.getInstance().getSettingsManager().getSettingByClass(EmotesMod.class, "Infinite Emotes").getValBoolean()) {
|
||||||
|
this.resetEmote();
|
||||||
|
EmoteSocket.get().endEmote();
|
||||||
|
repeat = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(repeat && this.emote.isFinished()) {
|
||||||
|
this.setEmote(entitylivingbase, this.entry, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if((flag1 || entitylivingbase.isSneaking()) && repeat) {
|
||||||
|
this.resetEmote(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.counter >= 0) {
|
||||||
|
if (this.resetThirdView && this.emote == null && this.counter == 0) {
|
||||||
|
this.resetThirdView = false;
|
||||||
|
Minecraft.getMinecraft().gameSettings.thirdPersonView = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
--this.counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.prevX = entitylivingbase.posX;
|
||||||
|
this.prevY = entitylivingbase.posY;
|
||||||
|
this.prevZ = entitylivingbase.posZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setupMatrix(BOBJBone bobjbone) {
|
||||||
|
Matrix4f matrix4f = bobjbone.mat;
|
||||||
|
((Buffer) matrix).clear();
|
||||||
|
matrix.put(matrix4f.get(buffer));
|
||||||
|
((Buffer) matrix).flip();
|
||||||
|
GL11.glMultMatrix(matrix);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetEmote() {
|
||||||
|
this.resetEmote(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetEmote(int i) {
|
||||||
|
if (this.entry != null) {
|
||||||
|
this.entry.stopAnimation(this.accessor);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.entry = null;
|
||||||
|
this.emote = null;
|
||||||
|
this.counter = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmote(EntityLivingBase entitylivingbase, String s) {
|
||||||
|
this.setEmote(entitylivingbase, PlayerModelManager.get().getEmote(s), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmote(EntityLivingBase entitylivingbase, Emote emotex) {
|
||||||
|
this.setEmote(entitylivingbase, emotex, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmote(EntityLivingBase entitylivingbase, Emote emotex, boolean ignorePerspective) {
|
||||||
|
if (emotex != null) {
|
||||||
|
BOBJAction bobjaction = this.animation.data.actions.get(emotex.getActionName());
|
||||||
|
if (bobjaction != null && emotex != null) {
|
||||||
|
ActionPlayback actionplayback = new ActionPlayback(bobjaction);
|
||||||
|
actionplayback.repeat = emotex.looping;
|
||||||
|
if (emotex.looping > 1) {
|
||||||
|
actionplayback.looping = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.isEmoting()) {
|
||||||
|
this.counter = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.accessor.entity = entitylivingbase;
|
||||||
|
if (this.entry != null) {
|
||||||
|
this.entry.stopAnimation(this.accessor);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.emote = actionplayback;
|
||||||
|
this.entry = emotex;
|
||||||
|
this.entry.startAnimation(this.accessor);
|
||||||
|
if (!ignorePerspective && this.mc.gameSettings.thirdPersonView != EmotesMod.getEmotePerspective() && entitylivingbase == this.mc.thePlayer) {
|
||||||
|
this.mc.gameSettings.thirdPersonView = EmotesMod.getEmotePerspective();
|
||||||
|
this.resetThirdView = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isEmoting() {
|
||||||
|
return this.emote != null && this.counter <= 0;
|
||||||
|
}
|
||||||
|
}
|
142
src/main/java/net/silentclient/client/emotes/EmoteAccessor.java
Normal file
142
src/main/java/net/silentclient/client/emotes/EmoteAccessor.java
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
package net.silentclient.client.emotes;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.BlockRendererDispatcher;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.projectile.EntitySnowball;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
|
import net.silentclient.client.emotes.animation.AnimationMeshConfig;
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJBone;
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJLoader;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.ParticleType;
|
||||||
|
import net.silentclient.client.emotes.particles.ParticleEndRod;
|
||||||
|
import net.silentclient.client.emotes.particles.PopcornParticle;
|
||||||
|
import net.silentclient.client.emotes.particles.SaltParticle;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
public class EmoteAccessor implements IEmoteAccessor {
|
||||||
|
public EntityLivingBase entity;
|
||||||
|
public AnimatorController controller;
|
||||||
|
|
||||||
|
public EmoteAccessor(AnimatorController animatorcontroller) {
|
||||||
|
this.controller = animatorcontroller;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Vector4f calcPosition(BOBJBone bobjbone, float f, float f1, float f2, float f3) {
|
||||||
|
return this.controller.calcPosition(this.entity, bobjbone, f, f1, f2, f3);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AnimationMeshConfig getConfig(String s) {
|
||||||
|
return this.controller.userConfig.meshes.get(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BOBJLoader.BOBJData getData() {
|
||||||
|
return this.controller.animation.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setupMatrix(BOBJBone bobjbone) {
|
||||||
|
this.controller.setupMatrix(bobjbone);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setItem(ItemStack m) {
|
||||||
|
this.controller.itemSlot = m;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setItemScale(float f) {
|
||||||
|
this.controller.itemSlotScale = f;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setHand(boolean flag) {
|
||||||
|
this.controller.right = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void spawnParticle(ParticleType particletype, double d0, double d1, double d2, double d3, double d4, double d5) {
|
||||||
|
if (particletype == ParticleType.POPCORN) {
|
||||||
|
Minecraft.getMinecraft().effectRenderer.addEffect(new PopcornParticle(this.entity.worldObj, d0, d1, d2, d4));
|
||||||
|
} else if (particletype == ParticleType.SALT) {
|
||||||
|
Minecraft.getMinecraft().effectRenderer.addEffect(new SaltParticle(this.entity.worldObj, d0, d1, d2, d3, d4, d5));
|
||||||
|
} else if (particletype == ParticleType.END_ROD) {
|
||||||
|
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleEndRod(this.entity.worldObj, d0, d1, d2, d3, d4, d5));
|
||||||
|
} else {
|
||||||
|
EnumParticleTypes enumparticletypes = null;
|
||||||
|
if (particletype == ParticleType.WATER_DROP) {
|
||||||
|
enumparticletypes = EnumParticleTypes.WATER_DROP;
|
||||||
|
} else if (particletype == ParticleType.SPELL_MOB) {
|
||||||
|
enumparticletypes = EnumParticleTypes.SPELL_MOB;
|
||||||
|
} else if (particletype == ParticleType.EXPLODE) {
|
||||||
|
enumparticletypes = EnumParticleTypes.EXPLOSION_NORMAL;
|
||||||
|
} else if (particletype == ParticleType.SMOKE) {
|
||||||
|
enumparticletypes = EnumParticleTypes.SMOKE_NORMAL;
|
||||||
|
} else if (particletype == ParticleType.SNOW_PUFF) {
|
||||||
|
enumparticletypes = EnumParticleTypes.SNOWBALL;
|
||||||
|
} else if (particletype == ParticleType.FLAME) {
|
||||||
|
enumparticletypes = EnumParticleTypes.FLAME;
|
||||||
|
} else if (particletype == ParticleType.CLOUD) {
|
||||||
|
enumparticletypes = EnumParticleTypes.CLOUD;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enumparticletypes != null) {
|
||||||
|
this.entity.worldObj.spawnParticle(enumparticletypes, d0, d1, d2, d3, d4, d5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void spawnItemParticle(ItemStack m, double d0, double d1, double d2, double d3, double d4, double d5) {
|
||||||
|
if (m != null) {
|
||||||
|
Item item = m.getItem();
|
||||||
|
EnumParticleTypes enumparticletypes;
|
||||||
|
int i;
|
||||||
|
if (item instanceof ItemBlock) {
|
||||||
|
enumparticletypes = EnumParticleTypes.BLOCK_CRACK;
|
||||||
|
i = Block.getIdFromBlock(((ItemBlock) item).getBlock());
|
||||||
|
} else {
|
||||||
|
enumparticletypes = EnumParticleTypes.ITEM_CRACK;
|
||||||
|
i = Item.getIdFromItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.entity.worldObj.spawnParticle(enumparticletypes, d0, d1, d2, d3, d4, d5, i, m.stackSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderBlock(ItemStack m) {
|
||||||
|
Item item = m.getItem();
|
||||||
|
if (item instanceof ItemBlock) {
|
||||||
|
BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
|
||||||
|
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||||
|
blockrendererdispatcher.renderBlockBrightness(((ItemBlock) item).getBlock().getDefaultState(), 1.0F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void throwSnowball(double d0, double d1, double d2, double d3, double d4, double d5) {
|
||||||
|
this.controller.runnables.add(() -> {
|
||||||
|
EntitySnowball entitysnowball = new EntitySnowball(this.entity.worldObj, d0, d1, d2);
|
||||||
|
entitysnowball.setThrowableHeading(d3, d4, d5, 1.0F, 0.0F);
|
||||||
|
this.entity.worldObj.spawnEntityInWorld(entitysnowball);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createFirework(double d0, double d1, double d2, double d3, double d4, double d5, NBTTagCompound f) {
|
||||||
|
if (f != null) {
|
||||||
|
this.entity.worldObj.makeFireworks(d0, d1, d2, d3, d4, d5, f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package net.silentclient.client.emotes;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class EmoteControllerManager {
|
||||||
|
public static final HashMap<String, AnimatorController> controllers = new HashMap<String, AnimatorController>();
|
||||||
|
}
|
13
src/main/java/net/silentclient/client/emotes/EmoteData.java
Normal file
13
src/main/java/net/silentclient/client/emotes/EmoteData.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package net.silentclient.client.emotes;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class EmoteData {
|
||||||
|
public List<String> emoteUsers = new ArrayList<>();
|
||||||
|
public String emoteName;
|
||||||
|
|
||||||
|
public EmoteData(String emoteName) {
|
||||||
|
this.emoteName = emoteName;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package net.silentclient.client.emotes;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.silentclient.client.Client;
|
||||||
|
import net.silentclient.client.emotes.emoticons.Emote;
|
||||||
|
|
||||||
|
public class EmoteManager {
|
||||||
|
public static void sendEmote(String name, int i) {
|
||||||
|
play(name, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void play(String name, int i) {
|
||||||
|
if (Minecraft.getMinecraft().theWorld != null) {
|
||||||
|
String s = PlayerModelManager.get().map.get(i);
|
||||||
|
EntityPlayer entityPlayer = EmoteManager.getPlayerEntityByName(Minecraft.getMinecraft().theWorld, name);
|
||||||
|
if (entityPlayer != null && s != null) {
|
||||||
|
Emote emote = PlayerModelManager.get().registry.get(s);
|
||||||
|
if (EmoteControllerManager.controllers.get(entityPlayer.getName()) != null) {
|
||||||
|
EmoteControllerManager.controllers.get(entityPlayer.getName()).setEmote(entityPlayer, emote);
|
||||||
|
} else {
|
||||||
|
Client.logger.info("emote player controller is null");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Client.logger.info("entity player or emote is null");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void stop(String name) {
|
||||||
|
if (Minecraft.getMinecraft().theWorld != null) {
|
||||||
|
EntityPlayer entityPlayer = EmoteManager.getPlayerEntityByName(Minecraft.getMinecraft().theWorld, name);
|
||||||
|
if (entityPlayer != null) {
|
||||||
|
if (EmoteControllerManager.controllers.get(entityPlayer.getName()) != null) {
|
||||||
|
EmoteControllerManager.controllers.get(entityPlayer.getName()).resetEmote();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EntityPlayer getPlayerEntityByName(World world, String name)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < world.playerEntities.size(); ++i)
|
||||||
|
{
|
||||||
|
EntityPlayer entityplayer = (EntityPlayer)world.playerEntities.get(i);
|
||||||
|
|
||||||
|
Client.logger.info(entityplayer.getName());
|
||||||
|
|
||||||
|
if (name.equalsIgnoreCase(entityplayer.getName()))
|
||||||
|
{
|
||||||
|
return entityplayer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
60
src/main/java/net/silentclient/client/emotes/EmotesMod.java
Normal file
60
src/main/java/net/silentclient/client/emotes/EmotesMod.java
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
package net.silentclient.client.emotes;
|
||||||
|
|
||||||
|
import net.silentclient.client.Client;
|
||||||
|
import net.silentclient.client.emotes.socket.EmoteSocket;
|
||||||
|
import net.silentclient.client.mods.Mod;
|
||||||
|
import net.silentclient.client.mods.ModCategory;
|
||||||
|
import net.silentclient.client.mods.Setting;
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class EmotesMod extends Mod {
|
||||||
|
public EmotesMod() {
|
||||||
|
super("Emotes", ModCategory.SETTINGS, "silentclient/emotes/icons/default.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup() {
|
||||||
|
this.addBooleanSetting("Emotes", this, true);
|
||||||
|
this.addKeybindSetting("Emote Wheel Keybind", this, Keyboard.KEY_B);
|
||||||
|
this.addBooleanSetting("Infinite Emotes", this, false);
|
||||||
|
this.addBooleanSetting("Enable Running in Emotes", this, false);
|
||||||
|
|
||||||
|
ArrayList<String> perspectives = new ArrayList<>();
|
||||||
|
perspectives.add("Second Person");
|
||||||
|
perspectives.add("Third Person");
|
||||||
|
|
||||||
|
this.addModeSetting("Default Emote Perspective", this, "Second Person", perspectives);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnable() {
|
||||||
|
super.onEnable();
|
||||||
|
if(Client.getInstance().getSettingsManager().getSettingByClass(EmotesMod.class, "Emotes").getValBoolean()) {
|
||||||
|
EmoteSocket.get().connect();
|
||||||
|
} else {
|
||||||
|
EmoteSocket.get().disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChangeSettingValue(Setting setting) {
|
||||||
|
super.onChangeSettingValue(setting);
|
||||||
|
if(setting.getName().equals("Emotes")) {
|
||||||
|
if(setting.getValBoolean()) {
|
||||||
|
EmoteSocket.get().connect();
|
||||||
|
} else {
|
||||||
|
EmoteSocket.get().disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getEmotePerspective() {
|
||||||
|
if(Client.getInstance().getSettingsManager().getSettingByClass(EmotesMod.class, "Default Emote Perspective").getValString().equalsIgnoreCase("second person")) {
|
||||||
|
return 2;
|
||||||
|
} else {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,272 @@
|
|||||||
|
package net.silentclient.client.emotes;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.silentclient.client.emotes.animation.Animation;
|
||||||
|
import net.silentclient.client.emotes.animation.AnimationMeshConfig;
|
||||||
|
import net.silentclient.client.emotes.animation.json.AnimationMeshConfigAdapter;
|
||||||
|
import net.silentclient.client.emotes.animation.json.AnimatorConfigAdapter;
|
||||||
|
import net.silentclient.client.emotes.animation.json.AnimatorHeldItemConfigAdapter;
|
||||||
|
import net.silentclient.client.emotes.animation.model.AnimatorConfig;
|
||||||
|
import net.silentclient.client.emotes.animation.model.AnimatorHeldItemConfig;
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJLoader;
|
||||||
|
import net.silentclient.client.emotes.emoticons.Emote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.Icon;
|
||||||
|
import net.silentclient.client.emotes.emoticons.PropEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.christmas.IcebergEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.christmas.PresentEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.emoticons.CryingEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.emoticons.DisgustedEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.emoticons.SneezeEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.emoticons.StarPowerEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.halloween.RisingFromDeadEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.halloween.TrickOrTreatEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.newyear.ChampagneEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.thanksgiving.PumpkinEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.valentines.BlowKissEmote;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class PlayerModelManager {
|
||||||
|
public static Map<String, EmoteData> emoteData = new HashMap<>();
|
||||||
|
public Animation steve;
|
||||||
|
public Animation alex;
|
||||||
|
public AnimatorConfig steveConfig;
|
||||||
|
public AnimatorConfig alexConfig;
|
||||||
|
public List<String> emotes = new ArrayList<>();
|
||||||
|
public Map<String, Emote> registry = new HashMap<>();
|
||||||
|
public Map<Integer, String> map = new TreeMap<>();
|
||||||
|
public List<String> emotesName = new ArrayList<>();
|
||||||
|
|
||||||
|
public static PlayerModelManager instance;
|
||||||
|
|
||||||
|
public static PlayerModelManager get() {
|
||||||
|
if(instance == null) {
|
||||||
|
instance = new PlayerModelManager();
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayerModelManager() {
|
||||||
|
try {
|
||||||
|
GsonBuilder gsonbuilder = new GsonBuilder();
|
||||||
|
gsonbuilder.registerTypeAdapter(AnimationMeshConfig.class, new AnimationMeshConfigAdapter());
|
||||||
|
gsonbuilder.registerTypeAdapter(AnimatorConfig.class, new AnimatorConfigAdapter());
|
||||||
|
gsonbuilder.registerTypeAdapter(AnimatorHeldItemConfig.class, new AnimatorHeldItemConfigAdapter());
|
||||||
|
Gson gson = gsonbuilder.create();
|
||||||
|
Class<?> oclass = this.getClass();
|
||||||
|
BOBJLoader.BOBJData bobjloader$bobjdata1 = BOBJLoader.readData(oclass.getResourceAsStream("/assets/minecraft/silentclient/emotes/models/armor.bobj"));
|
||||||
|
BOBJLoader.BOBJData bobjloader$bobjdata2 = BOBJLoader.readData(oclass.getResourceAsStream("/assets/minecraft/silentclient/emotes/models/default.bobj"));
|
||||||
|
BOBJLoader.BOBJData bobjloader$bobjdata3 = BOBJLoader.readData(oclass.getResourceAsStream("/assets/minecraft/silentclient/emotes/models/slim.bobj"));
|
||||||
|
BOBJLoader.BOBJData bobjloader$bobjdata4 = BOBJLoader.readData(oclass.getResourceAsStream("/assets/minecraft/silentclient/emotes/models/actions.bobj"));
|
||||||
|
BOBJLoader.BOBJData bobjloader$bobjdata5 = BOBJLoader.readData(oclass.getResourceAsStream("/assets/minecraft/silentclient/emotes/models/props.bobj"));
|
||||||
|
BOBJLoader.merge(bobjloader$bobjdata2, bobjloader$bobjdata1);
|
||||||
|
BOBJLoader.merge(bobjloader$bobjdata3, bobjloader$bobjdata1);
|
||||||
|
BOBJLoader.merge(bobjloader$bobjdata2, bobjloader$bobjdata5);
|
||||||
|
BOBJLoader.merge(bobjloader$bobjdata3, bobjloader$bobjdata5);
|
||||||
|
bobjloader$bobjdata2.actions.putAll(bobjloader$bobjdata4.actions);
|
||||||
|
bobjloader$bobjdata3.actions.putAll(bobjloader$bobjdata4.actions);
|
||||||
|
this.steve = new Animation("default", bobjloader$bobjdata2);
|
||||||
|
this.alex = new Animation("slim", bobjloader$bobjdata3);
|
||||||
|
this.steve.init();
|
||||||
|
this.alex.init();
|
||||||
|
this.steveConfig = gson.fromJson(
|
||||||
|
IOUtils.toString(Objects.requireNonNull(oclass.getResourceAsStream("/assets/minecraft/silentclient/emotes/models/default.json"))), AnimatorConfig.class
|
||||||
|
);
|
||||||
|
this.alexConfig = gson.fromJson(
|
||||||
|
IOUtils.toString(Objects.requireNonNull(oclass.getResourceAsStream("/assets/minecraft/silentclient/emotes/models/slim.json"))), AnimatorConfig.class
|
||||||
|
);
|
||||||
|
this.steve.data.armatures.get("Armature").enabled = true;
|
||||||
|
this.alex.data.armatures.get("Armature").enabled = true;
|
||||||
|
|
||||||
|
for (String s1 : bobjloader$bobjdata4.actions.keySet()) {
|
||||||
|
if (s1.startsWith("emote_") && !s1.endsWith("_IK")) {
|
||||||
|
String s = s1.substring(6);
|
||||||
|
int i = s.indexOf(":");
|
||||||
|
if (i != -1) {
|
||||||
|
s = s.substring(0, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.emotes.contains(s)) {
|
||||||
|
this.emotes.add(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.registerEmote("best_mates", "Best Mates", 999);
|
||||||
|
this.registerEmote("boneless", "Boneless", 2);
|
||||||
|
this.registerEmote("bow", "Bow");
|
||||||
|
this.registerEmote("boy", "Boyyy");
|
||||||
|
this.registerEmote("calculated", "Calculated");
|
||||||
|
this.registerEmote("chicken", "Chicken", 4);
|
||||||
|
this.registerEmote("clapping", "Clapping", 3);
|
||||||
|
this.registerEmote("confused", "Confused");
|
||||||
|
this.registerEmote(new CryingEmote("crying", "Crying").looping(3));
|
||||||
|
this.registerEmote("dab", "Dab");
|
||||||
|
this.registerEmote("default", "Dance moves");
|
||||||
|
this.registerEmote("disco_fever", "Disco Fever", 2);
|
||||||
|
this.registerEmote("electro_shuffle", "Electro Shuffle", 2);
|
||||||
|
this.registerEmote("facepalm", "Facepalm");
|
||||||
|
this.registerEmote("fist", "Fist");
|
||||||
|
this.registerEmote("floss", "Floss", 3);
|
||||||
|
this.registerEmote("free_flow", "Free Flow");
|
||||||
|
this.registerEmote("fresh", "Fresh", 2);
|
||||||
|
this.registerEmote("gangnam_style", "Gangnam", 4);
|
||||||
|
this.registerEmote("get_funky", "Get Funky", 2);
|
||||||
|
this.registerEmote("hype", "Hype", 3);
|
||||||
|
this.registerEmote("infinite_dab", "Infinite Dab", 4);
|
||||||
|
this.registerEmote("laughing", "Laughing", 2);
|
||||||
|
this.registerEmote("no", "No");
|
||||||
|
this.registerEmote("orange_justice", "Orange Justice");
|
||||||
|
this.registerEmote("pointing", "Pointing");
|
||||||
|
this.registerEmote("salute", "Salute");
|
||||||
|
this.registerEmote("shimmer", "Shimmer");
|
||||||
|
this.registerEmote("shrug", "Shrug");
|
||||||
|
this.registerEmote("skibidi", "Skibidi", 4);
|
||||||
|
this.registerEmote("squat_kick", "Squat Kick");
|
||||||
|
this.registerEmote(new StarPowerEmote("star_power", "Star Power", 1));
|
||||||
|
this.registerEmote("t_pose", "T-Pose");
|
||||||
|
this.registerEmote("take_the_l", "Take The L", 4);
|
||||||
|
this.registerEmote("thinking", "Thinking");
|
||||||
|
this.registerEmote("tidy", "Tidy");
|
||||||
|
this.registerEmote("wave", "Wave");
|
||||||
|
this.registerEmote("yes", "Yes");
|
||||||
|
this.registerEmote(new RisingFromDeadEmote("rising_from_dead", "Dead Rising"));
|
||||||
|
this.registerEmote(new PumpkinEmote("pumpkin", "Pumpkin"));
|
||||||
|
this.registerEmote(new TrickOrTreatEmote("trick_or_treat", "Trick or Treat"));
|
||||||
|
this.registerEmote(new BlowKissEmote("blow_kiss", "Blow Kiss"));
|
||||||
|
this.registerEmote("twerk", "Twerking", 8);
|
||||||
|
this.registerEmote("club", "Clubbing", 4);
|
||||||
|
this.registerEmote(new SneezeEmote("sneeze", "Sneeze"));
|
||||||
|
this.registerEmote("punch", "Punch!");
|
||||||
|
this.registerEmote("bongo_cat", "Bongo Cat");
|
||||||
|
this.registerEmote("exhausted", "Exhausted");
|
||||||
|
this.registerEmote(new DisgustedEmote("disgusted", "Disgusted"));
|
||||||
|
this.registerEmote("bitchslap", "Slap");
|
||||||
|
this.registerEmote("threatening", "Threatening");
|
||||||
|
this.registerEmote(new PropEmote("woah", "Woah!"));
|
||||||
|
this.registerEmote("breathtaking", "Breathtaking");
|
||||||
|
this.registerEmote("bunny_hop", "Bunny Hop");
|
||||||
|
this.registerEmote("chicken_dance", "Chicken Dance");
|
||||||
|
this.registerEmote(new PropEmote("broom", "Broom"));
|
||||||
|
this.registerEmote(new IcebergEmote("iceberg", "Iceberg"));
|
||||||
|
this.registerEmote(new PresentEmote("present", "Present"));
|
||||||
|
this.registerEmote(new ChampagneEmote("champagne", "Champagne"));
|
||||||
|
this.map.put(1, "default");
|
||||||
|
this.map.put(2, "best_mates");
|
||||||
|
this.map.put(3, "boneless");
|
||||||
|
this.map.put(4, "bow");
|
||||||
|
this.map.put(5, "boy");
|
||||||
|
this.map.put(6, "calculated");
|
||||||
|
this.map.put(7, "chicken");
|
||||||
|
this.map.put(8, "clapping");
|
||||||
|
this.map.put(9, "confused");
|
||||||
|
this.map.put(10, "crying");
|
||||||
|
this.map.put(11, "dab");
|
||||||
|
this.map.put(12, "disco_fever");
|
||||||
|
this.map.put(13, "electro_shuffle");
|
||||||
|
this.map.put(14, "facepalm");
|
||||||
|
this.map.put(15, "fist");
|
||||||
|
this.map.put(16, "floss");
|
||||||
|
this.map.put(17, "free_flow");
|
||||||
|
this.map.put(18, "fresh");
|
||||||
|
this.map.put(19, "gangnam_style");
|
||||||
|
this.map.put(20, "get_funky");
|
||||||
|
this.map.put(21, "hype");
|
||||||
|
this.map.put(22, "infinite_dab");
|
||||||
|
this.map.put(23, "laughing");
|
||||||
|
this.map.put(24, "no");
|
||||||
|
this.map.put(25, "orange_justice");
|
||||||
|
this.map.put(26, "pointing");
|
||||||
|
this.map.put(27, "salute");
|
||||||
|
this.map.put(28, "shimmer");
|
||||||
|
this.map.put(29, "shrug");
|
||||||
|
this.map.put(30, "skibidi");
|
||||||
|
this.map.put(31, "squat_kick");
|
||||||
|
this.map.put(32, "star_power");
|
||||||
|
this.map.put(33, "t_pose");
|
||||||
|
this.map.put(34, "take_the_l");
|
||||||
|
this.map.put(35, "thinking");
|
||||||
|
this.map.put(36, "tidy");
|
||||||
|
this.map.put(37, "wave");
|
||||||
|
this.map.put(38, "yes");
|
||||||
|
this.map.put(39, "rising_from_dead");
|
||||||
|
this.map.put(40, "pumpkin");
|
||||||
|
this.map.put(41, "trick_or_treat");
|
||||||
|
this.map.put(42, "blow_kiss");
|
||||||
|
this.map.put(43, "twerk");
|
||||||
|
this.map.put(44, "club");
|
||||||
|
this.map.put(45, "sneeze");
|
||||||
|
this.map.put(46, "punch");
|
||||||
|
this.map.put(47, "bongo_cat");
|
||||||
|
this.map.put(48, "exhausted");
|
||||||
|
this.map.put(49, "disgusted");
|
||||||
|
this.map.put(50, "bitchslap");
|
||||||
|
this.map.put(51, "threatening");
|
||||||
|
this.map.put(52, "woah");
|
||||||
|
this.map.put(53, "breathtaking");
|
||||||
|
this.map.put(54, "bunny_hop");
|
||||||
|
this.map.put(55, "chicken_dance");
|
||||||
|
this.map.put(56, "broom");
|
||||||
|
this.map.put(57, "iceberg");
|
||||||
|
this.map.put(58, "present");
|
||||||
|
this.map.put(59, "champagne");
|
||||||
|
|
||||||
|
for (String value : this.map.values()) {
|
||||||
|
emoteData.put(value, new EmoteData(value));
|
||||||
|
}
|
||||||
|
} catch (Exception var13) {
|
||||||
|
LogManager.getLogger().info("Error registering emotes: " + var13.getMessage());
|
||||||
|
LogManager.getLogger().catching(var13);
|
||||||
|
var13.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerEmote(String s, String s1) {
|
||||||
|
this.registerEmote(s, s1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerEmote(String s, String s1, int i) {
|
||||||
|
this.registerEmote(new Emote(s, s1).looping(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerEmote(Emote emote) {
|
||||||
|
if (this.emotes.contains(emote.id)) {
|
||||||
|
this.registry.put(emote.id, emote);
|
||||||
|
this.emotesName.add(emote.title);
|
||||||
|
this.setEmoteIcon(emote.id);
|
||||||
|
} else {
|
||||||
|
LogManager.getLogger().info("No emote registered for '" + emote.id + "' !");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setEmoteIcon(String s) {
|
||||||
|
this.setEmoteIcon(s, 100, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setEmoteIcon(String s, int i, int j) {
|
||||||
|
Emote emote = this.registry.get(s);
|
||||||
|
if (emote != null) {
|
||||||
|
emote.icon = new Icon(new ResourceLocation("silentclient/emotes/icons/" + s + ".png"), i, j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKey(String s) {
|
||||||
|
Emote emote = this.registry.get(s);
|
||||||
|
return emote == null ? s : emote.title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Emote getEmote(String s) {
|
||||||
|
String s1 = s.contains(":") ? s.split(":")[0] : s;
|
||||||
|
Emote emote = this.registry.get(s1);
|
||||||
|
if (s.contains(":")) {
|
||||||
|
emote = emote.getDynamicEmote(s.split(":")[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return emote;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package net.silentclient.client.emotes.animation;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJLoader;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
public class Animation {
|
||||||
|
public String name;
|
||||||
|
public BOBJLoader.BOBJData data;
|
||||||
|
public List<AnimationMesh> meshes;
|
||||||
|
|
||||||
|
public Animation(String string, BOBJLoader.BOBJData data) {
|
||||||
|
this.name = string;
|
||||||
|
this.data = data;
|
||||||
|
this.meshes = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reload(BOBJLoader.BOBJData bOBJData) {
|
||||||
|
this.data = bOBJData;
|
||||||
|
this.delete();
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init() {
|
||||||
|
Map<String, BOBJLoader.CompiledData> map = BOBJLoader.loadMeshes(this.data);
|
||||||
|
|
||||||
|
for (Entry<String, BOBJLoader.CompiledData> entry : map.entrySet()) {
|
||||||
|
BOBJLoader.CompiledData bobjloader$compileddata = entry.getValue();
|
||||||
|
AnimationMesh animationmesh = new AnimationMesh(this, entry.getKey(), bobjloader$compileddata);
|
||||||
|
this.meshes.add(animationmesh);
|
||||||
|
this.meshes
|
||||||
|
.sort((animationmesh1, animationmesh2) -> animationmesh1.name.startsWith("prop_") ? (animationmesh2.name.startsWith("prop_") ? 0 : 1) : -1);
|
||||||
|
this.data.release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete() {
|
||||||
|
for (AnimationMesh animationMesh : this.meshes) {
|
||||||
|
animationMesh.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.meshes.clear();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,150 @@
|
|||||||
|
package net.silentclient.client.emotes.animation;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJLoader;
|
||||||
|
import org.joml.Matrix4f;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
import org.lwjgl.BufferUtils;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
import org.lwjgl.opengl.GL15;
|
||||||
|
|
||||||
|
import java.nio.Buffer;
|
||||||
|
import java.nio.FloatBuffer;
|
||||||
|
import java.nio.IntBuffer;
|
||||||
|
|
||||||
|
public class AnimationMesh {
|
||||||
|
public Animation owner;
|
||||||
|
public String name;
|
||||||
|
public BOBJLoader.CompiledData data;
|
||||||
|
public BOBJArmature armature;
|
||||||
|
public FloatBuffer vertices;
|
||||||
|
public FloatBuffer normals;
|
||||||
|
public FloatBuffer textcoords;
|
||||||
|
public IntBuffer indices;
|
||||||
|
public int vertexBuffer;
|
||||||
|
public int normalBuffer;
|
||||||
|
public int upNormalBuffer;
|
||||||
|
public int texcoordBuffer;
|
||||||
|
public int indexBuffer;
|
||||||
|
|
||||||
|
public AnimationMesh(Animation owner, String name, BOBJLoader.CompiledData data) {
|
||||||
|
this.owner = owner;
|
||||||
|
this.name = name;
|
||||||
|
this.data = data;
|
||||||
|
(this.armature = this.data.mesh.armature).initArmature();
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
this.vertices = BufferUtils.createFloatBuffer(this.data.posData.length);
|
||||||
|
((Buffer) this.vertices.put(this.data.posData)).flip();
|
||||||
|
this.normals = BufferUtils.createFloatBuffer(this.data.normData.length);
|
||||||
|
((Buffer) this.normals.put(this.data.normData)).flip();
|
||||||
|
this.textcoords = BufferUtils.createFloatBuffer(this.data.texData.length);
|
||||||
|
((Buffer) this.textcoords.put(this.data.texData)).flip();
|
||||||
|
this.indices = BufferUtils.createIntBuffer(this.data.indexData.length);
|
||||||
|
((Buffer) this.indices.put(this.data.indexData)).flip();
|
||||||
|
float[] array = new float[this.data.normData.length];
|
||||||
|
|
||||||
|
for (int i = 0; i < this.data.normData.length / 3; ++i) {
|
||||||
|
array[i * 3] = 0.0F;
|
||||||
|
array[i * 3 + 1] = 1.0F;
|
||||||
|
array[i * 3 + 2] = 0.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
FloatBuffer buffer = BufferUtils.createFloatBuffer(this.data.normData.length);
|
||||||
|
((Buffer) buffer.put(array)).flip();
|
||||||
|
GL15.glBindBuffer(34962, this.vertexBuffer = GL15.glGenBuffers());
|
||||||
|
GL15.glBufferData(34962, this.vertices, 35048);
|
||||||
|
GL15.glBindBuffer(34962, this.normalBuffer = GL15.glGenBuffers());
|
||||||
|
GL15.glBufferData(34962, this.normals, 35044);
|
||||||
|
GL15.glBindBuffer(34962, this.upNormalBuffer = GL15.glGenBuffers());
|
||||||
|
GL15.glBufferData(34962, buffer, 35044);
|
||||||
|
GL15.glBindBuffer(34962, this.texcoordBuffer = GL15.glGenBuffers());
|
||||||
|
GL15.glBufferData(34962, this.textcoords, 35044);
|
||||||
|
GL15.glBindBuffer(34963, this.indexBuffer = GL15.glGenBuffers());
|
||||||
|
GL15.glBufferData(34963, this.indices, 35044);
|
||||||
|
GL15.glBindBuffer(34962, 0);
|
||||||
|
GL15.glBindBuffer(34963, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete() {
|
||||||
|
GL15.glDeleteBuffers(this.vertexBuffer);
|
||||||
|
GL15.glDeleteBuffers(this.normalBuffer);
|
||||||
|
GL15.glDeleteBuffers(this.upNormalBuffer);
|
||||||
|
GL15.glDeleteBuffers(this.texcoordBuffer);
|
||||||
|
GL15.glDeleteBuffers(this.indexBuffer);
|
||||||
|
this.vertices = null;
|
||||||
|
this.normals = null;
|
||||||
|
this.textcoords = null;
|
||||||
|
this.indices = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float[] mesh() {
|
||||||
|
Vector4f vector = new Vector4f();
|
||||||
|
Vector4f vector1 = new Vector4f(0.0F, 0.0F, 0.0F, 0.0F);
|
||||||
|
float[] posData = this.data.posData;
|
||||||
|
float[] array = new float[posData.length];
|
||||||
|
Matrix4f[] matrices = this.armature.matrices;
|
||||||
|
|
||||||
|
for (int i = 0; i < array.length / 4; ++i) {
|
||||||
|
int n = 0;
|
||||||
|
|
||||||
|
for (int j = 0; j < 4; ++j) {
|
||||||
|
float n2 = this.data.weightData[i * 4 + j];
|
||||||
|
if (n2 > 0.0F) {
|
||||||
|
int n3 = this.data.boneIndexData[i * 4 + j];
|
||||||
|
vector.set(posData[i * 4], posData[i * 4 + 1], posData[i * 4 + 2], 1.0F);
|
||||||
|
matrices[n3].transform(vector);
|
||||||
|
vector1.add(vector.mul(n2));
|
||||||
|
++n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (n == 0) {
|
||||||
|
vector1.set(posData[i * 4], posData[i * 4 + 1], posData[i * 4 + 2], 1.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
array[i * 4] = vector1.x;
|
||||||
|
array[i * 4 + 1] = vector1.y;
|
||||||
|
array[i * 4 + 2] = vector1.z;
|
||||||
|
array[i * 4 + 3] = vector1.w;
|
||||||
|
vector1.set(0.0F, 0.0F, 0.0F, 0.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update() {
|
||||||
|
((Buffer) this.vertices).clear();
|
||||||
|
((Buffer) this.vertices.put(this.mesh())).flip();
|
||||||
|
GL15.glBindBuffer(34962, this.vertexBuffer);
|
||||||
|
GL15.glBufferData(34962, this.vertices, 35048);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void render(AnimationMeshConfig config) {
|
||||||
|
if (config == null || config.visible) {
|
||||||
|
if (config != null) {
|
||||||
|
config.bindTexture();
|
||||||
|
int color = config.color;
|
||||||
|
GL11.glColor4f((float) (color >> 16 & 0xFF) / 255.0F, (float) (color >> 8 & 0xFF) / 255.0F, (float) (color & 0xFF) / 255.0F, 1.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
GL15.glBindBuffer(34962, this.vertexBuffer);
|
||||||
|
GL11.glVertexPointer(4, 5126, 0, 0L);
|
||||||
|
GL15.glBindBuffer(34962, config != null && config.normals ? this.normalBuffer : this.upNormalBuffer);
|
||||||
|
GL11.glNormalPointer(5126, 0, 0L);
|
||||||
|
GL15.glBindBuffer(34962, this.texcoordBuffer);
|
||||||
|
GL11.glTexCoordPointer(2, 5126, 0, 0L);
|
||||||
|
GL11.glEnableClientState(32884);
|
||||||
|
GL11.glEnableClientState(32885);
|
||||||
|
GL11.glEnableClientState(32888);
|
||||||
|
GL15.glBindBuffer(34963, this.indexBuffer);
|
||||||
|
GL11.glDrawElements(4, this.data.indexData.length, 5125, 0L);
|
||||||
|
GL15.glBindBuffer(34962, 0);
|
||||||
|
GL11.glDisableClientState(32884);
|
||||||
|
GL11.glDisableClientState(32885);
|
||||||
|
GL11.glDisableClientState(32888);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package net.silentclient.client.emotes.animation;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class AnimationMeshConfig {
|
||||||
|
public ResourceLocation texture;
|
||||||
|
public boolean normals = false;
|
||||||
|
public boolean visible = true;
|
||||||
|
public boolean smooth = false;
|
||||||
|
public int color = 16777215;
|
||||||
|
public float alpha = 1.0F;
|
||||||
|
|
||||||
|
public void bindTexture() {
|
||||||
|
if (this.texture != null) {
|
||||||
|
Minecraft.getMinecraft().getTextureManager().bindTexture(this.texture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public AnimationMeshConfig clone() {
|
||||||
|
AnimationMeshConfig animationmeshconfig = new AnimationMeshConfig();
|
||||||
|
animationmeshconfig.texture = this.texture;
|
||||||
|
animationmeshconfig.normals = this.normals;
|
||||||
|
animationmeshconfig.smooth = this.smooth;
|
||||||
|
animationmeshconfig.visible = this.visible;
|
||||||
|
animationmeshconfig.color = this.color;
|
||||||
|
animationmeshconfig.alpha = this.alpha;
|
||||||
|
return animationmeshconfig;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package net.silentclient.client.emotes.animation.json;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.animation.AnimationMeshConfig;
|
||||||
|
import com.google.gson.JsonDeserializationContext;
|
||||||
|
import com.google.gson.JsonDeserializer;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
|
public class AnimationMeshConfigAdapter implements JsonDeserializer<AnimationMeshConfig> {
|
||||||
|
public AnimationMeshConfig deserialize(JsonElement jsonelement, Type var2, JsonDeserializationContext var3) {
|
||||||
|
if (!jsonelement.isJsonObject()) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
JsonObject jsonobject = jsonelement.getAsJsonObject();
|
||||||
|
AnimationMeshConfig animationmeshconfig = new AnimationMeshConfig();
|
||||||
|
if (jsonobject.has("texture")) {
|
||||||
|
animationmeshconfig.texture = new ResourceLocation(jsonobject.get("texture").getAsString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonobject.has("normals")) {
|
||||||
|
animationmeshconfig.normals = jsonobject.get("normals").getAsBoolean();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonobject.has("visible")) {
|
||||||
|
animationmeshconfig.visible = jsonobject.get("visible").getAsBoolean();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonobject.has("smooth")) {
|
||||||
|
animationmeshconfig.smooth = jsonobject.get("smooth").getAsBoolean();
|
||||||
|
}
|
||||||
|
|
||||||
|
return animationmeshconfig;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,96 @@
|
|||||||
|
package net.silentclient.client.emotes.animation.json;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.animation.AnimationMeshConfig;
|
||||||
|
import net.silentclient.client.emotes.animation.model.AnimatorConfig;
|
||||||
|
import net.silentclient.client.emotes.animation.model.AnimatorHeldItemConfig;
|
||||||
|
import com.google.gson.*;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
public class AnimatorConfigAdapter implements JsonDeserializer<AnimatorConfig> {
|
||||||
|
public static String[] toStringArray(JsonArray jsonarray) {
|
||||||
|
ArrayList<String> arraylist = new ArrayList<>();
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
for (int j = jsonarray.size(); i < j; ++i) {
|
||||||
|
JsonElement jsonelement = jsonarray.get(i);
|
||||||
|
if (jsonelement.isJsonPrimitive()) {
|
||||||
|
arraylist.add(jsonelement.getAsString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return arraylist.toArray(new String[arraylist.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AnimatorConfig deserialize(JsonElement jsonelement, Type var2, JsonDeserializationContext jsondeserializationcontext) {
|
||||||
|
if (!jsonelement.isJsonObject()) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
JsonObject jsonobject = jsonelement.getAsJsonObject();
|
||||||
|
AnimatorConfig animatorconfig = new AnimatorConfig();
|
||||||
|
if (jsonobject.has("name")) {
|
||||||
|
animatorconfig.name = jsonobject.get("name").getAsString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonobject.has("primaryMesh")) {
|
||||||
|
animatorconfig.primaryMesh = jsonobject.get("primaryMesh").getAsString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonobject.has("scale")) {
|
||||||
|
animatorconfig.scale = jsonobject.get("scale").getAsFloat();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonobject.has("scaleGui")) {
|
||||||
|
animatorconfig.scaleGui = jsonobject.get("scaleGui").getAsFloat();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonobject.has("scaleItems")) {
|
||||||
|
animatorconfig.scaleItems = jsonobject.get("scaleItems").getAsFloat();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonobject.has("renderHeldItems")) {
|
||||||
|
animatorconfig.renderHeldItems = jsonobject.get("renderHeldItems").getAsBoolean();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonobject.has("leftHands")) {
|
||||||
|
this.addHeldConfig(animatorconfig.leftHands, jsonobject.get("leftHands"), jsondeserializationcontext);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonobject.has("rightHands")) {
|
||||||
|
this.addHeldConfig(animatorconfig.rightHands, jsonobject.get("rightHands"), jsondeserializationcontext);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonobject.has("head")) {
|
||||||
|
animatorconfig.head = jsonobject.get("head").getAsString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonobject.has("meshes")) {
|
||||||
|
animatorconfig.meshes = jsondeserializationcontext.deserialize(jsonobject.get("meshes"), (new TypeToken<Map<String, AnimationMeshConfig>>() {
|
||||||
|
}).getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
return animatorconfig;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addHeldConfig(Map<String, AnimatorHeldItemConfig> map, JsonElement jsonelement, JsonDeserializationContext jsondeserializationcontext) {
|
||||||
|
map.clear();
|
||||||
|
if (jsonelement.isJsonArray()) {
|
||||||
|
for (String s : toStringArray(jsonelement.getAsJsonArray())) {
|
||||||
|
map.put(s, new AnimatorHeldItemConfig(s));
|
||||||
|
}
|
||||||
|
} else if (jsonelement.isJsonObject()) {
|
||||||
|
for (Entry entry : ((JsonObject) jsonelement).entrySet()) {
|
||||||
|
AnimatorHeldItemConfig animatorhelditemconfig = jsondeserializationcontext.deserialize(
|
||||||
|
(JsonElement) entry.getValue(), AnimatorHeldItemConfig.class
|
||||||
|
);
|
||||||
|
animatorhelditemconfig.boneName = (String) entry.getKey();
|
||||||
|
map.put(animatorhelditemconfig.boneName, animatorhelditemconfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
package net.silentclient.client.emotes.animation.json;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.animation.model.AnimatorHeldItemConfig;
|
||||||
|
import com.google.gson.JsonDeserializationContext;
|
||||||
|
import com.google.gson.JsonDeserializer;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
|
public class AnimatorHeldItemConfigAdapter implements JsonDeserializer<AnimatorHeldItemConfig> {
|
||||||
|
public AnimatorHeldItemConfig deserialize(JsonElement jsonelement, Type var2, JsonDeserializationContext var3) {
|
||||||
|
if (!jsonelement.isJsonObject()) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
JsonObject jsonobject = (JsonObject) jsonelement;
|
||||||
|
AnimatorHeldItemConfig animatorhelditemconfig = new AnimatorHeldItemConfig("");
|
||||||
|
if (jsonobject.has("x")) {
|
||||||
|
animatorhelditemconfig.x = jsonobject.get("x").getAsFloat();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonobject.has("y")) {
|
||||||
|
animatorhelditemconfig.y = jsonobject.get("y").getAsFloat();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonobject.has("z")) {
|
||||||
|
animatorhelditemconfig.z = jsonobject.get("z").getAsFloat();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonobject.has("sx")) {
|
||||||
|
animatorhelditemconfig.scaleX = jsonobject.get("sx").getAsFloat();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonobject.has("sy")) {
|
||||||
|
animatorhelditemconfig.scaleY = jsonobject.get("sy").getAsFloat();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonobject.has("sz")) {
|
||||||
|
animatorhelditemconfig.scaleZ = jsonobject.get("sz").getAsFloat();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonobject.has("rx")) {
|
||||||
|
animatorhelditemconfig.rotateX = jsonobject.get("rx").getAsFloat();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonobject.has("ry")) {
|
||||||
|
animatorhelditemconfig.rotateY = jsonobject.get("ry").getAsFloat();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonobject.has("rz")) {
|
||||||
|
animatorhelditemconfig.rotateZ = jsonobject.get("rz").getAsFloat();
|
||||||
|
}
|
||||||
|
|
||||||
|
return animatorhelditemconfig;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,88 @@
|
|||||||
|
package net.silentclient.client.emotes.animation.model;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJAction;
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJBone;
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJGroup;
|
||||||
|
|
||||||
|
public class ActionPlayback {
|
||||||
|
public BOBJAction action;
|
||||||
|
public float ticks;
|
||||||
|
public int duration;
|
||||||
|
public int fade;
|
||||||
|
public float speed = 1.0F;
|
||||||
|
public boolean looping = false;
|
||||||
|
public int repeat = -1;
|
||||||
|
public boolean fading = false;
|
||||||
|
public boolean playing = true;
|
||||||
|
public int priority;
|
||||||
|
|
||||||
|
public ActionPlayback(BOBJAction bobjaction) {
|
||||||
|
this(bobjaction, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionPlayback(BOBJAction bobjaction, boolean flag) {
|
||||||
|
this.action = bobjaction;
|
||||||
|
this.duration = bobjaction.getDuration();
|
||||||
|
this.looping = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionPlayback(BOBJAction bobjaction, boolean flag, int i) {
|
||||||
|
this(bobjaction, flag);
|
||||||
|
this.priority = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFinished() {
|
||||||
|
return this.looping ? this.repeat == 0 && this.repeat >= 0 : this.ticks > (float) this.duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update() {
|
||||||
|
if (this.playing) {
|
||||||
|
if (this.looping || !this.looping && this.duration <= this.duration) {
|
||||||
|
this.ticks += this.speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.looping) {
|
||||||
|
if (this.ticks >= (float) this.duration && this.speed > 0.0F) {
|
||||||
|
this.ticks -= (float) this.duration;
|
||||||
|
if (this.repeat > 0) {
|
||||||
|
--this.repeat;
|
||||||
|
}
|
||||||
|
} else if (this.ticks < 0.0F && this.speed < 0.0F) {
|
||||||
|
this.ticks += (float) this.duration;
|
||||||
|
if (this.repeat > 0) {
|
||||||
|
--this.repeat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getTick(float f) {
|
||||||
|
float f1 = this.ticks + f * this.speed;
|
||||||
|
if (this.looping) {
|
||||||
|
if (f1 >= (float) this.duration && this.speed > 0.0F) {
|
||||||
|
f1 -= (float) this.duration;
|
||||||
|
if (this.repeat > 0) {
|
||||||
|
--this.repeat;
|
||||||
|
}
|
||||||
|
} else if (this.ticks < 0.0F && this.speed < 0.0F) {
|
||||||
|
f1 += (float) this.duration;
|
||||||
|
if (this.repeat > 0) {
|
||||||
|
--this.repeat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return f1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void apply(BOBJArmature bobjarmature, float f) {
|
||||||
|
for (BOBJGroup bobjgroup : this.action.groups.values()) {
|
||||||
|
BOBJBone bobjbone = bobjarmature.bones.get(bobjgroup.name);
|
||||||
|
if (bobjbone != null) {
|
||||||
|
bobjgroup.apply(bobjbone, this.getTick(f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
package net.silentclient.client.emotes.animation.model;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.animation.AnimationMeshConfig;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
public class AnimatorConfig {
|
||||||
|
public String name = "";
|
||||||
|
public String primaryMesh = "";
|
||||||
|
public float scale = 1.0F;
|
||||||
|
public float scaleGui = 1.0F;
|
||||||
|
public float scaleItems = 1.0F;
|
||||||
|
public boolean renderHeldItems = true;
|
||||||
|
public Map<String, AnimatorHeldItemConfig> leftHands = new HashMap<>();
|
||||||
|
public Map<String, AnimatorHeldItemConfig> rightHands = new HashMap<>();
|
||||||
|
public String head = "head";
|
||||||
|
public Map<String, AnimationMeshConfig> meshes = new HashMap<>();
|
||||||
|
|
||||||
|
public void copy(AnimatorConfig animatorconfig) {
|
||||||
|
this.name = animatorconfig.name;
|
||||||
|
this.primaryMesh = animatorconfig.primaryMesh;
|
||||||
|
this.scale = animatorconfig.scale;
|
||||||
|
this.scaleGui = animatorconfig.scaleGui;
|
||||||
|
this.scaleItems = animatorconfig.scaleItems;
|
||||||
|
this.renderHeldItems = animatorconfig.renderHeldItems;
|
||||||
|
this.head = animatorconfig.head;
|
||||||
|
this.leftHands.clear();
|
||||||
|
this.rightHands.clear();
|
||||||
|
this.meshes.clear();
|
||||||
|
|
||||||
|
for (Entry<String, AnimatorHeldItemConfig> entry : animatorconfig.leftHands.entrySet()) {
|
||||||
|
this.leftHands.put(entry.getKey(), entry.getValue().clone());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Entry<String, AnimatorHeldItemConfig> entry1 : animatorconfig.rightHands.entrySet()) {
|
||||||
|
this.rightHands.put(entry1.getKey(), entry1.getValue().clone());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Entry<String, AnimationMeshConfig> entry2 : animatorconfig.meshes.entrySet()) {
|
||||||
|
this.meshes.put(entry2.getKey(), entry2.getValue().clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package net.silentclient.client.emotes.animation.model;
|
||||||
|
|
||||||
|
public class AnimatorHeldItemConfig {
|
||||||
|
public String boneName = "";
|
||||||
|
public float x;
|
||||||
|
public float y;
|
||||||
|
public float z;
|
||||||
|
public float scaleX = 1.0F;
|
||||||
|
public float scaleY = 1.0F;
|
||||||
|
public float scaleZ = 1.0F;
|
||||||
|
public float rotateX;
|
||||||
|
public float rotateY;
|
||||||
|
public float rotateZ;
|
||||||
|
|
||||||
|
public AnimatorHeldItemConfig(String s) {
|
||||||
|
this.boneName = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AnimatorHeldItemConfig clone() {
|
||||||
|
AnimatorHeldItemConfig animatorhelditemconfig = new AnimatorHeldItemConfig(this.boneName);
|
||||||
|
animatorhelditemconfig.x = this.x;
|
||||||
|
animatorhelditemconfig.y = this.y;
|
||||||
|
animatorhelditemconfig.z = this.z;
|
||||||
|
animatorhelditemconfig.scaleX = this.scaleX;
|
||||||
|
animatorhelditemconfig.scaleY = this.scaleY;
|
||||||
|
animatorhelditemconfig.scaleZ = this.scaleZ;
|
||||||
|
animatorhelditemconfig.rotateX = this.rotateX;
|
||||||
|
animatorhelditemconfig.rotateY = this.rotateY;
|
||||||
|
animatorhelditemconfig.rotateZ = this.rotateZ;
|
||||||
|
return animatorhelditemconfig;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package net.silentclient.client.emotes.bobj;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class BOBJAction {
|
||||||
|
public String name;
|
||||||
|
public Map<String, BOBJGroup> groups = new HashMap<>();
|
||||||
|
|
||||||
|
public BOBJAction(String s) {
|
||||||
|
this.name = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDuration() {
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
for (BOBJGroup bobjgroup : this.groups.values()) {
|
||||||
|
i = Math.max(i, bobjgroup.getDuration());
|
||||||
|
}
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package net.silentclient.client.emotes.bobj;
|
||||||
|
|
||||||
|
import org.joml.Matrix4f;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class BOBJArmature {
|
||||||
|
public String name;
|
||||||
|
public String action = "";
|
||||||
|
public Map<String, BOBJBone> bones = new HashMap<>();
|
||||||
|
public List<BOBJBone> orderedBones = new ArrayList<>();
|
||||||
|
public Matrix4f[] matrices;
|
||||||
|
public boolean enabled = false;
|
||||||
|
private boolean initialized;
|
||||||
|
|
||||||
|
public BOBJArmature(String s) {
|
||||||
|
this.name = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addBone(BOBJBone bobjbone) {
|
||||||
|
this.bones.put(bobjbone.name, bobjbone);
|
||||||
|
this.orderedBones.add(bobjbone);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initArmature() {
|
||||||
|
if (!this.initialized) {
|
||||||
|
for (BOBJBone bobjbone : this.bones.values()) {
|
||||||
|
if (!bobjbone.parent.isEmpty()) {
|
||||||
|
bobjbone.parentBone = this.bones.get(bobjbone.parent);
|
||||||
|
bobjbone.relBoneMat.set(bobjbone.parentBone.boneMat).invert().mul(bobjbone.boneMat);
|
||||||
|
} else {
|
||||||
|
bobjbone.relBoneMat.set(bobjbone.boneMat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.orderedBones.sort(Comparator.comparingInt(bobjbone -> bobjbone.index));
|
||||||
|
this.matrices = new Matrix4f[this.orderedBones.size()];
|
||||||
|
this.initialized = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setupMatrices() {
|
||||||
|
for (BOBJBone bobjbone : this.orderedBones) {
|
||||||
|
this.matrices[bobjbone.index] = bobjbone.compute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
package net.silentclient.client.emotes.bobj;
|
||||||
|
|
||||||
|
import org.joml.Matrix4f;
|
||||||
|
import org.joml.Vector3f;
|
||||||
|
|
||||||
|
public class BOBJBone {
|
||||||
|
public int index;
|
||||||
|
public String name;
|
||||||
|
public String parent;
|
||||||
|
public BOBJBone parentBone;
|
||||||
|
public Vector3f head;
|
||||||
|
public Vector3f tail;
|
||||||
|
public float x;
|
||||||
|
public float y;
|
||||||
|
public float z;
|
||||||
|
public float rotateX;
|
||||||
|
public float rotateY;
|
||||||
|
public float rotateZ;
|
||||||
|
public float scaleX = 1.0F;
|
||||||
|
public float scaleY = 1.0F;
|
||||||
|
public float scaleZ = 1.0F;
|
||||||
|
public Matrix4f mat = new Matrix4f();
|
||||||
|
public Matrix4f boneMat;
|
||||||
|
public Matrix4f invBoneMat = new Matrix4f();
|
||||||
|
public Matrix4f relBoneMat = new Matrix4f();
|
||||||
|
|
||||||
|
public BOBJBone(int i, String s, String s1, Vector3f vector3f, Matrix4f matrix4f) {
|
||||||
|
this.index = i;
|
||||||
|
this.name = s;
|
||||||
|
this.parent = s1;
|
||||||
|
this.boneMat = matrix4f;
|
||||||
|
this.head = new Vector3f(matrix4f.m30(), matrix4f.m31(), matrix4f.m32());
|
||||||
|
this.tail = vector3f;
|
||||||
|
this.invBoneMat.set(matrix4f).invert();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Matrix4f compute() {
|
||||||
|
return this.compute(0.0F, 0.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Matrix4f compute(float f, float f1) {
|
||||||
|
Matrix4f matrix4f = this.computeMatrix(new Matrix4f(), f, f1);
|
||||||
|
this.mat.set(matrix4f);
|
||||||
|
matrix4f.mul(this.invBoneMat);
|
||||||
|
return matrix4f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Matrix4f computeMatrix(Matrix4f matrix4f, float f, float f1) {
|
||||||
|
this.mat.set(this.relBoneMat);
|
||||||
|
this.mat.translate(this.x, this.y, this.z);
|
||||||
|
this.mat.scale(this.scaleX, this.scaleY, this.scaleZ);
|
||||||
|
if (this.rotateZ != 0.0F) {
|
||||||
|
this.mat.rotateZ(this.rotateZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
float f2 = this.rotateY + f;
|
||||||
|
float f3 = this.rotateX + f1;
|
||||||
|
if (f2 != 0.0F) {
|
||||||
|
this.mat.rotateY(f2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f3 != 0.0F) {
|
||||||
|
this.mat.rotateX(f3);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.parentBone != null) {
|
||||||
|
matrix4f = new Matrix4f(this.parentBone.mat);
|
||||||
|
}
|
||||||
|
|
||||||
|
return matrix4f.mul(this.mat);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
this.x = this.y = this.z = 0.0F;
|
||||||
|
this.rotateX = this.rotateY = this.rotateZ = 0.0F;
|
||||||
|
this.scaleX = this.scaleY = this.scaleZ = 1.0F;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,117 @@
|
|||||||
|
package net.silentclient.client.emotes.bobj;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class BOBJChannel {
|
||||||
|
public String path;
|
||||||
|
public int index;
|
||||||
|
public List<BOBJKeyframe> frames = new ArrayList<>();
|
||||||
|
|
||||||
|
public BOBJChannel(String s, int i) {
|
||||||
|
this.path = s;
|
||||||
|
this.index = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float calculate(float f) {
|
||||||
|
int i = this.frames.size();
|
||||||
|
if (i <= 0) {
|
||||||
|
return 0.0F;
|
||||||
|
} else if (i == 1) {
|
||||||
|
return this.frames.get(0).value;
|
||||||
|
} else {
|
||||||
|
BOBJKeyframe bobjkeyframe = this.frames.get(0);
|
||||||
|
if ((float) bobjkeyframe.frame > f) {
|
||||||
|
return bobjkeyframe.value;
|
||||||
|
} else {
|
||||||
|
for (int j = 0; j < i; ++j) {
|
||||||
|
bobjkeyframe = this.frames.get(j);
|
||||||
|
if ((float) bobjkeyframe.frame > f && j != 0) {
|
||||||
|
BOBJKeyframe bobjkeyframe1 = this.frames.get(j - 1);
|
||||||
|
float f1 = (f - (float) bobjkeyframe1.frame) / (float) (bobjkeyframe.frame - bobjkeyframe1.frame);
|
||||||
|
return bobjkeyframe1.interpolate(f1, bobjkeyframe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return bobjkeyframe.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public BOBJKeyframe get(float f, boolean flag) {
|
||||||
|
int i = this.frames.size();
|
||||||
|
if (i == 0) {
|
||||||
|
return null;
|
||||||
|
} else if (i == 1) {
|
||||||
|
return this.frames.get(0);
|
||||||
|
} else {
|
||||||
|
BOBJKeyframe bobjkeyframe = null;
|
||||||
|
|
||||||
|
for (int j = 0; j < i; ++j) {
|
||||||
|
bobjkeyframe = this.frames.get(j);
|
||||||
|
if ((float) bobjkeyframe.frame > f && j != 0) {
|
||||||
|
return flag ? bobjkeyframe : this.frames.get(j - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return bobjkeyframe;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void apply(BOBJBone bobjbone, float f) {
|
||||||
|
if (this.path.equals("location")) {
|
||||||
|
if (this.index == 0) {
|
||||||
|
bobjbone.x = this.calculate(f);
|
||||||
|
} else if (this.index == 1) {
|
||||||
|
bobjbone.y = this.calculate(f);
|
||||||
|
} else if (this.index == 2) {
|
||||||
|
bobjbone.z = this.calculate(f);
|
||||||
|
}
|
||||||
|
} else if (this.path.equals("rotation")) {
|
||||||
|
if (this.index == 0) {
|
||||||
|
bobjbone.rotateX = this.calculate(f);
|
||||||
|
} else if (this.index == 1) {
|
||||||
|
bobjbone.rotateY = this.calculate(f);
|
||||||
|
} else if (this.index == 2) {
|
||||||
|
bobjbone.rotateZ = this.calculate(f);
|
||||||
|
}
|
||||||
|
} else if (this.path.equals("scale")) {
|
||||||
|
if (this.index == 0) {
|
||||||
|
bobjbone.scaleX = this.calculate(f);
|
||||||
|
} else if (this.index == 1) {
|
||||||
|
bobjbone.scaleY = this.calculate(f);
|
||||||
|
} else if (this.index == 2) {
|
||||||
|
bobjbone.scaleZ = this.calculate(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void applyInterpolate(BOBJBone bobjbone, float f, float f1) {
|
||||||
|
float f2 = this.calculate(f);
|
||||||
|
if (this.path.equals("location")) {
|
||||||
|
if (this.index == 0) {
|
||||||
|
bobjbone.x = f2 + (bobjbone.x - f2) * f1;
|
||||||
|
} else if (this.index == 1) {
|
||||||
|
bobjbone.y = f2 + (bobjbone.y - f2) * f1;
|
||||||
|
} else if (this.index == 2) {
|
||||||
|
bobjbone.z = f2 + (bobjbone.z - f2) * f1;
|
||||||
|
}
|
||||||
|
} else if (this.path.equals("rotation")) {
|
||||||
|
if (this.index == 0) {
|
||||||
|
bobjbone.rotateX = f2 + (bobjbone.rotateX - f2) * f1;
|
||||||
|
} else if (this.index == 1) {
|
||||||
|
bobjbone.rotateY = f2 + (bobjbone.rotateY - f2) * f1;
|
||||||
|
} else if (this.index == 2) {
|
||||||
|
bobjbone.rotateZ = f2 + (bobjbone.rotateZ - f2) * f1;
|
||||||
|
}
|
||||||
|
} else if (this.path.equals("scale")) {
|
||||||
|
if (this.index == 0) {
|
||||||
|
bobjbone.scaleX = f2 + (bobjbone.scaleX - f2) * f1;
|
||||||
|
} else if (this.index == 1) {
|
||||||
|
bobjbone.scaleY = f2 + (bobjbone.scaleY - f2) * f1;
|
||||||
|
} else if (this.index == 2) {
|
||||||
|
bobjbone.scaleZ = f2 + (bobjbone.scaleZ - f2) * f1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package net.silentclient.client.emotes.bobj;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class BOBJGroup {
|
||||||
|
public String name;
|
||||||
|
public List<BOBJChannel> channels = new ArrayList<>();
|
||||||
|
|
||||||
|
public BOBJGroup(String s) {
|
||||||
|
this.name = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void apply(BOBJBone bobjbone, float f) {
|
||||||
|
for (BOBJChannel bobjchannel : this.channels) {
|
||||||
|
bobjchannel.apply(bobjbone, f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void applyInterpolate(BOBJBone bobjbone, float f, float f1) {
|
||||||
|
for (BOBJChannel bobjchannel : this.channels) {
|
||||||
|
bobjchannel.applyInterpolate(bobjbone, f, f1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDuration() {
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
for (BOBJChannel bobjchannel : this.channels) {
|
||||||
|
int j = bobjchannel.frames.size();
|
||||||
|
if (j > 0) {
|
||||||
|
i = Math.max(i, bobjchannel.frames.get(j - 1).frame);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,88 @@
|
|||||||
|
package net.silentclient.client.emotes.bobj;
|
||||||
|
|
||||||
|
public class BOBJKeyframe {
|
||||||
|
public int frame;
|
||||||
|
public float value;
|
||||||
|
public BOBJKeyframe.Interpolation interpolation = BOBJKeyframe.Interpolation.LINEAR;
|
||||||
|
public float leftX;
|
||||||
|
public float leftY;
|
||||||
|
public float rightX;
|
||||||
|
public float rightY;
|
||||||
|
|
||||||
|
public BOBJKeyframe(int i, float f) {
|
||||||
|
this.frame = i;
|
||||||
|
this.value = f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BOBJKeyframe(int i, float f, String s) {
|
||||||
|
this(i, f);
|
||||||
|
this.interpolation = interpolationFromString(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BOBJKeyframe(int i, float f, String s, float f1, float f2, float f3, float f4) {
|
||||||
|
this(i, f, s);
|
||||||
|
this.leftX = f1;
|
||||||
|
this.leftY = f2;
|
||||||
|
this.rightX = f3;
|
||||||
|
this.rightY = f4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BOBJKeyframe parse(String[] astring) {
|
||||||
|
if (astring.length == 8) {
|
||||||
|
float f = Float.parseFloat(astring[4]);
|
||||||
|
float f1 = Float.parseFloat(astring[5]);
|
||||||
|
float f2 = Float.parseFloat(astring[6]);
|
||||||
|
float f3 = Float.parseFloat(astring[7]);
|
||||||
|
return new BOBJKeyframe(Integer.parseInt(astring[1]), Float.parseFloat(astring[2]), astring[3], f, f1, f2, f3);
|
||||||
|
} else {
|
||||||
|
return astring.length == 4
|
||||||
|
? new BOBJKeyframe(Integer.parseInt(astring[1]), Float.parseFloat(astring[2]), astring[3])
|
||||||
|
: (astring.length == 3 ? new BOBJKeyframe(Integer.parseInt(astring[1]), Float.parseFloat(astring[2])) : null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BOBJKeyframe.Interpolation interpolationFromString(String s) {
|
||||||
|
return s.equals("CONSTANT")
|
||||||
|
? BOBJKeyframe.Interpolation.CONSTANT
|
||||||
|
: (s.equals("BEZIER") ? BOBJKeyframe.Interpolation.BEZIER : BOBJKeyframe.Interpolation.LINEAR);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float lerp(float f, float f1, float f2) {
|
||||||
|
return f + (f1 - f) * f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float interpolate(float f, BOBJKeyframe bobjkeyframe) {
|
||||||
|
return this.interpolation.interpolate(this, f, bobjkeyframe);
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Interpolation {
|
||||||
|
CONSTANT {
|
||||||
|
@Override
|
||||||
|
public float interpolate(BOBJKeyframe bobjkeyframe, float var2, BOBJKeyframe var3) {
|
||||||
|
return bobjkeyframe.value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
LINEAR {
|
||||||
|
@Override
|
||||||
|
public float interpolate(BOBJKeyframe bobjkeyframe, float f, BOBJKeyframe bobjkeyframe1) {
|
||||||
|
return BOBJKeyframe.lerp(bobjkeyframe.value, bobjkeyframe1.value, f);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
BEZIER {
|
||||||
|
@Override
|
||||||
|
public float interpolate(BOBJKeyframe bobjkeyframe, float f, BOBJKeyframe bobjkeyframe1) {
|
||||||
|
float f1 = BOBJKeyframe.lerp(bobjkeyframe.value, bobjkeyframe.rightY, f);
|
||||||
|
float f2 = BOBJKeyframe.lerp(bobjkeyframe.rightY, bobjkeyframe1.leftY, f);
|
||||||
|
float f3 = BOBJKeyframe.lerp(bobjkeyframe1.leftY, bobjkeyframe1.value, f);
|
||||||
|
float f4 = BOBJKeyframe.lerp(f1, f2, f);
|
||||||
|
float f5 = BOBJKeyframe.lerp(f2, f3, f);
|
||||||
|
return BOBJKeyframe.lerp(f4, f5, f);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Interpolation() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract float interpolate(BOBJKeyframe var1, float var2, BOBJKeyframe var3);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,411 @@
|
|||||||
|
package net.silentclient.client.emotes.bobj;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
import org.joml.Matrix4f;
|
||||||
|
import org.joml.Vector2f;
|
||||||
|
import org.joml.Vector3f;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class BOBJLoader {
|
||||||
|
public static List<String> readAllLines(InputStream inputStream) {
|
||||||
|
ArrayList<String> list = new ArrayList<>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
|
||||||
|
|
||||||
|
String line;
|
||||||
|
while ((line = bufferedReader.readLine()) != null) {
|
||||||
|
list.add(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
bufferedReader.close();
|
||||||
|
} catch (Exception var4) {
|
||||||
|
var4.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void merge(BOBJLoader.BOBJData bobjloader$bobjdata, BOBJLoader.BOBJData bobjloader$bobjdata1) {
|
||||||
|
int i = bobjloader$bobjdata.vertices.size();
|
||||||
|
int j = bobjloader$bobjdata.normals.size();
|
||||||
|
int k = bobjloader$bobjdata.textures.size();
|
||||||
|
bobjloader$bobjdata.vertices.addAll(bobjloader$bobjdata1.vertices);
|
||||||
|
bobjloader$bobjdata.normals.addAll(bobjloader$bobjdata1.normals);
|
||||||
|
bobjloader$bobjdata.textures.addAll(bobjloader$bobjdata1.textures);
|
||||||
|
bobjloader$bobjdata.armatures.putAll(bobjloader$bobjdata1.armatures);
|
||||||
|
|
||||||
|
for (BOBJLoader.BOBJMesh bobjloader$bobjmesh : bobjloader$bobjdata1.meshes) {
|
||||||
|
BOBJLoader.BOBJMesh bobjloader$bobjmesh1 = bobjloader$bobjmesh.add(i, j, k);
|
||||||
|
bobjloader$bobjmesh1.armature = bobjloader$bobjdata.armatures.get(bobjloader$bobjmesh1.armatureName);
|
||||||
|
bobjloader$bobjdata.meshes.add(bobjloader$bobjmesh1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BOBJLoader.BOBJData readData(InputStream inputStream) {
|
||||||
|
List<String> lines = readAllLines(inputStream);
|
||||||
|
ArrayList<BOBJLoader.Vertex> list = new ArrayList<>();
|
||||||
|
ArrayList<Vector2f> list2 = new ArrayList();
|
||||||
|
ArrayList<Vector3f> list3 = new ArrayList();
|
||||||
|
ArrayList<BOBJLoader.BOBJMesh> list4 = new ArrayList<>();
|
||||||
|
HashMap<String, BOBJAction> map = new HashMap<>();
|
||||||
|
HashMap<String, BOBJArmature> map1 = new HashMap<>();
|
||||||
|
BOBJLoader.BOBJMesh bobjMesh = null;
|
||||||
|
BOBJAction bobjAction = null;
|
||||||
|
BOBJGroup bobjGroup = null;
|
||||||
|
BOBJChannel bobjChannel = null;
|
||||||
|
BOBJArmature bobjArmature = null;
|
||||||
|
BOBJLoader.Vertex vertex = null;
|
||||||
|
int n = 0;
|
||||||
|
|
||||||
|
for (String allLine : lines) {
|
||||||
|
String[] split = allLine.split("\\s");
|
||||||
|
String s = split[0];
|
||||||
|
switch (s) {
|
||||||
|
case "o":
|
||||||
|
list4.add(bobjMesh = new BOBJLoader.BOBJMesh(split[1]));
|
||||||
|
bobjArmature = null;
|
||||||
|
vertex = null;
|
||||||
|
break;
|
||||||
|
case "o_arm":
|
||||||
|
assert bobjMesh != null;
|
||||||
|
|
||||||
|
bobjMesh.armatureName = split[1];
|
||||||
|
break;
|
||||||
|
case "v":
|
||||||
|
if (vertex != null) {
|
||||||
|
vertex.eliminateTinyWeights();
|
||||||
|
}
|
||||||
|
|
||||||
|
list.add(vertex = new BOBJLoader.Vertex(Float.parseFloat(split[1]), Float.parseFloat(split[2]), Float.parseFloat(split[3])));
|
||||||
|
break;
|
||||||
|
case "vw":
|
||||||
|
float float1 = Float.parseFloat(split[2]);
|
||||||
|
if (float1 != 0.0F) {
|
||||||
|
assert vertex != null;
|
||||||
|
|
||||||
|
vertex.weights.add(new BOBJLoader.Weight(split[1], float1));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "vt":
|
||||||
|
list2.add(new Vector2f(Float.parseFloat(split[1]), Float.parseFloat(split[2])));
|
||||||
|
break;
|
||||||
|
case "vn":
|
||||||
|
list3.add(new Vector3f(Float.parseFloat(split[1]), Float.parseFloat(split[2]), Float.parseFloat(split[3])));
|
||||||
|
break;
|
||||||
|
case "f":
|
||||||
|
assert bobjMesh != null;
|
||||||
|
|
||||||
|
bobjMesh.faces.add(new BOBJLoader.Face(split[1], split[2], split[3]));
|
||||||
|
break;
|
||||||
|
case "arm_name":
|
||||||
|
n = 0;
|
||||||
|
bobjArmature = new BOBJArmature(split[1]);
|
||||||
|
map1.put(bobjArmature.name, bobjArmature);
|
||||||
|
break;
|
||||||
|
case "arm_action":
|
||||||
|
assert bobjArmature != null;
|
||||||
|
|
||||||
|
bobjArmature.action = split[1];
|
||||||
|
break;
|
||||||
|
case "arm_bone":
|
||||||
|
Vector3f vector3f = new Vector3f(Float.parseFloat(split[3]), Float.parseFloat(split[4]), Float.parseFloat(split[5]));
|
||||||
|
Matrix4f matrix4f = new Matrix4f();
|
||||||
|
float[] array = new float[16];
|
||||||
|
|
||||||
|
for (int i = 6; i < 22; ++i) {
|
||||||
|
array[i - 6] = Float.parseFloat(split[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
matrix4f.set(array).transpose();
|
||||||
|
|
||||||
|
assert bobjArmature != null;
|
||||||
|
|
||||||
|
bobjArmature.addBone(new BOBJBone(n++, split[1], split[2], vector3f, matrix4f));
|
||||||
|
break;
|
||||||
|
case "an":
|
||||||
|
map.put(split[1], bobjAction = new BOBJAction(split[1]));
|
||||||
|
break;
|
||||||
|
case "ao":
|
||||||
|
assert bobjAction != null;
|
||||||
|
|
||||||
|
bobjAction.groups.put(split[1], bobjGroup = new BOBJGroup(split[1]));
|
||||||
|
break;
|
||||||
|
case "ag":
|
||||||
|
assert bobjGroup != null;
|
||||||
|
|
||||||
|
bobjGroup.channels.add(bobjChannel = new BOBJChannel(split[1], Integer.parseInt(split[2])));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (s.equals("kf")) {
|
||||||
|
assert bobjChannel != null;
|
||||||
|
|
||||||
|
bobjChannel.frames.add(BOBJKeyframe.parse(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new BOBJLoader.BOBJData(list, list2, list3, list4, map, map1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, BOBJLoader.CompiledData> loadMeshes(BOBJLoader.BOBJData data) {
|
||||||
|
HashMap<String, BOBJLoader.CompiledData> map = new HashMap<>();
|
||||||
|
|
||||||
|
for (BOBJLoader.BOBJMesh bobjMesh : data.meshes) {
|
||||||
|
ArrayList<Integer> list = new ArrayList<>();
|
||||||
|
List<BOBJLoader.Face> faces = bobjMesh.faces;
|
||||||
|
int[] array = new int[faces.size() * 3 * 4];
|
||||||
|
float[] array2 = new float[faces.size() * 3 * 4];
|
||||||
|
float[] array3 = new float[faces.size() * 3 * 4];
|
||||||
|
float[] array4 = new float[faces.size() * 3 * 2];
|
||||||
|
float[] array5 = new float[faces.size() * 3 * 3];
|
||||||
|
Arrays.fill(array, -1);
|
||||||
|
Arrays.fill(array2, -1.0F);
|
||||||
|
int n = 0;
|
||||||
|
|
||||||
|
for (BOBJLoader.Face face : faces) {
|
||||||
|
BOBJLoader.IndexGroup[] idxGroups = face.idxGroups;
|
||||||
|
int length = idxGroups.length;
|
||||||
|
|
||||||
|
for (int i = 0; i < length; ++i) {
|
||||||
|
processFaceVertex(n, idxGroups[i], bobjMesh, data, list, array3, array4, array5, array2, array);
|
||||||
|
++n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
map.put(
|
||||||
|
bobjMesh.name, new BOBJLoader.CompiledData(array3, array4, array5, array2, array, ArrayUtils.toPrimitive(list.toArray(new Integer[0])), bobjMesh)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void processFaceVertex(
|
||||||
|
int n,
|
||||||
|
BOBJLoader.IndexGroup group,
|
||||||
|
BOBJLoader.BOBJMesh mesh,
|
||||||
|
BOBJLoader.BOBJData data,
|
||||||
|
List<Integer> list,
|
||||||
|
float[] array,
|
||||||
|
float[] array2,
|
||||||
|
float[] array3,
|
||||||
|
float[] array4,
|
||||||
|
int[] array5
|
||||||
|
) {
|
||||||
|
list.add(n);
|
||||||
|
if (group.idxPos >= 0) {
|
||||||
|
BOBJLoader.Vertex vertex = data.vertices.get(group.idxPos);
|
||||||
|
array[n * 4] = vertex.x;
|
||||||
|
array[n * 4 + 1] = vertex.y;
|
||||||
|
array[n * 4 + 2] = vertex.z;
|
||||||
|
array[n * 4 + 3] = 1.0F;
|
||||||
|
if (mesh != null) {
|
||||||
|
for (int i = 0; i < Math.min(vertex.weights.size(), 4); ++i) {
|
||||||
|
BOBJLoader.Weight weight = vertex.weights.get(i);
|
||||||
|
BOBJBone bobjBone = mesh.armature.bones.get(weight.name);
|
||||||
|
array4[n * 4 + i] = weight.factor;
|
||||||
|
array5[n * 4 + i] = bobjBone.index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (group.idxTextCoord >= 0) {
|
||||||
|
Vector2f vector2f = data.textures.get(group.idxTextCoord);
|
||||||
|
array2[n * 2] = vector2f.x;
|
||||||
|
array2[n * 2 + 1] = 1.0F - vector2f.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (group.idxVecNormal >= 0) {
|
||||||
|
Vector3f vector3f = data.normals.get(group.idxVecNormal);
|
||||||
|
array3[n * 3] = vector3f.x;
|
||||||
|
array3[n * 3 + 1] = vector3f.y;
|
||||||
|
array3[n * 3 + 2] = vector3f.z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class BOBJData {
|
||||||
|
public List<BOBJLoader.Vertex> vertices;
|
||||||
|
public List<Vector2f> textures;
|
||||||
|
public List<Vector3f> normals;
|
||||||
|
public List<BOBJLoader.BOBJMesh> meshes;
|
||||||
|
public Map<String, BOBJAction> actions;
|
||||||
|
public Map<String, BOBJArmature> armatures;
|
||||||
|
|
||||||
|
public BOBJData(
|
||||||
|
List<BOBJLoader.Vertex> vertices,
|
||||||
|
List<Vector2f> textures,
|
||||||
|
List<Vector3f> normals,
|
||||||
|
List<BOBJLoader.BOBJMesh> meshes,
|
||||||
|
Map<String, BOBJAction> actions,
|
||||||
|
Map<String, BOBJArmature> armatures
|
||||||
|
) {
|
||||||
|
this.vertices = vertices;
|
||||||
|
this.textures = textures;
|
||||||
|
this.normals = normals;
|
||||||
|
this.meshes = meshes;
|
||||||
|
this.actions = actions;
|
||||||
|
this.armatures = armatures;
|
||||||
|
|
||||||
|
for (BOBJLoader.BOBJMesh mesh : meshes) {
|
||||||
|
mesh.armature = armatures.get(mesh.armatureName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void release() {
|
||||||
|
this.vertices.clear();
|
||||||
|
this.textures.clear();
|
||||||
|
this.normals.clear();
|
||||||
|
this.meshes.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class BOBJMesh {
|
||||||
|
public String name;
|
||||||
|
public List<BOBJLoader.Face> faces = new ArrayList<>();
|
||||||
|
public String armatureName;
|
||||||
|
public BOBJArmature armature;
|
||||||
|
|
||||||
|
public BOBJMesh(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BOBJLoader.BOBJMesh add(int i, int j, int k) {
|
||||||
|
BOBJLoader.BOBJMesh bobjloader$bobjmesh = new BOBJLoader.BOBJMesh(this.name);
|
||||||
|
bobjloader$bobjmesh.armatureName = this.armatureName;
|
||||||
|
bobjloader$bobjmesh.armature = this.armature;
|
||||||
|
|
||||||
|
for (BOBJLoader.Face bobjloader$face : this.faces) {
|
||||||
|
bobjloader$bobjmesh.faces.add(bobjloader$face.add(i, j, k));
|
||||||
|
}
|
||||||
|
|
||||||
|
return bobjloader$bobjmesh;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class CompiledData {
|
||||||
|
public float[] posData;
|
||||||
|
public float[] texData;
|
||||||
|
public float[] normData;
|
||||||
|
public float[] weightData;
|
||||||
|
public int[] boneIndexData;
|
||||||
|
public int[] indexData;
|
||||||
|
public BOBJLoader.BOBJMesh mesh;
|
||||||
|
|
||||||
|
public CompiledData(
|
||||||
|
float[] posData, float[] texData, float[] normData, float[] weightData, int[] boneIndexData, int[] indexData, BOBJLoader.BOBJMesh mesh
|
||||||
|
) {
|
||||||
|
this.posData = posData;
|
||||||
|
this.texData = texData;
|
||||||
|
this.normData = normData;
|
||||||
|
this.weightData = weightData;
|
||||||
|
this.boneIndexData = boneIndexData;
|
||||||
|
this.indexData = indexData;
|
||||||
|
this.mesh = mesh;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Face {
|
||||||
|
public BOBJLoader.IndexGroup[] idxGroups = new BOBJLoader.IndexGroup[3];
|
||||||
|
|
||||||
|
public Face(String s, String s1, String s2) {
|
||||||
|
this.idxGroups[0] = this.parseLine(s);
|
||||||
|
this.idxGroups[1] = this.parseLine(s1);
|
||||||
|
this.idxGroups[2] = this.parseLine(s2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Face() {
|
||||||
|
}
|
||||||
|
|
||||||
|
private BOBJLoader.IndexGroup parseLine(String s) {
|
||||||
|
BOBJLoader.IndexGroup bobjloader$indexgroup = new BOBJLoader.IndexGroup();
|
||||||
|
String[] astring = s.split("/");
|
||||||
|
int i = astring.length;
|
||||||
|
bobjloader$indexgroup.idxPos = Integer.parseInt(astring[0]) - 1;
|
||||||
|
if (i > 1) {
|
||||||
|
String s1 = astring[1];
|
||||||
|
if (!s1.isEmpty()) {
|
||||||
|
bobjloader$indexgroup.idxTextCoord = Integer.parseInt(s1) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i > 2) {
|
||||||
|
bobjloader$indexgroup.idxVecNormal = Integer.parseInt(astring[2]) - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return bobjloader$indexgroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BOBJLoader.Face add(int i, int j, int k) {
|
||||||
|
BOBJLoader.Face bobjloader$face = new BOBJLoader.Face();
|
||||||
|
|
||||||
|
for (int l = 0; l < bobjloader$face.idxGroups.length; ++l) {
|
||||||
|
BOBJLoader.IndexGroup bobjloader$indexgroup = this.idxGroups[l];
|
||||||
|
bobjloader$face.idxGroups[l] = new BOBJLoader.IndexGroup(
|
||||||
|
bobjloader$indexgroup.idxPos + i, bobjloader$indexgroup.idxTextCoord + k, bobjloader$indexgroup.idxVecNormal + j
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return bobjloader$face;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class IndexGroup {
|
||||||
|
public static final int NO_VALUE = -1;
|
||||||
|
public int idxPos = -1;
|
||||||
|
public int idxTextCoord = -1;
|
||||||
|
public int idxVecNormal = -1;
|
||||||
|
|
||||||
|
public IndexGroup(int i, int j, int k) {
|
||||||
|
this.idxPos = i;
|
||||||
|
this.idxTextCoord = j;
|
||||||
|
this.idxVecNormal = k;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexGroup() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Vertex {
|
||||||
|
public float x;
|
||||||
|
public float y;
|
||||||
|
public float z;
|
||||||
|
public List<BOBJLoader.Weight> weights = new ArrayList<>();
|
||||||
|
|
||||||
|
public Vertex(float x, float y, float z) {
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void eliminateTinyWeights() {
|
||||||
|
this.weights.removeIf(weight -> (double) weight.factor < 0.05);
|
||||||
|
if (this.weights.size() > 0) {
|
||||||
|
float n = 0.0F;
|
||||||
|
|
||||||
|
for (BOBJLoader.Weight weight1 : this.weights) {
|
||||||
|
n += weight1.factor;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (n < 1.0F) {
|
||||||
|
BOBJLoader.Weight weight = this.weights.get(this.weights.size() - 1);
|
||||||
|
weight.factor += 1.0F - n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Weight {
|
||||||
|
public String name;
|
||||||
|
public float factor;
|
||||||
|
|
||||||
|
public Weight(String name, float factor) {
|
||||||
|
this.name = name;
|
||||||
|
this.factor = factor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,104 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJBone;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.ParticleType;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class Emote {
|
||||||
|
public final String id;
|
||||||
|
public final String title;
|
||||||
|
public int looping = 1;
|
||||||
|
public Icon icon = Icon.DEFAULT;
|
||||||
|
public Random rand = new Random();
|
||||||
|
public List<String> armatures = new ArrayList<>();
|
||||||
|
|
||||||
|
public Emote(String s, String s1) {
|
||||||
|
this.id = s;
|
||||||
|
this.title = s1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Emote looping(int i) {
|
||||||
|
this.looping = i;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Emote armatures(String... astring) {
|
||||||
|
Collections.addAll(this.armatures, astring);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void progressAnimation(IEmoteAccessor var1, BOBJArmature var2, int var3, float var4) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startAnimation(IEmoteAccessor iemoteaccessor) {
|
||||||
|
for (String s : this.armatures) {
|
||||||
|
iemoteaccessor.getData().armatures.get(s).enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopAnimation(IEmoteAccessor iemoteaccessor) {
|
||||||
|
for (String s : this.armatures) {
|
||||||
|
iemoteaccessor.getData().armatures.get(s).enabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Emote getDynamicEmote() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Emote getDynamicEmote(String var1) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Emote set(String var1) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKey() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getActionName() {
|
||||||
|
return "emote_" + this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void spawnParticle(IEmoteAccessor iemoteaccessor, ParticleType particletype, double d0, double d1, double d2, float f) {
|
||||||
|
double d3 = this.rand.nextDouble() * (double) f * 2.0 - (double) f;
|
||||||
|
double d4 = this.rand.nextDouble() * (double) f * 2.0 - (double) f;
|
||||||
|
double d5 = this.rand.nextDouble() * (double) f * 2.0 - (double) f;
|
||||||
|
iemoteaccessor.spawnParticle(particletype, d0, d1, d2, d3, d4, d5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector4f direction(IEmoteAccessor iemoteaccessor, BOBJBone bobjbone, float f) {
|
||||||
|
return this.direction(iemoteaccessor, bobjbone, 0.0F, 0.1F, 0.0F, f);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector4f direction(IEmoteAccessor iemoteaccessor, BOBJBone bobjbone, float f, float f1, float f2, float f3) {
|
||||||
|
Vector4f vector4f = iemoteaccessor.calcPosition(bobjbone, 0.0F, 0.0F, 0.0F, f3);
|
||||||
|
float f4 = vector4f.x;
|
||||||
|
float f5 = vector4f.y;
|
||||||
|
float f6 = vector4f.z;
|
||||||
|
vector4f = iemoteaccessor.calcPosition(bobjbone, f, f1, f2, f3);
|
||||||
|
vector4f.set(vector4f.x - f4, vector4f.y - f5, vector4f.z - f6, vector4f.w);
|
||||||
|
return vector4f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector4f position(IEmoteAccessor iemoteaccessor, BOBJArmature bobjarmature, String s, float f, float f1, float f2, float f3) {
|
||||||
|
return iemoteaccessor.calcPosition(bobjarmature.bones.get(s), f, f1, f2, f3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float rand(float f) {
|
||||||
|
return this.rand.nextFloat() * f - f / 2.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int tick(int i) {
|
||||||
|
return (int) ((float) i / 30.0F * 20.0F);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.Gui;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class Icon {
|
||||||
|
public static final Icon DEFAULT = new Icon(new ResourceLocation("silentclient/emotes/icons/1.png"), 53, 85);
|
||||||
|
public ResourceLocation icon;
|
||||||
|
public int width;
|
||||||
|
public int height;
|
||||||
|
|
||||||
|
public Icon(ResourceLocation aj, int i, int j) {
|
||||||
|
this.set(aj, i, j);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(ResourceLocation aj, int i, int j) {
|
||||||
|
this.icon = aj;
|
||||||
|
this.width = i;
|
||||||
|
this.height = j;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void render(int i, int j) {
|
||||||
|
if (this.isIconPresent()) {
|
||||||
|
this.bindTexture();
|
||||||
|
Gui.drawModalRectWithCustomSizedTexture(i, j, 0.0F, 0.0F, this.width, this.height, (float) this.width, (float) this.height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void render(int i, int j, float f) {
|
||||||
|
if (this.isIconPresent()) {
|
||||||
|
int k = (int) ((float) this.width * f);
|
||||||
|
int l = (int) ((float) this.height * f);
|
||||||
|
this.bindTexture();
|
||||||
|
Gui.drawModalRectWithCustomSizedTexture(i - k / 2, j, 0.0F, 0.0F, k, l, (float) k, (float) l);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isIconPresent() {
|
||||||
|
return this.icon != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void bindTexture() {
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user