-
-
Notifications
You must be signed in to change notification settings - Fork 507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(legacy): JumpCircle texture #5365
base: legacy
Are you sure you want to change the base?
Conversation
translate(x - mc.renderManager.viewerPosX, y - mc.renderManager.viewerPosY, z - mc.renderManager.viewerPosZ) | ||
} | ||
|
||
fun setupDrawCircles(render: Runnable) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inline it
private fun renderTexturedCircle(pos: Vec3, maxRadius: Double, timeFraction: Float, circleIndex: Int, shift: Float, intensity: Float) { | ||
val waveValue = 1f - timeFraction | ||
val wave = easeWave(waveValue) | ||
var alphaFraction = easeOutCirc(wave.toDouble()).toFloat() | ||
if (timeFraction < 0.5f) alphaFraction *= easeInOutExpo(alphaFraction.toDouble()).toFloat() | ||
val mainFactor = if (timeFraction > 0.5f) { | ||
easeOutElasticX((wave * wave).toDouble()) | ||
} else { | ||
easeOutBounce(wave.toDouble()) | ||
} | ||
val circleRadius = (mainFactor * maxRadius).toFloat() | ||
val rotation = (easeInOutElasticx(wave.toDouble()) * 90.0 / (1.0 + wave.toDouble())) | ||
val textureResource = selectJumpTexture(circleIndex, timeFraction) | ||
|
||
val (color, color2) = run { | ||
val inner = animateColor(innerColor, 1f - timeFraction) | ||
val outer = animateColor(outerColor, 1f - timeFraction) | ||
Pair(inner,outer) | ||
|
||
} | ||
|
||
val red = ((color.rgb shr 16) and 0xFF) / 255f | ||
val green = ((color.rgb shr 8) and 0xFF) / 255f | ||
val blue = (color.rgb and 0xFF) / 255f | ||
val alpha = ((color.rgb shr 24) and 0xFF) / 255f | ||
val red2 = ((color2.rgb shr 16) and 0xFF) / 255f | ||
val green2 = ((color2.rgb shr 8) and 0xFF) / 255f | ||
val blue2 = (color2.rgb and 0xFF) / 255f | ||
val alpha2 = ((color2.rgb shr 24) and 0xFF) / 255f | ||
|
||
mc.textureManager.bindTexture(textureResource) | ||
mc.textureManager.getTexture(textureResource).setBlurMipmap(true, true) | ||
|
||
GlStateManager.pushMatrix() | ||
GlStateManager.translate(pos.xCoord - circleRadius / 2.0, pos.yCoord, pos.zCoord - circleRadius / 2.0) | ||
GlStateManager.rotate(90f, 1f, 0f, 0f) | ||
customRotatedObject2D(0f, 0f, circleRadius, circleRadius, rotation) | ||
worldRenderer.begin(GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR) | ||
worldRenderer.pos(0.0, 0.0, 0.0).tex(0.0, 0.0).color(red, green, blue, alpha).endVertex() | ||
worldRenderer.pos(0.0, circleRadius.toDouble(), 0.0).tex(0.0, 1.0).color(red, green, blue, alpha).endVertex() | ||
worldRenderer.pos(circleRadius.toDouble(), circleRadius.toDouble(), 0.0).tex(1.0, 1.0).color(red, green, blue, alpha).endVertex() | ||
worldRenderer.pos(circleRadius.toDouble(), 0.0, 0.0).tex(1.0, 0.0).color(red, green, blue, alpha).endVertex() | ||
tessellator.draw() | ||
GlStateManager.popMatrix() | ||
|
||
if (shift >= 1f / 255f) { | ||
GlStateManager.pushMatrix() | ||
GlStateManager.translate(pos.xCoord, pos.yCoord, pos.zCoord) | ||
GlStateManager.rotate(rotation.toFloat(), 0f, 1f, 0f) | ||
worldRenderer.begin(GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR) | ||
|
||
val polygons = 40 | ||
val maxY = circleRadius / 3.5f | ||
val maxXZ = circleRadius / 7f | ||
|
||
for (i in 1 until polygons) { | ||
val fraction = i / polygons.toFloat() | ||
val fractionValue = fraction - (1.5f / polygons) | ||
val wave2 = easeWave(fractionValue) | ||
val circVal = easeOutCirc(wave2.toDouble()).toFloat() | ||
val alphaCheck = (alphaFraction * intensity * shift).takeIf { it * 255 >= 1 } ?: continue | ||
val alphaInt = (alphaCheck * 255).toInt() | ||
val variedRadius = circleRadius + circVal * maxXZ | ||
|
||
worldRenderer.pos((-variedRadius / 2f).toDouble(), (maxY * i / polygons - maxY / polygons).toDouble(), | ||
(-variedRadius / 2f).toDouble() | ||
) | ||
.tex(0.0, 0.0).color(red2, green2, blue2, alphaInt / 255f).endVertex() | ||
worldRenderer.pos((-variedRadius / 2f).toDouble(), | ||
(maxY * i / polygons - maxY / polygons).toDouble(), (variedRadius / 2f).toDouble() | ||
) | ||
.tex(0.0, 1.0).color(red2, green2, blue2, alphaInt / 255f).endVertex() | ||
worldRenderer.pos( | ||
(variedRadius / 2f).toDouble(), (maxY * i / polygons - maxY / polygons).toDouble(), | ||
(variedRadius / 2f).toDouble() | ||
) | ||
.tex(1.0, 1.0).color(red2, green2, blue2, alphaInt / 255f).endVertex() | ||
worldRenderer.pos((variedRadius / 2f).toDouble(), (maxY * i / polygons - maxY / polygons).toDouble(), | ||
(-variedRadius / 2f).toDouble() | ||
) | ||
.tex(1.0, 0.0).color(red2, green2, blue2, alphaInt / 255f).endVertex() | ||
} | ||
tessellator.draw() | ||
GlStateManager.popMatrix() | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this code to RenderUtils
private fun calculateEntityPosition(entity: net.minecraft.entity.Entity): Vec3 { | ||
val partialTicks = mc.timer.renderPartialTicks | ||
val dx = entity.posX - entity.lastTickPosX | ||
val dy = entity.posY - entity.lastTickPosY | ||
val dz = entity.posZ - entity.lastTickPosZ | ||
return Vec3( | ||
entity.lastTickPosX + dx * partialTicks + dx * 2.0, | ||
entity.lastTickPosY + dy * partialTicks, | ||
entity.lastTickPosZ + dz * partialTicks + dz * 2.0 | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
private val circles = ArrayDeque<JumpData>() | ||
private var hasJumped = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have JumpData so why this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add the missing textures for leeches
stop skidding moonlight client😂 |
added new modes and custom texture