-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upd: .mcfunction output in frontend (#20)
- Loading branch information
1 parent
a490243
commit 9d37715
Showing
21 changed files
with
190 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ cache/ | |
!.env.example | ||
dist/* | ||
build/* | ||
node_modules/ | ||
node_modules/ | ||
tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,7 @@ | ||
# img2mcstructure | ||
[![img2mcstructure on JSR](https://jsr.io/badges/@jjg/img2mcstructure)](https://jsr.io/@jjg/img2mcstructure "Add JSR package") | ||
![JSR structure](https://github.com/user-attachments/assets/3266865a-d6db-4063-9dc9-c0d9c6291860) | ||
|
||
> ![RGB example](https://github.com/jasonjgardner/img2mcstructure/assets/1903667/3f98a433-9f41-4009-b840-d8341eb2c2f7) | ||
> [Made with RGB add-on](https://cdn.discordapp.com/attachments/830521962383802368/1201692650122792990/RGB.mcaddon) | ||
### Demo: https://mcstructure.deno.dev/ | ||
|
||
> ![Minecraft mural made with RAINBOW III!!!](https://github.com/jasonjgardner/img2mcstructure/assets/1903667/dcc165d9-4cab-4858-9106-330426a4a0e7) | ||
> [_RAINBOW III!!!_ add-on](https://cdn.discordapp.com/attachments/830521962383802368/1200453046304518164/RAINBOW_III-beta.mcaddon). | ||
Try it at https://mcstructure.deno.dev/ | ||
|
||
Images will be clamped to 64px. To create a larger structure, download Deno and | ||
run: | ||
|
||
```powershell | ||
deno run --allow-net --allow-write --allow-env https://raw.githubusercontent.com/jasonjgardner/img2mcstructure/main/main.ts "http://placekitten.com/256/256" y | ||
``` | ||
|
||
Set the axis parameter to `y` to create ceiling and floors. Omit the axis to | ||
default to walls. | ||
|
||
##### [See examples](./example/README.md) for advanced usage. | ||
##### [See examples](https://github.com/jasonjgardner/img2mcstructure/blob/main/example/README.md) for advanced usage. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,26 @@ | ||
import createFunction from "./setBlock.ts"; | ||
import { basename, extname, join, readdir, writeFile } from "../deps.ts"; | ||
import { img2mcfunction } from "../mod.ts"; | ||
import { basename, extname, join } from "node:path"; | ||
import { readdir, writeFile } from "node:fs/promises"; | ||
import process from "node:process"; | ||
import db from "../db/minecraft.json" with { type: "json" }; | ||
|
||
if (import.meta.main) { | ||
const dir = process.argv[0] ?? process.cwd(); | ||
const dir = process.argv[0] ?? process.cwd(); | ||
|
||
let itr = 0; | ||
const files = await readdir(dir, { recursive: true }); | ||
let itr = 0; | ||
const files = await readdir(dir, { recursive: true }); | ||
|
||
for await (const path of files) { | ||
if (!path.endsWith(".png")) { | ||
continue; | ||
} | ||
for await (const path of files) { | ||
if (!path.endsWith(".png")) { | ||
continue; | ||
} | ||
|
||
const fn = `${basename(path, extname(path))}.mcfunction`; | ||
const fn = `${basename(path, extname(path))}.mcfunction`; | ||
|
||
await writeFile( | ||
join(dir, fn), | ||
await createFunction(path, [200, 100, 200]), | ||
); | ||
await writeFile(join(dir, fn), await img2mcfunction(path, db, [0, 0, 0])); | ||
|
||
itr++; | ||
} | ||
itr++; | ||
} | ||
|
||
process.exit(0); | ||
process.exit(0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.