Skip to content

Commit

Permalink
Fixed more speck bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
miyucomics committed Mar 10, 2024
1 parent 95c1996 commit 3de1feb
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,24 @@ import net.minecraft.client.render.entity.EntityRenderer
import net.minecraft.client.render.entity.EntityRendererFactory
import net.minecraft.client.util.math.MatrixStack
import net.minecraft.util.Identifier
import net.minecraft.util.math.Vec2f

class SpeckEntityRenderer(ctx: EntityRendererFactory.Context?) : EntityRenderer<SpeckEntity?>(ctx) {
override fun render(entity: SpeckEntity?, yaw: Float, tickDelta: Float, matrices: MatrixStack?, vertexConsumers: VertexConsumerProvider?, light: Int) {
val oldShader = RenderSystem.getShader()
RenderSystem.setShader(GameRenderer::getPositionColorShader)
RenderSystem.enableDepthTest()
matrices!!.push()
matrices.scale(-1f, -1f, 1f)

val mat = matrices.peek()
val size = 0.25f
val pattern = entity!!.getPattern()
val lines = pattern.toLines(1f, pattern.getCenter(1f).negate())
val lines = pattern.toLines(size, pattern.getCenter(size).negate()).toMutableList()
for (i in lines.indices)
lines[i] = Vec2f(lines[i].x, -lines[i].y)
val zappy = makeZappy(lines, findDupIndices(pattern.positions()), 10, 1.5f, 0.1f, 0.2f, 0f, 1f, hashCode().toDouble())
val outer = -0x9b3701
drawLineSeq(mat.positionMatrix, zappy, 0.1f, 0.01f, outer, outer)

val mat = matrices.peek()
drawLineSeq(mat.positionMatrix, zappy, 0.05f, 0.01f, outer, outer)
matrices.pop()
RenderSystem.setShader { oldShader }
}
Expand Down

0 comments on commit 3de1feb

Please sign in to comment.