Skip to content
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

Draft
wants to merge 8 commits into
base: legacy
Choose a base branch
from
Draft

Conversation

opZywl
Copy link
Contributor

@opZywl opZywl commented Jan 19, 2025

added new modes and custom texture

@EclipsesDev EclipsesDev marked this pull request as draft January 19, 2025 15:17
translate(x - mc.renderManager.viewerPosX, y - mc.renderManager.viewerPosY, z - mc.renderManager.viewerPosZ)
}

fun setupDrawCircles(render: Runnable) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inline it

@mems01 mems01 added this to the b100 milestone Jan 19, 2025
@mems01 mems01 added 🔥 enhancement New feature or request 🌕 legacy labels Jan 19, 2025
Comment on lines +183 to +268
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()
}
}
Copy link
Contributor

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

Comment on lines +278 to +288
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
)
}
Copy link
Contributor

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
Copy link
Contributor

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?

Copy link
Contributor

@EclipsesDev EclipsesDev left a 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

@XeContrast
Copy link

stop skidding moonlight client😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔥 enhancement New feature or request 🌕 legacy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants