anything wrong in this skidded stupid script?



  • /// api_version=2
    var script = registerScript({
        name: "TargetHUD",
        version: "6.9",
        authors: ["Choco"]
    });
    var mobs = Java.type("net.minecraft.entity.EntityCreature");
    var GlStateManager = Java.type("net.minecraft.client.renderer.GlStateManager")
    var RenderHelper = Java.type("net.minecraft.client.renderer.RenderHelper")
    var OpenGlHelper = Java.type("net.minecraft.client.renderer.OpenGlHelper")
    var Potion = Java.type("net.minecraft.potion.Potion");
    var target
    var e1
    var Fonts = Java.type("net.ccbluex.liquidbounce.ui.font.Fonts");
    
    
    script.registerModule({
        name: "TargetHUD",
        category: "Fun", 
        description: "idk",
        tag: "ok em",
        settings: {
            scale: Setting.float({
                name: "Scale",
                min: 0,
                max: 10,
                default: 1
            })
            
        }
    }, function (TargetHUD) {
        TargetHUD.on("enable", function() {
            target = null
        });
        TargetHUD.on("render2D", function(event) {
            var mcHeight = getScaledHeight();
            var mcWidth = getScaledWidth();
    		if (target != null) {
    		    var partialTicks = event.getPartialTicks(); // Used to render FPS 
                          independent animations
    			var line = 1;
    			var mcHeight = getScaledHeight();
    			var mcWidth = getScaledWidth();
    			var currenthealth = target.getHealth().toFixed(0);
    			var maxhealth = target.getMaxHealth().toFixed(0);
    			var hp = mc.thePlayer.getHealth().toFixed(0);
    		    var playerInfo = mc.getNetHandler().getPlayerInfo(target.getUniqueID());
                var ping = playerInfo == null ? "0 ms" : playerInfo.getResponseTime() + " ms";
                GL11.glPushMatrix();
    			GL11.glScaled(TargetHUD.settings.scale.get(), TargetHUD.settings.scale.get(), TargetHUD.settings.scale.get());
    			drawRect(mcWidth/2+35, mcHeight/2, mcWidth/2+297.5 - line, mcHeight/2+75, 0xCF000000);//BackGround
    			drawEntityOnScreen(405, 260, 31, 90, 90, target);
    			Fonts.font40.drawStringWithShadow(target.getName() ,  mcWidth/2+97, mcHeight/2+7, 0x00CFFF);
    			Fonts.font35.drawStringWithShadow(ping ,  mcWidth/2+253, mcHeight/2+7, 0xFFFFFF);
    			Fonts.font35.drawStringWithShadow('  Distance: ' +target.getDistanceToEntity(mc.thePlayer).toFixed(2)+' | Sneaking: ' + target.isSneaking() ,  mcWidth/2+91, mcHeight/2+19, 0xFFFFFF);
    			Fonts.font35.drawStringWithShadow('  Health: ' +currenthealth+'/'+maxhealth+ ' | Hurt Time: '+target.hurtTime, mcWidth/2+91, mcHeight/2+32, 0xFFFFFF);
    			Fonts.font35.drawStringWithShadow('Regeneration: '+ e1, mcWidth/2+97, mcHeight/2+44, 0xFFFFFF);
    			if ((hp - currenthealth) > 0  ){
    				Fonts.font40.drawStringWithShadow('  You Will Win The duel! ', mcWidth/2+91, mcHeight/2+57, 0x6CC312);
    			}
    			if ((hp - currenthealth) < 0  ){
    				Fonts.font40.drawStringWithShadow('  You Will Lose The Duel! ', mcWidth/2+91, mcHeight/2+57, 0xFF3300);
    			}
    			if ((hp - currenthealth) == 0  ){
    				Fonts.font40.drawStringWithShadow('  You Will Draw The Duel! ', mcWidth/2+91, mcHeight/2+57, 0xFFFF00);
    			}
    			if(toPercent(currenthealth,maxhealth) >=80){
    		     		drawRect(mcWidth/2+88.4, mcHeight/2+69, mcWidth/2+(toPercent(currenthealth,maxhealth)*2)+96, mcHeight/2+75.3, 0x8800FF00); 
    			}else if(toPercent(currenthealth,maxhealth) >= 60){
    					drawRect(mcWidth/2+88.4, mcHeight/2+69, mcWidth/2+(toPercent(currenthealth,maxhealth)*2)+96, mcHeight/2+75.3, 0x88CCFF66); 
    			}else if(toPercent(currenthealth,maxhealth) >= 40){
    					drawRect(mcWidth/2+88.4, mcHeight/2+69, mcWidth/2+(toPercent(currenthealth,maxhealth)*2)+96, mcHeight/2+75.3, 0x88FFFF00); 
    			}else if(toPercent(currenthealth,maxhealth) >= 20){
    					drawRect(mcWidth/2+88.4, mcHeight/2+69, mcWidth/2+(toPercent(currenthealth,maxhealth)*2)+96, mcHeight/2+75.3, 0x88FF5500); 
    			}else if(toPercent(currenthealth,maxhealth) > 0){
    					drawRect(mcWidth/2+88.4, mcHeight/2+69, mcWidth/2+(toPercent(currenthealth,maxhealth)*2)+96, mcHeight/2+75.3, 0x88FF0000); 
    			}
    			if (target.isDead || target.getDistanceToEntity(mc.thePlayer)> 15.0) {
    				target = null;
                }		
    		}
        });
        TargetHUD.on("attack", function(event) {
            target = event.getTargetEntity()
        });
        TargetHUD.on("update", function() {
            if(target != null) {
    			if(target.isPotionActive(Potion.regeneration)){
    				e1 = "Active"
    			}
    			else if(!target.isPotionActive(Potion.regeneration)) {
    				e1 = "Inactive"
    			}	
    		}
        })
    });
    
    function drawEntityOnScreen(posX, posY, scale, mouseX, mouseY, ent) {
        GlStateManager.enableColorMaterial();
        GlStateManager.pushMatrix();
        GlStateManager.translate(posX, posY, 50.0);
        GlStateManager.scale((-scale), scale, scale);
        GlStateManager.rotate(180.0, 0.0, 0.0, 1.0);
        GlStateManager.rotate(135.0, 0.0, 1.0, 0.0);
        RenderHelper.enableStandardItemLighting();
        GlStateManager.rotate(-135.0, 0.0, 1.0, 0.0);
        GlStateManager.rotate(-(Math.atan((mouseY / 40.0))) * 20.0, 1.0, 0.0, 0.0);
        ent.renderYawOffset = 0
        ent.renderPitchOffset = 0
        ent.rotationYaw = Math.atan((mouseX / 40.0)) * 40.0;
        ent.rotationPitch = -(Math.atan((mouseY / 40.0))) * 20.0;
        ent.rotationYawHead = ent.getRotationYawHead()
        GlStateManager.translate(0.0, 0.0, 0.0);
        rendermanager = mc.getRenderManager();
        rendermanager.setPlayerViewY(180.0);
        rendermanager.setRenderShadow(false);
        rendermanager.renderEntityWithPosYaw(ent, 0.0, 0.0, 0.0, 0.0, 1.0);
        rendermanager.setRenderShadow(true);
        GlStateManager.popMatrix();
        RenderHelper.disableStandardItemLighting();
        GlStateManager.disableRescaleNormal();
        GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
        GlStateManager.disableTexture2D();
        GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
    }
    
    function toPercent(num, total) { 
        return (Math.round(num / total * 10000) / 100 );
    }
    
    

    skidded from Wu_Dian and scorpion3013 ™



  • no .



  • my G0D I even can't clearly see what you writed and what you want to do...
    plz fix format
    add some documents or comments



  • he tried to make a targethud
    with full body entity render



  • @LolMC I think that there are a lot of trashes in his code... I can't tolerate them



  • @Kasumi_Scarlet said in anything wrong in this skidded stupid script?:

    my G0D I even can't clearly see what you writed and what you want to do...
    plz fix format
    add some documents or comments

    the format in my IDE is different from here lmfao



  • @ChocoPie_isme I see that because you use tab & spaces in a single file lol



  • IMG_20200704_092905.jpg



  • my ocd, pls help





  • var line = 1 🙂



  • @ChocoPie_isme independent animations



  • @ChocoPie_isme
    lol I edited it randomly

    // api_version=2
    var EntityPlayer = Java.type("net.minecraft.entity.player.EntityPlayer");
    //var EntityLivingBase = Java.type("net.minecraft.entity.EntityLivingBase");
    var GlStateManager = Java.type("net.minecraft.client.renderer.GlStateManager");
    var RenderHelper = Java.type("net.minecraft.client.renderer.RenderHelper");
    var OpenGlHelper = Java.type("net.minecraft.client.renderer.OpenGlHelper");
    var Potion = Java.type("net.minecraft.potion.Potion");
    var Fonts = Java.type("net.ccbluex.liquidbounce.ui.font.Fonts");
    
    var ScaledResolution = Java.type("net.minecraft.client.gui.ScaledResolution");
    var GL11 = Java.type("org.lwjgl.opengl.GL11");
    var Gui = Java.type("net.minecraft.client.gui.Gui");
    //plz add other necessary imports.
    
    var script = registerScript({
        name: "TargetHUD",
        version: "6.9",
        authors: ["Choco", "Kasumi"]
    });
    
    /**@type EntityPlayer? */
    var target = null;
    
    script.registerModule({
        name: "TargetHUD",
        category: "Render",
        description: "Show your current target."
    }, function (TargetHUD) {
        TargetHUD.on("disable", function () {
            target = null;
        });
    
        TargetHUD.on("render2D", function (event) {
            if (!target.isEntityAlive() || target.getDistanceToEntity(mc.thePlayer) > 10.0) 
                target = null;
    
            if (!target) return;
    
            var sr = new ScaledResolution(mc);
            
            var y = 5;
    
            var pos = `Distance: ${target.getDistanceToEntity(mc.thePlayer).toFixed(1)}m | Sneaking: ${target.isSneaking()}`;
            var health = `Health: ${target.getMaxHealth().toFixed(1)}/${target.getMaxHealth().toFixed(1)} | HurtTime: ${target.hurtTime}`;
            var regeneration = `Regeneration: ${target.isPotionActive(Potion.regeneration) ? "Active" : "Inactive"}`
    
            GL11.glPushMatrix();
            GL11.glTranslated(sr.getScaledWidth_double() * 0.5, sr.getScaledHeight_double() * 0.5, 0);
    
            Gui.drawRect(35, 0, 297.5, 75, 0x7F000000);
    
            drawEntityOnScreen(405, 260, 31, 90, 90, target);
            Fonts.font40.drawStringWithShadow(target.getName(), 91, y, 0x00CFFF);
            Fonts.font35.drawStringWithShadow(pos, 91, y += Fonts.font40.FONT_HEIGHT, 0xFFFFFF);
            Fonts.font35.drawStringWithShadow(health, 91, y += Fonts.font35.FONT_HEIGHT, 0xFFFFFF);
            Fonts.font35.drawStringWithShadow(regeneration, 91, y += Fonts.font35.FONT_HEIGHT, 0xFFFFFF);
    
            var delta = ~~mc.thePlayer.getHealth() - ~~target.getHealth();
            if (!delta) Fonts.font40.drawStringWithShadow("You Will Draw The Duel! ", 91, y += Fonts.font35.FONT_HEIGHT, 0xFFFF00);
            else if (delta > 0) Fonts.font40.drawStringWithShadow("You Will Win The Duel! ", 91, y += Fonts.font35.FONT_HEIGHT, 0x6CC312);
            else Fonts.font40.drawStringWithShadow("You Will Lose The Duel! ", 91, y += Fonts.font35.FONT_HEIGHT, 0xFF3300);
    
            var proportion = (target.getHealth() + target.getAbsorptionAmount()) / (target.getMaxHealth() + target.getAbsorptionAmount());
            Gui.drawRect(88, y + Fonts.font35.FONT_HEIGHT, proportion * 50 + 88, y + Fonts.font35.FONT_HEIGHT + 15, 0xFFFF0000);
    
            GL11.glPopMatrix();
        });
    
        TargetHUD.on("attack", function (event) {
            var entity = event.getTargetEntity();
            if (entity instanceof EntityPlayer)
                target = entity;
        });
    });
    
    function drawEntityOnScreen(posX, posY, scale, mouseX, mouseY, ent) {
        GlStateManager.enableColorMaterial();
        GlStateManager.pushMatrix();
        GlStateManager.translate(posX, posY, 50.0);
        GlStateManager.scale((-scale), scale, scale);
        GlStateManager.rotate(180.0, 0.0, 0.0, 1.0);
        GlStateManager.rotate(135.0, 0.0, 1.0, 0.0);
        RenderHelper.enableStandardItemLighting();
        GlStateManager.rotate(-135.0, 0.0, 1.0, 0.0);
        GlStateManager.rotate(-(Math.atan((mouseY / 40.0))) * 20.0, 1.0, 0.0, 0.0);
        ent.renderYawOffset = 0
        ent.renderPitchOffset = 0
        ent.rotationYaw = Math.atan((mouseX / 40.0)) * 40.0;
        ent.rotationPitch = -(Math.atan((mouseY / 40.0))) * 20.0;
        ent.rotationYawHead = ent.getRotationYawHead()
        GlStateManager.translate(0.0, 0.0, 0.0);
        rendermanager = mc.getRenderManager();
        rendermanager.setPlayerViewY(180.0);
        rendermanager.setRenderShadow(false);
        rendermanager.renderEntityWithPosYaw(ent, 0.0, 0.0, 0.0, 0.0, 1.0);
        rendermanager.setRenderShadow(true);
        GlStateManager.popMatrix();
        RenderHelper.disableStandardItemLighting();
        GlStateManager.disableRescaleNormal();
        GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
        GlStateManager.disableTexture2D();
        GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
    }
    


  • skidding is that hard apparently



  • happy independent animations day



  • that need be hard for skidders/pasters, uh, you looks like a paster



  • can i get a useful reply




Log in to reply