Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Develop

See merge request minecraft/ConvertJavaTextureToBedrock!20
  • Loading branch information
ozelot379 committed Jan 1, 2020
2 parents 94bfff8 + 02d8eec commit 008afe1
Show file tree
Hide file tree
Showing 37 changed files with 792 additions and 393 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/issue.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ assignees: ''
A clear and concise description of what the issue is.

**Context**
WebApp or CLI?
Web app or CLI?

**System info**
System OS:
Browser (If WebApp):
Browser (If web app):
NodeJS (If CLI):

**Texture pack**
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## [3.0.0]
- Most ui conversions are now experimental and need to enabled (if you want to try)
- Convert dialog and inventory ui (Experimental)
- Improve error handling
- Possible bugs fixed in:
- Fix crosshair
- Fix dye
- Fix enchanted item glint
- Fix grass block
- Fix sheep

## [2.0.2]
- Support java v1.15 and bedrock v1.14
- Convert hotbar, bars, buttons and tabs ui and inventory icons
Expand Down
47 changes: 32 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
THIS PROJECT IS NO OFFICIAL MINECRAFT] PRODUCT - NOT AUTHORIZED OR ASSOCIATED BY MOJANG
THIS PROJECT IS NO OFFICIAL MINECRAFT PRODUCT - NOT AUTHORIZED OR ASSOCIATED BY MOJANG

---

# Convert Minecraft Java texture packs to Bedrock texture packs

Look at https://ozelot379.github.io/ConvertJavaTextureToBedrock

It works directly in your browser

It supports currently the follow Minecraft versions:
It supports the follow Minecraft versions:

| Minecraft | Version |
|-----------|---------|
| Java | v1.13.x, v1.14.x or v1.15.x |
| Bedrock | v1.14.x |

Currently it supports to convert blocks, items, entities, paintings, particles, map icons, mob effects and some basic ui textures

Some conversions of HD texture packs may takes a while

