Closed slmpc closed 1 year ago
为ZealotCrystal+的攻击目标渲染圈
可以更突出被攻击的目标,增加打水晶时的手感,更平滑的视觉效果 我尝试自己添加这一功能,但是渲染出现了问题,颜色与透明度都有问题 我认为可能是troll异步执行的原因(也有可能是其他的,因为我没有太多时间看troll的源代码) 但是在视角偏离攻击对象大概三分之一个屏幕时,渲染是正常的 以我的能力无法解决它,所以我希望您能实现这一功能 谢谢
safeListener<Render3DEvent> { if (renderPredict != RenderMode.OFF) { val tessellator = Tessellator.getInstance() val buffer = tessellator.buffer val partialTicks = RenderUtils3D.partialTicks GlStateManager.color(0.3f, 1.0f, 0.3f, 1.0f) GlStateManager.glLineWidth(2.0f) buffer.begin(GL_LINES, DefaultVertexFormats.POSITION) buffer.setTranslation(-mc.renderManager.renderPosX, -mc.renderManager.renderPosY, -mc.renderManager.renderPosZ) if (renderPredict == RenderMode.SINGLE) { val placeInfo = renderPlaceInfo if (placeInfo != null) { targets.getLazy()?.find { it.entity == placeInfo.target }?.let { drawEntityPrediction(buffer, it.entity, it.predictMotion, partialTicks) } } else { targets } } else { targets.getLazy()?.forEach { drawEntityPrediction(buffer, it.entity, it.predictMotion, partialTicks) } } GlStateUtils.useProgram(0) tessellator.draw() buffer.setTranslation(0.0, 0.0, 0.0) GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f) GlStateManager.glLineWidth(1.0f) } Renderer.onRender3D() if (renderTarget) { val placeInfo = renderPlaceInfo if (placeInfo != null) { Renderer.jelloRender(placeInfo.target) } } }
fun jelloRender(target: EntityLivingBase) { GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f) val drawTime = (System.currentTimeMillis() % 2000).toInt() val drawMode = drawTime > 1000 var drawPercent = drawTime / 1000f if (!drawMode) { drawPercent = 1 - drawPercent } else { drawPercent -= 1 } drawPercent = Easing.IN_OUT_QUAD.inc(drawPercent) AbstractModule.mc.entityRenderer.disableLightmap() GL11.glPushMatrix() GL11.glDisable(GL11.GL_TEXTURE_2D) GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA) GL11.glEnable(GL11.GL_LINE_SMOOTH) GL11.glEnable(GL11.GL_BLEND) GL11.glDisable(GL11.GL_DEPTH_TEST) GL11.glDisable(GL11.GL_CULL_FACE) GL11.glShadeModel(7425) AbstractModule.mc.entityRenderer.disableLightmap() val radius = target.width val height = target.height + 0.1 val x = target.lastTickPosX + (target.posX - target.lastTickPosX) * AbstractModule.mc.renderPartialTicks - AbstractModule.mc.renderManager.viewerPosX val y = (target.lastTickPosY + (target.posY - target.lastTickPosY) * AbstractModule.mc.renderPartialTicks - AbstractModule.mc.renderManager.viewerPosY) + height * drawPercent val z = target.lastTickPosZ + (target.posZ - target.lastTickPosZ) * AbstractModule.mc.renderPartialTicks - AbstractModule.mc.renderManager.viewerPosZ val eased = (height / 3) * (if (drawPercent > 0.5) 1 - drawPercent else drawPercent) * (if (drawMode) -1 else 1) for (segments in 0 until 360 step 5) { val color = colorRender // 圈的颜色 val x1 = x - sin(segments * Math.PI / 180F) * radius val z1 = z + cos(segments * Math.PI / 180F) * radius val x2 = x - sin((segments - 5) * Math.PI / 180F) * radius val z2 = z + cos((segments - 5) * Math.PI / 180F) * radius GL11.glBegin(GL11.GL_QUADS) GL11.glColor4f(pulseColor(color, 200, 1).r / 255.0f, pulseColor(color, 200, 1).g / 255.0f, pulseColor(color, 200, 1).b / 255.0f, 0.0f) GL11.glVertex3d(x1, y + eased, z1) GL11.glVertex3d(x2, y + eased, z2) GL11.glColor4f(pulseColor(color, 200, 1).r / 255.0f, pulseColor(color, 200, 1).g / 255.0f, pulseColor(color, 200, 1).b / 255.0f, 200.0f) GL11.glVertex3d(x2, y, z2) GL11.glVertex3d(x1, y, z1) GL11.glEnd() GL11.glBegin(GL11.GL_LINE_LOOP) GL11.glVertex3d(x2, y, z2) GL11.glVertex3d(x1, y, z1) GL11.glEnd() } GL11.glEnable(GL11.GL_CULL_FACE) GL11.glShadeModel(7424) GL11.glColor4f(1f, 1f, 1f, 1f) GL11.glEnable(GL11.GL_DEPTH_TEST) GL11.glDisable(GL11.GL_LINE_SMOOTH) GL11.glDisable(GL11.GL_BLEND) GL11.glEnable(GL11.GL_TEXTURE_2D) GL11.glPopMatrix() } fun pulseColor(color: ColorRGB, index: Int, count: Int): ColorRGB { var hsb = color.toHSB() var brightness = abs((System.currentTimeMillis() % (1230675006L xor 0x495A9BEEL) / Float.intBitsToFloat(Float.floatToIntBits(0.0013786979f) xor 0x7ECEB56D) + index / count.toFloat() * Float.intBitsToFloat(Float.floatToIntBits(0.09192204f) xor 0x7DBC419F)) % Float.intBitsToFloat(Float.floatToIntBits(0.7858098f) xor 0x7F492AD5) - Float.intBitsToFloat(Float.floatToIntBits(6.46708f) xor 0x7F4EF252)) brightness = Float.intBitsToFloat(Float.floatToIntBits(18.996923f) xor 0x7E97F9B3) + Float.intBitsToFloat(Float.floatToIntBits(2.7958195f) xor 0x7F32EEB5) * brightness hsb = ColorHSB(hsb.h, hsb.s, (brightness % Float.intBitsToFloat(Float.floatToIntBits(0.8992331f) xor 0x7F663424))) return hsb.toRGB() }
Dirty spaghetti code, nothing helpful. But what ever.
Feature or enhancement
为ZealotCrystal+的攻击目标渲染圈
可以更突出被攻击的目标,增加打水晶时的手感,更平滑的视觉效果 我尝试自己添加这一功能,但是渲染出现了问题,颜色与透明度都有问题 我认为可能是troll异步执行的原因(也有可能是其他的,因为我没有太多时间看troll的源代码) 但是在视角偏离攻击对象大概三分之一个屏幕时,渲染是正常的 以我的能力无法解决它,所以我希望您能实现这一功能 谢谢
Code