From e25378baf34ac2d9f1ab16c1c37a9ed65859ffb4 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 29 Oct 2026 19:46:02 +0200 Subject: feat: Create result slot and check items against known recipes --- index.html | 89 +++++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 65 insertions(+), 24 deletions(-) diff --git a/index.html b/index.html index 2d43ea5..5343c47 100644 --- a/index.html +++ b/index.html @@ -5,23 +5,26 @@
- - - - - - - - - - - - - - - - -
+
+ + + + + + + + + + + + + + + + +
+
+
@@ -44,7 +47,11 @@ article { border-radius: 3px; } -img, #crafting-bench td { +#crafting-table { + width: 20em; + margin: 0 auto; +} +img, #crafting-grid td { width: 3em; height: 3em; border: none; @@ -53,11 +60,11 @@ img, #crafting-bench td { img[src$="/"] { opacity: 0; } -#crafting-bench { +#crafting-grid { background-color: #c6c6c6; border-spacing: 1px; } -#crafting-bench td { +#crafting-grid td, .result { border-left: 2px solid #373737; border-top: 2px solid #373737; border-right: 2px solid white; @@ -65,13 +72,20 @@ img[src$="/"] { background-color: #8b8b8b; padding: 0.15em; } -#crafting-bench td:hover { +#crafting-grid td:hover { background-color: #c6c6c6; } -#crafting-bench, #crafting-bench tr, #crafting-bench td { +#crafting-grid, #crafting-grid tr, #crafting-grid td { user-select: none; } +.result { + width: fit-content; + height: fit-content; + float: right; + margin-top: -7.2em; +} + #inventory .item { cursor: pointer; } @@ -119,7 +133,7 @@ img[src$="/"] { const items = document.getElementsByClassName('item') function onItemPress(e) { - if (e.target.id !== "") + if (e.target.id !== "" && e.target.id !== "crafting-table") return; console.log(e.target.src) if (e.target.src === undefined || e.target.src === "/" || e.target.src.endsWith("html")) { @@ -140,6 +154,27 @@ img[src$="/"] { var itemMap = { "plank": "https://minecraft.wiki/images/Oak_Planks.png", + "button": "https://minecraft.wiki/images/archive/20260728031107!Oak_Button_JE5.png", + "slab": "https://minecraft.wiki/images/Oak_Slab_JE3_BE2.png", + "crafting_table": "https://minecraft.wiki/images/Crafting_Table_JE4_BE3.png", + }; + var recipesMap = { + "plank,,,,,,,,,": "button", + ",plank,,,,,,,,": "button", + ",,plank,,,,,,,": "button", + ",,,plank,,,,,,": "button", + ",,,,plank,,,,,": "button", + ",,,,,plank,,,,": "button", + ",,,,,,plank,,,": "button", + ",,,,,,,plank,,": "button", + ",,,,,,,,plank,": "button", + "plank,plank,plank,,,,,,,": "slab", + ",,,plank,plank,plank,,,,": "slab", + ",,,,,,plank,plank,plank,": "slab", + "plank,plank,,plank,plank,,,,,": "crafting_table", + ",plank,plank,,plank,plank,,,,": "crafting_table", + ",,,plank,plank,,plank,plank,,": "crafting_table", + ",,,,plank,plank,,plank,plank,": "crafting_table", }; for (item in itemMap) { var itemImg = document.createElement("img") @@ -165,7 +200,13 @@ img[src$="/"] { return result } function onSlotSrcChanged() { - console.log(getCraft()) + var craft = getCraft() + if (craft in recipesMap) { + craftingResult.src = itemMap[recipesMap[craft]] + } + else { + craftingResult.src = "/" + } } -- cgit v1.3.1-26-gb76a