This project is inspired by the no longer continued [PCTexture2PE](https://github.com/rodrigojxd/PCTexture2PE)

It supports to convert blocks, items, entities, paintings, particles, map icons, mob effects and some more basic ui textures (hotbar)

Some experimental features are disabled by default, but can be enabled if you want to try:
- UI
- Buttons
- Tabs
- Dialogs
- Inventory

## Web app
Look at https://ozelot379.github.io/ConvertJavaTextureToBedrock

Works directly in your browser - no upload

## CLI
As an alternative you can also use the cli version
As an alternative you can also use the cli version on your computer

First be sure you have installed [NodeJS](https://nodejs.org) (At least the LTS version) and install [Yarn](https://yarnpkg.com/en/docs/install)

Expand All @@ -43,10 +50,10 @@ ConvertJavaTextureToBedrock -i input/java_texture_pack.zip -o output/bedrock_tex
| -i (Required) | Input folder or zip path |
| -o (Required) | Output folder or zip path |
| -l | Show log (Default `true`) |
| -e | Experimental features (Default `false`) |

## Known issues
- Convert horse textures is very tricky and may buggy
- Convert weather textures (rain and snow) may not works (seems to be an other format as the default)
## Report issue
Use github repo issues (https://github.com/ozelot379/ConvertJavaTextureToBedrock/issues/new/choose)

# Extras (for texture pack creators)

Expand All @@ -72,7 +79,7 @@ Then install the dependencies
yarn
```

## WebApp
## Web app
```bash
NODE_ENV=development yarn debug:webapp
```
Expand All @@ -82,6 +89,11 @@ NODE_ENV=development yarn debug:webapp
NODE_ENV=development yarn debug:cli
```

## Build
```bash
yarn build
```

# How this work
This project uses the follow main features or external libraries:

Expand All @@ -108,7 +120,7 @@ You can now convert your texture packs
```javascript
let output;
try {
output = await new ConvertJavaTextureToBedrock(input, output, log).convert();
output = await new ConvertJavaTextureToBedrock(input, output, log, options).convert();
} catch (err) {

}
Expand Down Expand Up @@ -149,6 +161,11 @@ try {
| `SlientLog` | Disable log |
| `AbstractLog` | Base log |

## Options
| Key | Description |
|-----|-------------|
| `experimental` | Experimental features |

## Example
```javascript
import ConvertJavaTextureToBedrock, {ConsoleLog, Input, LocalFileInputEntry, LocalFileOutput} from "@ozelot379/convert-minecraft-java-texture-to-bedrock";
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ozelot379/convert-minecraft-java-texture-to-bedrock",
"productName": "ConvertJavaTextureToBedrock",
"version": "2.0.2",
"version": "3.0.0",
"description": "Convert Minecraft Java texture packs to Bedrock texture packs",
"keywords": [
"Minecraft",
Expand Down Expand Up @@ -57,8 +57,9 @@
"ConvertJavaTextureToBedrock": "dist/cli.js"
},
"scripts": {
"build": "webpack --config ./webpack.config.cli.js && webpack --config ./webpack.config.webapp.js",
"debug:cli": "webpack --config ./webpack.config.cli.js && node ./dist/cli.js",
"debug:webapp": "webpack-dev-server --config ./webpack.config.webapp.js",
"prepublishOnly": "webpack --config ./webpack.config.cli.js && webpack --config ./webpack.config.webapp.js && gh-pages -d ./dist/webapp"
"prepublishOnly": "yarn build && gh-pages -d ./dist/webapp"
}
}
13 changes: 13 additions & 0 deletions src/Options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Class Options
*/
class Options {
constructor() {
/**
* @type {boolean}
*/
this.experimental = false;
}
}

export {Options};
11 changes: 10 additions & 1 deletion src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ import yargs from "yargs";
default: true,
describe: "Log",
type: "boolean"
},
e: {
alias: "experimental",
default: false,
describe: "Experimental features",
type: "boolean"
}
})
.help("help").alias("h", "help")
Expand All @@ -41,7 +47,10 @@ import yargs from "yargs";
return new ConvertJavaTextureToBedrock(
new Input(fs.statSync(argv.input).isDirectory() ? new LocalFolderInputEntry(argv.input) : new LocalFileInputEntry(argv.input)),
(argv.output.includes(".") ? new LocalFileOutput(argv.output) : new LocalFolderOutput(argv.output)),
(argv.log ? new ConsoleLog() : new SilentLog())
(argv.log ? new ConsoleLog() : new SilentLog()),
{
experimental: argv.experimental
}
).convert();
} catch (err) {
console.error(err.message);
Expand Down
11 changes: 10 additions & 1 deletion src/converter/AbstractConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {AbstractInput} from "./../input"
import {AbstractLog} from "./../log";
import {AbstractOutput} from "./../output";
import Jimp from "@ozelot379/jimp-plugins";
import {Options} from "./../Options";

/**
* Class AbstractConverter
Expand Down Expand Up @@ -63,6 +64,12 @@ class AbstractConverter {
* @protected
*/
this.log;
/**
* @type {Object}
*
* @protected
*/
this.options;
/**
* @type {*}
*
Expand All @@ -75,13 +82,15 @@ class AbstractConverter {
* @param {AbstractInput} input
* @param {AbstractOutput} output
* @param {AbstractLog} log
* @param {Options} options
*
* @returns Promise<>
*/
async _init(input, output, log) {
async _init(input, output, log, options) {
this.input = input;
this.output = output;
this.log = log;
this.options = options;
}

/**
Expand Down
17 changes: 9 additions & 8 deletions src/converter/BarConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ class BarConverter extends AbstractConverter {
* @inheritDoc
*/
async convert() {
const [icons, bars, nubs] = this.data;
const [from, factor_detect, bars, nubs] = this.data;

if (!await this.output.exists(icons)) {
if (!await this.output.exists(from)) {
return [];
}

const icons_image = await this.readImage(icons);
const image_from = await this.readImage(from);

const factor = (icons_image.getWidth() / 256);
const factor = (image_from.getWidth() / factor_detect);

for (const [y, tos] of bars) {
const image = icons_image.clone().crop(0, (y * factor), (182 * factor), (5 * factor));
const image = image_from.clone().crop(0, (y * factor), (182 * factor), (5 * factor));

const metadata = {
nineslice_size: [factor, 0, factor, 0],
base_size: [image.getWidth(), image.getHeight()]
nineslice_size: [1, 0, 1, 0],
base_size: [182, 5]
};

for (const [to, colorize] of tos) {
Expand Down Expand Up @@ -52,6 +52,7 @@ class BarConverter extends AbstractConverter {
return [
[
"textures/gui/icons.png",
256,
[
[64, [
["textures/gui/achievements/hotdogempty"],
Expand All @@ -75,7 +76,7 @@ class BarConverter extends AbstractConverter {
[
"textures/gui/achievements/nub.png",
"textures/ui/experiencenub.png",
"textures/ui/experience_bar_nub_blue.png",
"textures/ui/experience_bar_nub_blue.png"
]
]
];
Expand Down
Loading

0 comments on commit 008afe1

Please sign in to comment.