round decimal gui rendering

This commit is contained in:
LabyStudio
2022-05-03 22:41:08 +02:00
parent 898d0b0a84
commit ed0849ca28
2 changed files with 12 additions and 2 deletions
+11 -1
View File
@@ -118,7 +118,17 @@ export default class Gui {
static drawSprite(stack, texture, spriteX, spriteY, spriteWidth, spriteHeight, x, y, width, height, alpha = 1.0) {
stack.save();
stack.globalAlpha = alpha;
stack.drawImage(texture, spriteX, spriteY, spriteWidth, spriteHeight, x, y, width, height);
stack.drawImage(
texture,
Math.floor(spriteX),
Math.floor(spriteY),
Math.floor(spriteWidth),
Math.floor(spriteHeight),
Math.floor(x),
Math.floor(y),
Math.floor(width),
Math.floor(height)
);
stack.restore();
}
}
@@ -62,7 +62,7 @@ export default class IngameOverlay extends Gui {
if (typeId !== 0) {
let renderId = "hotbar" + i;
let block = Block.getById(typeId);
this.minecraft.itemRenderer.renderItemInGui(renderId, block, x + i * 20 + 11, y + 11);
this.minecraft.itemRenderer.renderItemInGui(renderId, block, Math.floor(x + i * 20 + 11), Math.floor(y + 11));
}
}
}