Skip to content

Commit 91abfaa

Browse files
committed
Add 1.20.2 slicer
1 parent b332e26 commit 91abfaa

File tree

7 files changed

+830
-5
lines changed

7 files changed

+830
-5
lines changed

1.14/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group 'com.mojang'
7-
version '1.0-SNAPSHOT'
7+
version '1.1-SNAPSHOT'
88

99
mainClassName = "com.mojang.slicer.Main"
1010
archivesBaseName = distributions.main.distributionBaseName = "slicer-1.14"

1.20.2/build.gradle

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
plugins {
2+
id 'java'
3+
id 'application'
4+
}
5+
6+
group 'com.mojang'
7+
version '1.1-SNAPSHOT'
8+
9+
mainClassName = "com.mojang.slicer.Main"
10+
archivesBaseName = distributions.main.distributionBaseName = "slicer-1.20.2"
11+
12+
java {
13+
toolchain {
14+
languageVersion = JavaLanguageVersion.of(17)
15+
}
16+
}
17+
18+
repositories {
19+
mavenCentral()
20+
}
21+
22+
dependencies {
23+
implementation rootProject
24+
compileOnly 'com.google.code.findbugs:jsr305:2.0.1'
25+
}
26+
27+
jar {
28+
from rootProject.sourceSets.main.output
29+
manifest {
30+
attributes 'Main-Class': mainClassName
31+
}
32+
}

1.20.2/src/main/java/com/mojang/slicer/Main.java

+775
Large diffs are not rendered by default.

README.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
# slicer
2-
Resource pack migration tool for Minecraft: Java Edition 1.14.
2+
Resource pack migration tool for Minecraft: Java Edition.
3+
Two versions of the tool are available for migrations to both 1.14 and 1.20.2 pack formats.
4+
The migrations automated here are not exhaustive, so some manual work may still be required. See the release changelog for the relevant version for more information.
35

46
This tool is provided as reference code to help update existing resource packs for Minecraft: Java Edition, and as such we are not accepting contributions or actively maintaining it. However, we may update or revisit this in the future. Forking is welcome, and you are free to use the code as you see fit - for more information see the [provided license](LICENSE).
57

68
## Usage
7-
`<input dir or zip> <output dir> [<leftover dir>]` (`leftover dir` is optional location that will be filled with copies of source images with added hightlights for no longer needed areas).
9+
Pre-built jars are available through the [Releases](https://github.com/Mojang/slicer/releases) page. An installation of Java 17 or higher is required.
10+
11+
`<input dir or zip> <output dir> [<leftover dir>]`
12+
- `input dir or zip` is the root of your resource pack (directory or zip containing an `assets` directory)
13+
- `output dir` will be filled with all processed texture files
14+
- `leftover dir` is optional location that will be filled with copies of source images with added highlights for areas that were migrated
15+
- The highlighted areas were processed by the tool and are used by the Vanilla game, the rest is not required in the pack

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
}
44

55
group 'com.mojang'
6-
version '1.0-SNAPSHOT'
6+
version '1.1-SNAPSHOT'
77

88
java {
99
toolchain {

settings.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
rootProject.name = 'slicer'
22

3-
include '1.14'
3+
include '1.14', '1.20.2'

src/main/java/com/mojang/slicer/OutputFile.java

+10
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
package com.mojang.slicer;
55

6+
import javax.annotation.Nullable;
67
import javax.annotation.ParametersAreNonnullByDefault;
78
import java.awt.Color;
89
import java.awt.Graphics;
@@ -22,6 +23,8 @@ public class OutputFile {
2223
private final String path;
2324
private final Box box;
2425
private final List<UnaryOperator<BufferedImage>> transformers = new ArrayList<>();
26+
@Nullable
27+
private String metadata;
2528

2629
public OutputFile(final String path, final Box box) {
2730
this.path = path;
@@ -48,6 +51,8 @@ public void process(final Path root, final Path imagePath, final BufferedImage i
4851
final Path inputMetaPath = getMetaPath(imagePath);
4952
if (Files.exists(inputMetaPath)) {
5053
Files.copy(inputMetaPath, getMetaPath(outputPath), StandardCopyOption.REPLACE_EXISTING);
54+
} else if (metadata != null) {
55+
Files.writeString(getMetaPath(outputPath), metadata);
5156
}
5257

5358
leftover.setColor(REMOVED_MARKER);
@@ -62,4 +67,9 @@ public OutputFile apply(final UnaryOperator<BufferedImage> transform) {
6267
transformers.add(transform);
6368
return this;
6469
}
70+
71+
public OutputFile metadata(final String metadata) {
72+
this.metadata = metadata;
73+
return this;
74+
}
6575
}

0 commit comments

Comments
 (0)