use 2d items for hotbar
This commit is contained in:
@@ -38,12 +38,19 @@ window.IngameOverlay = class extends Gui {
|
||||
let typeId = this.minecraft.inventory.getItemInSlot(i);
|
||||
|
||||
if (typeId !== 0) {
|
||||
this.renderBlock(
|
||||
/*this.renderBlock(
|
||||
stack,
|
||||
this.textureTerrain, Block.getById(typeId),
|
||||
x + i * 20 + 11,
|
||||
y + 9
|
||||
);
|
||||
);*/
|
||||
|
||||
// UV Mapping
|
||||
let textureIndex = Block.getById(typeId).getTextureForFace(EnumBlockFace.NORTH);
|
||||
let minU = (textureIndex % 16) / 16.0;
|
||||
let minV = Math.floor(textureIndex / 16) / 16.0;
|
||||
|
||||
this.drawSprite(stack, this.textureTerrain, minU * 256, minV, 16, 16, x + 3, y + 3, 16, 16)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,12 @@ window.Keyboard = class {
|
||||
|
||||
static create() {
|
||||
window.addEventListener('keydown', function (event) {
|
||||
event.preventDefault();
|
||||
Keyboard.state[event.code] = true;
|
||||
//console.log("Key " + event.code + " down");
|
||||
});
|
||||
window.addEventListener('keyup', function (event) {
|
||||
event.preventDefault();
|
||||
delete Keyboard.state[event.code];
|
||||
//console.log("Key " + event.code + " up");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user