BIN
libs/joml-1.10.5.jar
Normal file
@ -402,6 +402,7 @@ public class Client {
|
||||
Client.getInstance().getCosmetics().setMyBandanas(cosmetics.getAccount().getCosmetics().getBandanas());
|
||||
Client.getInstance().getCosmetics().setMyHats(cosmetics.getAccount().getCosmetics().getHats());
|
||||
Client.getInstance().getCosmetics().setMyShields(cosmetics.getAccount().getCosmetics().getShields());
|
||||
Client.getInstance().getCosmetics().setMyEmotes(cosmetics.getAccount().getCosmetics().getEmotes());
|
||||
Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Shoulders").setValBoolean(cosmetics.getAccount().getCapeShoulders());
|
||||
Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Type").setValString(cosmetics.getAccount().getCapeType().equals("dynamic_curved") ? "Dynamic Curved" : cosmetics.getAccount().getCapeType().equals("curved_rectangle") ? "Curved Rectangle" : "Rectangle");
|
||||
if(Minecraft.getMinecraft().thePlayer != null) {
|
||||
@ -666,7 +667,7 @@ public class Client {
|
||||
}
|
||||
|
||||
public boolean isTest() {
|
||||
return getBuildData().getBranch().equals("test");
|
||||
return getBuildData().getBranch().equals("TEST2");
|
||||
}
|
||||
|
||||
public boolean isDebug() {
|
||||
|
@ -8,4 +8,12 @@ public class ServerDataFeature extends ServerData {
|
||||
public ServerDataFeature(String serverName, String serverIp) {
|
||||
super(serverName, serverIp, false);
|
||||
}
|
||||
|
||||
public void resetData() {
|
||||
this.field_78841_f = false;
|
||||
this.pingToServer = 0;
|
||||
this.populationInfo = null;
|
||||
this.playerList = null;
|
||||
this.serverMOTD = null;
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ public class Cosmetics {
|
||||
public Map<Number, HatData> hats = new HashMap<>();
|
||||
public Map<Number, ShieldData> shields = new HashMap<>();
|
||||
public Map<Number, StaticResourceLocation> icons = new HashMap<>();
|
||||
public Map<Number, CosmeticItem> emotes = new HashMap<>();
|
||||
|
||||
public ArrayList<CosmeticItem> myIcons = new ArrayList<CosmeticItem>();
|
||||
public ArrayList<CosmeticItem> myWings = new ArrayList<CosmeticItem>();
|
||||
@ -37,6 +38,7 @@ public class Cosmetics {
|
||||
public ArrayList<CosmeticItem> myBandanas = new ArrayList<CosmeticItem>();
|
||||
public ArrayList<CosmeticItem> myHats = new ArrayList<CosmeticItem>();
|
||||
public ArrayList<CosmeticItem> myShields = new ArrayList<CosmeticItem>();
|
||||
public ArrayList<CosmeticItem> myEmotes = new ArrayList<CosmeticItem>();
|
||||
|
||||
|
||||
public StaticResourceLocation defaultIcon;
|
||||
@ -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");
|
||||
Outfits.loadOutfits();
|
||||
}
|
||||
@ -157,7 +167,8 @@ public class Cosmetics {
|
||||
Client.getInstance().getCosmetics().setMyBandanas(cosmetics.getAccount().getCosmetics().getBandanas());
|
||||
Client.getInstance().getCosmetics().setMyHats(cosmetics.getAccount().getCosmetics().getHats());
|
||||
Client.getInstance().getCosmetics().setMyShields(cosmetics.getAccount().getCosmetics().getShields());
|
||||
Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Shoulders").setValBoolean(cosmetics.getAccount().getCapeShoulders());
|
||||
Client.getInstance().getCosmetics().setMyEmotes(cosmetics.getAccount().getCosmetics().getEmotes());
|
||||
Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Shoulders").setValBoolean(cosmetics.getAccount().getCapeShoulders());
|
||||
Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Type").setValString(cosmetics.getAccount().getCapeType().equals("dynamic_curved") ? "Dynamic Curved" : cosmetics.getAccount().getCapeType().equals("curved_rectangle") ? "Curved Rectangle" : "Rectangle");
|
||||
if(Minecraft.getMinecraft().thePlayer != null) {
|
||||
((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$setCapeType(cosmetics.getAccount().getCapeType());
|
||||
@ -178,6 +189,7 @@ public class Cosmetics {
|
||||
Client.getInstance().getCosmetics().setMyBandanas(cosmetics.getAccount().getCosmetics().getBandanas());
|
||||
Client.getInstance().getCosmetics().setMyHats(cosmetics.getAccount().getCosmetics().getHats());
|
||||
Client.getInstance().getCosmetics().setMyShields(cosmetics.getAccount().getCosmetics().getShields());
|
||||
Client.getInstance().getCosmetics().setMyEmotes(cosmetics.getAccount().getCosmetics().getEmotes());
|
||||
Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Shoulders").setValBoolean(cosmetics.getAccount().getCapeShoulders());
|
||||
Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Type").setValString(cosmetics.getAccount().getCapeType().equals("dynamic_curved") ? "Dynamic Curved" : cosmetics.getAccount().getCapeType().equals("curved_rectangle") ? "Curved Rectangle" : "Rectangle");
|
||||
if(Minecraft.getMinecraft().thePlayer != null) {
|
||||
@ -222,6 +234,14 @@ public class Cosmetics {
|
||||
return myShields;
|
||||
}
|
||||
|
||||
public ArrayList<CosmeticItem> getMyEmotes() {
|
||||
return myEmotes;
|
||||
}
|
||||
|
||||
public void setMyEmotes(ArrayList<CosmeticItem> myEmotes) {
|
||||
this.myEmotes = myEmotes;
|
||||
}
|
||||
|
||||
public static PlayerResponse.Account.Cosmetics getAllCosmetics() {
|
||||
try {
|
||||
InputStream in = Client.getInstance().getClass().getResourceAsStream("/assets/minecraft/silentclient/cosmetics.json");
|
||||
|
@ -305,7 +305,7 @@ public class CosmeticsGui extends SilentScreen {
|
||||
scrollHelper.setStep(5);
|
||||
scrollHelper.setElementsHeight((items != null ? items.size() : 0) * 35);
|
||||
scrollHelper.setMaxScroll(height - 25);
|
||||
scrollHelper.setSpeed(100);
|
||||
scrollHelper.setSpeed(200);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
ScaledResolution r = new ScaledResolution(mc);
|
||||
|
@ -72,7 +72,7 @@ public class OutfitsGui extends SilentScreen {
|
||||
scrollHelper.setStep(5);
|
||||
scrollHelper.setElementsHeight((float) Math.ceil((Outfits.getOutfits().size() + 3) / 3) * 85);
|
||||
scrollHelper.setMaxScroll(height - 20);
|
||||
scrollHelper.setSpeed(100);
|
||||
scrollHelper.setSpeed(200);
|
||||
scrollHelper.setFlag(true);
|
||||
float scrollY = scrollHelper.getScroll();
|
||||
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
@ -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
@ -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
@ -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();
|
||||
}
|
||||
}
|
@ -89,6 +89,7 @@ public class SilentMultiplayerGui extends SilentScreen {
|
||||
public void getServers() {
|
||||
servers.clear();
|
||||
for(ServerDataFeature serverDataFeature : Client.getInstance().getFeaturedServers()) {
|
||||
serverDataFeature.resetData();
|
||||
servers.add(new ServerComponent(this, serverDataFeature));
|
||||
}
|
||||
for (int i = 0; i < savedServerList.countServers(); ++i)
|
||||
@ -141,7 +142,7 @@ public class SilentMultiplayerGui extends SilentScreen {
|
||||
scrollHelper.setStep(5);
|
||||
scrollHelper.setElementsHeight(servers.size() * 38);
|
||||
scrollHelper.setMaxScroll(blockHeight - 43 - 41);
|
||||
scrollHelper.setSpeed(100);
|
||||
scrollHelper.setSpeed(200);
|
||||
float serverY = blockY + 43 + scrollHelper.getScroll();
|
||||
trimContentStart();
|
||||
int serverIndex = -1;
|
||||
|
@ -125,7 +125,7 @@ public class SilentResourcePacksGui extends SilentScreen {
|
||||
scrollHelper.setStep(5);
|
||||
scrollHelper.setElementsHeight(availableResourcePacks.size() * 37 + 19);
|
||||
scrollHelper.setMaxScroll(blockHeight - 45);
|
||||
scrollHelper.setSpeed(150);
|
||||
scrollHelper.setSpeed(200);
|
||||
|
||||
if(MouseUtils.isInside(mouseX, mouseY, x, y, 193, blockHeight - 45)) {
|
||||
scrollHelper.setFlag(true);
|
||||
@ -207,7 +207,8 @@ public class SilentResourcePacksGui extends SilentScreen {
|
||||
scrollHelper2.setStep(5);
|
||||
scrollHelper2.setElementsHeight(selectedResourcePacks.size() * 37 + 19);
|
||||
scrollHelper2.setMaxScroll(blockHeight - 45);
|
||||
scrollHelper2.setSpeed(150);
|
||||
scrollHelper.setSpeed(200);
|
||||
|
||||
if(MouseUtils.isInside(mouseX, mouseY, x, y, 193, blockHeight - 45)) {
|
||||
scrollHelper2.setFlag(true);
|
||||
} else {
|
||||
|
@ -2,11 +2,11 @@ package net.silentclient.client.hooks;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.silentclient.client.Client;
|
||||
@ -18,8 +18,6 @@ import net.silentclient.client.utils.Players;
|
||||
import net.silentclient.client.utils.RenderTransformer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
|
||||
public class NameTagRenderingHooks {
|
||||
public static int drawNametagText(FontRenderer fontRenderer, String text, int x, int y, int color, boolean shadow) {
|
||||
int render;
|
||||
@ -41,24 +39,24 @@ public class NameTagRenderingHooks {
|
||||
return render;
|
||||
}
|
||||
|
||||
public static void renderNametag(Entity entityIn, String str, double x, double y, double z, int maxDistance, boolean isMainNametag, Render render) {
|
||||
public static void renderNametag(Entity entityIn, String str, double x, double y, double z, int maxDistance, boolean isMainNametag) {
|
||||
String username = "";
|
||||
double d0 = entityIn.getDistanceSqToEntity(render.getRenderManager().livingPlayer);
|
||||
double d0 = entityIn.getDistanceSqToEntity(Minecraft.getMinecraft().getRenderManager().livingPlayer);
|
||||
|
||||
if (d0 <= (double)(maxDistance * maxDistance))
|
||||
{
|
||||
boolean fontShadow = Client.getInstance().getModInstances().getModByClass(NametagsMod.class).isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(NametagsMod.class, "Font Shadow").getValBoolean();
|
||||
boolean icons = !Client.getInstance().getModInstances().getModByClass(NametagsMod.class).isEnabled() || Client.getInstance().getSettingsManager().getSettingByClass(NametagsMod.class, "Show Nametag Icons").getValBoolean();
|
||||
boolean background = !Client.getInstance().getModInstances().getModByClass(NametagsMod.class).isEnabled() || Client.getInstance().getModInstances().getModByClass(NametagsMod.class).isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(NametagsMod.class, "Background").getValBoolean();
|
||||
FontRenderer fontrenderer = render.getFontRendererFromRenderManager();
|
||||
FontRenderer fontrenderer = Minecraft.getMinecraft().fontRendererObj;
|
||||
float f = 1.6F;
|
||||
float f1 = 0.016666668F * f;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate((float)x + 0.0F, (float)y + entityIn.height + 0.5F, (float)z);
|
||||
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
|
||||
float viewY = render.getRenderManager().playerViewY;
|
||||
float viewX = render.getRenderManager().playerViewX;
|
||||
float viewY = Minecraft.getMinecraft().getRenderManager().playerViewY;
|
||||
float viewX = Minecraft.getMinecraft().getRenderManager().playerViewX;
|
||||
if(Client.getInstance().getModInstances().getSnaplookMod().isActive()) {
|
||||
viewY = Client.getInstance().getModInstances().getSnaplookMod().getYaw();
|
||||
viewX = Client.getInstance().getModInstances().getSnaplookMod().getPitch();
|
||||
|
@ -112,7 +112,7 @@ public abstract class AbstractClientPlayerMixin implements AbstractClientPlayerE
|
||||
(new Thread("CustomSkinThread") {
|
||||
public void run() {
|
||||
Client.logger.info(String.format("Downloading Custom Skin (%s)", silent$nameClear));
|
||||
customSkin.setImage(SCTextureManager.getImage("https://cdn.silentclient.net/skins/" + silent$nameClear.toLowerCase() + ".png"));
|
||||
customSkin.setImage(SCTextureManager.getImage("https://cdn-test.silentclient.net/file/silentclient/skins/" + silent$nameClear.toLowerCase() + ".png"));
|
||||
CustomSkin.loading = false;
|
||||
customSkin.setLoaded(true);
|
||||
Client.logger.info(String.format("Custom Skin downloaded! (%s)", silent$nameClear));
|
||||
|
@ -12,6 +12,7 @@ import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.client.shader.Framebuffer;
|
||||
import net.minecraft.client.stream.IStream;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
@ -33,6 +34,7 @@ import net.silentclient.client.mixin.ducks.MinecraftExt;
|
||||
import net.silentclient.client.mods.player.ZoomMod;
|
||||
import net.silentclient.client.mods.render.AnimationsMod;
|
||||
import net.silentclient.client.mods.settings.FPSBoostMod;
|
||||
import net.silentclient.client.mods.settings.GeneralMod;
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.lwjgl.LWJGLException;
|
||||
@ -242,6 +244,13 @@ public abstract class MinecraftMixin implements MinecraftExt {
|
||||
event.call();
|
||||
}
|
||||
|
||||
@Redirect(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/InventoryPlayer;changeCurrentItem(I)V"))
|
||||
public void cancelInventoryScroll(InventoryPlayer instance, int direction) {
|
||||
if(!Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Disable Scroll Wheel").getValBoolean()) {
|
||||
instance.changeCurrentItem(direction);
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "runTick", at = @At(value = "INVOKE", target = "Lorg/lwjgl/input/Mouse;getEventDWheel()I"))
|
||||
public int cancelScroll() {
|
||||
if(!Client.getInstance().getModInstances().getZoomMod().isEnabled() || !Client.getInstance().getModInstances().getZoomMod().isActive() || !Client.getInstance().getSettingsManager().getSettingByClass(ZoomMod.class, "Scroll").getValBoolean()) {
|
||||
|
@ -14,7 +14,7 @@ public abstract class RenderMixin<T extends Entity> {
|
||||
*/
|
||||
@Overwrite
|
||||
protected void renderLivingLabel(T entityIn, String str, double x, double y, double z, int maxDistance) {
|
||||
NameTagRenderingHooks.renderNametag(entityIn, str, x, y, z, maxDistance, false, ((Render) (Object) this));
|
||||
NameTagRenderingHooks.renderNametag(entityIn, str, x, y, z, maxDistance, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -24,6 +24,6 @@ public abstract class RenderMixin<T extends Entity> {
|
||||
@Overwrite
|
||||
protected void renderOffsetLivingLabel(T entityIn, double x, double y, double z, String str, float p_177069_9_, double p_177069_10_)
|
||||
{
|
||||
NameTagRenderingHooks.renderNametag(entityIn, str, x, y, z, 64, true, ((Render) (Object) this));
|
||||
NameTagRenderingHooks.renderNametag(entityIn, str, x, y, z, 64, true);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
package net.silentclient.client.mixin.mixins.emotes;
|
||||
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.emotes.AnimatorController;
|
||||
import net.silentclient.client.emotes.EmoteControllerManager;
|
||||
import net.silentclient.client.emotes.EmotesMod;
|
||||
import net.silentclient.client.emotes.PlayerModelManager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
/**
|
||||
* @author refactoring
|
||||
*/
|
||||
@Mixin(EntityPlayer.class)
|
||||
public abstract class EntityPlayerMixin {
|
||||
@Shadow public abstract String getName();
|
||||
|
||||
@Unique
|
||||
public AnimatorController controller;
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
public void ae$init(CallbackInfo ci) {
|
||||
controller = new AnimatorController(PlayerModelManager.get().steve, PlayerModelManager.get().steveConfig);
|
||||
EmoteControllerManager.controllers.put(this.getName(), controller);
|
||||
}
|
||||
|
||||
@Inject(method = "onUpdate", at = @At("RETURN"))
|
||||
public void ae$onUpdate(CallbackInfo ci) {
|
||||
if(!Client.getInstance().getSettingsManager().getSettingByClass(EmotesMod.class, "Emotes").getValBoolean()) {
|
||||
return;
|
||||
}
|
||||
controller.update((EntityPlayer) (Object) this);
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package net.silentclient.client.mixin.mixins.emotes;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.emotes.EmotesMod;
|
||||
import net.silentclient.client.emotes.PlayerModelManager;
|
||||
import net.silentclient.client.emotes.ui.EmoteMenuGui;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
/**
|
||||
* @author refactoring
|
||||
*/
|
||||
@Mixin(Minecraft.class)
|
||||
public class MinecraftMixin {
|
||||
@Inject(method = "runTick", at = @At("RETURN"))
|
||||
public void mchorse$runTick(CallbackInfo ci) {
|
||||
if(!Client.getInstance().getSettingsManager().getSettingByClass(EmotesMod.class, "Emotes").getValBoolean()) {
|
||||
return;
|
||||
}
|
||||
if(Client.getInstance().getSettingsManager().getSettingByClass(EmotesMod.class, "Emote Wheel Keybind").isKeyDown()) {
|
||||
Minecraft.getMinecraft().displayGuiScreen(new EmoteMenuGui());
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "startGame", at = @At("RETURN"))
|
||||
public void mchorse$startGame(CallbackInfo ci) {
|
||||
PlayerModelManager.get();
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package net.silentclient.client.mixin.mixins.emotes;
|
||||
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.emotes.EmoteControllerManager;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
import net.minecraft.client.renderer.entity.RendererLivingEntity;
|
||||
import net.silentclient.client.emotes.EmotesMod;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
/**
|
||||
* @author refactoring
|
||||
*/
|
||||
@Mixin(RenderPlayer.class)
|
||||
public abstract class RenderPlayerMixin extends RendererLivingEntity<AbstractClientPlayer> {
|
||||
public RenderPlayerMixin(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) {
|
||||
super(renderManagerIn, modelBaseIn, shadowSizeIn);
|
||||
}
|
||||
|
||||
@Shadow
|
||||
protected abstract void setModelVisibilities(AbstractClientPlayer p_177137_0_);
|
||||
|
||||
@Inject(method = "doRender(Lnet/minecraft/client/entity/AbstractClientPlayer;DDDFF)V", at = @At("HEAD"), cancellable = true)
|
||||
public void ae$doRender(AbstractClientPlayer entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo ci) {
|
||||
if(!Client.getInstance().getSettingsManager().getSettingByClass(EmotesMod.class, "Emotes").getValBoolean()) {
|
||||
return;
|
||||
}
|
||||
if (EmoteControllerManager.controllers.get(entity.getName()) != null) {
|
||||
if (EmoteControllerManager.controllers.get(entity.getName()).renderHook((RenderPlayer) (Object) (this), entity, x, y, z, partialTicks, this.canRenderName(entity))) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package net.silentclient.client.mods;
|
||||
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.emotes.EmotesMod;
|
||||
import net.silentclient.client.mods.hud.*;
|
||||
import net.silentclient.client.mods.hypixel.AutoGGMod;
|
||||
import net.silentclient.client.mods.hypixel.AutoTipMod;
|
||||
@ -14,10 +15,7 @@ import net.silentclient.client.mods.settings.CosmeticsMod;
|
||||
import net.silentclient.client.mods.settings.FPSBoostMod;
|
||||
import net.silentclient.client.mods.settings.GeneralMod;
|
||||
import net.silentclient.client.mods.settings.RenderMod;
|
||||
import net.silentclient.client.mods.staff.DebugNpcMod;
|
||||
import net.silentclient.client.mods.staff.FPSSpoofer;
|
||||
import net.silentclient.client.mods.staff.HitDelayFixMod;
|
||||
import net.silentclient.client.mods.staff.TestMod;
|
||||
import net.silentclient.client.mods.staff.*;
|
||||
import net.silentclient.client.mods.world.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -61,6 +59,7 @@ public class ModInstances {
|
||||
private RenderMod renderMod;
|
||||
private CosmeticsMod cosmeticsMod;
|
||||
private FPSBoostMod fpsBoostMod;
|
||||
private EmotesMod emotesMod;
|
||||
|
||||
public ModInstances() {
|
||||
fpsMod = new FPSMod();
|
||||
@ -72,6 +71,9 @@ public class ModInstances {
|
||||
autoSprintMod = new AutoSprintMod();
|
||||
mods.add(autoSprintMod);
|
||||
|
||||
emotesMod = new EmotesMod();
|
||||
mods.add(emotesMod);
|
||||
|
||||
keystrokesMod = new KeystrokesMod();
|
||||
mods.add(keystrokesMod);
|
||||
|
||||
@ -187,7 +189,6 @@ public class ModInstances {
|
||||
}
|
||||
mods.add(new QuickPlayMod());
|
||||
mods.add(new SoundsMod());
|
||||
// mods.add(new ItemSizeMod());
|
||||
}
|
||||
|
||||
public void postInit() {
|
||||
@ -205,6 +206,7 @@ public class ModInstances {
|
||||
customMods.add(renderMod);
|
||||
customMods.add(fpsBoostMod);
|
||||
customMods.add(cosmeticsMod);
|
||||
customMods.add(emotesMod);
|
||||
|
||||
return customMods;
|
||||
}
|
||||
|
@ -105,10 +105,10 @@ public class ScoreboardMod extends Mod {
|
||||
if (k == scores.size()) {
|
||||
String s3 = sidebar.getDisplayName();
|
||||
|
||||
if(headerBackground) {
|
||||
Gui.drawRect(sidebarX - 2, scoreY - fr.FONT_HEIGHT - 1, scoreX, scoreY - 1, headerBgColor.getRGB());
|
||||
}
|
||||
if(background) {
|
||||
if(headerBackground) {
|
||||
Gui.drawRect(sidebarX - 2, scoreY - fr.FONT_HEIGHT - 1, scoreX, scoreY - 1, headerBgColor.getRGB());
|
||||
}
|
||||
Gui.drawRect(sidebarX - 2, scoreY - 1, scoreX, scoreY, bgColor.getRGB());
|
||||
}
|
||||
fr.drawString(s3, sidebarX + (sidebarWidth - fr.getStringWidth(s3)) / 2, scoreY - fr.FONT_HEIGHT, -1, fontShadow);
|
||||
|
@ -1,12 +1,12 @@
|
||||
package net.silentclient.client.mods.settings;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.mods.Mod;
|
||||
import net.silentclient.client.mods.ModCategory;
|
||||
import net.silentclient.client.mods.Setting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class CosmeticsMod extends Mod {
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
|
@ -42,6 +42,7 @@ public class GeneralMod extends Mod {
|
||||
}
|
||||
this.addBooleanSetting("Menu Animations", this, true);
|
||||
this.addSliderSetting("Menu Animations Speed", this, 300, 100, 500, true);
|
||||
this.addBooleanSetting("Disable Scroll Wheel", this, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,27 @@
|
||||
package net.silentclient.client.mods.staff;
|
||||
|
||||
import net.silentclient.client.event.EventTarget;
|
||||
import net.silentclient.client.event.impl.EventText;
|
||||
import net.silentclient.client.mods.Mod;
|
||||
import net.silentclient.client.mods.ModCategory;
|
||||
|
||||
public class RadmirMod extends Mod {
|
||||
public RadmirMod() {
|
||||
super("Radmir Mod", ModCategory.MODS, "silentclient/mods/radmir/radmir.png");
|
||||
}
|
||||
|
||||
@EventTarget
|
||||
public void onText(EventText event) {
|
||||
event.setOutputText(this.replaceWords(event.getText(), "Radmir (курица)"));
|
||||
}
|
||||
|
||||
private String replaceWords(String input, String replacement) {
|
||||
String[] words = input.split("\\s+");
|
||||
|
||||
for (int i = 0; i < words.length; i++) {
|
||||
words[i] = replacement;
|
||||
}
|
||||
|
||||
return String.join(" ", words);
|
||||
}
|
||||
}
|
@ -1,6 +1,15 @@
|
||||
package net.silentclient.client.utils;
|
||||
|
||||
import java.awt.Image;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiNewChat;
|
||||
import net.minecraft.event.ClickEvent;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.silentclient.client.Client;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
import java.awt.datatransfer.DataFlavor;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.awt.datatransfer.UnsupportedFlavorException;
|
||||
@ -10,20 +19,9 @@ import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiNewChat;
|
||||
import net.minecraft.event.ClickEvent;
|
||||
import net.minecraft.event.HoverEvent;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.silentclient.client.Client;
|
||||
|
||||
public class AsyncScreenshots implements Runnable {
|
||||
|
||||
public static final String prefix = "SC Screenshot ";
|
||||
public static final String prefix = "SLC Screenshot ";
|
||||
private static BufferedImage image;
|
||||
private static File screenshot;
|
||||
private final int width, height;
|
||||
@ -81,7 +79,7 @@ public class AsyncScreenshots implements Runnable {
|
||||
|
||||
private void sendChatMessages(File screenshot) throws IOException {
|
||||
IChatComponent chatComponent;
|
||||
chatComponent = new ChatComponentText("SC Sceenshot");
|
||||
chatComponent = new ChatComponentText("SLC Screenshot");
|
||||
|
||||
final IChatComponent deleteComponent = new ChatComponentText(EnumChatFormatting.RED.toString() + EnumChatFormatting.BOLD +
|
||||
"[DELETE]");
|
||||
|
@ -440,6 +440,7 @@ public class PlayerResponse extends AbstractReply {
|
||||
public ArrayList<CosmeticItem> bandanas = new ArrayList<CosmeticItem>();
|
||||
public ArrayList<CosmeticItem> hats = new ArrayList<CosmeticItem>();
|
||||
public ArrayList<CosmeticItem> shields = new ArrayList<CosmeticItem>();
|
||||
public ArrayList<CosmeticItem> emotes = new ArrayList<CosmeticItem>();
|
||||
|
||||
public ArrayList<CosmeticItem> getCapes() {
|
||||
return capes;
|
||||
@ -465,6 +466,10 @@ public class PlayerResponse extends AbstractReply {
|
||||
return shields;
|
||||
}
|
||||
|
||||
public ArrayList<CosmeticItem> getEmotes() {
|
||||
return emotes;
|
||||
}
|
||||
|
||||
public class CosmeticItem {
|
||||
public int id;
|
||||
public String name;
|
||||
@ -515,6 +520,7 @@ public class PlayerResponse extends AbstractReply {
|
||||
public ArrayList<Number> bandanas = new ArrayList<Number>();
|
||||
public ArrayList<Number> hats = new ArrayList<Number>();
|
||||
public ArrayList<Number> shields = new ArrayList<Number>();
|
||||
public ArrayList<Number> emotes = new ArrayList<Number>();
|
||||
}
|
||||
|
||||
public class BanInfo {
|
||||
|
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 7.6 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 8.4 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 7.4 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 6.1 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 5.8 KiB |