Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fun drawTexture(x: Int, y: Int, u: Int, v: Int, width: Int, height: Int) {
- val f = 0.00390625F
- val startX = x.toDouble()
- val startY = y.toDouble()
- val startU = (u/f).toDouble()
- val startV = (v/f).toDouble()
- val endX = (x + width).toDouble()
- val endY = (y + height).toDouble()
- val endU = ((u + width)/f).toDouble()
- val endV = ((v + height)/f).toDouble()
- val tess = Tessellator.getInstance()
- val builder = tess.buffer
- builder.begin(7, DefaultVertexFormats.POSITION_TEX)
- builder.pos(startX, startY, 0.0).tex(startU, startV).endVertex()
- builder.pos(startX, endY, 0.0).tex(startU, endV).endVertex()
- builder.pos(endX, endY, 0.0).tex(endU, endV).endVertex()
- builder.pos(endX, startY, 0.0).tex(endU, startV).endVertex()
- tess.draw()
- }
- // DrawUtils.kt
- mc.textureManager.bindTexture(ResourceLocation("$modid:textures/gui/stats.png"))
- DrawUtils.drawTexture(100, 100, 0, 0, 58, 100)
- DrawUtils.drawTexture(100, 100, 63, 0, 58, 100)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement