mirror of
https://github.com/refactorinqq/SLC-1.8.9.git
synced 2024-11-10 07:31:32 +01:00
commit
f7f2afb373
4
.gitignore
vendored
4
.gitignore
vendored
@ -13,7 +13,9 @@ autobuilder/temp/
|
|||||||
.idea/modules.xml
|
.idea/modules.xml
|
||||||
.idea/jarRepositories.xml
|
.idea/jarRepositories.xml
|
||||||
.idea/compiler.xml
|
.idea/compiler.xml
|
||||||
.idea/libraries/
|
.idea/libraries
|
||||||
|
.idea/misc.xml
|
||||||
|
.idea/gradle.xml
|
||||||
*.iws
|
*.iws
|
||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
<option name="linkedExternalProjectsSettings">
|
<option name="linkedExternalProjectsSettings">
|
||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
<option name="gradleJvm" value="zulu-1.8 (4)" />
|
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="FrameworkDetectionExcludesConfiguration">
|
<component name="FrameworkDetectionExcludesConfiguration">
|
||||||
<file type="web" url="file://$PROJECT_DIR$" />
|
<file type="web" url="file://$PROJECT_DIR$" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="zulu-1.8 (3)" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="zulu-1.8 (4)" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
BIN
autobuilder/assets/asm-tree-5.2.jar
Normal file
BIN
autobuilder/assets/asm-tree-5.2.jar
Normal file
Binary file not shown.
@ -72,6 +72,8 @@ async function build() {
|
|||||||
console.log(`Extracting ${lib}`);
|
console.log(`Extracting ${lib}`);
|
||||||
await unzip(assetsPaths.libs + `/${lib}`, tempPaths.jar);
|
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");
|
console.log("Cleaning up extra files in JAR");
|
||||||
try {
|
try {
|
||||||
|
BIN
libs/LWJGL-Patched-bf1d105853.jar
Normal file
BIN
libs/LWJGL-Patched-bf1d105853.jar
Normal file
Binary file not shown.
BIN
libs/joml-1.10.5.jar
Normal file
BIN
libs/joml-1.10.5.jar
Normal file
Binary file not shown.
BIN
libs/lwjgl-nanovg-natives-macos-arm64.jar
Normal file
BIN
libs/lwjgl-nanovg-natives-macos-arm64.jar
Normal file
Binary file not shown.
BIN
libs/lwjgl-nanovg-natives-macos.jar
Normal file
BIN
libs/lwjgl-nanovg-natives-macos.jar
Normal file
Binary file not shown.
BIN
libs/lwjgl-nanovg-natives-windows-x86.jar
Normal file
BIN
libs/lwjgl-nanovg-natives-windows-x86.jar
Normal file
Binary file not shown.
BIN
libs/lwjgl-nanovg-natives-windows.jar
Normal file
BIN
libs/lwjgl-nanovg-natives-windows.jar
Normal file
Binary file not shown.
BIN
libs/lwjgl-natives-macos-arm64.jar
Normal file
BIN
libs/lwjgl-natives-macos-arm64.jar
Normal file
Binary file not shown.
BIN
libs/lwjgl-natives-macos.jar
Normal file
BIN
libs/lwjgl-natives-macos.jar
Normal file
Binary file not shown.
BIN
libs/lwjgl-natives-windows-x86.jar
Normal file
BIN
libs/lwjgl-natives-windows-x86.jar
Normal file
Binary file not shown.
BIN
libs/lwjgl-natives-windows.jar
Normal file
BIN
libs/lwjgl-natives-windows.jar
Normal file
Binary file not shown.
BIN
libs/lwjgl-stb-natives-macos-arm64.jar
Normal file
BIN
libs/lwjgl-stb-natives-macos-arm64.jar
Normal file
Binary file not shown.
BIN
libs/lwjgl-stb-natives-macos.jar
Normal file
BIN
libs/lwjgl-stb-natives-macos.jar
Normal file
Binary file not shown.
BIN
libs/lwjgl-stb-natives-windows-x86.jar
Normal file
BIN
libs/lwjgl-stb-natives-windows-x86.jar
Normal file
Binary file not shown.
BIN
libs/lwjgl-stb-natives-windows.jar
Normal file
BIN
libs/lwjgl-stb-natives-windows.jar
Normal file
Binary file not shown.
BIN
libs/lwjgl-tinyfd-natives-macos-arm64.jar
Normal file
BIN
libs/lwjgl-tinyfd-natives-macos-arm64.jar
Normal file
Binary file not shown.
BIN
libs/lwjgl-tinyfd-natives-macos.jar
Normal file
BIN
libs/lwjgl-tinyfd-natives-macos.jar
Normal file
Binary file not shown.
BIN
libs/lwjgl-tinyfd-natives-windows-x86.jar
Normal file
BIN
libs/lwjgl-tinyfd-natives-windows-x86.jar
Normal file
Binary file not shown.
BIN
libs/lwjgl-tinyfd-natives-windows.jar
Normal file
BIN
libs/lwjgl-tinyfd-natives-windows.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();
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,7 @@ import net.minecraft.client.multiplayer.ServerData;
|
|||||||
import net.minecraft.client.multiplayer.ServerList;
|
import net.minecraft.client.multiplayer.ServerList;
|
||||||
import net.minecraft.client.resources.data.IMetadataSerializer;
|
import net.minecraft.client.resources.data.IMetadataSerializer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.Session;
|
||||||
import net.silentclient.client.config.ConfigManager;
|
import net.silentclient.client.config.ConfigManager;
|
||||||
import net.silentclient.client.cosmetics.Cosmetics;
|
import net.silentclient.client.cosmetics.Cosmetics;
|
||||||
import net.silentclient.client.event.EventManager;
|
import net.silentclient.client.event.EventManager;
|
||||||
@ -27,6 +28,7 @@ import net.silentclient.client.keybinds.KeyBindManager;
|
|||||||
import net.silentclient.client.mixin.SilentClientTweaker;
|
import net.silentclient.client.mixin.SilentClientTweaker;
|
||||||
import net.silentclient.client.mixin.accessors.MinecraftAccessor;
|
import net.silentclient.client.mixin.accessors.MinecraftAccessor;
|
||||||
import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt;
|
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.ModInstances;
|
||||||
import net.silentclient.client.mods.SettingsManager;
|
import net.silentclient.client.mods.SettingsManager;
|
||||||
import net.silentclient.client.mods.settings.CosmeticsMod;
|
import net.silentclient.client.mods.settings.CosmeticsMod;
|
||||||
@ -35,6 +37,7 @@ import net.silentclient.client.mods.settings.GeneralMod;
|
|||||||
import net.silentclient.client.mods.util.PingSource;
|
import net.silentclient.client.mods.util.PingSource;
|
||||||
import net.silentclient.client.mods.util.Server;
|
import net.silentclient.client.mods.util.Server;
|
||||||
import net.silentclient.client.mods.util.Utils;
|
import net.silentclient.client.mods.util.Utils;
|
||||||
|
import net.silentclient.client.nanovg.UI;
|
||||||
import net.silentclient.client.premium.PremiumCosmeticsGui;
|
import net.silentclient.client.premium.PremiumCosmeticsGui;
|
||||||
import net.silentclient.client.premium.PremiumUtils;
|
import net.silentclient.client.premium.PremiumUtils;
|
||||||
import net.silentclient.client.skillissue.SkillIssue;
|
import net.silentclient.client.skillissue.SkillIssue;
|
||||||
@ -60,7 +63,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class Client {
|
public class Client {
|
||||||
public static final Logger logger = LogManager.getLogger("SC");
|
public static final Logger logger = LogManager.getLogger("SC");
|
||||||
private final String version = "2.0.1";
|
private final String version = "2.1.0";
|
||||||
|
|
||||||
private static final Client INSTANCE = new Client();
|
private static final Client INSTANCE = new Client();
|
||||||
public static final Client getInstance() {
|
public static final Client getInstance() {
|
||||||
@ -201,6 +204,10 @@ public class Client {
|
|||||||
|
|
||||||
if(acc != null) {
|
if(acc != null) {
|
||||||
Client.getInstance().setAccount(acc.getAccount());
|
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");
|
logger.info("STARTING > settings-manager");
|
||||||
settingsManager = new SettingsManager();
|
settingsManager = new SettingsManager();
|
||||||
@ -280,10 +287,12 @@ public class Client {
|
|||||||
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(mod.getIcon()));
|
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(mod.getIcon()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
logger.info("STARTING > ui");
|
||||||
|
UI.init();
|
||||||
logger.info("STARTING > servers");
|
logger.info("STARTING > servers");
|
||||||
ArrayList<FeaturedServers.FeaturedServerInfo> servers = FeaturedServers.get();
|
ArrayList<FeaturedServers.FeaturedServerInfo> servers = FeaturedServers.get();
|
||||||
featuredServers.clear();
|
featuredServers.clear();
|
||||||
if(servers != null && servers != null) {
|
if(servers != null) {
|
||||||
servers.forEach(server -> {
|
servers.forEach(server -> {
|
||||||
featuredServers.add(new ServerDataFeature(server.getName(), server.getIp()));
|
featuredServers.add(new ServerDataFeature(server.getName(), server.getIp()));
|
||||||
});
|
});
|
||||||
@ -409,6 +418,7 @@ public class Client {
|
|||||||
Client.getInstance().getCosmetics().setMyBandanas(cosmetics.getAccount().getCosmetics().getBandanas());
|
Client.getInstance().getCosmetics().setMyBandanas(cosmetics.getAccount().getCosmetics().getBandanas());
|
||||||
Client.getInstance().getCosmetics().setMyHats(cosmetics.getAccount().getCosmetics().getHats());
|
Client.getInstance().getCosmetics().setMyHats(cosmetics.getAccount().getCosmetics().getHats());
|
||||||
Client.getInstance().getCosmetics().setMyShields(cosmetics.getAccount().getCosmetics().getShields());
|
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 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");
|
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) {
|
if(Minecraft.getMinecraft().thePlayer != null) {
|
||||||
@ -673,7 +683,7 @@ public class Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTest() {
|
public boolean isTest() {
|
||||||
return getBuildData().getBranch().equals("test");
|
return getBuildData().getBranch().equals("TEST2");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDebug() {
|
public boolean isDebug() {
|
||||||
|
@ -8,4 +8,12 @@ public class ServerDataFeature extends ServerData {
|
|||||||
public ServerDataFeature(String serverName, String serverIp) {
|
public ServerDataFeature(String serverName, String serverIp) {
|
||||||
super(serverName, serverIp, false);
|
super(serverName, serverIp, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resetData() {
|
||||||
|
this.field_78841_f = false;
|
||||||
|
this.pingToServer = 0;
|
||||||
|
this.populationInfo = null;
|
||||||
|
this.playerList = null;
|
||||||
|
this.serverMOTD = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import net.silentclient.client.utils.MenuBlurUtils;
|
|||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
@ -190,6 +191,11 @@ public final class ConfigManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(set.isCellGrid()) {
|
||||||
|
try {
|
||||||
|
set.setCells(stringToBooleanArray(args[3]));
|
||||||
|
} catch (Exception ignored) {}
|
||||||
|
}
|
||||||
if (set.isCombo()) {
|
if (set.isCombo()) {
|
||||||
try {
|
try {
|
||||||
if(set.getOptions().contains(args[3])) {
|
if(set.getOptions().contains(args[3])) {
|
||||||
@ -247,6 +253,32 @@ public final class ConfigManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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() {
|
public void save() {
|
||||||
Client.logger.info("Saving Config: " + this.configFile.getName());
|
Client.logger.info("Saving Config: " + this.configFile.getName());
|
||||||
try(PrintWriter writer = new PrintWriter(this.configFile)) {
|
try(PrintWriter writer = new PrintWriter(this.configFile)) {
|
||||||
@ -277,6 +309,9 @@ public final class ConfigManager {
|
|||||||
if(set.isKeybind()) {
|
if(set.isKeybind()) {
|
||||||
writer.println("SET:" + set.getName() + ":" + set.getParentMod().getName() + ":" + set.getKeybind());
|
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()) {
|
for(AutoTextCommand command : Client.getInstance().getModInstances().getAutoText().getCommands()) {
|
||||||
|
@ -30,6 +30,7 @@ public class Cosmetics {
|
|||||||
public Map<Number, HatData> hats = new HashMap<>();
|
public Map<Number, HatData> hats = new HashMap<>();
|
||||||
public Map<Number, ShieldData> shields = new HashMap<>();
|
public Map<Number, ShieldData> shields = new HashMap<>();
|
||||||
public Map<Number, StaticResourceLocation> icons = 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> myIcons = new ArrayList<CosmeticItem>();
|
||||||
public ArrayList<CosmeticItem> myWings = new ArrayList<CosmeticItem>();
|
public ArrayList<CosmeticItem> myWings = new ArrayList<CosmeticItem>();
|
||||||
@ -37,6 +38,7 @@ public class Cosmetics {
|
|||||||
public ArrayList<CosmeticItem> myBandanas = new ArrayList<CosmeticItem>();
|
public ArrayList<CosmeticItem> myBandanas = new ArrayList<CosmeticItem>();
|
||||||
public ArrayList<CosmeticItem> myHats = new ArrayList<CosmeticItem>();
|
public ArrayList<CosmeticItem> myHats = new ArrayList<CosmeticItem>();
|
||||||
public ArrayList<CosmeticItem> myShields = new ArrayList<CosmeticItem>();
|
public ArrayList<CosmeticItem> myShields = new ArrayList<CosmeticItem>();
|
||||||
|
public ArrayList<CosmeticItem> myEmotes = new ArrayList<CosmeticItem>();
|
||||||
|
|
||||||
|
|
||||||
public StaticResourceLocation defaultIcon;
|
public StaticResourceLocation defaultIcon;
|
||||||
@ -132,6 +134,14 @@ public class Cosmetics {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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");
|
Client.logger.info("STARTING > cosmeitcs > outfits");
|
||||||
Outfits.loadOutfits();
|
Outfits.loadOutfits();
|
||||||
}
|
}
|
||||||
@ -157,6 +167,7 @@ public class Cosmetics {
|
|||||||
Client.getInstance().getCosmetics().setMyBandanas(cosmetics.getAccount().getCosmetics().getBandanas());
|
Client.getInstance().getCosmetics().setMyBandanas(cosmetics.getAccount().getCosmetics().getBandanas());
|
||||||
Client.getInstance().getCosmetics().setMyHats(cosmetics.getAccount().getCosmetics().getHats());
|
Client.getInstance().getCosmetics().setMyHats(cosmetics.getAccount().getCosmetics().getHats());
|
||||||
Client.getInstance().getCosmetics().setMyShields(cosmetics.getAccount().getCosmetics().getShields());
|
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 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");
|
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) {
|
if(Minecraft.getMinecraft().thePlayer != null) {
|
||||||
@ -178,6 +189,7 @@ public class Cosmetics {
|
|||||||
Client.getInstance().getCosmetics().setMyBandanas(cosmetics.getAccount().getCosmetics().getBandanas());
|
Client.getInstance().getCosmetics().setMyBandanas(cosmetics.getAccount().getCosmetics().getBandanas());
|
||||||
Client.getInstance().getCosmetics().setMyHats(cosmetics.getAccount().getCosmetics().getHats());
|
Client.getInstance().getCosmetics().setMyHats(cosmetics.getAccount().getCosmetics().getHats());
|
||||||
Client.getInstance().getCosmetics().setMyShields(cosmetics.getAccount().getCosmetics().getShields());
|
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 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");
|
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) {
|
if(Minecraft.getMinecraft().thePlayer != null) {
|
||||||
@ -222,6 +234,14 @@ public class Cosmetics {
|
|||||||
return myShields;
|
return myShields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList<CosmeticItem> getMyEmotes() {
|
||||||
|
return myEmotes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMyEmotes(ArrayList<CosmeticItem> myEmotes) {
|
||||||
|
this.myEmotes = myEmotes;
|
||||||
|
}
|
||||||
|
|
||||||
public static PlayerResponse.Account.Cosmetics getAllCosmetics() {
|
public static PlayerResponse.Account.Cosmetics getAllCosmetics() {
|
||||||
try {
|
try {
|
||||||
InputStream in = Client.getInstance().getClass().getResourceAsStream("/assets/minecraft/silentclient/cosmetics.json");
|
InputStream in = Client.getInstance().getClass().getResourceAsStream("/assets/minecraft/silentclient/cosmetics.json");
|
||||||
|
@ -305,7 +305,7 @@ public class CosmeticsGui extends SilentScreen {
|
|||||||
scrollHelper.setStep(5);
|
scrollHelper.setStep(5);
|
||||||
scrollHelper.setElementsHeight((items != null ? items.size() : 0) * 35);
|
scrollHelper.setElementsHeight((items != null ? items.size() : 0) * 35);
|
||||||
scrollHelper.setMaxScroll(height - 25);
|
scrollHelper.setMaxScroll(height - 25);
|
||||||
scrollHelper.setSpeed(100);
|
scrollHelper.setSpeed(200);
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||||
ScaledResolution r = new ScaledResolution(mc);
|
ScaledResolution r = new ScaledResolution(mc);
|
||||||
|
@ -72,7 +72,7 @@ public class OutfitsGui extends SilentScreen {
|
|||||||
scrollHelper.setStep(5);
|
scrollHelper.setStep(5);
|
||||||
scrollHelper.setElementsHeight((float) Math.ceil((Outfits.getOutfits().size() + 3) / 3) * 85);
|
scrollHelper.setElementsHeight((float) Math.ceil((Outfits.getOutfits().size() + 3) / 3) * 85);
|
||||||
scrollHelper.setMaxScroll(height - 20);
|
scrollHelper.setMaxScroll(height - 20);
|
||||||
scrollHelper.setSpeed(100);
|
scrollHelper.setSpeed(200);
|
||||||
scrollHelper.setFlag(true);
|
scrollHelper.setFlag(true);
|
||||||
float scrollY = scrollHelper.getScroll();
|
float scrollY = scrollHelper.getScroll();
|
||||||
RenderUtil.drawRoundedRect(x, y, width, height, 4, Theme.backgroundColor().getRGB());
|
RenderUtil.drawRoundedRect(x, y, width, height, 4, Theme.backgroundColor().getRGB());
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -1,32 +0,0 @@
|
|||||||
package net.silentclient.client.emotes;
|
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelBiped;
|
|
||||||
import net.silentclient.client.emotes.animation.EmoteSimpleAnimation;
|
|
||||||
|
|
||||||
public class DabEmote {
|
|
||||||
private EmoteSimpleAnimation bipedRightArm = new EmoteSimpleAnimation();
|
|
||||||
private EmoteSimpleAnimation bipedLeftArm = new EmoteSimpleAnimation();
|
|
||||||
private EmoteSimpleAnimation bipedHead = new EmoteSimpleAnimation();
|
|
||||||
private EmoteSimpleAnimation modelRightArm = new EmoteSimpleAnimation();
|
|
||||||
private EmoteSimpleAnimation modelRightArmWear = new EmoteSimpleAnimation();
|
|
||||||
private EmoteSimpleAnimation modelLeftArm = new EmoteSimpleAnimation();
|
|
||||||
private EmoteSimpleAnimation modelLeftArmWear = new EmoteSimpleAnimation();
|
|
||||||
private EmoteSimpleAnimation modelHead = new EmoteSimpleAnimation();
|
|
||||||
private EmoteSimpleAnimation modelHeadWear = new EmoteSimpleAnimation();
|
|
||||||
|
|
||||||
public void initEmoteBiped(ModelBiped modelBiped) {
|
|
||||||
bipedHead.getX().setValue(modelBiped.bipedHead.rotateAngleX);
|
|
||||||
bipedHead.getY().setValue(modelBiped.bipedHead.rotateAngleY);
|
|
||||||
bipedHead.getZ().setValue(modelBiped.bipedHead.rotateAngleZ);
|
|
||||||
bipedRightArm.getX().setValue(modelBiped.bipedRightArm.rotateAngleX);
|
|
||||||
bipedRightArm.getY().setValue(modelBiped.bipedRightArm.rotateAngleY);
|
|
||||||
bipedRightArm.getZ().setValue(modelBiped.bipedRightArm.rotateAngleZ);
|
|
||||||
bipedLeftArm.getX().setValue(modelBiped.bipedLeftArm.rotateAngleX);
|
|
||||||
bipedLeftArm.getY().setValue(modelBiped.bipedLeftArm.rotateAngleY);
|
|
||||||
bipedLeftArm.getZ().setValue(modelBiped.bipedLeftArm.rotateAngleZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void renderEmoteBiped(ModelBiped modelBiped) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
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;
|
||||||
|
}
|
||||||
|
}
|
@ -1,21 +0,0 @@
|
|||||||
package net.silentclient.client.emotes.animation;
|
|
||||||
|
|
||||||
import net.silentclient.client.gui.animation.SimpleAnimation;
|
|
||||||
|
|
||||||
public class EmoteSimpleAnimation {
|
|
||||||
private SimpleAnimation xAnimation = new SimpleAnimation(0);
|
|
||||||
private SimpleAnimation yAnimation = new SimpleAnimation(0);
|
|
||||||
private SimpleAnimation zAnimation = new SimpleAnimation(0);
|
|
||||||
|
|
||||||
public SimpleAnimation getX() {
|
|
||||||
return xAnimation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SimpleAnimation getY() {
|
|
||||||
return yAnimation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SimpleAnimation getZ() {
|
|
||||||
return zAnimation;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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() {
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.animation.AnimationMeshConfig;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PropEmote extends Emote {
|
||||||
|
public List<String> props = new ArrayList<>();
|
||||||
|
|
||||||
|
public PropEmote(String s, String s1) {
|
||||||
|
super(s, s1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PropEmote props(String... astring) {
|
||||||
|
Collections.addAll(this.props, astring);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startAnimation(IEmoteAccessor iemoteaccessor) {
|
||||||
|
super.startAnimation(iemoteaccessor);
|
||||||
|
this.setVisible(iemoteaccessor, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stopAnimation(IEmoteAccessor iemoteaccessor) {
|
||||||
|
super.stopAnimation(iemoteaccessor);
|
||||||
|
this.setVisible(iemoteaccessor, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVisible(IEmoteAccessor iemoteaccessor, boolean flag) {
|
||||||
|
for (String s : this.props) {
|
||||||
|
AnimationMeshConfig animationmeshconfig = iemoteaccessor.getConfig(s);
|
||||||
|
if (animationmeshconfig != null) {
|
||||||
|
animationmeshconfig.visible = flag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.accessor;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.silentclient.client.emotes.animation.AnimationMeshConfig;
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJBone;
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJLoader;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
public interface IEmoteAccessor {
|
||||||
|
Vector4f calcPosition(BOBJBone var1, float var2, float var3, float var4, float var5);
|
||||||
|
|
||||||
|
AnimationMeshConfig getConfig(String var1);
|
||||||
|
|
||||||
|
BOBJLoader.BOBJData getData();
|
||||||
|
|
||||||
|
void setupMatrix(BOBJBone var1);
|
||||||
|
|
||||||
|
void setItem(ItemStack var1);
|
||||||
|
|
||||||
|
void setItemScale(float var1);
|
||||||
|
|
||||||
|
void setHand(boolean var1);
|
||||||
|
|
||||||
|
void spawnParticle(ParticleType var1, double var2, double var4, double var6, double var8, double var10, double var12);
|
||||||
|
|
||||||
|
void spawnItemParticle(ItemStack var1, double var2, double var4, double var6, double var8, double var10, double var12);
|
||||||
|
|
||||||
|
void renderBlock(ItemStack var1);
|
||||||
|
|
||||||
|
void throwSnowball(double var1, double var3, double var5, double var7, double var9, double var11);
|
||||||
|
|
||||||
|
void createFirework(double var1, double var3, double var5, double var7, double var9, double var11, NBTTagCompound var13);
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.accessor;
|
||||||
|
|
||||||
|
public enum ParticleType {
|
||||||
|
WATER_DROP,
|
||||||
|
SPELL_MOB,
|
||||||
|
END_ROD,
|
||||||
|
EXPLODE,
|
||||||
|
SMOKE,
|
||||||
|
SNOW_PUFF,
|
||||||
|
FLAME,
|
||||||
|
CLOUD,
|
||||||
|
POPCORN,
|
||||||
|
SALT
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.christmas;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.emoticons.PropEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.ParticleType;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
public class ChimneyEmote extends PropEmote {
|
||||||
|
public ChimneyEmote(String s, String s1) {
|
||||||
|
super(s, s1);
|
||||||
|
this.props("prop_chimney");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressAnimation(IEmoteAccessor iemoteaccessor, BOBJArmature bobjarmature, int i, float f) {
|
||||||
|
int j = this.rand.nextInt(6) + 4;
|
||||||
|
if (i % j == 0 && i > 10 && i < 143) {
|
||||||
|
Vector4f vector4f = this.position(iemoteaccessor, bobjarmature, "misc_bone_1", 0.0F, 0.4F, 0.0F, f);
|
||||||
|
|
||||||
|
for (int k = 0; k < 25; ++k) {
|
||||||
|
float f1 = vector4f.x + this.rand(0.3F);
|
||||||
|
float f2 = vector4f.z + this.rand(0.3F);
|
||||||
|
iemoteaccessor.spawnParticle(
|
||||||
|
ParticleType.SMOKE,
|
||||||
|
f1,
|
||||||
|
vector4f.y,
|
||||||
|
f2,
|
||||||
|
this.rand(0.05F),
|
||||||
|
0.025F + this.rand(0.01F),
|
||||||
|
this.rand(0.05F)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.christmas;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJBone;
|
||||||
|
import net.silentclient.client.emotes.emoticons.PropEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
public class CoalEmote extends PropEmote {
|
||||||
|
private final ItemStack coal = new ItemStack(Items.coal);
|
||||||
|
|
||||||
|
public CoalEmote(String s, String s1) {
|
||||||
|
super(s, s1);
|
||||||
|
this.props("prop_grave_base");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startAnimation(IEmoteAccessor iemoteaccessor) {
|
||||||
|
super.startAnimation(iemoteaccessor);
|
||||||
|
iemoteaccessor.getConfig("prop_grave_base").texture = new ResourceLocation("textures/blocks/coal_block.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressAnimation(IEmoteAccessor iemoteaccessor, BOBJArmature bobjarmature, int i, float f) {
|
||||||
|
boolean flag = i == this.tick(116) || i == this.tick(137) || i == this.tick(157) || i == this.tick(179);
|
||||||
|
boolean flag1 = i == this.tick(128) || i == this.tick(148) || i == this.tick(168) || i == this.tick(193);
|
||||||
|
if (flag || flag1) {
|
||||||
|
BOBJBone bobjbone = bobjarmature.bones.get(flag1 ? "low_left_arm.end" : "low_right_arm.end");
|
||||||
|
Vector4f vector4f = this.direction(iemoteaccessor, bobjbone, f);
|
||||||
|
float f1 = vector4f.x * 3.5F + this.rand(0.1F);
|
||||||
|
float f2 = vector4f.y * 3.5F + this.rand(0.1F);
|
||||||
|
float f3 = vector4f.z * 3.5F + this.rand(0.1F);
|
||||||
|
Vector4f vector4f1 = iemoteaccessor.calcPosition(bobjbone, 0.0F, 0.25F, 0.0F, f);
|
||||||
|
|
||||||
|
for (int j = 0; j < 15; ++j) {
|
||||||
|
iemoteaccessor.spawnItemParticle(
|
||||||
|
this.coal,
|
||||||
|
vector4f1.x + this.rand(0.2F),
|
||||||
|
vector4f1.y,
|
||||||
|
vector4f1.z + this.rand(0.2F),
|
||||||
|
f1,
|
||||||
|
f2,
|
||||||
|
f3
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.christmas;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.emoticons.PropEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.ParticleType;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
public class IceSkatingEmote extends PropEmote {
|
||||||
|
public IceSkatingEmote(String s, String s1) {
|
||||||
|
super(s, s1);
|
||||||
|
this.props("prop_skates");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressAnimation(IEmoteAccessor iemoteaccessor, BOBJArmature bobjarmature, int i, float var4) {
|
||||||
|
boolean flag = this.tick(40) < i && i < this.tick(90);
|
||||||
|
boolean flag1 = this.tick(95) < i && i < this.tick(140);
|
||||||
|
if ((flag || flag1) && i % 5 == 0) {
|
||||||
|
String s = flag ? "low_leg_right" : "low_left_leg";
|
||||||
|
Vector4f vector4f = this.position(iemoteaccessor, bobjarmature, s, 0.0F, 0.3125F, 0.0F, 0.1F);
|
||||||
|
|
||||||
|
for (int j = 0; j < 2; ++j) {
|
||||||
|
this.spawnParticle(iemoteaccessor, ParticleType.END_ROD, vector4f.x, vector4f.y, vector4f.z, 0.05F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.christmas;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.emoticons.PropEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.ParticleType;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
public class IcebergEmote extends PropEmote {
|
||||||
|
public IcebergEmote(String s, String s1) {
|
||||||
|
super(s, s1);
|
||||||
|
this.props("prop_iceberg");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressAnimation(IEmoteAccessor iemoteaccessor, BOBJArmature bobjarmature, int i, float f) {
|
||||||
|
super.progressAnimation(iemoteaccessor, bobjarmature, i, f);
|
||||||
|
if (i <= 60 && i >= 40 && i % 2 == 0) {
|
||||||
|
int j = (i - 40) / 2;
|
||||||
|
Vector4f vector4f = this.position(iemoteaccessor, bobjarmature, "anchor", 0.0F, 0.0F, 0.0F, f);
|
||||||
|
float f1 = 0.6F;
|
||||||
|
float f2 = 1.0F - Math.abs((float) (i - 40) / 20.0F - 0.5F) * 2.0F;
|
||||||
|
f1 *= f2 * f2 * f2 * 0.5F + 0.5F;
|
||||||
|
|
||||||
|
for (int k = 0; k < 64; ++k) {
|
||||||
|
float f3 = (float) Math.cos((double) ((float) k / 64.0F) * Math.PI * 2.0) * f1 + this.rand(0.1F);
|
||||||
|
float f4 = (float) Math.sin((double) ((float) k / 64.0F) * Math.PI * 2.0) * f1 + this.rand(0.1F);
|
||||||
|
this.spawnParticle(
|
||||||
|
iemoteaccessor,
|
||||||
|
ParticleType.END_ROD,
|
||||||
|
vector4f.x + f3,
|
||||||
|
(double) vector4f.y + (double) ((float) j / 9.0F) * 1.8 - 0.5 + (double) this.rand(0.1F),
|
||||||
|
vector4f.z + f4,
|
||||||
|
0.025F
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,91 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.christmas;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.emoticons.Emote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.PropEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemEnchantedBook;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
public class PresentEmote extends PropEmote {
|
||||||
|
public int item = -1;
|
||||||
|
|
||||||
|
public PresentEmote(String s, String s1) {
|
||||||
|
super(s, s1);
|
||||||
|
this.props("prop_present");
|
||||||
|
}
|
||||||
|
|
||||||
|
public PresentEmote(String s, String s1, int i) {
|
||||||
|
this(s, s1);
|
||||||
|
this.item = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Emote getDynamicEmote() {
|
||||||
|
return this.getDynamicEmote(String.valueOf(this.rand.nextInt(6) + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Emote getDynamicEmote(String s) {
|
||||||
|
int i = -1;
|
||||||
|
|
||||||
|
try {
|
||||||
|
i = Integer.parseInt(s);
|
||||||
|
} catch (Exception var4) {
|
||||||
|
}
|
||||||
|
|
||||||
|
return new PresentEmote(this.id, this.title, i).looping(this.looping);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Emote set(String s) {
|
||||||
|
return s.contains(":") ? this.getDynamicEmote(s.split(":")[1]) : this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return this.id + (this.item == -1 ? "" : ":" + this.item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getActionName() {
|
||||||
|
return super.getActionName() + (this.item <= 3 ? ":bad" : ":good");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startAnimation(IEmoteAccessor iemoteaccessor) {
|
||||||
|
super.startAnimation(iemoteaccessor);
|
||||||
|
Item o = Items.coal;
|
||||||
|
if (this.item == 1) {
|
||||||
|
o = Items.fish;
|
||||||
|
} else if (this.item == 2) {
|
||||||
|
o = Items.stick;
|
||||||
|
} else if (this.item == 4) {
|
||||||
|
o = Items.diamond;
|
||||||
|
} else if (this.item == 5) {
|
||||||
|
ItemEnchantedBook m = Items.enchanted_book;
|
||||||
|
} else if (this.item == 6) {
|
||||||
|
o = Items.nether_star;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack m = new ItemStack(o);
|
||||||
|
if (this.item == 1) {
|
||||||
|
}
|
||||||
|
|
||||||
|
iemoteaccessor.setItem(m);
|
||||||
|
iemoteaccessor.setItemScale(0.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stopAnimation(IEmoteAccessor iemoteaccessor) {
|
||||||
|
super.stopAnimation(iemoteaccessor);
|
||||||
|
iemoteaccessor.setItem(null);
|
||||||
|
iemoteaccessor.setItemScale(0.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressAnimation(IEmoteAccessor iemoteaccessor, BOBJArmature var2, int i, float f) {
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.emoticons;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.emoticons.Emote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.ParticleType;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
public class CryingEmote extends Emote {
|
||||||
|
public CryingEmote(String s, String s1) {
|
||||||
|
super(s, s1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressAnimation(IEmoteAccessor iemoteaccessor, BOBJArmature bobjarmature, int i, float f) {
|
||||||
|
if (i % 2 == 0) {
|
||||||
|
Vector4f vector4f = this.position(iemoteaccessor, bobjarmature, "head", 0.0F, 0.5F, 0.15F, f);
|
||||||
|
this.spawnParticle(iemoteaccessor, ParticleType.WATER_DROP, vector4f.x, vector4f.y, vector4f.z, 0.25F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.emoticons;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.emoticons.Emote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
public class DisgustedEmote extends Emote {
|
||||||
|
private final ItemStack greenDye = new ItemStack(Items.dye, 1, 2);
|
||||||
|
|
||||||
|
public DisgustedEmote(String s, String s1) {
|
||||||
|
super(s, s1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressAnimation(IEmoteAccessor iemoteaccessor, BOBJArmature bobjarmature, int i, float f) {
|
||||||
|
super.progressAnimation(iemoteaccessor, bobjarmature, i, f);
|
||||||
|
if (i >= this.tick(117) && i < this.tick(140)) {
|
||||||
|
for (int j = 0; j < 10; ++j) {
|
||||||
|
Vector4f vector4f = iemoteaccessor.calcPosition(bobjarmature.bones.get("head"), 0.0F, 0.125F, 0.25F, f);
|
||||||
|
iemoteaccessor.spawnItemParticle(
|
||||||
|
this.greenDye,
|
||||||
|
vector4f.x + this.rand(0.1F),
|
||||||
|
vector4f.y,
|
||||||
|
vector4f.z + this.rand(0.1F),
|
||||||
|
this.rand(0.05F),
|
||||||
|
-0.125,
|
||||||
|
this.rand(0.05F)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.emoticons;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.emoticons.PropEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.ParticleType;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
public class PopcornEmote extends PropEmote {
|
||||||
|
public PopcornEmote(String s, String s1) {
|
||||||
|
super(s, s1);
|
||||||
|
this.props("prop_popcorn");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressAnimation(IEmoteAccessor iemoteaccessor, BOBJArmature bobjarmature, int i, float f) {
|
||||||
|
if (i == 8 || i == 32 || i == 56 || i == 86) {
|
||||||
|
Vector4f vector4f = this.position(iemoteaccessor, bobjarmature, "low_right_arm.end", 0.0F, 0.15F, 0.0F, f);
|
||||||
|
int j = 0;
|
||||||
|
|
||||||
|
for (byte b0 = 15; j < b0; ++j) {
|
||||||
|
iemoteaccessor.spawnParticle(ParticleType.POPCORN, vector4f.x, vector4f.y, vector4f.z, 0.0, 0.1, 0.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.emoticons;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.emoticons.Emote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.ParticleType;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
public class PureSaltEmote extends Emote {
|
||||||
|
public PureSaltEmote(String s, String s1) {
|
||||||
|
super(s, s1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressAnimation(IEmoteAccessor iemoteaccessor, BOBJArmature bobjarmature, int i, float f) {
|
||||||
|
if (i > 18 && i <= 78 && i % 2 == 0) {
|
||||||
|
Vector4f vector4f = this.position(iemoteaccessor, bobjarmature, "low_right_arm.end", 0.0F, 0.15F, 0.0F, f);
|
||||||
|
int j = 0;
|
||||||
|
|
||||||
|
for (int k = i == 78 ? 12 : 1; j < k; ++j) {
|
||||||
|
iemoteaccessor.spawnParticle(
|
||||||
|
ParticleType.SALT, vector4f.x, vector4f.y, vector4f.z, this.rand(0.05F), this.rand(0.05F), 0.1F
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.emoticons;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.emoticons.Emote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
public class RockPaperScissorsEmote extends Emote {
|
||||||
|
public String suffix = "";
|
||||||
|
|
||||||
|
public RockPaperScissorsEmote(String s, String s1, int var3) {
|
||||||
|
super(s, s1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RockPaperScissorsEmote(String s, String s1, int i, String s2) {
|
||||||
|
this(s, s1, i);
|
||||||
|
this.suffix = s2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Emote getDynamicEmote() {
|
||||||
|
String s = "";
|
||||||
|
int i = this.rand.nextInt(30);
|
||||||
|
if (i <= 10) {
|
||||||
|
s = "rock";
|
||||||
|
} else if (i <= 20) {
|
||||||
|
s = "paper";
|
||||||
|
} else if (i <= 30) {
|
||||||
|
s = "scissors";
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.getDynamicEmote(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Emote getDynamicEmote(String s) {
|
||||||
|
return new RockPaperScissorsEmote(this.id, this.title, this.looping, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Emote set(String s) {
|
||||||
|
return s.contains(":") ? this.getDynamicEmote(s.split(":")[1]) : this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return this.id + (this.suffix.isEmpty() ? "" : ":" + this.suffix);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startAnimation(IEmoteAccessor iemoteaccessor) {
|
||||||
|
super.startAnimation(iemoteaccessor);
|
||||||
|
ItemStack m;
|
||||||
|
if (this.suffix.equals("rock")) {
|
||||||
|
m = new ItemStack(Blocks.stone);
|
||||||
|
} else if (this.suffix.equals("paper")) {
|
||||||
|
m = new ItemStack(Items.paper);
|
||||||
|
} else {
|
||||||
|
m = new ItemStack(Items.shears);
|
||||||
|
}
|
||||||
|
|
||||||
|
iemoteaccessor.setItem(m);
|
||||||
|
iemoteaccessor.setItemScale(0.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stopAnimation(IEmoteAccessor iemoteaccessor) {
|
||||||
|
super.stopAnimation(iemoteaccessor);
|
||||||
|
iemoteaccessor.setItem(null);
|
||||||
|
iemoteaccessor.setItemScale(0.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressAnimation(IEmoteAccessor iemoteaccessor, BOBJArmature var2, int i, float f) {
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.emoticons;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.emoticons.Emote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.ParticleType;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
public class SneezeEmote extends Emote {
|
||||||
|
public SneezeEmote(String s, String s1) {
|
||||||
|
super(s, s1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressAnimation(IEmoteAccessor iemoteaccessor, BOBJArmature bobjarmature, int i, float f) {
|
||||||
|
super.progressAnimation(iemoteaccessor, bobjarmature, i, f);
|
||||||
|
if (i == this.tick(121) - 1) {
|
||||||
|
Vector4f vector4f = iemoteaccessor.calcPosition(bobjarmature.bones.get("head"), 0.0F, 0.125F, 0.25F, f);
|
||||||
|
|
||||||
|
for (int j = 0; j < 10; ++j) {
|
||||||
|
iemoteaccessor.spawnParticle(
|
||||||
|
ParticleType.CLOUD, vector4f.x, vector4f.y, vector4f.z, this.rand(0.05F), -0.025F, this.rand(0.05F)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.emoticons;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.emoticons.Emote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.ParticleType;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
public class StarPowerEmote extends Emote {
|
||||||
|
public StarPowerEmote(String s, String s1, int var3) {
|
||||||
|
super(s, s1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressAnimation(IEmoteAccessor iemoteaccessor, BOBJArmature bobjarmature, int i, float f) {
|
||||||
|
if (i == 30) {
|
||||||
|
Vector4f vector4f = this.position(iemoteaccessor, bobjarmature, "low_right_arm.end", 0.0F, 0.15F, 0.0F, f);
|
||||||
|
int j = 0;
|
||||||
|
|
||||||
|
for (byte b0 = 15; j < b0; ++j) {
|
||||||
|
this.spawnParticle(iemoteaccessor, ParticleType.END_ROD, vector4f.x, vector4f.y, vector4f.z, 0.025F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i >= 33 && i < 43) {
|
||||||
|
Vector4f vector4f1 = this.position(iemoteaccessor, bobjarmature, "low_right_arm.end", 0.0F, 0.15F, 0.0F, f);
|
||||||
|
float f3 = 1.0F;
|
||||||
|
float f4 = 0.0F;
|
||||||
|
float f1 = 0.0F;
|
||||||
|
float f2 = (float) (i - 33) / 10.0F;
|
||||||
|
if ((double) f2 >= 0.2) {
|
||||||
|
if ((double) f2 < 0.35) {
|
||||||
|
f4 = 0.5F;
|
||||||
|
} else if ((double) f2 < 0.45) {
|
||||||
|
f4 = 1.0F;
|
||||||
|
} else if ((double) f2 < 0.65) {
|
||||||
|
f3 = 0.25F;
|
||||||
|
f4 = 1.0F;
|
||||||
|
} else if ((double) f2 < 0.85) {
|
||||||
|
f3 = 0.0F;
|
||||||
|
f4 = 0.75F;
|
||||||
|
f1 = 1.0F;
|
||||||
|
} else {
|
||||||
|
f3 = 0.0F;
|
||||||
|
f4 = 0.0F;
|
||||||
|
f1 = 1.0F;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int k = 0;
|
||||||
|
|
||||||
|
for (byte b1 = 7; k < b1; ++k) {
|
||||||
|
iemoteaccessor.spawnParticle(
|
||||||
|
ParticleType.SPELL_MOB,
|
||||||
|
(double) vector4f1.x + this.rand.nextDouble() * 0.05 - 0.025,
|
||||||
|
(double) vector4f1.y + this.rand.nextDouble() * 0.05 - 0.025,
|
||||||
|
(double) vector4f1.z + this.rand.nextDouble() * 0.05 - 0.025,
|
||||||
|
f3,
|
||||||
|
f4,
|
||||||
|
f1
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.halloween;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.emoticons.PropEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
public class RisingFromDeadEmote extends PropEmote {
|
||||||
|
private final ItemStack dirt = new ItemStack(Blocks.dirt);
|
||||||
|
|
||||||
|
public RisingFromDeadEmote(String s, String s1) {
|
||||||
|
super(s, s1);
|
||||||
|
this.props("prop_grave", "prop_grave_base");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startAnimation(IEmoteAccessor iemoteaccessor) {
|
||||||
|
super.startAnimation(iemoteaccessor);
|
||||||
|
iemoteaccessor.getConfig("prop_grave_base").texture = new ResourceLocation("textures/blocks/dirt.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressAnimation(IEmoteAccessor iemoteaccessor, BOBJArmature bobjarmature, int i, float f) {
|
||||||
|
if (i == 1 || i == 21 || i == 48 || i == 88 || i == 104) {
|
||||||
|
Vector4f vector4f = this.position(iemoteaccessor, bobjarmature, "misc_bone_1", 0.0F, 0.0F, 0.0F, f);
|
||||||
|
byte b0 = 10;
|
||||||
|
if (i == 1 || i == 21) {
|
||||||
|
b0 = 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j = 0; j < b0; ++j) {
|
||||||
|
iemoteaccessor.spawnItemParticle(
|
||||||
|
this.dirt,
|
||||||
|
vector4f.x,
|
||||||
|
vector4f.y,
|
||||||
|
vector4f.z,
|
||||||
|
this.rand.nextDouble() * 0.05F,
|
||||||
|
this.rand.nextDouble() * 0.05F,
|
||||||
|
this.rand.nextDouble() * 0.05F
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == 83) {
|
||||||
|
Vector4f vector4f1 = this.position(iemoteaccessor, bobjarmature, "low_right_arm.end", 0.0F, 0.0F, 0.0F, f);
|
||||||
|
byte b1 = 10;
|
||||||
|
|
||||||
|
for (int k = 0; k < b1; ++k) {
|
||||||
|
iemoteaccessor.spawnItemParticle(
|
||||||
|
this.dirt,
|
||||||
|
vector4f1.x,
|
||||||
|
vector4f1.y,
|
||||||
|
vector4f1.z,
|
||||||
|
this.rand.nextDouble() * 0.05F,
|
||||||
|
this.rand.nextDouble() * 0.05F,
|
||||||
|
this.rand.nextDouble() * 0.05F
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.halloween;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.emoticons.PropEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.ParticleType;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
public class TrickOrTreatEmote extends PropEmote {
|
||||||
|
public TrickOrTreatEmote(String s, String s1) {
|
||||||
|
super(s, s1);
|
||||||
|
this.props("prop_candy_bag");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressAnimation(IEmoteAccessor iemoteaccessor, BOBJArmature bobjarmature, int i, float f) {
|
||||||
|
if (i == 14 || i == 144) {
|
||||||
|
Vector4f vector4f = this.position(iemoteaccessor, bobjarmature, "low_right_arm.end", 0.0F, 0.15F, 0.0F, f);
|
||||||
|
int j = 0;
|
||||||
|
|
||||||
|
for (byte b0 = 15; j < b0; ++j) {
|
||||||
|
this.spawnParticle(iemoteaccessor, ParticleType.EXPLODE, vector4f.x, vector4f.y, vector4f.z, 0.025F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.newyear;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJBone;
|
||||||
|
import net.silentclient.client.emotes.emoticons.PropEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.ParticleType;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
public class ChampagneEmote extends PropEmote {
|
||||||
|
public ChampagneEmote(String s, String s1) {
|
||||||
|
super(s, s1);
|
||||||
|
this.props("prop_champagne_bottle", "prop_champagne_flying_cork");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stopAnimation(IEmoteAccessor iemoteaccessor) {
|
||||||
|
super.stopAnimation(iemoteaccessor);
|
||||||
|
iemoteaccessor.getConfig("prop_champagne_cork").visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressAnimation(IEmoteAccessor iemoteaccessor, BOBJArmature bobjarmature, int i, float f) {
|
||||||
|
iemoteaccessor.getConfig("prop_champagne_cork").visible = i < this.tick(75);
|
||||||
|
if (i > this.tick(80) && i < this.tick(160)) {
|
||||||
|
BOBJBone bobjbone = bobjarmature.bones.get("low_right_arm.item");
|
||||||
|
Vector4f vector4f = this.direction(iemoteaccessor, bobjbone, 0.0F, 0.0F, -1.0F, f);
|
||||||
|
float f1 = vector4f.x * 0.1F + this.rand(0.05F);
|
||||||
|
float f2 = vector4f.y * 0.1F + this.rand(0.05F);
|
||||||
|
float f3 = vector4f.z * 0.1F + this.rand(0.05F);
|
||||||
|
Vector4f vector4f1 = iemoteaccessor.calcPosition(bobjbone, 0.0F, 0.0F, -0.625F, f);
|
||||||
|
iemoteaccessor.spawnParticle(ParticleType.END_ROD, vector4f1.x, vector4f1.y, vector4f1.z, f1, f2, f3);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == this.tick(83)) {
|
||||||
|
Vector4f vector4f2 = iemoteaccessor.calcPosition(bobjarmature.bones.get("misc_bone_2"), 0.0F, 0.0F, 0.0F, f);
|
||||||
|
|
||||||
|
for (int j = 0; j < 15; ++j) {
|
||||||
|
this.spawnParticle(iemoteaccessor, ParticleType.EXPLODE, vector4f2.x, vector4f2.y, vector4f2.z, 0.01F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.newyear;
|
||||||
|
|
||||||
|
public class FireworksEmote {
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.thanksgiving;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.emoticons.PropEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.ParticleType;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
public class HuntEmote extends PropEmote {
|
||||||
|
public HuntEmote(String s, String s1) {
|
||||||
|
super(s, s1);
|
||||||
|
this.props("prop_hunt_gun");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressAnimation(IEmoteAccessor iemoteaccessor, BOBJArmature bobjarmature, int i, float f) {
|
||||||
|
if (i == 91) {
|
||||||
|
Vector4f vector4f = this.position(iemoteaccessor, bobjarmature, "low_right_arm.item", 0.0F, 0.0F, -1.25F, f);
|
||||||
|
int j = 0;
|
||||||
|
|
||||||
|
for (byte b0 = 15; j < b0; ++j) {
|
||||||
|
this.spawnParticle(iemoteaccessor, ParticleType.EXPLODE, vector4f.x, vector4f.y, vector4f.z, 0.05F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.thanksgiving;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.emoticons.Emote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
public class PumpkinEmote extends Emote {
|
||||||
|
private final ItemStack shears = new ItemStack(Items.shears);
|
||||||
|
private final ItemStack pumpkin = new ItemStack(Blocks.pumpkin);
|
||||||
|
private final ItemStack pumpkinLit = new ItemStack(Blocks.lit_pumpkin);
|
||||||
|
|
||||||
|
public PumpkinEmote(String s, String s1) {
|
||||||
|
super(s, s1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startAnimation(IEmoteAccessor iemoteaccessor) {
|
||||||
|
super.startAnimation(iemoteaccessor);
|
||||||
|
iemoteaccessor.setItem(this.shears);
|
||||||
|
iemoteaccessor.setItemScale(0.0F);
|
||||||
|
iemoteaccessor.setHand(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stopAnimation(IEmoteAccessor iemoteaccessor) {
|
||||||
|
super.stopAnimation(iemoteaccessor);
|
||||||
|
iemoteaccessor.setItem(null);
|
||||||
|
iemoteaccessor.setItemScale(0.0F);
|
||||||
|
iemoteaccessor.setHand(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressAnimation(IEmoteAccessor iemoteaccessor, BOBJArmature bobjarmature, int i, float f) {
|
||||||
|
boolean flag = true;
|
||||||
|
boolean flag1 = true;
|
||||||
|
boolean flag2 = true;
|
||||||
|
boolean flag3 = true;
|
||||||
|
iemoteaccessor.setupMatrix(bobjarmature.bones.get("misc_bone_1"));
|
||||||
|
GlStateManager.scale(0.475F, 0.475F, 0.475F);
|
||||||
|
GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F);
|
||||||
|
GlStateManager.translate(-0.5F, 0.0F, 0.5F);
|
||||||
|
iemoteaccessor.renderBlock(i > 117 ? this.pumpkinLit : this.pumpkin);
|
||||||
|
float f1 = 0.0F;
|
||||||
|
if (i >= 14 && i < 115) {
|
||||||
|
if (i < 21) {
|
||||||
|
f1 = ((float) (i - 14) + f) / 7.0F;
|
||||||
|
} else if (i >= 105) {
|
||||||
|
f1 = 1.0F - ((float) (i - 105) + f) / 10.0F;
|
||||||
|
} else {
|
||||||
|
f1 = 1.0F;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
iemoteaccessor.setItemScale(f1);
|
||||||
|
if (i == 29 || i == 36 || i == 44 || i == 51 || i == 64 || i == 82) {
|
||||||
|
Vector4f vector4f = this.position(iemoteaccessor, bobjarmature, "misc_bone_1", 0.0F, 0.125F, 0.0F, f);
|
||||||
|
byte b0 = 10;
|
||||||
|
|
||||||
|
for (int j = 0; j < b0; ++j) {
|
||||||
|
iemoteaccessor.spawnItemParticle(
|
||||||
|
this.pumpkin,
|
||||||
|
vector4f.x,
|
||||||
|
vector4f.y,
|
||||||
|
vector4f.z,
|
||||||
|
this.rand.nextDouble() * 0.05F,
|
||||||
|
this.rand.nextDouble() * 0.05F,
|
||||||
|
this.rand.nextDouble() * 0.05F
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.thanksgiving;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.emoticons.PropEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
public class TurkeyEmote extends PropEmote {
|
||||||
|
private final ItemStack chicken = new ItemStack(Items.cooked_chicken);
|
||||||
|
|
||||||
|
public TurkeyEmote(String s, String s1) {
|
||||||
|
super(s, s1);
|
||||||
|
this.props("prop_turkey");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressAnimation(IEmoteAccessor iemoteaccessor, BOBJArmature bobjarmature, int i, float f) {
|
||||||
|
if (i == 82) {
|
||||||
|
Vector4f vector4f = this.position(iemoteaccessor, bobjarmature, "misc_bone_1", 0.0F, 0.125F, 0.0F, f);
|
||||||
|
|
||||||
|
for (int j = 0; j < 20; ++j) {
|
||||||
|
iemoteaccessor.spawnItemParticle(
|
||||||
|
this.chicken,
|
||||||
|
vector4f.x,
|
||||||
|
vector4f.y,
|
||||||
|
vector4f.z,
|
||||||
|
this.rand(0.25F),
|
||||||
|
this.rand.nextDouble() * 0.2 + 0.1,
|
||||||
|
this.rand(0.25F)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.valentines;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.emoticons.PropEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.ParticleType;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
public class BlowKissEmote extends PropEmote {
|
||||||
|
public BlowKissEmote(String s, String s1) {
|
||||||
|
super(s, s1);
|
||||||
|
this.props("prop_heart");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressAnimation(IEmoteAccessor iemoteaccessor, BOBJArmature bobjarmature, int i, float f) {
|
||||||
|
if (i > this.tick(17) && i < this.tick(55)) {
|
||||||
|
new ItemStack(Items.redstone);
|
||||||
|
Vector4f vector4f = this.position(iemoteaccessor, bobjarmature, "low_right_arm.end", 0.0F, 0.15F, 0.0F, f);
|
||||||
|
int j = 0;
|
||||||
|
|
||||||
|
for (byte b0 = 7; j < b0; ++j) {
|
||||||
|
iemoteaccessor.spawnParticle(ParticleType.FLAME, vector4f.x, vector4f.y, vector4f.z, 0.0, 0.0, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
vector4f = this.position(iemoteaccessor, bobjarmature, "low_left_arm.end", 0.0F, 0.15F, 0.0F, f);
|
||||||
|
j = 0;
|
||||||
|
|
||||||
|
for (byte b1 = 7; j < b1; ++j) {
|
||||||
|
iemoteaccessor.spawnParticle(ParticleType.FLAME, vector4f.x, vector4f.y, vector4f.z, 0.0, 0.0, 0.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == this.tick(152)) {
|
||||||
|
Vector4f vector4f1 = this.position(iemoteaccessor, bobjarmature, "misc_bone_2", 0.0F, 0.0F, -0.125F, f);
|
||||||
|
|
||||||
|
for (int k = 0; k < 10; ++k) {
|
||||||
|
this.spawnParticle(iemoteaccessor, ParticleType.SMOKE, vector4f1.x, vector4f1.y, vector4f1.z, 0.05F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.valentines;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.emoticons.PropEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.ParticleType;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
public class HeartbrokenEmote extends PropEmote {
|
||||||
|
public HeartbrokenEmote(String s, String s1) {
|
||||||
|
super(s, s1);
|
||||||
|
this.props("prop_heart_1", "prop_heart_2");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressAnimation(IEmoteAccessor iemoteaccessor, BOBJArmature bobjarmature, int i, float f) {
|
||||||
|
if (i == this.tick(75)) {
|
||||||
|
ItemStack m = new ItemStack(Items.redstone);
|
||||||
|
|
||||||
|
for (int j = 0; j < 10; ++j) {
|
||||||
|
Vector4f vector4f = this.direction(iemoteaccessor, bobjarmature.bones.get("low_body"), 0.0F, 0.0F, -0.125F, f).mul(1.0F + this.rand(0.1F));
|
||||||
|
float f1 = vector4f.x + this.rand(0.1F);
|
||||||
|
float f2 = vector4f.y + this.rand(0.1F);
|
||||||
|
float f3 = vector4f.z + this.rand(0.1F);
|
||||||
|
Vector4f vector4f1 = this.position(iemoteaccessor, bobjarmature, "low_body", this.rand(0.05F), 0.125F + this.rand(0.05F), -0.25F, f);
|
||||||
|
iemoteaccessor.spawnItemParticle(m, vector4f1.x, vector4f1.y, vector4f1.z, f1, f2, f3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == this.tick(123) || i == this.tick(143) || i == this.tick(157) || i == this.tick(173) || i == this.tick(192)) {
|
||||||
|
Vector4f vector4f2 = this.position(iemoteaccessor, bobjarmature, "misc_bone_2", 0.0F, 0.0F, 0.0F, f);
|
||||||
|
|
||||||
|
for (int k = 0; k < 10; ++k) {
|
||||||
|
this.spawnParticle(iemoteaccessor, ParticleType.SMOKE, vector4f2.x, vector4f2.y, vector4f2.z, 0.1F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == this.tick(208)) {
|
||||||
|
Vector4f vector4f3 = this.position(iemoteaccessor, bobjarmature, "misc_bone_2", 0.0F, 0.0F, 0.0F, f);
|
||||||
|
|
||||||
|
for (int l = 0; l < 10; ++l) {
|
||||||
|
this.spawnParticle(iemoteaccessor, ParticleType.SMOKE, vector4f3.x, vector4f3.y, vector4f3.z, 0.1F);
|
||||||
|
}
|
||||||
|
|
||||||
|
vector4f3 = this.position(iemoteaccessor, bobjarmature, "misc_bone_3", 0.0F, 0.0F, 0.0F, f);
|
||||||
|
|
||||||
|
for (int i1 = 0; i1 < 10; ++i1) {
|
||||||
|
this.spawnParticle(iemoteaccessor, ParticleType.SMOKE, vector4f3.x, vector4f3.y, vector4f3.z, 0.1F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package net.silentclient.client.emotes.emoticons.valentines;
|
||||||
|
|
||||||
|
import net.silentclient.client.emotes.bobj.BOBJArmature;
|
||||||
|
import net.silentclient.client.emotes.emoticons.PropEmote;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.IEmoteAccessor;
|
||||||
|
import net.silentclient.client.emotes.emoticons.accessor.ParticleType;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
public class RoseEmote extends PropEmote {
|
||||||
|
public RoseEmote(String s, String s1) {
|
||||||
|
super(s, s1);
|
||||||
|
this.props("prop_rose");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressAnimation(IEmoteAccessor iemoteaccessor, BOBJArmature bobjarmature, int i, float f) {
|
||||||
|
if (i == this.tick(91)) {
|
||||||
|
Vector4f vector4f = this.position(iemoteaccessor, bobjarmature, "body", 0.375F, 0.25F, -0.25F, f);
|
||||||
|
|
||||||
|
for (int j = 0; j < 10; ++j) {
|
||||||
|
this.spawnParticle(iemoteaccessor, ParticleType.EXPLODE, vector4f.x, vector4f.y, vector4f.z, 0.01F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package net.silentclient.client.emotes.particles;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.particle.EntityFX;
|
||||||
|
import net.minecraft.client.renderer.WorldRenderer;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class ParticleEndRod extends EntityFX {
|
||||||
|
public static final ResourceLocation TEXTURE = new ResourceLocation("silentclient/emotes/particles/mc-particles.png");
|
||||||
|
private final int numAgingFrames = 8;
|
||||||
|
|
||||||
|
public ParticleEndRod(World world, double d0, double d1, double d2, double d3, double d4, double d5) {
|
||||||
|
super(world, d0, d1, d2, d3, d4, d5);
|
||||||
|
this.motionX = d3;
|
||||||
|
this.motionY = d4;
|
||||||
|
this.motionZ = d5;
|
||||||
|
this.particleScale *= 0.75F;
|
||||||
|
this.particleMaxAge = 60 + this.rand.nextInt(12);
|
||||||
|
this.particleTextureIndexX = 0;
|
||||||
|
this.particleTextureIndexY = 11;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderParticle(WorldRenderer worldrenderer, Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||||
|
Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE);
|
||||||
|
if (worldrenderer != null) {
|
||||||
|
super.renderParticle(worldrenderer, entity, f, f1, f2, f3, f4, f5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate() {
|
||||||
|
super.onUpdate();
|
||||||
|
this.particleTextureIndexX = this.numAgingFrames - 1 - this.particleAge * this.numAgingFrames / this.particleMaxAge;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFXLayer() {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,80 @@
|
|||||||
|
package net.silentclient.client.emotes.particles;
|
||||||
|
|
||||||
|
import net.minecraft.client.model.ModelBase;
|
||||||
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
|
import net.minecraft.client.particle.EntityFX;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
|
import net.minecraft.client.renderer.WorldRenderer;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class PopcornParticle extends EntityFX {
|
||||||
|
public static ModelRenderer kernel1;
|
||||||
|
public static ModelRenderer kernel2;
|
||||||
|
public static ModelRenderer kernel3;
|
||||||
|
protected int color;
|
||||||
|
|
||||||
|
public PopcornParticle(World world, double d0, double d1, double d2, double d3) {
|
||||||
|
super(world, d0, d1, d2);
|
||||||
|
this.particleGravity = 0.5F;
|
||||||
|
this.particleMaxAge = 20 + this.rand.nextInt(10);
|
||||||
|
this.motionX = this.rand.nextFloat() * 0.05F;
|
||||||
|
this.motionZ = this.rand.nextFloat() * 0.05F;
|
||||||
|
this.motionY = d3 == 0.0 ? d3 : this.rand.nextDouble() * 0.1F + d3;
|
||||||
|
if (kernel1 == null) {
|
||||||
|
ModelBase modelbase = new ModelBase() {
|
||||||
|
};
|
||||||
|
modelbase.textureWidth = 64;
|
||||||
|
modelbase.textureHeight = 64;
|
||||||
|
kernel1 = new ModelRenderer(modelbase, 0, 2);
|
||||||
|
kernel1.addBox(-0.5F, -0.5F, 0.5F, 1, 1, 1);
|
||||||
|
kernel2 = new ModelRenderer(modelbase, 0, 4);
|
||||||
|
kernel2.addBox(-0.5F, -0.5F, 0.5F, 1, 1, 1);
|
||||||
|
kernel3 = new ModelRenderer(modelbase, 0, 6);
|
||||||
|
kernel3.addBox(-0.5F, -0.5F, 0.5F, 1, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.color = this.rand.nextInt(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderParticle(WorldRenderer var1, Entity entity, float f, float var4, float var5, float var6, float var7, float var8) {
|
||||||
|
float f1 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) f - interpPosX);
|
||||||
|
float f2 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) f - interpPosY);
|
||||||
|
float f3 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) f - interpPosZ);
|
||||||
|
int i = this.particleMaxAge - this.particleAge;
|
||||||
|
float f4 = 0.75F * (i < 5 ? (float) i / 5.0F : 1.0F);
|
||||||
|
ModelRenderer modelrenderer = kernel1;
|
||||||
|
if (this.color == 1) {
|
||||||
|
modelrenderer = kernel2;
|
||||||
|
} else if (this.color == 2) {
|
||||||
|
modelrenderer = kernel3;
|
||||||
|
}
|
||||||
|
|
||||||
|
int j = entity.getBrightnessForRender(f);
|
||||||
|
if (entity.isBurning()) {
|
||||||
|
j = 15728880;
|
||||||
|
}
|
||||||
|
|
||||||
|
int k = j % 65536;
|
||||||
|
int l = j / 65536;
|
||||||
|
GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
|
||||||
|
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) k, (float) l);
|
||||||
|
GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||||
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
GlStateManager.pushMatrix();
|
||||||
|
GlStateManager.translate(f1, f2, f3);
|
||||||
|
GlStateManager.scale(f4, f4, f4);
|
||||||
|
RenderHelper.enableStandardItemLighting();
|
||||||
|
modelrenderer.render(0.0625F);
|
||||||
|
RenderHelper.disableStandardItemLighting();
|
||||||
|
GlStateManager.popMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFXLayer() {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
package net.silentclient.client.emotes.particles;
|
||||||
|
|
||||||
|
import net.minecraft.client.model.ModelBase;
|
||||||
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
|
import net.minecraft.client.particle.EntityFX;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
|
import net.minecraft.client.renderer.WorldRenderer;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class SaltParticle extends EntityFX {
|
||||||
|
public static ModelRenderer salt;
|
||||||
|
|
||||||
|
public SaltParticle(World world, double d0, double d1, double d2, double d3, double d4, double d5) {
|
||||||
|
super(world, d0, d1, d2);
|
||||||
|
this.particleGravity = 0.5F;
|
||||||
|
this.particleMaxAge = 20 + this.rand.nextInt(10);
|
||||||
|
this.motionX = d3;
|
||||||
|
this.motionZ = d4;
|
||||||
|
this.motionY = d5;
|
||||||
|
if (salt == null) {
|
||||||
|
ModelBase modelbase = new ModelBase() {
|
||||||
|
};
|
||||||
|
modelbase.textureWidth = 64;
|
||||||
|
modelbase.textureHeight = 64;
|
||||||
|
salt = new ModelRenderer(modelbase, 0, 0);
|
||||||
|
salt.addBox(-0.5F, -0.5F, 0.5F, 1, 1, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderParticle(WorldRenderer var1, Entity entity, float f, float var4, float var5, float var6, float var7, float var8) {
|
||||||
|
float f1 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) f - interpPosX);
|
||||||
|
float f2 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) f - interpPosY);
|
||||||
|
float f3 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) f - interpPosZ);
|
||||||
|
int i = this.particleMaxAge - this.particleAge;
|
||||||
|
float f4 = 0.5F * (i < 5 ? (float) i / 5.0F : 1.0F);
|
||||||
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
int j = entity.getBrightnessForRender(f);
|
||||||
|
if (entity.isBurning()) {
|
||||||
|
j = 15728880;
|
||||||
|
}
|
||||||
|
|
||||||
|
int k = j % 65536;
|
||||||
|
int l = j / 65536;
|
||||||
|
GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
|
||||||
|
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) k, (float) l);
|
||||||
|
GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||||
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
GlStateManager.pushMatrix();
|
||||||
|
GlStateManager.translate(f1, f2, f3);
|
||||||
|
GlStateManager.scale(f4, f4, f4);
|
||||||
|
RenderHelper.enableStandardItemLighting();
|
||||||
|
salt.render(0.0625F);
|
||||||
|
RenderHelper.disableStandardItemLighting();
|
||||||
|
GlStateManager.popMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFXLayer() {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
package net.silentclient.client.emotes.socket;
|
||||||
|
|
||||||
|
import io.socket.client.IO;
|
||||||
|
import io.socket.client.Socket;
|
||||||
|
import net.silentclient.client.Client;
|
||||||
|
import net.silentclient.client.emotes.EmoteManager;
|
||||||
|
import net.silentclient.client.utils.NotificationUtils;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
|
public class EmoteSocket {
|
||||||
|
public static EmoteSocket instance;
|
||||||
|
|
||||||
|
public static EmoteSocket get() {
|
||||||
|
if(instance == null) {
|
||||||
|
instance = new EmoteSocket();
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Socket socket;
|
||||||
|
|
||||||
|
public EmoteSocket() {
|
||||||
|
try {
|
||||||
|
this.socket = IO.socket(new URI("https://emotes.silentclient.net:443"));
|
||||||
|
} catch (Exception err) {
|
||||||
|
Client.logger.catching(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.socket.on(Socket.EVENT_CONNECT, (Object... arg0) -> {
|
||||||
|
Client.logger.info("Connected to Emotes Socket");
|
||||||
|
}).on(Socket.EVENT_DISCONNECT, (Object... arg0) -> {
|
||||||
|
Client.logger.info("Disconnected from Emotes Socket");
|
||||||
|
}).on("error", (Object... arg0) -> {
|
||||||
|
SocketError error = Client.getInstance().getGson().fromJson((String)arg0[0], SocketError.class);
|
||||||
|
NotificationUtils.showNotification("Error", error.getError());
|
||||||
|
}).on("startEmote", (Object... arg0) -> {
|
||||||
|
Client.logger.info("startEmote: " + (String)arg0[0]);
|
||||||
|
SocketShowEmote data = Client.getInstance().getGson().fromJson((String)arg0[0], SocketShowEmote.class);
|
||||||
|
EmoteManager.sendEmote(data.username, data.emoteId);
|
||||||
|
}).on("endEmote", (Object... arg0) -> {
|
||||||
|
Client.logger.info("endEmote: " + (String)arg0[0]);
|
||||||
|
SocketShowEmote data = Client.getInstance().getGson().fromJson((String)arg0[0], SocketShowEmote.class);
|
||||||
|
EmoteManager.stop(data.username);
|
||||||
|
});;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startEmote(int id) {
|
||||||
|
this.socket.emit("startEmote", new JSONObject().put("accessToken", Client.getInstance().getUserData().getAccessToken()).put("emoteId", id).toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void endEmote() {
|
||||||
|
this.socket.emit("endEmote", new JSONObject().put("accessToken", Client.getInstance().getUserData().getAccessToken()).toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void connect() {
|
||||||
|
this.socket.connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void disconnect() {
|
||||||
|
this.socket.disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class SocketError {
|
||||||
|
public String error;
|
||||||
|
|
||||||
|
public String getError() {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class SocketShowEmote {
|
||||||
|
public String username;
|
||||||
|
public int emoteId;
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEmoteId() {
|
||||||
|
return emoteId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,188 @@
|
|||||||
|
package net.silentclient.client.emotes.ui;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.client.gui.ScaledResolution;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.silentclient.client.Client;
|
||||||
|
import net.silentclient.client.emotes.PlayerModelManager;
|
||||||
|
import net.silentclient.client.emotes.emoticons.Emote;
|
||||||
|
import net.silentclient.client.emotes.socket.EmoteSocket;
|
||||||
|
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;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class EmoteMenuGui extends SilentScreen {
|
||||||
|
private ScrollHelper scrollHelper = new ScrollHelper();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initGui() {
|
||||||
|
super.initGui();
|
||||||
|
defaultCursor = false;
|
||||||
|
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);
|
||||||
|
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((Client.getInstance().getCosmetics().getMyEmotes().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, "Emotes", 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 emoteX = x + 3;
|
||||||
|
float emoteY = y + 20 + scrollY;
|
||||||
|
int emoteIndex = 0;
|
||||||
|
for(PlayerResponse.Account.Cosmetics.CosmeticItem emote : Client.getInstance().getCosmetics().getMyEmotes()) {
|
||||||
|
String emoteName = PlayerModelManager.get().map.get(emote.id);
|
||||||
|
if(emoteName == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Emote emoteInstance = PlayerModelManager.get().getEmote(emoteName);
|
||||||
|
if(emoteInstance == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isHovered = MouseUtils.isInside(mouseX, mouseY, emoteX, emoteY, 80, 80) && !MouseUtils.isInside(mouseX, mouseY, emoteX + 80 - 3 - 10, emoteY + 3, 10, 10);
|
||||||
|
if(isHovered) {
|
||||||
|
cursorType = MouseCursorHandler.CursorType.POINTER;
|
||||||
|
RenderUtil.drawRoundedRect(emoteX, emoteY, 80, 80, 3, new Color(255, 255, 255, 30).getRGB());
|
||||||
|
}
|
||||||
|
if(MouseUtils.isInside(mouseX, mouseY, emoteX + 80 - 3 - 10, emoteY + 3, 10, 10)) {
|
||||||
|
cursorType = MouseCursorHandler.CursorType.POINTER;
|
||||||
|
}
|
||||||
|
RenderUtil.drawRoundedOutline(emoteX, emoteY, 80, 80, 3, 1, Theme.borderColor().getRGB());
|
||||||
|
Client.getInstance().getSilentFontRenderer().drawString(emote.getName(), emoteX + 3, (int) (emoteY + 3), 12, SilentFontRenderer.FontType.TITLE, 64);
|
||||||
|
|
||||||
|
boolean favorite = false;
|
||||||
|
for(Number i : Client.getInstance().getAccount().getFavoriteCosmetics().emotes == null ? new ArrayList<Number>() : Client.getInstance().getAccount().getFavoriteCosmetics().emotes) {
|
||||||
|
if(i.intValue() == emote.getId()) {
|
||||||
|
favorite = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RenderUtil.drawImage(new ResourceLocation(favorite ? "silentclient/icons/star.png" : "silentclient/icons/star_outline.png"), emoteX + 80 - 3 - 10, emoteY + 3, 10, 10);
|
||||||
|
|
||||||
|
RenderUtil.drawImage(emoteInstance.icon.icon, emoteX + 3 + 37 - 28 , emoteY + 16, 56, 56);
|
||||||
|
|
||||||
|
emoteIndex += 1;
|
||||||
|
if(emoteIndex == 3) {
|
||||||
|
emoteIndex = 0;
|
||||||
|
emoteX = x + 3;
|
||||||
|
emoteY += 85;
|
||||||
|
} else {
|
||||||
|
emoteX += 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(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 emoteX = x + 3;
|
||||||
|
float emoteY = (int) (y + 20 + scrollHelper.getScroll());
|
||||||
|
int emoteIndex = 0;
|
||||||
|
for(PlayerResponse.Account.Cosmetics.CosmeticItem emote : Client.getInstance().getCosmetics().getMyEmotes()) {
|
||||||
|
String emoteName = PlayerModelManager.get().map.get(emote.id);
|
||||||
|
if(emoteName == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Emote emoteInstance = PlayerModelManager.get().getEmote(emoteName);
|
||||||
|
if(emoteInstance == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
boolean isHovered = MouseUtils.isInside(mouseX, mouseY, emoteX, emoteY, 80, 80) && !MouseUtils.isInside(mouseX, mouseY, emoteX + 80 - 3 - 10, emoteY + 3, 10, 10);
|
||||||
|
|
||||||
|
if(isHovered) {
|
||||||
|
EmoteSocket.get().startEmote(emote.getId());
|
||||||
|
mc.displayGuiScreen(null);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(MouseUtils.isInside(mouseX, mouseY, emoteX + 80 - 3 - 10, emoteY + 3, 10, 10)) {
|
||||||
|
Client.getInstance().getAccount().updateFavorite(emote.getId(), "emotes");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
emoteIndex += 1;
|
||||||
|
if(emoteIndex == 3) {
|
||||||
|
emoteIndex = 0;
|
||||||
|
emoteX = x + 3;
|
||||||
|
emoteY += 85;
|
||||||
|
} else {
|
||||||
|
emoteX += 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(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGuiClosed() {
|
||||||
|
super.onGuiClosed();
|
||||||
|
MenuBlurUtils.unloadBlur();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,273 @@
|
|||||||
|
package net.silentclient.client.gui.elements;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.Gui;
|
||||||
|
import net.silentclient.client.gui.animation.SimpleAnimation;
|
||||||
|
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class HSBPicker extends Gui {
|
||||||
|
public float[] color;
|
||||||
|
private boolean pickingColor;
|
||||||
|
private boolean pickingHue;
|
||||||
|
private boolean pickingAlpha;
|
||||||
|
private int pickerX, pickerY, pickerWidth, pickerHeight;
|
||||||
|
private int hueSliderX, hueSliderY, hueSliderWidth, hueSliderHeight;
|
||||||
|
private int alphaSliderX, alphaSliderY, alphaSliderWidth, alphaSliderHeight;
|
||||||
|
private boolean rainbowState = false;
|
||||||
|
private final int x, y, width, height;
|
||||||
|
private int selectedColorFinal = -1;
|
||||||
|
private Color selectedColorFinalAsColor;
|
||||||
|
public int cursorX;
|
||||||
|
public int cursorY;
|
||||||
|
public boolean alphaSlider = true;
|
||||||
|
|
||||||
|
public SimpleAnimation sx = new SimpleAnimation(0f);
|
||||||
|
public SimpleAnimation sy = new SimpleAnimation(0f);
|
||||||
|
|
||||||
|
public HSBPicker(int x, int y, int width, int height, boolean alphaSlider) {
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.width = width;
|
||||||
|
this.height = height;
|
||||||
|
this.color = new float[]{0.4f, 1.0f, 1.0f, 1.0f};
|
||||||
|
this.pickingColor = false;
|
||||||
|
this.alphaSlider = alphaSlider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init() {
|
||||||
|
this.pickerWidth = width;
|
||||||
|
this.pickerHeight = height;
|
||||||
|
this.pickerX = x;
|
||||||
|
this.pickerY = y;
|
||||||
|
this.hueSliderX = pickerX;
|
||||||
|
this.hueSliderY = pickerY + pickerHeight + 6;
|
||||||
|
this.hueSliderWidth = pickerWidth;
|
||||||
|
this.hueSliderHeight = 6;
|
||||||
|
this.alphaSliderX = pickerX + pickerWidth + 6;
|
||||||
|
this.alphaSliderY = pickerY;
|
||||||
|
this.alphaSliderWidth = 6;
|
||||||
|
this.alphaSliderHeight = pickerHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void render(int mouseX, int mouseY) {
|
||||||
|
if (this.rainbowState) {
|
||||||
|
double rainbowState = Math.ceil((System.currentTimeMillis() + 200) / 20.0);
|
||||||
|
rainbowState %= 360.0;
|
||||||
|
this.color[0] = (float) (rainbowState / 360.0);
|
||||||
|
}
|
||||||
|
if (this.pickingHue) {
|
||||||
|
if (this.hueSliderWidth > this.hueSliderHeight) {
|
||||||
|
float restrictedX = (float) Math.min(Math.max(hueSliderX, mouseX), hueSliderX + hueSliderWidth);
|
||||||
|
this.color[0] = (restrictedX - (float) hueSliderX) / hueSliderWidth;
|
||||||
|
} else {
|
||||||
|
float restrictedY = (float) Math.min(Math.max(hueSliderY, mouseY), hueSliderY + hueSliderHeight);
|
||||||
|
this.color[0] = (restrictedY - (float) hueSliderY) / hueSliderHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.pickingAlpha) {
|
||||||
|
if (this.alphaSliderWidth > this.alphaSliderHeight) {
|
||||||
|
float restrictedX = (float) Math.min(Math.max(alphaSliderX, mouseX), alphaSliderX + alphaSliderWidth);
|
||||||
|
this.color[3] = 1 - (restrictedX - (float) alphaSliderX) / alphaSliderWidth;
|
||||||
|
} else {
|
||||||
|
float restrictedY = (float) Math.min(Math.max(alphaSliderY, mouseY), alphaSliderY + alphaSliderHeight);
|
||||||
|
this.color[3] = 1 - (restrictedY - (float) alphaSliderY) / alphaSliderHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.pickingColor) {
|
||||||
|
float restrictedX = (float) Math.min(Math.max(pickerX, mouseX), pickerX + pickerWidth);
|
||||||
|
float restrictedY = (float) Math.min(Math.max(pickerY, mouseY), pickerY + pickerHeight);
|
||||||
|
this.color[1] = (restrictedX - (float) pickerX) / pickerWidth;
|
||||||
|
this.color[2] = 1 - (restrictedY - (float) pickerY) / pickerHeight;
|
||||||
|
}
|
||||||
|
int selectedX = pickerX + pickerWidth + 6;
|
||||||
|
int selectedY = pickerY + pickerHeight + 6;
|
||||||
|
int selectedWidth = 6;
|
||||||
|
int selectedHeight = 6;
|
||||||
|
Gui.drawRect(pickerX - 1, pickerY - 1, pickerX + pickerWidth + 1, pickerY + pickerHeight + 1, new Color(0, 0, 0, 0).getRGB());
|
||||||
|
Gui.drawRect(hueSliderX - 1, hueSliderY - 1, hueSliderX + hueSliderWidth + 1, hueSliderY + hueSliderHeight + 1, new Color(0, 0, 0, 0).getRGB());
|
||||||
|
Gui.drawRect(alphaSliderX - 1, alphaSliderY - 1, alphaSliderX + alphaSliderWidth + 1, alphaSliderY + alphaSliderHeight + 1, new Color(0, 0, 0, 0).getRGB());
|
||||||
|
int selectedColor = Color.HSBtoRGB(this.color[0], 1.0f, 1.0f);
|
||||||
|
float selectedRed = (selectedColor >> 16 & 0xFF) / 255.0f;
|
||||||
|
float selectedGreen = (selectedColor >> 8 & 0xFF) / 255.0f;
|
||||||
|
float selectedBlue = (selectedColor & 0xFF) / 255.0f;
|
||||||
|
|
||||||
|
this.drawPickerBase(pickerX, pickerY, pickerWidth, pickerHeight, selectedRed, selectedGreen, selectedBlue, 255);
|
||||||
|
this.drawHueSlider(hueSliderX, hueSliderY, hueSliderWidth, hueSliderHeight, this.color[0]);
|
||||||
|
if (alphaSlider) {
|
||||||
|
this.drawAlphaSlider(alphaSliderX, alphaSliderY, alphaSliderWidth, alphaSliderHeight, selectedRed, selectedGreen, selectedBlue, this.color[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedColorFinal = alpha(new Color(Color.HSBtoRGB(this.color[0], this.color[1], this.color[2])), this.color[3]);
|
||||||
|
selectedColorFinalAsColor = color(new Color(Color.HSBtoRGB(this.color[0], this.color[1], this.color[2])), this.color[3]);
|
||||||
|
|
||||||
|
Gui.drawRect(selectedX - 1, selectedY - 1, selectedX + selectedWidth + 1, selectedY + selectedHeight + 1, new Color(0, 0, 0, 0).getRGB());
|
||||||
|
Gui.drawRect(selectedX, selectedY, selectedX + selectedWidth, selectedY + selectedHeight, selectedColorFinal);
|
||||||
|
|
||||||
|
cursorX = (int) (pickerX + color[1] * pickerWidth);
|
||||||
|
cursorY = (int) ((pickerY + pickerHeight) - color[2] * pickerHeight);
|
||||||
|
|
||||||
|
sx.setAnimation(cursorX, 25f);
|
||||||
|
sy.setAnimation(cursorY, 25f);
|
||||||
|
|
||||||
|
RenderUtils.drawRect(sx.getValue() - 1, sy.getValue() - 1, 2, 2, Color.WHITE.getRGB());
|
||||||
|
}
|
||||||
|
|
||||||
|
final int alpha(Color color, float alpha) {
|
||||||
|
final float red = (float) color.getRed() / 255;
|
||||||
|
final float green = (float) color.getGreen() / 255;
|
||||||
|
final float blue = (float) color.getBlue() / 255;
|
||||||
|
return new Color(red, green, blue, alpha).getRGB();
|
||||||
|
}
|
||||||
|
|
||||||
|
final Color color(Color color, float alpha) {
|
||||||
|
final float red = (float) color.getRed() / 255;
|
||||||
|
final float green = (float) color.getGreen() / 255;
|
||||||
|
final float blue = (float) color.getBlue() / 255;
|
||||||
|
return new Color(red, green, blue, alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||||
|
this.pickingColor = check(pickerX, pickerY, pickerX + pickerWidth, pickerY + pickerHeight, mouseX, mouseY);
|
||||||
|
this.pickingHue = check(hueSliderX, hueSliderY, hueSliderX + hueSliderWidth, hueSliderY + hueSliderHeight, mouseX, mouseY);
|
||||||
|
if (alphaSlider) {
|
||||||
|
this.pickingAlpha = check(alphaSliderX, alphaSliderY, alphaSliderX + alphaSliderWidth, alphaSliderY + alphaSliderHeight, mouseX, mouseY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseReleased(int mouseX, int mouseY, int state) {
|
||||||
|
this.pickingColor = this.pickingHue = this.pickingAlpha = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawHueSlider(int x, int y, int width, int height, float hue) {
|
||||||
|
int step = 0;
|
||||||
|
if (height > width) {
|
||||||
|
Gui.drawRect(x, y, x + width, y + 4, 0xFFFF0000);
|
||||||
|
y += 4;
|
||||||
|
for (int colorIndex = 0; colorIndex < 6; colorIndex++) {
|
||||||
|
int previousStep = Color.HSBtoRGB((float) step / 6, 1.0f, 1.0f);
|
||||||
|
int nextStep = Color.HSBtoRGB((float) (step + 1) / 6, 1.0f, 1.0f);
|
||||||
|
this.drawGradientRect(x, y + step * (height / 6), x + width, y + (step + 1) * (height / 6), previousStep, nextStep);
|
||||||
|
step++;
|
||||||
|
}
|
||||||
|
final int sliderMinY = (int) (y + (height * hue)) - 4;
|
||||||
|
Gui.drawRect(x, sliderMinY - 1, x + width, sliderMinY + 1, -1);
|
||||||
|
} else {
|
||||||
|
for (int colorIndex = 0; colorIndex < 6; colorIndex++) {
|
||||||
|
int previousStep = Color.HSBtoRGB((float) step / 6, 1.0f, 1.0f);
|
||||||
|
int nextStep = Color.HSBtoRGB((float) (step + 1) / 6, 1.0f, 1.0f);
|
||||||
|
this.gradient(x + step * (width / 6), y, x + (step + 1) * (width / 6), y + height, previousStep, nextStep, true);
|
||||||
|
step++;
|
||||||
|
}
|
||||||
|
final int sliderMinX = (int) (x + (width * hue));
|
||||||
|
Gui.drawRect(sliderMinX - 1, y, sliderMinX, y + height, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawAlphaSlider(int x, int y, int width, int height, float red, float green, float blue, float alpha) {
|
||||||
|
boolean left = true;
|
||||||
|
int checkerBoardSquareSize = width / 2;
|
||||||
|
for (int squareIndex = -checkerBoardSquareSize; squareIndex < height; squareIndex += checkerBoardSquareSize) {
|
||||||
|
if (!left) {
|
||||||
|
Gui.drawRect(x, y + squareIndex, x + width, y + squareIndex + checkerBoardSquareSize, 0xFFFFFFFF);
|
||||||
|
Gui.drawRect(x + checkerBoardSquareSize, y + squareIndex, x + width, y + squareIndex + checkerBoardSquareSize, 0xFF909090);
|
||||||
|
if (squareIndex < height - checkerBoardSquareSize) {
|
||||||
|
int minY = y + squareIndex + checkerBoardSquareSize;
|
||||||
|
int maxY = Math.min(y + height, y + squareIndex + checkerBoardSquareSize * 2);
|
||||||
|
Gui.drawRect(x, minY, x + width, maxY, 0xFF909090);
|
||||||
|
Gui.drawRect(x + checkerBoardSquareSize, minY, x + width, maxY, 0xFFFFFFFF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
left = !left;
|
||||||
|
}
|
||||||
|
this.gradient(x, y, x + width, y + height, new Color((int)red, (int)green, (int)blue, 255).getRGB(), 0, false);
|
||||||
|
final int sliderMinY = (int) (y + height - (height * alpha));
|
||||||
|
Gui.drawRect(x, sliderMinY - 1, x + width, sliderMinY, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawPickerBase(int pickerX, int pickerY, int pickerWidth, int pickerHeight, float red, float green, float blue, float alpha) {
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||||
|
GL11.glBegin(GL11.GL_POLYGON);
|
||||||
|
{
|
||||||
|
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
GL11.glVertex2f(pickerX, pickerY);
|
||||||
|
GL11.glVertex2f(pickerX, pickerY + pickerHeight);
|
||||||
|
GL11.glColor4f(red, green, blue, alpha);
|
||||||
|
GL11.glVertex2f(pickerX + pickerWidth, pickerY + pickerHeight);
|
||||||
|
GL11.glVertex2f(pickerX + pickerWidth, pickerY);
|
||||||
|
}
|
||||||
|
GL11.glEnd();
|
||||||
|
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||||
|
GL11.glBegin(GL11.GL_POLYGON);
|
||||||
|
{
|
||||||
|
GL11.glColor4f(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
GL11.glVertex2f(pickerX, pickerY);
|
||||||
|
GL11.glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
GL11.glVertex2f(pickerX, pickerY + pickerHeight);
|
||||||
|
GL11.glVertex2f(pickerX + pickerWidth, pickerY + pickerHeight);
|
||||||
|
GL11.glColor4f(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
GL11.glVertex2f(pickerX + pickerWidth, pickerY);
|
||||||
|
}
|
||||||
|
GL11.glEnd();
|
||||||
|
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||||
|
GL11.glShadeModel(GL11.GL_FLAT);
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glDisable(GL11.GL_BLEND);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void gradient(int minX, int minY, int maxX, int maxY, int startColor, int endColor, boolean left) {
|
||||||
|
if (left) {
|
||||||
|
|
||||||
|
final float startA = (startColor >> 24 & 0xFF) / 255.0f;
|
||||||
|
final float startR = (startColor >> 16 & 0xFF) / 255.0f;
|
||||||
|
final float startG = (startColor >> 8 & 0xFF) / 255.0f;
|
||||||
|
final float startB = (startColor & 0xFF) / 255.0f;
|
||||||
|
|
||||||
|
final float endA = (endColor >> 24 & 0xFF) / 255.0f;
|
||||||
|
final float endR = (endColor >> 16 & 0xFF) / 255.0f;
|
||||||
|
final float endG = (endColor >> 8 & 0xFF) / 255.0f;
|
||||||
|
final float endB = (endColor & 0xFF) / 255.0f;
|
||||||
|
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||||
|
GL11.glBegin(GL11.GL_POLYGON);
|
||||||
|
{
|
||||||
|
GL11.glColor4f(startR, startG, startB, startA);
|
||||||
|
GL11.glVertex2f(minX, minY);
|
||||||
|
GL11.glVertex2f(minX, maxY);
|
||||||
|
GL11.glColor4f(endR, endG, endB, endA);
|
||||||
|
GL11.glVertex2f(maxX, maxY);
|
||||||
|
GL11.glVertex2f(maxX, minY);
|
||||||
|
}
|
||||||
|
GL11.glEnd();
|
||||||
|
GL11.glShadeModel(GL11.GL_FLAT);
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glDisable(GL11.GL_BLEND);
|
||||||
|
} else drawGradientRect(minX, minY, maxX, maxY, startColor, endColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean check(int minX, int minY, int maxX, int maxY, int curX, int curY) {
|
||||||
|
return curX >= minX && curY >= minY && curX < maxX && curY < maxY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Color getSelectedColorFinal() {
|
||||||
|
return new Color(selectedColorFinal);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFinalColor(Color color) {
|
||||||
|
float r = color.getRed() / 255.0F;
|
||||||
|
float g = color.getGreen() / 255.0F;
|
||||||
|
float b = color.getBlue() / 255.0F;
|
||||||
|
float a = color.getAlpha() / 255.0F;
|
||||||
|
this.color[0] = r;
|
||||||
|
this.color[1] = g;
|
||||||
|
this.color[2] = b;
|
||||||
|
this.color[3] = a;
|
||||||
|
}
|
||||||
|
}
|
@ -140,7 +140,7 @@ public class ClickGUI extends SilentScreen {
|
|||||||
RenderUtil.drawImage(new ResourceLocation(m.getIcon()), modOffsetX + ((65 / 2) - 10), y + modOffsetY - scrollAnimation.getValue() + ((70 / 2) - 10), 20, 20, false);
|
RenderUtil.drawImage(new ResourceLocation(m.getIcon()), modOffsetX + ((65 / 2) - 10), y + modOffsetY - scrollAnimation.getValue() + ((70 / 2) - 10), 20, 20, false);
|
||||||
}
|
}
|
||||||
if(selectedCategory.equals(ModCategory.MODS)) {
|
if(selectedCategory.equals(ModCategory.MODS)) {
|
||||||
Switch.render(mouseX, mouseY, switchX, switchY, m.switchAniamation, m.isEnabled(), m.isForceDisabled(), m.isForceDisabled() ? "Force disabled" : null);
|
Switch.render(mouseX, mouseY, switchX, switchY, m.simpleAnimation, m.isEnabled(), m.isForceDisabled(), m.isForceDisabled() ? "Force disabled" : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(switchHovered || isHovered) {
|
if(switchHovered || isHovered) {
|
||||||
|
@ -8,18 +8,16 @@ import net.minecraft.util.ResourceLocation;
|
|||||||
import net.silentclient.client.Client;
|
import net.silentclient.client.Client;
|
||||||
import net.silentclient.client.gui.SilentScreen;
|
import net.silentclient.client.gui.SilentScreen;
|
||||||
import net.silentclient.client.gui.animation.normal.Direction;
|
import net.silentclient.client.gui.animation.normal.Direction;
|
||||||
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.gui.elements.Button;
|
import net.silentclient.client.gui.elements.Button;
|
||||||
import net.silentclient.client.gui.elements.Checkbox;
|
import net.silentclient.client.gui.elements.Checkbox;
|
||||||
|
import net.silentclient.client.gui.elements.HSBPicker;
|
||||||
import net.silentclient.client.gui.elements.Slider;
|
import net.silentclient.client.gui.elements.Slider;
|
||||||
import net.silentclient.client.gui.font.SilentFontRenderer;
|
import net.silentclient.client.gui.font.SilentFontRenderer;
|
||||||
import net.silentclient.client.gui.hud.HUDConfigScreen;
|
import net.silentclient.client.gui.hud.HUDConfigScreen;
|
||||||
|
import net.silentclient.client.gui.lite.clickgui.utils.GlUtils;
|
||||||
import net.silentclient.client.gui.theme.Theme;
|
import net.silentclient.client.gui.theme.Theme;
|
||||||
|
import net.silentclient.client.gui.util.ColorPickerAction;
|
||||||
import net.silentclient.client.gui.util.RenderUtil;
|
import net.silentclient.client.gui.util.RenderUtil;
|
||||||
import net.silentclient.client.mods.Mod;
|
|
||||||
import net.silentclient.client.mods.Setting;
|
|
||||||
import net.silentclient.client.utils.MenuBlurUtils;
|
import net.silentclient.client.utils.MenuBlurUtils;
|
||||||
import net.silentclient.client.utils.MouseCursorHandler;
|
import net.silentclient.client.utils.MouseCursorHandler;
|
||||||
import net.silentclient.client.utils.Sounds;
|
import net.silentclient.client.utils.Sounds;
|
||||||
@ -28,44 +26,30 @@ import org.lwjgl.opengl.GL11;
|
|||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class GuiColorPicker extends SilentScreen {
|
public class GuiColorPicker extends SilentScreen {
|
||||||
private final Mod mod;
|
|
||||||
private final GuiScreen parentScreen;
|
private final GuiScreen parentScreen;
|
||||||
|
|
||||||
private ArrayList<Color> colors = new ArrayList<Color>();
|
|
||||||
private final String value;
|
|
||||||
private long initTime;
|
private long initTime;
|
||||||
|
private HSBPicker hsb;
|
||||||
|
private final Color defaultColor;
|
||||||
|
private boolean chroma;
|
||||||
|
private final boolean allowChangeOpacity;
|
||||||
|
private int opacity;
|
||||||
|
private ColorPickerAction action;
|
||||||
|
|
||||||
public GuiColorPicker(Mod mod, String value, GuiScreen parent) {
|
public GuiColorPicker(Color defaultColor, boolean chroma, boolean allowChangeOpacity, int opacity, ColorPickerAction action, GuiScreen parentScreen) {
|
||||||
if (mod == null) throw new IllegalArgumentException("Mod is null");
|
this.parentScreen = parentScreen;
|
||||||
|
this.defaultColor = defaultColor;
|
||||||
this.mod = mod;
|
this.allowChangeOpacity = allowChangeOpacity;
|
||||||
this.parentScreen = parent;
|
this.chroma = chroma;
|
||||||
this.value = value;
|
this.opacity = opacity;
|
||||||
|
this.action = action;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
defaultCursor = false;
|
defaultCursor = false;
|
||||||
this.initTime = System.currentTimeMillis();
|
this.initTime = System.currentTimeMillis();
|
||||||
colors.clear();
|
|
||||||
colors.add(new Color(255, 255, 255));
|
|
||||||
colors.add(new Color(156, 157, 151));
|
|
||||||
colors.add(new Color(71,79,82));
|
|
||||||
colors.add(new Color(0, 0, 0));
|
|
||||||
colors.add(new Color(255,216,61));
|
|
||||||
colors.add(new Color(249,128,29));
|
|
||||||
colors.add(new Color(176,46,38));
|
|
||||||
colors.add(new Color(130,84,50));
|
|
||||||
colors.add(new Color(128,199,31));
|
|
||||||
colors.add(new Color(58,179,218));
|
|
||||||
colors.add(new Color(22,156,157));
|
|
||||||
colors.add(new Color(60,68,169));
|
|
||||||
colors.add(new Color(243,140,170));
|
|
||||||
colors.add(new Color(198,79,189));
|
|
||||||
colors.add(new Color(137,50,183));
|
|
||||||
MenuBlurUtils.loadBlur();
|
MenuBlurUtils.loadBlur();
|
||||||
int addX = 190;
|
int addX = 190;
|
||||||
int addY = 110;
|
int addY = 110;
|
||||||
@ -74,13 +58,15 @@ public class GuiColorPicker extends SilentScreen {
|
|||||||
int height = addY * 2;
|
int height = addY * 2;
|
||||||
this.buttonList.add(new Button(1, x + 5, y + 25, 75, 20, "< Back"));
|
this.buttonList.add(new Button(1, x + 5, y + 25, 75, 20, "< Back"));
|
||||||
this.buttonList.add(new Button(2, x + 5, (y + height) - 26, 75, 20, "Edit HUD"));
|
this.buttonList.add(new Button(2, x + 5, (y + height) - 26, 75, 20, "Edit HUD"));
|
||||||
|
hsb = new HSBPicker(x + 100, y + 40, 120, 70, false);
|
||||||
|
float[] vals = Color.RGBtoHSB(defaultColor.getRed(), defaultColor.getGreen(), defaultColor.getBlue(), null);
|
||||||
|
hsb.color = new float[] {vals[0],vals[1],vals[2], defaultColor.getAlpha() / 255.0f};
|
||||||
|
hsb.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGuiClosed() {
|
public void onGuiClosed() {
|
||||||
if(mod.getName() == "Pack Tweaks" && mod.isEnabled()) {
|
action.onClose(hsb.getSelectedColorFinal(), chroma, opacity);
|
||||||
mc.renderGlobal.loadRenderers();
|
|
||||||
}
|
|
||||||
MenuBlurUtils.unloadBlur();
|
MenuBlurUtils.unloadBlur();
|
||||||
super.onGuiClosed();
|
super.onGuiClosed();
|
||||||
}
|
}
|
||||||
@ -99,53 +85,37 @@ public class GuiColorPicker extends SilentScreen {
|
|||||||
int width = addX * 2;
|
int width = addX * 2;
|
||||||
int height = addY * 2;
|
int height = addY * 2;
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlUtils.startScale(((x) + (x) + width) / 2, ((y) + (y + height)) / 2, (float) ClickGUI.introAnimation.getValue());
|
GlUtils.startScale((float) ((x) + (x) + width) / 2, (float) ((y) + (y + height)) / 2, (float) ClickGUI.introAnimation.getValue());
|
||||||
RenderUtil.drawRoundedRect(x, y, width, height, 10, Theme.backgroundColor().getRGB());
|
RenderUtil.drawRoundedRect(x, y, width, height, 10, Theme.backgroundColor().getRGB());
|
||||||
|
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
int settingY = y + 25;
|
int settingY = y + 25;
|
||||||
|
action.onChange(hsb.getSelectedColorFinal(), chroma, opacity);
|
||||||
int colorIndex = 0;
|
|
||||||
int spacing = 100;
|
|
||||||
|
|
||||||
Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value);
|
|
||||||
|
|
||||||
for(Color color : colors) {
|
|
||||||
RenderUtils.drawRect(x + spacing, settingY - 1, 22, 22, new Color(0, 0, 0).getRGB());
|
|
||||||
RenderUtils.drawRect(x + spacing + 1, settingY - 1 + 1, 20, 20, new Color(color.getRed(), color.getGreen(), color.getBlue(), setting.getOpacity()).getRGB());
|
|
||||||
if(MouseUtils.isInside(mouseX, mouseY, x + spacing, settingY - 1, 22, 22)) {
|
|
||||||
cursorType = MouseCursorHandler.CursorType.POINTER;
|
|
||||||
}
|
|
||||||
spacing += 25;
|
|
||||||
colorIndex += 1;
|
|
||||||
if(colorIndex == 5 || colorIndex == 10) {
|
|
||||||
spacing = 100;
|
|
||||||
settingY += 30;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int settingHeight = 10 + 5;
|
int settingHeight = 10 + 5;
|
||||||
settingY += settingHeight;
|
|
||||||
if(setting.isCanChangeOpacity()) {
|
|
||||||
settingY += settingHeight;
|
|
||||||
Slider.render(x, settingY - 1, width, "Opacity", 255, setting.getOpacity());
|
|
||||||
if (Slider.isDrag(mouseX, mouseY, x, settingY - 1, width) && (System.currentTimeMillis() - initTime) > 500) {
|
|
||||||
double diff = 255 - 0;
|
|
||||||
double mouse = MathHelper.clamp_double((mouseX - Slider.getLeft(x, width)) / 90D, 0, 1);
|
|
||||||
double newVal = 0 + mouse * diff;
|
|
||||||
setting.setOpacity((int) newVal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
settingY += settingHeight;
|
Checkbox.render(mouseX, mouseY, x + 100, settingY - 1, "Chroma", chroma);
|
||||||
|
|
||||||
Checkbox.render(mouseX, mouseY, x + 100, settingY - 1, "Chroma", setting.isChroma());
|
|
||||||
if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) {
|
if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) {
|
||||||
cursorType = MouseCursorHandler.CursorType.POINTER;
|
cursorType = MouseCursorHandler.CursorType.POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
settingY += settingHeight + 90;
|
||||||
|
|
||||||
|
hsb.render(mouseX, mouseY);
|
||||||
|
|
||||||
|
if(allowChangeOpacity) {
|
||||||
|
GlStateManager.color(1, 1, 1, 1);
|
||||||
|
Slider.render(x, settingY - 1, width, "Opacity", 255, opacity);
|
||||||
|
if (Slider.isDrag(mouseX, mouseY, x, settingY - 1, width) && (System.currentTimeMillis() - initTime) > 500) {
|
||||||
|
double diff = 255;
|
||||||
|
double mouse = MathHelper.clamp_double((double) (mouseX - Slider.getLeft(x, width)) / 90D, 0, 1);
|
||||||
|
double newVal = 0 + mouse * diff;
|
||||||
|
opacity = (int) newVal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
RenderUtil.drawImage(new ResourceLocation("silentclient/logos/logo.png"), x + 5, y + 5, 77, 15);
|
RenderUtil.drawImage(new ResourceLocation("silentclient/logos/logo.png"), x + 5, y + 5, 77, 15);
|
||||||
@ -182,7 +152,6 @@ public class GuiColorPicker extends SilentScreen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
|
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
|
||||||
int addX = 190;
|
int addX = 190;
|
||||||
@ -191,39 +160,26 @@ public class GuiColorPicker extends SilentScreen {
|
|||||||
int x = (width / 2) - addX;
|
int x = (width / 2) - addX;
|
||||||
int y = (height / 2) - addY;
|
int y = (height / 2) - addY;
|
||||||
int settingY = y + 25;
|
int settingY = y + 25;
|
||||||
int colorIndex = 0;
|
|
||||||
int spacing = 100;
|
|
||||||
|
|
||||||
Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value);
|
hsb.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
|
||||||
for(Color color : colors) {
|
|
||||||
if(MouseUtils.isInside(mouseX, mouseY, x + spacing, settingY - 1, 22, 22) && mouseButton == 0) {
|
|
||||||
Sounds.playButtonSound();
|
|
||||||
Client.getInstance().getSettingsManager().getSettingByName(mod, this.value).setValColor(color);
|
|
||||||
mc.displayGuiScreen(parentScreen);
|
|
||||||
}
|
|
||||||
spacing += 25;
|
|
||||||
colorIndex += 1;
|
|
||||||
if(colorIndex == 5 || colorIndex == 10) {
|
|
||||||
spacing = 100;
|
|
||||||
settingY += 30;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int settingHeight = 10 + 5;
|
|
||||||
|
|
||||||
settingY += settingHeight + settingHeight + (setting.isCanChangeOpacity() ? settingHeight : 0);
|
|
||||||
|
|
||||||
if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) {
|
if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) {
|
||||||
Sounds.playButtonSound();
|
Sounds.playButtonSound();
|
||||||
setting.setChroma(!setting.isChroma());
|
chroma = !chroma;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseReleased(int mouseX, int mouseY, int state) {
|
||||||
|
hsb.mouseReleased(mouseX, mouseY, state);
|
||||||
|
super.mouseReleased(mouseX, mouseY, state);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void keyTyped(char typedChar, int keyCode) throws IOException {
|
protected void keyTyped(char typedChar, int keyCode) throws IOException {
|
||||||
if (keyCode == Keyboard.KEY_ESCAPE) {
|
if (keyCode == Keyboard.KEY_ESCAPE) {
|
||||||
ClickGUI.close = true;
|
ClickGUI.close = true;
|
||||||
|
Client.getInstance().configManager.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,19 +10,22 @@ import net.silentclient.client.Client;
|
|||||||
import net.silentclient.client.gui.SilentScreen;
|
import net.silentclient.client.gui.SilentScreen;
|
||||||
import net.silentclient.client.gui.animation.SimpleAnimation;
|
import net.silentclient.client.gui.animation.SimpleAnimation;
|
||||||
import net.silentclient.client.gui.animation.normal.Direction;
|
import net.silentclient.client.gui.animation.normal.Direction;
|
||||||
|
import net.silentclient.client.gui.elements.Button;
|
||||||
import net.silentclient.client.gui.lite.clickgui.utils.GlUtils;
|
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.MouseUtils;
|
||||||
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils.Scroll;
|
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils.Scroll;
|
||||||
import net.silentclient.client.gui.elements.*;
|
import net.silentclient.client.gui.elements.*;
|
||||||
import net.silentclient.client.gui.font.SilentFontRenderer;
|
import net.silentclient.client.gui.font.SilentFontRenderer;
|
||||||
import net.silentclient.client.gui.hud.HUDConfigScreen;
|
import net.silentclient.client.gui.hud.HUDConfigScreen;
|
||||||
|
import net.silentclient.client.gui.modmenu.CellGrid;
|
||||||
import net.silentclient.client.gui.theme.Theme;
|
import net.silentclient.client.gui.theme.Theme;
|
||||||
import net.silentclient.client.gui.theme.input.DefaultInputTheme;
|
import net.silentclient.client.gui.theme.input.DefaultInputTheme;
|
||||||
|
import net.silentclient.client.gui.util.ColorPickerAction;
|
||||||
import net.silentclient.client.gui.util.RenderUtil;
|
import net.silentclient.client.gui.util.RenderUtil;
|
||||||
import net.silentclient.client.mods.Mod;
|
import net.silentclient.client.mods.Mod;
|
||||||
import net.silentclient.client.mods.ModCategory;
|
import net.silentclient.client.mods.ModCategory;
|
||||||
import net.silentclient.client.mods.Setting;
|
import net.silentclient.client.mods.Setting;
|
||||||
import net.silentclient.client.mods.render.CrosshairMod;
|
import net.silentclient.client.mods.render.crosshair.CrosshairMod;
|
||||||
import net.silentclient.client.mods.world.TimeChangerMod;
|
import net.silentclient.client.mods.world.TimeChangerMod;
|
||||||
import net.silentclient.client.utils.ColorUtils;
|
import net.silentclient.client.utils.ColorUtils;
|
||||||
import net.silentclient.client.utils.MenuBlurUtils;
|
import net.silentclient.client.utils.MenuBlurUtils;
|
||||||
@ -31,6 +34,7 @@ import net.silentclient.client.utils.Sounds;
|
|||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
@ -193,10 +197,19 @@ public class ModSettings extends SilentScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (setting.isCheck()) {
|
if (setting.isCheck()) {
|
||||||
Checkbox.render(mouseX, mouseY, x + 100, settingY - 1, setting.getName(), setting.getValBoolean());
|
Switch.render(mouseX, mouseY, x + 100, settingY - 1, setting.switchAnimation, setting.getValBoolean(), false);
|
||||||
if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) {
|
if(Switch.isHovered(mouseX, mouseY, x + 100, settingY - 1)) {
|
||||||
cursorType = MouseCursorHandler.CursorType.POINTER;
|
cursorType = MouseCursorHandler.CursorType.POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Client.getInstance().getSilentFontRenderer().drawString(setting.getName(), x + 100 + 18, settingY + (((float) 8 / 2) - ((float) 12 / 2)) - 1, 12, SilentFontRenderer.FontType.TITLE);
|
||||||
|
}
|
||||||
|
if(setting.isCellGrid()) {
|
||||||
|
MouseCursorHandler.CursorType cellGridCursor = CellGrid.render(mouseX, mouseY, x + 100, settingY, setting);
|
||||||
|
if(cellGridCursor != null) {
|
||||||
|
cursorType = cellGridCursor;
|
||||||
|
}
|
||||||
|
settingY += 135;
|
||||||
}
|
}
|
||||||
if (setting.isSlider()) {
|
if (setting.isSlider()) {
|
||||||
Slider.render(x, settingY - 1, width, setting.getName(), setting.getMax(), setting.getValDouble());
|
Slider.render(x, settingY - 1, width, setting.getName(), setting.getMax(), setting.getValDouble());
|
||||||
@ -222,7 +235,7 @@ public class ModSettings extends SilentScreen {
|
|||||||
if(MouseUtils.isInside(mouseX, mouseY, x + width - (10 + 8) - 15, y + 5 + scrollAnimation.getValue(), 10, 10)) {
|
if(MouseUtils.isInside(mouseX, mouseY, x + width - (10 + 8) - 15, y + 5 + scrollAnimation.getValue(), 10, 10)) {
|
||||||
cursorType = MouseCursorHandler.CursorType.POINTER;
|
cursorType = MouseCursorHandler.CursorType.POINTER;
|
||||||
}
|
}
|
||||||
Switch.render(mouseX, mouseY, x + width - (10 + 8), y + 6 + scrollAnimation.getValue(), mod.switchAniamation, mod.isEnabled(), mod.isForceDisabled(), mod.isForceDisabled() ? "Force disabled" : null);
|
Switch.render(mouseX, mouseY, x + width - (10 + 8), y + 6 + scrollAnimation.getValue(), mod.simpleAnimation, mod.isEnabled(), mod.isForceDisabled(), mod.isForceDisabled() ? "Force disabled" : null);
|
||||||
if(Switch.isHovered(mouseX, mouseY, x + width - (10 + 8), y + 6 + scrollAnimation.getValue())) {
|
if(Switch.isHovered(mouseX, mouseY, x + width - (10 + 8), y + 6 + scrollAnimation.getValue())) {
|
||||||
cursorType = MouseCursorHandler.CursorType.POINTER;
|
cursorType = MouseCursorHandler.CursorType.POINTER;
|
||||||
}
|
}
|
||||||
@ -354,7 +367,10 @@ public class ModSettings extends SilentScreen {
|
|||||||
settingY += 5;
|
settingY += 5;
|
||||||
inputIndex++;
|
inputIndex++;
|
||||||
}
|
}
|
||||||
|
if(setting.isCellGrid()) {
|
||||||
|
CellGrid.click(mouseX, mouseY, mouseButton, setting);
|
||||||
|
settingY += 135;
|
||||||
|
}
|
||||||
if(setting.isCombo()) {
|
if(setting.isCombo()) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
String curr = setting.getValString();
|
String curr = setting.getValString();
|
||||||
@ -392,7 +408,7 @@ public class ModSettings extends SilentScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (setting.isCheck()) {
|
if (setting.isCheck()) {
|
||||||
if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) {
|
if(Switch.isHovered(mouseX, mouseY, x + 100, settingY - 1)) {
|
||||||
Sounds.playButtonSound();
|
Sounds.playButtonSound();
|
||||||
setting.setValBoolean(!setting.getValBoolean());
|
setting.setValBoolean(!setting.getValBoolean());
|
||||||
mod.onChangeSettingValue(setting);
|
mod.onChangeSettingValue(setting);
|
||||||
@ -401,7 +417,16 @@ public class ModSettings extends SilentScreen {
|
|||||||
|
|
||||||
if (setting.isColor() && ColorPicker.isHovered(mouseX, mouseY, x, settingY - 1, width)) {
|
if (setting.isColor() && ColorPicker.isHovered(mouseX, mouseY, x, settingY - 1, width)) {
|
||||||
Sounds.playButtonSound();
|
Sounds.playButtonSound();
|
||||||
this.mc.displayGuiScreen(new GuiColorPicker(mod, setting.getName(), this));
|
this.mc.displayGuiScreen(new GuiColorPicker(setting.getValColor(true), setting.isChroma(), setting.isCanChangeOpacity(), setting.getOpacity(), new ColorPickerAction() {
|
||||||
|
@Override
|
||||||
|
public void onChange(Color color, boolean chroma, int opacity) {
|
||||||
|
setting.setValColor(color);
|
||||||
|
setting.setChroma(chroma);
|
||||||
|
if(setting.isCanChangeOpacity()) {
|
||||||
|
setting.setOpacity(opacity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
settingY += settingHeight;
|
settingY += settingHeight;
|
||||||
@ -437,6 +462,16 @@ public class ModSettings extends SilentScreen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseReleased(int mouseX, int mouseY, int state) {
|
||||||
|
for (Setting setting : Client.getInstance().getSettingsManager().getSettingByMod(mod)) {
|
||||||
|
if(setting.isCellGrid()) {
|
||||||
|
CellGrid.release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.mouseReleased(mouseX, mouseY, state);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doesGuiPauseGame() {
|
public boolean doesGuiPauseGame() {
|
||||||
return !(this.mod instanceof TimeChangerMod);
|
return !(this.mod instanceof TimeChangerMod);
|
||||||
|
@ -0,0 +1,76 @@
|
|||||||
|
package net.silentclient.client.gui.modmenu;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.silentclient.client.gui.elements.IconButton;
|
||||||
|
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
|
||||||
|
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
|
||||||
|
import net.silentclient.client.gui.util.RenderUtil;
|
||||||
|
import net.silentclient.client.mods.Setting;
|
||||||
|
import net.silentclient.client.utils.MouseCursorHandler;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author refactoring
|
||||||
|
*/
|
||||||
|
public class CellGrid {
|
||||||
|
private static IconButton trashBtn = new IconButton(0,0,0,new ResourceLocation("silentclient/icons/trash-icon.png"));
|
||||||
|
|
||||||
|
private static boolean rmb;
|
||||||
|
private static boolean lmb;
|
||||||
|
|
||||||
|
public static MouseCursorHandler.CursorType render(float mouseX, float mouseY, float x, float y, Setting grid) {
|
||||||
|
MouseCursorHandler.CursorType cursorType = null;
|
||||||
|
for (int row = 0; row < 11; row++) {
|
||||||
|
for (int col = 0; col < 11; col++) {
|
||||||
|
float rx = x + col * 11;
|
||||||
|
float ry = y + row * 11;
|
||||||
|
RenderUtil.drawRoundedOutline(rx, ry, 11, 11, 0f, 1f, new Color(255, 255, 255, 120).getRGB());
|
||||||
|
|
||||||
|
RenderUtils.drawRect(rx, ry, 11, 11,
|
||||||
|
grid.getCells()[row][col] ?
|
||||||
|
MouseUtils.isInside((int) mouseX, (int) mouseY, rx, ry, 11, 11) ? 0x70ffffff : 0x50ffffff :
|
||||||
|
MouseUtils.isInside((int) mouseX, (int) mouseY, rx, ry, 11, 11) ? 0x20ffffff : 0x00ffffff
|
||||||
|
);
|
||||||
|
|
||||||
|
if(MouseUtils.isInside((int) mouseX, (int) mouseY, rx, ry, 11, 11)) {
|
||||||
|
cursorType = MouseCursorHandler.CursorType.POINTER;
|
||||||
|
if(rmb) {
|
||||||
|
grid.getCells()[row][col] = true;
|
||||||
|
}
|
||||||
|
if(lmb) {
|
||||||
|
grid.getCells()[row][col] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
trashBtn.xPosition = (int)x;
|
||||||
|
trashBtn.yPosition = (int)y + 125;
|
||||||
|
|
||||||
|
trashBtn.drawButton(Minecraft.getMinecraft(), (int)mouseX, (int)mouseY);
|
||||||
|
if(trashBtn.isMouseOver()) {
|
||||||
|
cursorType = MouseCursorHandler.CursorType.POINTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
return cursorType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void click(float mouseX, float mouseY, int btn, Setting setting) {
|
||||||
|
if(trashBtn.isMouseOver() && btn == 0) {
|
||||||
|
setting.setCells(new boolean[11][11]);
|
||||||
|
} else {
|
||||||
|
if(btn == 1) {
|
||||||
|
lmb = true;
|
||||||
|
} else if (btn == 0) {
|
||||||
|
rmb = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void release() {
|
||||||
|
lmb = false;
|
||||||
|
rmb = false;
|
||||||
|
}
|
||||||
|
}
|
@ -2,38 +2,37 @@ package net.silentclient.client.gui.modmenu;
|
|||||||
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.silentclient.client.Client;
|
import net.silentclient.client.Client;
|
||||||
import net.silentclient.client.gui.SilentScreen;
|
import net.silentclient.client.gui.SilentScreen;
|
||||||
import net.silentclient.client.gui.elements.Button;
|
import net.silentclient.client.gui.elements.Button;
|
||||||
import net.silentclient.client.gui.elements.Checkbox;
|
import net.silentclient.client.gui.elements.Checkbox;
|
||||||
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
|
import net.silentclient.client.gui.elements.HSBPicker;
|
||||||
import net.silentclient.client.gui.theme.button.DefaultButtonTheme;
|
import net.silentclient.client.gui.util.ColorPickerAction;
|
||||||
import net.silentclient.client.gui.theme.button.SelectedButtonTheme;
|
|
||||||
import net.silentclient.client.gui.util.RenderUtil;
|
|
||||||
import net.silentclient.client.mods.Mod;
|
|
||||||
import net.silentclient.client.mods.ModCategory;
|
|
||||||
import net.silentclient.client.mods.Setting;
|
|
||||||
import net.silentclient.client.utils.MenuBlurUtils;
|
import net.silentclient.client.utils.MenuBlurUtils;
|
||||||
import net.silentclient.client.utils.MouseCursorHandler;
|
import net.silentclient.client.utils.MouseCursorHandler;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class ColorPicker extends SilentScreen {
|
public class ColorPicker extends SilentScreen {
|
||||||
private long initTime;
|
|
||||||
private final Mod mod;
|
|
||||||
private final GuiScreen parentScreen;
|
private final GuiScreen parentScreen;
|
||||||
private ArrayList<Color> colors = new ArrayList<Color>();
|
private long initTime;
|
||||||
private final String value;
|
private HSBPicker hsb;
|
||||||
|
private final Color defaultColor;
|
||||||
|
private boolean chroma;
|
||||||
|
private final boolean allowChangeOpacity;
|
||||||
|
private int opacity;
|
||||||
|
private ColorPickerAction action;
|
||||||
|
|
||||||
public ColorPicker(Mod mod, String value, GuiScreen parentScreen) {
|
public ColorPicker(Color defaultColor, boolean chroma, boolean allowChangeOpacity, int opacity, ColorPickerAction action, GuiScreen parentScreen) {
|
||||||
if (mod == null) throw new IllegalArgumentException("Mod is null");
|
|
||||||
|
|
||||||
this.mod = mod;
|
|
||||||
this.parentScreen = parentScreen;
|
this.parentScreen = parentScreen;
|
||||||
this.value = value;
|
this.defaultColor = defaultColor;
|
||||||
|
this.allowChangeOpacity = allowChangeOpacity;
|
||||||
|
this.chroma = chroma;
|
||||||
|
this.opacity = opacity;
|
||||||
|
this.action = action;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -43,83 +42,50 @@ public class ColorPicker extends SilentScreen {
|
|||||||
this.initTime = System.currentTimeMillis();
|
this.initTime = System.currentTimeMillis();
|
||||||
this.buttonList.clear();
|
this.buttonList.clear();
|
||||||
this.silentInputs.clear();
|
this.silentInputs.clear();
|
||||||
|
hsb = new HSBPicker(3, 80, 120, 70, false);
|
||||||
|
float[] vals = Color.RGBtoHSB(defaultColor.getRed(), defaultColor.getGreen(), defaultColor.getBlue(), null);
|
||||||
|
hsb.color = new float[] {vals[0],vals[1],vals[2], defaultColor.getAlpha() / 255.0f};
|
||||||
|
hsb.init();
|
||||||
|
|
||||||
MenuBlurUtils.loadBlur();
|
MenuBlurUtils.loadBlur();
|
||||||
|
|
||||||
ModMenu.initBaseButtons(this.buttonList);
|
ModMenu.initBaseButtons(this.buttonList);
|
||||||
this.buttonList.add(new Button(1, 3, 26, 144, 15, "Back"));
|
this.buttonList.add(new Button(1, 3, 26, 144, 15, "Back"));
|
||||||
this.buttonList.add(new Button(2, 3, this.height - 18, mod.getCategory() == ModCategory.MODS ? 70 : 144, 15, "Reset"));
|
|
||||||
if(mod.getCategory() == ModCategory.MODS) {
|
|
||||||
this.buttonList.add(new Button(3, 76, this.height - 18, 70, 15, mod.isEnabled() ? "Enabled" : "Disabled", false, mod.isEnabled() ? new SelectedButtonTheme() : new DefaultButtonTheme()));
|
|
||||||
}
|
|
||||||
|
|
||||||
colors.clear();
|
|
||||||
colors.add(new Color(255, 255, 255));
|
|
||||||
colors.add(new Color(156, 157, 151));
|
|
||||||
colors.add(new Color(71,79,82));
|
|
||||||
colors.add(new Color(0, 0, 0));
|
|
||||||
colors.add(new Color(255,216,61));
|
|
||||||
colors.add(new Color(249,128,29));
|
|
||||||
colors.add(new Color(176,46,38));
|
|
||||||
colors.add(new Color(130,84,50));
|
|
||||||
colors.add(new Color(128,199,31));
|
|
||||||
colors.add(new Color(58,179,218));
|
|
||||||
colors.add(new Color(22,156,157));
|
|
||||||
colors.add(new Color(60,68,169));
|
|
||||||
colors.add(new Color(243,140,170));
|
|
||||||
colors.add(new Color(198,79,189));
|
|
||||||
colors.add(new Color(137,50,183));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||||
MenuBlurUtils.renderBackground(this);
|
MenuBlurUtils.renderBackground(this);
|
||||||
MouseCursorHandler.CursorType cursorType = getCursor(silentInputs, buttonList);
|
MouseCursorHandler.CursorType cursorType = getCursor(silentInputs, buttonList);
|
||||||
Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value);
|
|
||||||
|
|
||||||
ModMenu.drawOverlayListBase(height, "Choose a color");
|
ModMenu.drawOverlayListBase(height, "Choose a color");
|
||||||
|
|
||||||
|
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||||
|
|
||||||
ModMenu.trimContentStart(width, height);
|
ModMenu.trimContentStart(width, height);
|
||||||
|
|
||||||
float colorY = 66;
|
float colorY = 66;
|
||||||
int colorX = 3;
|
Checkbox.render(mouseX, mouseY, 3, colorY, "Chroma", chroma);
|
||||||
int colorIndex = 0;
|
|
||||||
for(Color color : colors) {
|
|
||||||
RenderUtil.drawRoundedRect(colorX, colorY, 20, 20, 3, new Color(color.getRed(), color.getGreen(), color.getBlue(), setting.getOpacity()).getRGB());
|
|
||||||
RenderUtil.drawRoundedOutline(colorX, colorY, 20, 20, 3, 2, new Color(0, 0, 0).getRGB());
|
|
||||||
if(MouseUtils.isInside(mouseX, mouseY, colorX, colorY, 20, 20)) {
|
|
||||||
cursorType = MouseCursorHandler.CursorType.POINTER;
|
|
||||||
}
|
|
||||||
colorX += 25;
|
|
||||||
colorIndex += 1;
|
|
||||||
if(colorIndex == 6) {
|
|
||||||
colorIndex = 0;
|
|
||||||
colorX = 3;
|
|
||||||
colorY += 25;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int settingHeight = 15;
|
|
||||||
colorY += settingHeight;
|
|
||||||
if(setting.isCanChangeOpacity()) {
|
|
||||||
colorY += settingHeight;
|
|
||||||
RegularSlider.render(3, colorY, 144, "Opacity", 255, setting.getOpacity());
|
|
||||||
if (RegularSlider.isDrag(mouseX, mouseY, 3, colorY, 144) && (System.currentTimeMillis() - initTime) > 500) {
|
|
||||||
double diff = 255 - 0;
|
|
||||||
double mouse = MathHelper.clamp_double((mouseX - 3) / 100D, 0, 1);
|
|
||||||
double newVal = 0 + mouse * diff;
|
|
||||||
setting.setOpacity((int) newVal);
|
|
||||||
}
|
|
||||||
colorY += settingHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
colorY += settingHeight;
|
|
||||||
|
|
||||||
Checkbox.render(mouseX, mouseY, 3, colorY, "Chroma", setting.isChroma());
|
|
||||||
if(Checkbox.isHovered(mouseX, mouseY, 3, colorY)) {
|
if(Checkbox.isHovered(mouseX, mouseY, 3, colorY)) {
|
||||||
cursorType = MouseCursorHandler.CursorType.POINTER;
|
cursorType = MouseCursorHandler.CursorType.POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
hsb.render(mouseX, mouseY);
|
||||||
|
|
||||||
|
action.onChange(hsb.getSelectedColorFinal(), chroma, opacity);
|
||||||
|
|
||||||
|
colorY += 100;
|
||||||
|
|
||||||
|
if(allowChangeOpacity) {
|
||||||
|
GlStateManager.color(1, 1, 1, 1);
|
||||||
|
RegularSlider.render(3, colorY, 144, "Opacity", 255, opacity);
|
||||||
|
if (RegularSlider.isDrag(mouseX, mouseY, 3, colorY, 144) && (System.currentTimeMillis() - initTime) > 500) {
|
||||||
|
double diff = 255;
|
||||||
|
double mouse = MathHelper.clamp_double((mouseX - 3) / 144D, 0, 1);
|
||||||
|
double newVal = 0 + mouse * diff;
|
||||||
|
opacity = (int) newVal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Client.getInstance().getMouseCursorHandler().enableCursor(cursorType);
|
Client.getInstance().getMouseCursorHandler().enableCursor(cursorType);
|
||||||
|
|
||||||
@ -131,64 +97,33 @@ public class ColorPicker extends SilentScreen {
|
|||||||
super.actionPerformed(button);
|
super.actionPerformed(button);
|
||||||
ModMenu.clickBaseButtons(button, this);
|
ModMenu.clickBaseButtons(button, this);
|
||||||
|
|
||||||
switch (button.id) {
|
if (button.id == 1) {
|
||||||
case 1:
|
|
||||||
mc.displayGuiScreen(parentScreen);
|
mc.displayGuiScreen(parentScreen);
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
mod.reset(false);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
mod.toggle();
|
|
||||||
button.displayString = mod.isEnabled() ? "Enabled" : "Disabled";
|
|
||||||
if(button instanceof Button) {
|
|
||||||
((Button) button).setTheme(mod.isEnabled() ? new SelectedButtonTheme() : new DefaultButtonTheme());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
|
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
|
||||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value);
|
|
||||||
float colorY = 66;
|
float colorY = 66;
|
||||||
int colorX = 3;
|
|
||||||
int colorIndex = 0;
|
|
||||||
for(Color color : colors) {
|
|
||||||
if(MouseUtils.isInside(mouseX, mouseY, colorX, colorY, 20, 20)) {
|
|
||||||
setting.setValColor(color);
|
|
||||||
mc.displayGuiScreen(parentScreen);
|
|
||||||
}
|
|
||||||
colorX += 25;
|
|
||||||
colorIndex += 1;
|
|
||||||
if(colorIndex == 6) {
|
|
||||||
colorIndex = 0;
|
|
||||||
colorX = 3;
|
|
||||||
colorY += 25;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int settingHeight = 15;
|
|
||||||
colorY += settingHeight;
|
|
||||||
if(setting.isCanChangeOpacity()) {
|
|
||||||
colorY += settingHeight * 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
colorY += settingHeight;
|
|
||||||
|
|
||||||
if(Checkbox.isHovered(mouseX, mouseY, 3, colorY)) {
|
if(Checkbox.isHovered(mouseX, mouseY, 3, colorY)) {
|
||||||
setting.setChroma(!setting.isChroma());
|
chroma = !chroma;
|
||||||
mc.displayGuiScreen(parentScreen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hsb.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseReleased(int mouseX, int mouseY, int state) {
|
||||||
|
hsb.mouseReleased(mouseX, mouseY, state);
|
||||||
|
super.mouseReleased(mouseX, mouseY, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGuiClosed() {
|
public void onGuiClosed() {
|
||||||
super.onGuiClosed();
|
super.onGuiClosed();
|
||||||
if(mod.getName() == "Pack Tweaks" && mod.isEnabled()) {
|
action.onClose(hsb.getSelectedColorFinal(), chroma, opacity);
|
||||||
mc.renderGlobal.loadRenderers();
|
|
||||||
}
|
|
||||||
MenuBlurUtils.unloadBlur();
|
MenuBlurUtils.unloadBlur();
|
||||||
|
Client.getInstance().configManager.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import net.silentclient.client.gui.theme.Theme;
|
|||||||
import net.silentclient.client.gui.theme.button.DefaultButtonTheme;
|
import net.silentclient.client.gui.theme.button.DefaultButtonTheme;
|
||||||
import net.silentclient.client.gui.theme.button.SelectedButtonTheme;
|
import net.silentclient.client.gui.theme.button.SelectedButtonTheme;
|
||||||
import net.silentclient.client.gui.theme.switches.DefaultSwitchTheme;
|
import net.silentclient.client.gui.theme.switches.DefaultSwitchTheme;
|
||||||
|
import net.silentclient.client.gui.util.ColorPickerAction;
|
||||||
import net.silentclient.client.gui.util.RenderUtil;
|
import net.silentclient.client.gui.util.RenderUtil;
|
||||||
import net.silentclient.client.mods.Mod;
|
import net.silentclient.client.mods.Mod;
|
||||||
import net.silentclient.client.mods.ModCategory;
|
import net.silentclient.client.mods.ModCategory;
|
||||||
@ -171,7 +172,7 @@ public class ModMenu extends SilentScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(modCategory == ModCategory.MODS) {
|
if(modCategory == ModCategory.MODS) {
|
||||||
Switch.render(mouseX, mouseY, 129, modY + 10 - 4, mod.switchAniamation, mod.isEnabled(), mod.isForceDisabled(), mod.isForceDisabled() ? "Force disabled" : null);
|
Switch.render(mouseX, mouseY, 129, modY + 10 - 4, mod.simpleAnimation, mod.isEnabled(), mod.isForceDisabled(), mod.isForceDisabled() ? "Force disabled" : null);
|
||||||
if(Switch.isHovered(mouseX, mouseY, 129, modY + 10 - 4)) {
|
if(Switch.isHovered(mouseX, mouseY, 129, modY + 10 - 4)) {
|
||||||
cursorType = MouseCursorHandler.CursorType.POINTER;
|
cursorType = MouseCursorHandler.CursorType.POINTER;
|
||||||
}
|
}
|
||||||
@ -449,7 +450,24 @@ public class ModMenu extends SilentScreen {
|
|||||||
premiumY += 15;
|
premiumY += 15;
|
||||||
if(RegularColorPicker.isHovered(mouseX, mouseY, 3, (int) premiumY, 144)) {
|
if(RegularColorPicker.isHovered(mouseX, mouseY, 3, (int) premiumY, 144)) {
|
||||||
// Color Picker
|
// Color Picker
|
||||||
mc.displayGuiScreen(new PremiumColorPicker(this));
|
mc.displayGuiScreen(new ColorPicker(Client.getInstance().getAccount().getBandanaColor() == 50 ? new Color(255, 255, 255) : new Color(Client.getInstance().getAccount().getBandanaColor()), Client.getInstance().getAccount().getBandanaColor() == 50, false, 255, new ColorPickerAction() {
|
||||||
|
@Override
|
||||||
|
public void onChange(Color color, boolean chroma, int opacity) {
|
||||||
|
int colorInt = 0;
|
||||||
|
colorInt = color.getRGB();
|
||||||
|
if(chroma) {
|
||||||
|
colorInt = 50;
|
||||||
|
}
|
||||||
|
if(Client.getInstance().getAccount().getBandanaColor() != colorInt) {
|
||||||
|
Client.getInstance().getAccount().setBandanaColor(colorInt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClose(Color color, boolean chroma, int opacity) {
|
||||||
|
Client.getInstance().getAccount().saveBandanaColor();
|
||||||
|
}
|
||||||
|
}, this));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
premiumY += 15;
|
premiumY += 15;
|
||||||
|
@ -7,25 +7,25 @@ import net.minecraft.util.MathHelper;
|
|||||||
import net.silentclient.client.Client;
|
import net.silentclient.client.Client;
|
||||||
import net.silentclient.client.gui.SilentScreen;
|
import net.silentclient.client.gui.SilentScreen;
|
||||||
import net.silentclient.client.gui.animation.SimpleAnimation;
|
import net.silentclient.client.gui.animation.SimpleAnimation;
|
||||||
|
import net.silentclient.client.gui.elements.*;
|
||||||
import net.silentclient.client.gui.elements.Button;
|
import net.silentclient.client.gui.elements.Button;
|
||||||
import net.silentclient.client.gui.elements.Checkbox;
|
|
||||||
import net.silentclient.client.gui.elements.Input;
|
|
||||||
import net.silentclient.client.gui.elements.StaticButton;
|
|
||||||
import net.silentclient.client.gui.font.SilentFontRenderer;
|
import net.silentclient.client.gui.font.SilentFontRenderer;
|
||||||
import net.silentclient.client.gui.theme.button.DefaultButtonTheme;
|
import net.silentclient.client.gui.theme.button.DefaultButtonTheme;
|
||||||
import net.silentclient.client.gui.theme.button.RedButtonTheme;
|
import net.silentclient.client.gui.theme.button.RedButtonTheme;
|
||||||
import net.silentclient.client.gui.theme.button.SelectedButtonTheme;
|
import net.silentclient.client.gui.theme.button.SelectedButtonTheme;
|
||||||
import net.silentclient.client.gui.theme.input.DefaultInputTheme;
|
import net.silentclient.client.gui.theme.input.DefaultInputTheme;
|
||||||
|
import net.silentclient.client.gui.util.ColorPickerAction;
|
||||||
import net.silentclient.client.mods.Mod;
|
import net.silentclient.client.mods.Mod;
|
||||||
import net.silentclient.client.mods.ModCategory;
|
import net.silentclient.client.mods.ModCategory;
|
||||||
import net.silentclient.client.mods.Setting;
|
import net.silentclient.client.mods.Setting;
|
||||||
import net.silentclient.client.mods.render.CrosshairMod;
|
import net.silentclient.client.mods.render.crosshair.CrosshairMod;
|
||||||
import net.silentclient.client.mods.world.TimeChangerMod;
|
import net.silentclient.client.mods.world.TimeChangerMod;
|
||||||
import net.silentclient.client.utils.MenuBlurUtils;
|
import net.silentclient.client.utils.MenuBlurUtils;
|
||||||
import net.silentclient.client.utils.MouseCursorHandler;
|
import net.silentclient.client.utils.MouseCursorHandler;
|
||||||
import net.silentclient.client.utils.Sounds;
|
import net.silentclient.client.utils.Sounds;
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
@ -130,12 +130,20 @@ public class ModSettings extends SilentScreen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (setting.isCheck()) {
|
if (setting.isCheck()) {
|
||||||
Checkbox.render(mouseX, mouseY, 3, settingY, setting.getName(), setting.getValBoolean());
|
Switch.render(mouseX, mouseY, 3, settingY, setting.switchAnimation, setting.getValBoolean(), false);
|
||||||
if(Checkbox.isHovered(mouseX, mouseY, 3, settingY)) {
|
if(Switch.isHovered(mouseX, mouseY, 3, settingY)) {
|
||||||
cursorType = MouseCursorHandler.CursorType.POINTER;
|
cursorType = MouseCursorHandler.CursorType.POINTER;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
Client.getInstance().getSilentFontRenderer().drawString(setting.getName(), 3 + 18, settingY + (((float) 8 / 2) - ((float) 12 / 2)), 12, SilentFontRenderer.FontType.TITLE);
|
||||||
|
}
|
||||||
|
if(setting.isCellGrid()) {
|
||||||
|
MouseCursorHandler.CursorType cellGridCursor = CellGrid.render(mouseX, mouseY, 3, settingY, setting);
|
||||||
|
if(cellGridCursor != null) {
|
||||||
|
cursorType = cellGridCursor;
|
||||||
|
}
|
||||||
|
settingY += 135;
|
||||||
|
}
|
||||||
if(setting.isSlider()) {
|
if(setting.isSlider()) {
|
||||||
RegularSlider.render(3, settingY, 144, setting.getName(), setting.getMax(), setting.getValDouble());
|
RegularSlider.render(3, settingY, 144, setting.getName(), setting.getMax(), setting.getValDouble());
|
||||||
|
|
||||||
@ -254,16 +262,30 @@ public class ModSettings extends SilentScreen {
|
|||||||
inputIndex++;
|
inputIndex++;
|
||||||
}
|
}
|
||||||
if (setting.isColor() && RegularColorPicker.isHovered(mouseX, mouseY, 3, (int) settingY, 144)) {
|
if (setting.isColor() && RegularColorPicker.isHovered(mouseX, mouseY, 3, (int) settingY, 144)) {
|
||||||
mc.displayGuiScreen(new ColorPicker(mod, setting.getName(), this));
|
mc.displayGuiScreen(new ColorPicker(setting.getValColor(true), setting.isChroma(), setting.isCanChangeOpacity(), setting.getOpacity(), new ColorPickerAction() {
|
||||||
|
@Override
|
||||||
|
public void onChange(Color color, boolean chroma, int opacity) {
|
||||||
|
setting.setValColor(color);
|
||||||
|
setting.setChroma(chroma);
|
||||||
|
if(setting.isCanChangeOpacity()) {
|
||||||
|
setting.setOpacity(opacity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, this));
|
||||||
}
|
}
|
||||||
if (setting.isCheck()) {
|
if (setting.isCheck()) {
|
||||||
if(Checkbox.isHovered(mouseX, mouseY, 3, settingY)) {
|
if(Switch.isHovered(mouseX, mouseY, 3, settingY)) {
|
||||||
Sounds.playButtonSound();
|
Sounds.playButtonSound();
|
||||||
setting.setValBoolean(!setting.getValBoolean());
|
setting.setValBoolean(!setting.getValBoolean());
|
||||||
mod.onChangeSettingValue(setting);
|
mod.onChangeSettingValue(setting);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(setting.isCellGrid()) {
|
||||||
|
CellGrid.click(mouseX, mouseY, mouseButton, setting);
|
||||||
|
settingY += 135;
|
||||||
|
}
|
||||||
|
|
||||||
if(setting.isSlider()) {
|
if(setting.isSlider()) {
|
||||||
settingY += 15;
|
settingY += 15;
|
||||||
}
|
}
|
||||||
@ -381,6 +403,17 @@ public class ModSettings extends SilentScreen {
|
|||||||
MenuBlurUtils.unloadBlur();
|
MenuBlurUtils.unloadBlur();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseReleased(int mouseX, int mouseY, int state) {
|
||||||
|
super.mouseReleased(mouseX, mouseY, state);
|
||||||
|
|
||||||
|
for (Setting setting : Client.getInstance().getSettingsManager().getSettingByMod(mod)) {
|
||||||
|
if(setting.isCellGrid()) {
|
||||||
|
CellGrid.release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doesGuiPauseGame() {
|
public boolean doesGuiPauseGame() {
|
||||||
return !(this.mod instanceof TimeChangerMod);
|
return !(this.mod instanceof TimeChangerMod);
|
||||||
|
@ -1,149 +0,0 @@
|
|||||||
package net.silentclient.client.gui.modmenu;
|
|
||||||
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
|
||||||
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.lite.clickgui.utils.MouseUtils;
|
|
||||||
import net.silentclient.client.gui.util.RenderUtil;
|
|
||||||
import net.silentclient.client.utils.MenuBlurUtils;
|
|
||||||
import net.silentclient.client.utils.MouseCursorHandler;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class PremiumColorPicker extends SilentScreen {
|
|
||||||
private long initTime;
|
|
||||||
private final GuiScreen parentScreen;
|
|
||||||
private ArrayList<Color> colors = new ArrayList<Color>();
|
|
||||||
|
|
||||||
public PremiumColorPicker(GuiScreen parentScreen) {
|
|
||||||
this.parentScreen = parentScreen;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initGui() {
|
|
||||||
super.initGui();
|
|
||||||
defaultCursor = false;
|
|
||||||
this.initTime = System.currentTimeMillis();
|
|
||||||
this.buttonList.clear();
|
|
||||||
this.silentInputs.clear();
|
|
||||||
|
|
||||||
MenuBlurUtils.loadBlur();
|
|
||||||
|
|
||||||
ModMenu.initBaseButtons(this.buttonList);
|
|
||||||
this.buttonList.add(new Button(1, 3, 26, 144, 15, "Back"));
|
|
||||||
|
|
||||||
colors.clear();
|
|
||||||
colors.add(new Color(255, 255, 255));
|
|
||||||
colors.add(new Color(156, 157, 151));
|
|
||||||
colors.add(new Color(71,79,82));
|
|
||||||
colors.add(new Color(0, 0, 0));
|
|
||||||
colors.add(new Color(255,216,61));
|
|
||||||
colors.add(new Color(249,128,29));
|
|
||||||
colors.add(new Color(176,46,38));
|
|
||||||
colors.add(new Color(130,84,50));
|
|
||||||
colors.add(new Color(128,199,31));
|
|
||||||
colors.add(new Color(58,179,218));
|
|
||||||
colors.add(new Color(22,156,157));
|
|
||||||
colors.add(new Color(60,68,169));
|
|
||||||
colors.add(new Color(243,140,170));
|
|
||||||
colors.add(new Color(198,79,189));
|
|
||||||
colors.add(new Color(137,50,183));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
|
||||||
MenuBlurUtils.renderBackground(this);
|
|
||||||
|
|
||||||
MouseCursorHandler.CursorType cursorType = getCursor(silentInputs, buttonList);
|
|
||||||
|
|
||||||
ModMenu.drawOverlayListBase(height, "Choose a color");
|
|
||||||
|
|
||||||
ModMenu.trimContentStart(width, height);
|
|
||||||
float colorY = 66;
|
|
||||||
int colorX = 3;
|
|
||||||
int colorIndex = 0;
|
|
||||||
for(Color color : colors) {
|
|
||||||
RenderUtil.drawRoundedRect(colorX, colorY, 20, 20, 3, new Color(color.getRed(), color.getGreen(), color.getBlue()).getRGB());
|
|
||||||
RenderUtil.drawRoundedOutline(colorX, colorY, 20, 20, 3, 2, new Color(0, 0, 0).getRGB());
|
|
||||||
if(MouseUtils.isInside(mouseX, mouseY, colorX, colorY, 20, 20)) {
|
|
||||||
cursorType = MouseCursorHandler.CursorType.POINTER;
|
|
||||||
}
|
|
||||||
colorX += 25;
|
|
||||||
colorIndex += 1;
|
|
||||||
if(colorIndex == 6) {
|
|
||||||
colorIndex = 0;
|
|
||||||
colorX = 3;
|
|
||||||
colorY += 25;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int settingHeight = 15;
|
|
||||||
colorY += settingHeight;
|
|
||||||
colorY += settingHeight;
|
|
||||||
|
|
||||||
Checkbox.render(mouseX, mouseY, 3, colorY, "Chroma", Client.getInstance().getAccount().getBandanaColor() == 50);
|
|
||||||
|
|
||||||
if(Checkbox.isHovered(mouseX, mouseY, 3, colorY)) {
|
|
||||||
cursorType = MouseCursorHandler.CursorType.POINTER;
|
|
||||||
}
|
|
||||||
|
|
||||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
|
||||||
|
|
||||||
Client.getInstance().getMouseCursorHandler().enableCursor(cursorType);
|
|
||||||
|
|
||||||
ModMenu.trimContentEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void actionPerformed(GuiButton button) throws IOException {
|
|
||||||
super.actionPerformed(button);
|
|
||||||
ModMenu.clickBaseButtons(button, this);
|
|
||||||
|
|
||||||
switch (button.id) {
|
|
||||||
case 1:
|
|
||||||
mc.displayGuiScreen(parentScreen);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
|
|
||||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
|
||||||
float colorY = 66;
|
|
||||||
int colorX = 3;
|
|
||||||
int colorIndex = 0;
|
|
||||||
for(Color color : colors) {
|
|
||||||
if(MouseUtils.isInside(mouseX, mouseY, colorX, colorY, 20, 20)) {
|
|
||||||
Client.getInstance().getAccount().setBandanaColor(color.getRGB());
|
|
||||||
mc.displayGuiScreen(parentScreen);
|
|
||||||
}
|
|
||||||
colorX += 25;
|
|
||||||
colorIndex += 1;
|
|
||||||
if(colorIndex == 6) {
|
|
||||||
colorIndex = 0;
|
|
||||||
colorX = 3;
|
|
||||||
colorY += 25;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int settingHeight = 15;
|
|
||||||
colorY += settingHeight;
|
|
||||||
colorY += settingHeight;
|
|
||||||
|
|
||||||
if(Checkbox.isHovered(mouseX, mouseY, 3, colorY)) {
|
|
||||||
Client.getInstance().getAccount().setBandanaColor(Client.getInstance().getAccount().getBandanaColor() == 50 ? -1 : 50);
|
|
||||||
mc.displayGuiScreen(parentScreen);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onGuiClosed() {
|
|
||||||
super.onGuiClosed();
|
|
||||||
MenuBlurUtils.unloadBlur();
|
|
||||||
}
|
|
||||||
}
|
|
@ -89,6 +89,7 @@ public class SilentMultiplayerGui extends SilentScreen {
|
|||||||
public void getServers() {
|
public void getServers() {
|
||||||
servers.clear();
|
servers.clear();
|
||||||
for(ServerDataFeature serverDataFeature : Client.getInstance().getFeaturedServers()) {
|
for(ServerDataFeature serverDataFeature : Client.getInstance().getFeaturedServers()) {
|
||||||
|
serverDataFeature.resetData();
|
||||||
servers.add(new ServerComponent(this, serverDataFeature));
|
servers.add(new ServerComponent(this, serverDataFeature));
|
||||||
}
|
}
|
||||||
for (int i = 0; i < savedServerList.countServers(); ++i)
|
for (int i = 0; i < savedServerList.countServers(); ++i)
|
||||||
@ -141,7 +142,7 @@ public class SilentMultiplayerGui extends SilentScreen {
|
|||||||
scrollHelper.setStep(5);
|
scrollHelper.setStep(5);
|
||||||
scrollHelper.setElementsHeight(servers.size() * 38);
|
scrollHelper.setElementsHeight(servers.size() * 38);
|
||||||
scrollHelper.setMaxScroll(blockHeight - 43 - 41);
|
scrollHelper.setMaxScroll(blockHeight - 43 - 41);
|
||||||
scrollHelper.setSpeed(100);
|
scrollHelper.setSpeed(200);
|
||||||
float serverY = blockY + 43 + scrollHelper.getScroll();
|
float serverY = blockY + 43 + scrollHelper.getScroll();
|
||||||
trimContentStart();
|
trimContentStart();
|
||||||
int serverIndex = -1;
|
int serverIndex = -1;
|
||||||
|
@ -28,6 +28,7 @@ import java.io.IOException;
|
|||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class SilentResourcePacksGui extends SilentScreen {
|
public class SilentResourcePacksGui extends SilentScreen {
|
||||||
private final GuiScreen parentScreen;
|
private final GuiScreen parentScreen;
|
||||||
@ -40,6 +41,7 @@ public class SilentResourcePacksGui extends SilentScreen {
|
|||||||
private int blockHeight = 0;
|
private int blockHeight = 0;
|
||||||
private ScrollHelper scrollHelper = new ScrollHelper();
|
private ScrollHelper scrollHelper = new ScrollHelper();
|
||||||
private ScrollHelper scrollHelper2 = new ScrollHelper();
|
private ScrollHelper scrollHelper2 = new ScrollHelper();
|
||||||
|
private Random random = new Random();
|
||||||
|
|
||||||
public SilentResourcePacksGui(GuiScreen parentScreenIn)
|
public SilentResourcePacksGui(GuiScreen parentScreenIn)
|
||||||
{
|
{
|
||||||
@ -61,6 +63,7 @@ public class SilentResourcePacksGui extends SilentScreen {
|
|||||||
if(mc.thePlayer != null) {
|
if(mc.thePlayer != null) {
|
||||||
this.buttonList.add(new TooltipIconButton(2, blockX + blockWidth - 14 - 5, blockY + blockHeight - 5 - 14, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/lightoverlay.png"), "Toggle Background Panorama"));
|
this.buttonList.add(new TooltipIconButton(2, blockX + blockWidth - 14 - 5, blockY + blockHeight - 5 - 14, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/lightoverlay.png"), "Toggle Background Panorama"));
|
||||||
}
|
}
|
||||||
|
this.buttonList.add(new TooltipIconButton(6, blockX + 5, blockY + blockHeight - 5 - 14, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/dice.png"), "Random Resource Pack"));
|
||||||
this.buttonList.add(new Button(3, blockX + 40, blockY + blockHeight - 5 - 14, 100, 14, "Open Pack Folder"));
|
this.buttonList.add(new Button(3, blockX + 40, blockY + blockHeight - 5 - 14, 100, 14, "Open Pack Folder"));
|
||||||
this.buttonList.add(new Button(4, blockX + 40 + 100 + 5, blockY + blockHeight - 5 - 14, 100, 14, "Apply"));
|
this.buttonList.add(new Button(4, blockX + 40 + 100 + 5, blockY + blockHeight - 5 - 14, 100, 14, "Apply"));
|
||||||
this.buttonList.add(new Button(5, blockX + 40 + 100 + 5 + 100 + 5, blockY + blockHeight - 5 - 14, 100, 14, "Done"));
|
this.buttonList.add(new Button(5, blockX + 40 + 100 + 5 + 100 + 5, blockY + blockHeight - 5 - 14, 100, 14, "Done"));
|
||||||
@ -122,7 +125,7 @@ public class SilentResourcePacksGui extends SilentScreen {
|
|||||||
scrollHelper.setStep(5);
|
scrollHelper.setStep(5);
|
||||||
scrollHelper.setElementsHeight(availableResourcePacks.size() * 37 + 19);
|
scrollHelper.setElementsHeight(availableResourcePacks.size() * 37 + 19);
|
||||||
scrollHelper.setMaxScroll(blockHeight - 45);
|
scrollHelper.setMaxScroll(blockHeight - 45);
|
||||||
scrollHelper.setSpeed(150);
|
scrollHelper.setSpeed(200);
|
||||||
|
|
||||||
if(MouseUtils.isInside(mouseX, mouseY, x, y, 193, blockHeight - 45)) {
|
if(MouseUtils.isInside(mouseX, mouseY, x, y, 193, blockHeight - 45)) {
|
||||||
scrollHelper.setFlag(true);
|
scrollHelper.setFlag(true);
|
||||||
@ -204,7 +207,8 @@ public class SilentResourcePacksGui extends SilentScreen {
|
|||||||
scrollHelper2.setStep(5);
|
scrollHelper2.setStep(5);
|
||||||
scrollHelper2.setElementsHeight(selectedResourcePacks.size() * 37 + 19);
|
scrollHelper2.setElementsHeight(selectedResourcePacks.size() * 37 + 19);
|
||||||
scrollHelper2.setMaxScroll(blockHeight - 45);
|
scrollHelper2.setMaxScroll(blockHeight - 45);
|
||||||
scrollHelper2.setSpeed(150);
|
scrollHelper.setSpeed(200);
|
||||||
|
|
||||||
if(MouseUtils.isInside(mouseX, mouseY, x, y, 193, blockHeight - 45)) {
|
if(MouseUtils.isInside(mouseX, mouseY, x, y, 193, blockHeight - 45)) {
|
||||||
scrollHelper2.setFlag(true);
|
scrollHelper2.setFlag(true);
|
||||||
} else {
|
} else {
|
||||||
@ -410,9 +414,30 @@ public class SilentResourcePacksGui extends SilentScreen {
|
|||||||
this.apply();
|
this.apply();
|
||||||
mc.displayGuiScreen(parentScreen);
|
mc.displayGuiScreen(parentScreen);
|
||||||
break;
|
break;
|
||||||
|
case 6:
|
||||||
|
this.randomPack();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void randomPack() {
|
||||||
|
if(!this.selectedResourcePacks.isEmpty()) {
|
||||||
|
for(ResourcePackRepository.Entry entry : this.selectedResourcePacks) {
|
||||||
|
this.availableResourcePacks.add(0, entry);
|
||||||
|
}
|
||||||
|
this.selectedResourcePacks.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
ResourcePackRepository.Entry randomPack = this.availableResourcePacks.get(random.nextInt(this.availableResourcePacks.size()));
|
||||||
|
|
||||||
|
if(randomPack != null) {
|
||||||
|
this.selectedResourcePacks.add(0, randomPack);
|
||||||
|
this.availableResourcePacks.remove(randomPack);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.markChanged();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
|
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
|
||||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
@ -11,6 +11,7 @@ import net.minecraft.util.ResourceLocation;
|
|||||||
import net.silentclient.client.Client;
|
import net.silentclient.client.Client;
|
||||||
import net.silentclient.client.cosmetics.gui.CosmeticsGui;
|
import net.silentclient.client.cosmetics.gui.CosmeticsGui;
|
||||||
import net.silentclient.client.gui.SilentScreen;
|
import net.silentclient.client.gui.SilentScreen;
|
||||||
|
import net.silentclient.client.gui.animation.SimpleAnimation;
|
||||||
import net.silentclient.client.gui.elements.IconButton;
|
import net.silentclient.client.gui.elements.IconButton;
|
||||||
import net.silentclient.client.gui.font.SilentFontRenderer;
|
import net.silentclient.client.gui.font.SilentFontRenderer;
|
||||||
import net.silentclient.client.gui.lite.LiteMainMenu;
|
import net.silentclient.client.gui.lite.LiteMainMenu;
|
||||||
@ -19,10 +20,12 @@ import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
|
|||||||
import net.silentclient.client.gui.silentmainmenu.components.AccountPicker;
|
import net.silentclient.client.gui.silentmainmenu.components.AccountPicker;
|
||||||
import net.silentclient.client.gui.silentmainmenu.components.MenuOption;
|
import net.silentclient.client.gui.silentmainmenu.components.MenuOption;
|
||||||
import net.silentclient.client.gui.theme.button.IButtonTheme;
|
import net.silentclient.client.gui.theme.button.IButtonTheme;
|
||||||
|
import net.silentclient.client.gui.util.GlUtil;
|
||||||
import net.silentclient.client.gui.util.RenderUtil;
|
import net.silentclient.client.gui.util.RenderUtil;
|
||||||
import net.silentclient.client.utils.MouseCursorHandler;
|
import net.silentclient.client.utils.MouseCursorHandler;
|
||||||
import net.silentclient.client.utils.PromoController;
|
import net.silentclient.client.utils.PromoController;
|
||||||
import net.silentclient.client.utils.SCTextureManager;
|
import net.silentclient.client.utils.SCTextureManager;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@ -36,6 +39,7 @@ public class MainMenuConcept extends SilentScreen {
|
|||||||
public static boolean loading = false;
|
public static boolean loading = false;
|
||||||
public static boolean initSkin = false;
|
public static boolean initSkin = false;
|
||||||
private AccountPicker accountPicker;
|
private AccountPicker accountPicker;
|
||||||
|
private final SimpleAnimation scaleAnimation = new SimpleAnimation(0f);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
@ -99,13 +103,23 @@ public class MainMenuConcept extends SilentScreen {
|
|||||||
if(MouseUtils.isInside(mouseX, mouseY, 10, 10, 109, 63)) {
|
if(MouseUtils.isInside(mouseX, mouseY, 10, 10, 109, 63)) {
|
||||||
cursorType = MouseCursorHandler.CursorType.POINTER;
|
cursorType = MouseCursorHandler.CursorType.POINTER;
|
||||||
}
|
}
|
||||||
RenderUtils.drawRect(10, 10, 109, 63, -1);
|
RenderUtils.drawRect(11, 11, 107, 61, -1);
|
||||||
RenderUtil.drawImage(PromoController.getResponse().getCurrentPanel().getImageLocation(), 12, 12, 105, 59, false);
|
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||||
|
GlUtil.scissor(12, 12, 12 + 105, 12 + 59);
|
||||||
|
RenderUtil.drawImage(PromoController.getResponse().getCurrentPanel().getImageLocation(), 12 - scaleAnimation.getValue(), 12 - scaleAnimation.getValue(), 105 + (scaleAnimation.getValue() * 2), 59 + (scaleAnimation.getValue() * 2), false);
|
||||||
|
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
||||||
|
|
||||||
|
if(MouseUtils.isInside(mouseX, mouseY, 12, 12, 105, 59)) {
|
||||||
|
scaleAnimation.setAnimation(10f, 15f);
|
||||||
|
} else {
|
||||||
|
scaleAnimation.setAnimation(0f, 15f);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
PromoController.getResponse().getCurrentPanel().loadImage();
|
PromoController.getResponse().getCurrentPanel().loadImage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Client.getInstance().getSilentFontRenderer().drawString(3, height - 14, "Silent Client 1.8.9", 12, SilentFontRenderer.FontType.TITLE);
|
Client.getInstance().getSilentFontRenderer().drawString(3, height - 14, "Silent Client 1.8.9", 12, SilentFontRenderer.FontType.TITLE);
|
||||||
|
|
||||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||||
|
@ -10,14 +10,17 @@ import net.silentclient.client.gui.font.SilentFontRenderer;
|
|||||||
import net.silentclient.client.gui.lite.LiteMainMenu;
|
import net.silentclient.client.gui.lite.LiteMainMenu;
|
||||||
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
|
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
|
||||||
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
|
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
|
||||||
|
import net.silentclient.client.gui.util.GlUtil;
|
||||||
import net.silentclient.client.gui.util.RenderUtil;
|
import net.silentclient.client.gui.util.RenderUtil;
|
||||||
import net.silentclient.client.utils.PromoController;
|
import net.silentclient.client.utils.PromoController;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
public class SilentMainMenu extends SilentScreen {
|
public class SilentMainMenu extends SilentScreen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
super.initGui();
|
super.initGui();
|
||||||
@ -51,6 +54,7 @@ public class SilentMainMenu extends SilentScreen {
|
|||||||
blockY = 70;
|
blockY = 70;
|
||||||
}
|
}
|
||||||
RenderUtils.drawRect(blockX, blockY, 320, 150, new Color(20, 20, 20).getRGB());
|
RenderUtils.drawRect(blockX, blockY, 320, 150, new Color(20, 20, 20).getRGB());
|
||||||
|
|
||||||
if(PromoController.getResponse().getCurrentPanel() != null) {
|
if(PromoController.getResponse().getCurrentPanel() != null) {
|
||||||
if(PromoController.getResponse().getCurrentPanel().getImageLocation() != null) {
|
if(PromoController.getResponse().getCurrentPanel().getImageLocation() != null) {
|
||||||
RenderUtil.drawImage(PromoController.getResponse().getCurrentPanel().getImageLocation(), blockX + 78, blockY + 10, 231, 130, false);
|
RenderUtil.drawImage(PromoController.getResponse().getCurrentPanel().getImageLocation(), blockX + 78, blockY + 10, 231, 130, false);
|
||||||
@ -59,6 +63,7 @@ public class SilentMainMenu extends SilentScreen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int optionY = blockY + 10;
|
int optionY = blockY + 10;
|
||||||
this.drawOptionButton(mouseX, mouseY, blockX + 5, optionY, new ResourceLocation("silentclient/icons/settings/cosmetics.png"), "Cosmetics");
|
this.drawOptionButton(mouseX, mouseY, blockX + 5, optionY, new ResourceLocation("silentclient/icons/settings/cosmetics.png"), "Cosmetics");
|
||||||
optionY += 15;
|
optionY += 15;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user