diff --git a/src/minecraft/kevin/file/FileManager.java b/src/minecraft/kevin/file/FileManager.java index ef4074ad..7ae23747 100644 --- a/src/minecraft/kevin/file/FileManager.java +++ b/src/minecraft/kevin/file/FileManager.java @@ -20,6 +20,7 @@ public class FileManager extends MinecraftInstance { public final File serverIconsDir = new File(dir,"ServerIcons"); public final File configsDir = new File(dir,"Configs"); public final File killMessages = new File(dir,"KillMessages"); + public final File playerModels = new File(dir,"PlayerModels"); public final FileConfig modulesConfig = new ModulesConfig(new File(dir, "modules.json")); public final FileConfig hudConfig = new HudConfig(new File(dir, "hud.json")); public final File altsFile = new File(dir,"accounts.json"); @@ -33,6 +34,7 @@ public void load(){ if (!serverIconsDir.exists()) serverIconsDir.mkdir(); if (!configsDir.exists()) configsDir.mkdir(); if (!killMessages.exists()) killMessages.mkdir(); + if (!playerModels.exists()) playerModels.mkdir(); } public void saveConfig(final FileConfig config) { diff --git a/src/minecraft/kevin/main/KevinClient.kt b/src/minecraft/kevin/main/KevinClient.kt index 090bf66e..9ec2619a 100644 --- a/src/minecraft/kevin/main/KevinClient.kt +++ b/src/minecraft/kevin/main/KevinClient.kt @@ -12,6 +12,7 @@ import kevin.hud.HUD.Companion.createDefault import kevin.module.ModuleManager import kevin.module.modules.render.ClickGui.ClickGUI import kevin.module.modules.render.ClickGui.NewClickGui +import kevin.module.modules.render.Renderer import kevin.skin.SkinManager import kevin.utils.CombatManager import kevin.utils.FontManager @@ -19,7 +20,7 @@ import org.lwjgl.opengl.Display object KevinClient { var name = "Kevin" - var version = "b1.31" + var version = "b1.35" lateinit var moduleManager: ModuleManager lateinit var fileManager: FileManager @@ -42,11 +43,12 @@ object KevinClient { fontManager = FontManager() fontManager.loadFonts() Display.setTitle("$name $version | Minecraft 1.8.9") + fileManager.load() + Renderer.load() moduleManager.load() fileManager.loadConfig(fileManager.modulesConfig) hud = createDefault() fileManager.loadConfig(fileManager.hudConfig) - fileManager.load() commandManager.load() clickGUI = ClickGUI() newClickGui = NewClickGui() diff --git a/src/minecraft/kevin/module/modules/combat/KillAura.kt b/src/minecraft/kevin/module/modules/combat/KillAura.kt index 2d66c39b..a3caaa91 100644 --- a/src/minecraft/kevin/module/modules/combat/KillAura.kt +++ b/src/minecraft/kevin/module/modules/combat/KillAura.kt @@ -3,6 +3,7 @@ package kevin.module.modules.combat import kevin.event.* import kevin.main.KevinClient import kevin.module.* +import kevin.module.modules.exploit.TP import kevin.module.modules.misc.Teams import kevin.utils.* import net.minecraft.client.gui.inventory.GuiContainer @@ -676,7 +677,7 @@ class KillAura : Module("KillAura","Automatically attacks targets around you.", */ private val cancelRun: Boolean inline get() = mc.thePlayer!!.isSpectator || !isAlive(mc.thePlayer!!) - || KevinClient.moduleManager.getModule("Blink")!!.getToggle() || KevinClient.moduleManager.getModule("FreeCam")!!.getToggle() + || KevinClient.moduleManager.getModule("Blink")!!.getToggle() || KevinClient.moduleManager.getModule("FreeCam")!!.getToggle() || (KevinClient.moduleManager.getModule("TP")!!.getToggle()&&(KevinClient.moduleManager.getModule("TP") as TP).mode.get().equals("AAC",true)) /** * Check if [entity] is alive diff --git a/src/minecraft/kevin/module/modules/exploit/TP.kt b/src/minecraft/kevin/module/modules/exploit/TP.kt index f6a0e73a..15e187ac 100644 --- a/src/minecraft/kevin/module/modules/exploit/TP.kt +++ b/src/minecraft/kevin/module/modules/exploit/TP.kt @@ -9,6 +9,7 @@ import kevin.module.modules.misc.Teams import kevin.utils.BlockUtils import kevin.utils.ChatUtils import kevin.utils.MovementUtils +import kevin.utils.PathUtils import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraft.init.Blocks import net.minecraft.network.play.client.C03PacketPlayer @@ -23,12 +24,13 @@ import kotlin.math.max import kotlin.math.min class TP : Module("TP","Allows you to teleport around.",category = ModuleCategory.EXPLOIT) { - private val mode = ListValue("Mode", arrayOf("Flag","AAC"),"Flag") + val mode = ListValue("Mode", arrayOf("Flag","AAC"),"Flag") private val keepTick = IntegerValue("FlagKeepTick",40,10,60) private val autoBedFind = BooleanValue("AutoBedFind",false) private val bedFindRange = IntegerValue("BedFindRange",6,2,6) private val aacFlySpeedValue = FloatValue("Speed", 0.8f, 0.1f, 2f) + private val aacPathFindMode = ListValue("AACPathFindMode", arrayOf("Direct","FindPath"),"Direct") private var fakePlayer: EntityOtherPlayerMP? = null private var flagTPState = 0 private var playerPos = Vec3(.0,.0,.0) @@ -71,17 +73,26 @@ class TP : Module("TP","Allows you to teleport around.",category = ModuleCategor thePlayer.motionZ = 0.0 //Do teleport - val packets = (mc.thePlayer.getDistance(playerPos.xCoord,playerPos.yCoord,playerPos.zCoord).toInt() / 10) + 1 val packetY = arrayOf(1.1,1.1,1.2,1.2,.8,.8,.4,.0,.0,1.1,1.1) repeat(11){ mc.netHandler.addToSendQueue(C03PacketPlayer.C04PacketPlayerPosition(playerPos.xCoord,playerPos.yCoord+packetY[it],playerPos.zCoord,true)) } - - val xV = ((thePlayer.posX - playerPos.xCoord)) / packets.toDouble() - val yV = ((thePlayer.posY - playerPos.yCoord)) / packets.toDouble() - val zV = ((thePlayer.posZ - playerPos.zCoord)) / packets.toDouble() - repeat(packets){ - mc.netHandler.addToSendQueue(C03PacketPlayer.C04PacketPlayerPosition(playerPos.xCoord+xV*(it+1),playerPos.yCoord+yV*(it+1),playerPos.zCoord+zV*(it+1),true)) + when(aacPathFindMode.get()){ + "Direct" -> { + val packets = (mc.thePlayer.getDistance(playerPos.xCoord,playerPos.yCoord,playerPos.zCoord).toInt() / 10) + 1 + val xV = ((thePlayer.posX - playerPos.xCoord)) / packets.toDouble() + val yV = ((thePlayer.posY - playerPos.yCoord)) / packets.toDouble() + val zV = ((thePlayer.posZ - playerPos.zCoord)) / packets.toDouble() + repeat(packets){ + mc.netHandler.addToSendQueue(C03PacketPlayer.C04PacketPlayerPosition(playerPos.xCoord+xV*(it+1),playerPos.yCoord+yV*(it+1),playerPos.zCoord+zV*(it+1),true)) + } + } + "FindPath" -> { + val path = PathUtils.findBlinkPath2(playerPos.xCoord,playerPos.yCoord,playerPos.zCoord,thePlayer.posX,thePlayer.posY,thePlayer.posZ,thePlayer.getDistance(playerPos.xCoord,playerPos.yCoord,playerPos.zCoord) % 10.0) + path.forEach { + mc.netHandler.addToSendQueue(C03PacketPlayer.C04PacketPlayerPosition(it.xCoord,it.yCoord,it.zCoord,true)) + } + } } mc.netHandler.addToSendQueue(C03PacketPlayer.C04PacketPlayerPosition(thePlayer.posX,thePlayer.posY-1,thePlayer.posZ,true)) mc.netHandler.addToSendQueue(C03PacketPlayer.C04PacketPlayerPosition(playerPos.xCoord,playerPos.yCoord,playerPos.zCoord,true)) diff --git a/src/minecraft/kevin/module/modules/render/Renderer.kt b/src/minecraft/kevin/module/modules/render/Renderer.kt index 31776873..e7d08d65 100644 --- a/src/minecraft/kevin/module/modules/render/Renderer.kt +++ b/src/minecraft/kevin/module/modules/render/Renderer.kt @@ -1,5 +1,8 @@ package kevin.module.modules.render +import jdk.nashorn.api.scripting.JSObject +import jdk.nashorn.api.scripting.NashornScriptEngineFactory +import jdk.nashorn.api.scripting.ScriptUtils import kevin.event.EventTarget import kevin.event.UpdateEvent import kevin.main.KevinClient @@ -8,11 +11,13 @@ import kevin.module.ListValue import kevin.module.Module import kevin.module.ModuleCategory import kevin.module.modules.combat.KillAura +import kevin.utils.MinecraftInstance import kevin.utils.RotationUtils import net.minecraft.client.Minecraft import net.minecraft.client.entity.AbstractClientPlayer import net.minecraft.client.model.ModelBase import net.minecraft.client.model.ModelRenderer +import net.minecraft.client.model.TextureOffset import net.minecraft.client.renderer.GlStateManager import net.minecraft.client.renderer.block.model.ItemCameraTransforms import net.minecraft.client.renderer.entity.RenderManager @@ -26,12 +31,247 @@ import net.minecraft.item.ItemSword import net.minecraft.util.ResourceLocation import org.lwjgl.opengl.GL11 import java.awt.image.BufferedImage +import java.io.File +import java.util.* +import java.util.function.Function import javax.imageio.ImageIO +import javax.script.Invocable +import javax.script.ScriptEngine +import kotlin.collections.ArrayList +import kotlin.collections.HashMap import kotlin.math.cos object Renderer : Module("Renderer","Allows you to modify some renderings.",category = ModuleCategory.RENDER) { val noArmor = BooleanValue("NoArmor",false) - private val playerModel = ListValue("PlayerModel", arrayOf("Fox","Snow_Fox","Player"),"Player") + val noRightArm = BooleanValue("NoRightArm",false) + private var playerModel = ListValue("PlayerModel", arrayOf("Fox","Snow_Fox","Player"),"Player") + private val renderers = HashMap>() + private val models = HashMap() + private val layers = HashMap>>() + lateinit var renderManager: RenderManager + + fun load(){ + val files = KevinClient.fileManager.playerModels.listFiles() + if (files.isNullOrEmpty()) return + val pngs = files.filter { it.isFile&&it.name.endsWith(".png",true) } + val jss = files.filter { it.isFile&&it.name.endsWith(".js",true) } + if (pngs.isEmpty()||jss.isEmpty()) return + val list = arrayListOf("Fox","Snow_Fox","Player") + pngs.forEach { + val name = it.name.replace(".png","",true) + val jsFile = jss.find { file -> file.name.replace(".js","",true) == name } + if (jsFile != null && (name!="Fox"&&name!="Snow_Fox"&&name!="Player")) { + try { + val js = JSFile(jsFile) + texturesList[name] = Texture(name,ImageIO.read(it)) + models[name] = ModelFromFile(js) + renderers[name] = RenderFromFile(js,name, renderManager) + list.add(name) + } catch (e: Throwable) { + Minecraft.logger.error("[Renderer] Failed to load model $name",e) + } + } + } + playerModel = ListValue("PlayerModel", list.toTypedArray(),"Player") + } + + class JSFile(val jsFile: File) : MinecraftInstance(){ + private val scriptEngine = NashornScriptEngineFactory().scriptEngine + private val jsText = jsFile.readText() + val inv:Invocable + var setLivingAnimations = false + var getRandomModelBox = false + var setRotationAngles = false + var setTextureOffset = false + var setModelAttributes = false + var getTextureOffset = false + var render = false + init { + scriptEngine.put("mc",mc) + scriptEngine.put("kevinClient",KevinClient) + scriptEngine.put("Main",RegisterRender()) + scriptEngine.put("addLayer",AddLayer()) + scriptEngine.eval(jsText) + inv = scriptEngine as Invocable + } + inner class AddLayer : Function { + override fun apply(scriptObject: JSObject) { + val name = jsFile.name.replace(".js","",true) + val layerRenderer = LayerFromFile(name, + LayerJSFile(File(KevinClient.fileManager.playerModels,"${scriptObject.getMember("name")}.js")) + ) + if (layers[name] == null) { + layers[name] = arrayListOf(layerRenderer) + } else layers[name]!!.add(layerRenderer) + } + } + inner class RegisterRender : Function { + override fun apply(scriptObject: JSObject) { + setLivingAnimations = try { scriptObject.getMember("setLivingAnimations") as Boolean } catch (e:Throwable) {false} + getRandomModelBox = try { scriptObject.getMember("getRandomModelBox") as Boolean } catch (e:Throwable) {false} + setRotationAngles = try { scriptObject.getMember("setRotationAngles") as Boolean } catch (e:Throwable) {false} + setTextureOffset = try { scriptObject.getMember("setTextureOffset") as Boolean } catch (e:Throwable) {false} + setModelAttributes = try { scriptObject.getMember("setModelAttributes") as Boolean } catch (e:Throwable) {false} + getTextureOffset = try { scriptObject.getMember("getTextureOffset") as Boolean } catch (e:Throwable) {false} + render = try { scriptObject.getMember("render") as Boolean } catch (e:Throwable) {false} + } + } + } + + class LayerJSFile(jsFile: File):MinecraftInstance(){ + private val scriptEngine = NashornScriptEngineFactory().scriptEngine + private val jsText = jsFile.readText() + val inv:Invocable + var shouldCombineTextures = false + init { + scriptEngine.put("mc",mc) + scriptEngine.put("kevinClient",KevinClient) + scriptEngine.eval(jsText) + inv = scriptEngine as Invocable + shouldCombineTextures = try { + scriptEngine.get("shouldCombineTextures") as Boolean + } catch (e:Throwable){ + false + } + } + } + + class LayerFromFile(val name: String,private val jsFile: LayerJSFile) : LayerRenderer{ + override fun doRenderLayer( + entitylivingbaseIn: AbstractClientPlayer?, + p_177141_2_: Float, + p_177141_3_: Float, + partialTicks: Float, + p_177141_5_: Float, + p_177141_6_: Float, + p_177141_7_: Float, + scale: Float + ) { + try { + jsFile.inv.invokeFunction("doRenderLayer",entitylivingbaseIn,p_177141_2_,p_177141_3_,partialTicks,p_177141_5_,p_177141_6_,p_177141_7_,scale) + } catch (e: Throwable) { + Minecraft.logger.error("[Render] Error in Layer $name",e) + } + } + + override fun shouldCombineTextures() = jsFile.shouldCombineTextures + } + + class ModelFromFile(private val jsFile: JSFile) : ModelBase() { + private fun error(message:String,e:Throwable) { + Minecraft.logger.error("[Renderer] Error in '$message' !", e) + } + + override fun setTextureOffset(partName: String?, x: Int, y: Int) { + val s = if (jsFile.setTextureOffset) { + try { + jsFile.inv.invokeFunction("setTextureOffset",partName,x,y) as Boolean + }catch (e:Throwable){ + error("SetTextureOffset",e) + true + } + } else true + if (s) super.setTextureOffset(partName, x, y) + } + + override fun setModelAttributes(model: ModelBase?) { + val s = if (jsFile.setModelAttributes) { + try { + jsFile.inv.invokeFunction("setModelAttributes",model) as Boolean + }catch (e:Throwable){ + error("SetModelAttributes",e) + true + } + } else true + if (s) super.setModelAttributes(model) + } + + override fun getTextureOffset(partName: String?): TextureOffset { + if (jsFile.getTextureOffset){ + try { + return jsFile.inv.invokeFunction("getTextureOffset",partName) as TextureOffset + } catch (e:Throwable){ + error("GetTextureOffset",e) + } + } + return super.getTextureOffset(partName) + } + + override fun render( + entityIn: Entity?, + p_78088_2_: Float, + p_78088_3_: Float, + p_78088_4_: Float, + p_78088_5_: Float, + p_78088_6_: Float, + scale: Float + ) { + if (jsFile.render) { + try { + jsFile.inv.invokeFunction("render",entityIn,p_78088_2_,p_78088_3_,p_78088_4_,p_78088_5_,p_78088_6_,scale) + }catch (e: Throwable){ + error("Render",e) + } + } + } + + override fun setRotationAngles( + limbSwing: Float, + limbSwingAmount: Float, + ageInTicks: Float, + netHeadYaw: Float, + headPitch: Float, + scaleFactor: Float, + entityIn: Entity? + ) { + if (jsFile.setRotationAngles) { + try { + jsFile.inv.invokeFunction("setRotationAngles",limbSwing,limbSwingAmount,ageInTicks,netHeadYaw,headPitch,scaleFactor,entityIn) + }catch (e: Throwable){ + error("SetRotationAngles",e) + } + } + } + + override fun setLivingAnimations( + entitylivingbaseIn: EntityLivingBase?, + p_78086_2_: Float, + p_78086_3_: Float, + partialTickTime: Float + ) { + if (jsFile.setLivingAnimations){ + try { + jsFile.inv.invokeFunction("setLivingAnimations",entitylivingbaseIn,p_78086_2_,p_78086_3_,partialTickTime) + } catch (e:Throwable){ + error("SetLivingAnimations",e) + } + } + } + + override fun getRandomModelBox(rand: Random?): ModelRenderer { + if (jsFile.getRandomModelBox) { + try { + return jsFile.inv.invokeFunction("getRandomModelBox",rand) as ModelRenderer + } catch (e:Throwable){ + error("GetRandomModelBox",e) + } + } + return super.getRandomModelBox(rand) + } + } + + class RenderFromFile(val jsFile: JSFile,val name: String,renderManager: RenderManager) : RendererLivingEntity( + renderManager, + models[name]!!, + 1F + ) { + init { + layers[name]!!.forEach { this.addLayer(it) } + } + override fun getEntityTexture(entity: AbstractClientPlayer): ResourceLocation { + return texturesList[name]!!.resource + } + } @EventTarget(true) fun onUpdate(event: UpdateEvent){ @@ -46,13 +286,17 @@ object Renderer : Module("Renderer","Allows you to modify some renderings.",cate "Fox" -> { resourceLocation = if (mc.thePlayer.isPlayerSleeping) texturesList["Fox_Sleep"]!!.resource else texturesList["Fox"]!!.resource fox = true + renderer = null } "Snow_Fox" -> { resourceLocation = if (mc.thePlayer.isPlayerSleeping) texturesList["Snow_Fox_Sleep"]!!.resource else texturesList["Snow_Fox"]!!.resource fox = true + renderer = null } else -> { fox = false + val modelMode = playerModel.get() + renderer = if (modelMode != "Player") renderers[modelMode] else null } } } @@ -63,6 +307,7 @@ object Renderer : Module("Renderer","Allows you to modify some renderings.",cate private var resourceLocation: ResourceLocation? = null var fox = false + var renderer: RendererLivingEntity? = null private val texturesList = HashMap() override val tag: String get() = playerModel.get() diff --git a/src/minecraft/net/minecraft/client/renderer/ItemRenderer.java b/src/minecraft/net/minecraft/client/renderer/ItemRenderer.java index 0da57d4d..a9a3872a 100644 --- a/src/minecraft/net/minecraft/client/renderer/ItemRenderer.java +++ b/src/minecraft/net/minecraft/client/renderer/ItemRenderer.java @@ -181,7 +181,7 @@ private void renderPlayerArms(AbstractClientPlayer clientPlayer) { this.mc.getTextureManager().bindTexture(clientPlayer.getLocationSkin()); Render render = this.renderManager.getEntityRenderObject(this.mc.thePlayer); - if (Renderer.INSTANCE.getFox()&&Renderer.INSTANCE.getToggle()) return; + if ((Renderer.INSTANCE.getFox()||Renderer.INSTANCE.getRenderer()!=null)&&Renderer.INSTANCE.getToggle()) return; RenderPlayer renderplayer = (RenderPlayer)render; if (!clientPlayer.isInvisible()) @@ -262,13 +262,11 @@ private void renderPlayerArm(AbstractClientPlayer clientPlayer, float equipProgr GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F); GlStateManager.scale(1.0F, 1.0F, 1.0F); GlStateManager.translate(5.6F, 0.0F, 0.0F); - Render render = this.renderManager.getEntityRenderObject(this.mc.thePlayer); - if (!Renderer.INSTANCE.getFox()){ - GlStateManager.disableCull(); - RenderPlayer renderplayer = (RenderPlayer)render; - renderplayer.renderRightArm(this.mc.thePlayer); - GlStateManager.enableCull(); - } + if (Renderer.INSTANCE.getNoRightArm().get()) return; + RenderPlayer render = this.renderManager.getPlayerRender(this.mc.thePlayer); + GlStateManager.disableCull(); + render.renderRightArm(this.mc.thePlayer); + GlStateManager.enableCull(); } /** diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderManager.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderManager.java index db9893fb..cca4cf62 100644 --- a/src/minecraft/net/minecraft/client/renderer/entity/RenderManager.java +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderManager.java @@ -210,6 +210,7 @@ public RenderManager(TextureManager renderEngineIn, RenderItem itemRendererIn) this.skinMap.put("slim", new RenderPlayer(this, true)); PlayerItemsLayer.register(this.skinMap); this.renderFox = new Renderer.RenderFox(this); + Renderer.INSTANCE.setRenderManager(this); if (Reflector.RenderingRegistry_loadEntityRenderers.exists()) { @@ -248,12 +249,19 @@ public Render getEntityClassRenderObject(Class) render; } + public RenderPlayer getPlayerRender(AbstractClientPlayer entityIn){ + String s = entityIn.getSkinType(); + RenderPlayer renderplayer = this.skinMap.get(s); + return renderplayer != null ? renderplayer : this.playerRenderer; + } + public Render getEntityRenderObject(Entity entityIn) { if (entityIn instanceof AbstractClientPlayer) { - if (Renderer.INSTANCE.getFox()&&entityIn== Minecraft.getMinecraft().thePlayer){ - return (Render)renderFox; + if (entityIn==Minecraft.getMinecraft().thePlayer){ + if (Renderer.INSTANCE.getRenderer()!=null) return (Render)Renderer.INSTANCE.getRenderer(); + if (Renderer.INSTANCE.getFox()) return (Render) renderFox; } String s = ((AbstractClientPlayer)entityIn).getSkinType(); RenderPlayer renderplayer = this.skinMap.get(s);