Skip to content

Commit

Permalink
Prerelease 2.2.5 (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
CoryBorek authored Jun 30, 2024
2 parents 5c388c1 + 7945322 commit 1ebcd4c
Show file tree
Hide file tree
Showing 22 changed files with 515 additions and 49 deletions.
2 changes: 1 addition & 1 deletion Applications/Console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>Applications</artifactId>
<groupId>com.agentdid127.resourcepack</groupId>
<version>2.2.4</version>
<version>2.2.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion Applications/Gui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>Applications</artifactId>
<groupId>com.agentdid127.resourcepack</groupId>
<version>2.2.4</version>
<version>2.2.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
6 changes: 3 additions & 3 deletions Applications/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ResourcePackConverter</artifactId>
<groupId>com.agentdid127</groupId>
<version>2.2.4</version>
<version>2.2.5</version>

</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -33,12 +33,12 @@
<dependency>
<groupId>com.agentdid127.resourcepack</groupId>
<artifactId>Forwards</artifactId>
<version>2.2.4</version>
<version>2.2.5</version>
</dependency>
<dependency>
<groupId>com.agentdid127.resourcepack</groupId>
<artifactId>Backwards</artifactId>
<version>2.2.4</version>
<version>2.2.5</version>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Hypixel Inc.
Copyright (c) 2024 agentdid127.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
14 changes: 7 additions & 7 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# Resource Pack Converter
[![](https://jitpack.io/v/agentdid127/ResourcePackConverter.svg)](https://jitpack.io/#agentdid127/ResourcePackConverter)

This is a program that converts most issues with resource packs between any version from 1.7.2 all the way to 1.20.3.

This is my fork of Hypixel's Resource Pack Converter. It updates to any newer version from 1.8.x - 1.20.x

We know that many use resource packs in nonstandard and quirky ways - but giving this a shot *may* reduce quite a bit of your pain and workload for the 1.13 conversion.

This should convert most things, but if it doesn't please let me know what didn't work so I can fix it.
This should convert most things, but if you notice anything that does not work correctly, or should be added, create an issue on Github.

Also if any other developers would like to open any PRs with fixes and additions please feel free.

Expand All @@ -31,9 +28,12 @@ To update to any other version than 1.12-1.13, you can use these parameters.

We hope this helps out!

# Not On the list to add
- Horse and Zombified Piglin Conversion (the models were changed, which may make that much more difficult to convert)
## Not On the list to add
- Horse, Zombified Piglin, and Bat Conversion (the models were changed, which may make that much more difficult to convert)

## In-Development Versions
Before a version of the converter is ready for release, it will be automatically built on a Jenkins server, where you can get non-production builds. Note: that there is no guaruntee that these versions are stable, however, feel free to post issue reports on the issues page.
[Jenkins Server](https://jenkins.dc1.agentdid127.com/job/agentdid127/job/ResourcePackConverter/job/master/)

### Upstream
This program was originally derived from Hypixel's Resource Pack Converter, though has been essentially reworked over the span of 5 years. Very few, if any bits of the original software remain, but in case that does exist, their original license is included in the licenses' directory.
2 changes: 1 addition & 1 deletion conversions/Backwards/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>conversions</artifactId>
<groupId>com.agentdid127.resourcepack</groupId>
<version>2.2.4</version>
<version>2.2.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ public void convert(Pack pack) throws IOException {
if (!file.toFile().exists())
return;
// Possible TODO: Make this JSON? Possibly use protocol.json, but update it.
if (version >= Util.getVersionProtocol(packConverter.getGson(), "1.20.3"))
if (version >= Util.getVersionProtocol(packConverter.getGson(), "1.21"))
versionInt = 34;
else if (version >= Util.getVersionProtocol(packConverter.getGson(), "1.20.5")
&& version < Util.getVersionProtocol(packConverter.getGson(), "1.21"))
versionInt = 32;
else if (version >= Util.getVersionProtocol(packConverter.getGson(), "1.20.3")
&& version < Util.getVersionProtocol(packConverter.getGson(), "1.20.5"))
versionInt = 22;
else if (version >= Util.getVersionProtocol(packConverter.getGson(), "1.20.2")
&& version < Util.getVersionProtocol(packConverter.getGson(), "1.20.3"))
Expand Down
2 changes: 1 addition & 1 deletion conversions/Forwards/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>conversions</artifactId>
<groupId>com.agentdid127.resourcepack</groupId>
<version>2.2.4</version>
<version>2.2.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.agentdid127.resourcepack.forwards;

import com.agentdid127.resourcepack.forwards.impl.*;
import com.agentdid127.resourcepack.forwards.impl.textures.*;
import com.agentdid127.resourcepack.library.Converter;
import com.agentdid127.resourcepack.library.PackConverter;
import com.agentdid127.resourcepack.library.pack.Pack;
import com.agentdid127.resourcepack.library.utilities.Logger;
import com.agentdid127.resourcepack.library.utilities.Util;
import com.agentdid127.resourcepack.forwards.impl.*;
import com.google.gson.GsonBuilder;

import java.io.IOException;
Expand Down Expand Up @@ -112,6 +112,10 @@ private void converterRunner(String from, String to, String light) {
if (protocolFrom < Util.getVersionProtocol(gson, "1.20.3")
&& protocolTo >= Util.getVersionProtocol(gson, "1.20.3"))
this.registerConverter(new ImageFormatConverter(this));

if (protocolFrom < Util.getVersionProtocol(gson, "1.20.5")
&& protocolTo >= Util.getVersionProtocol(gson, "1.20.5"))
this.registerConverter(new MapIconSlicerConverter(this, protocolFrom));
}

public void runPack(Pack pack) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ public void convert(Pack pack) throws IOException {
int versionInt = 4;

// Possible TODO: Make this JSON? Possibly use protocol.json, but update it.
if (to >= Util.getVersionProtocol(packConverter.getGson(), "1.20.3"))
if (to >= Util.getVersionProtocol(packConverter.getGson(), "1.21"))
versionInt = 34;
else if (to >= Util.getVersionProtocol(packConverter.getGson(), "1.20.5")
&& to < Util.getVersionProtocol(packConverter.getGson(), "1.21"))
versionInt = 32;
else if (to >= Util.getVersionProtocol(packConverter.getGson(), "1.20.3")
&& to < Util.getVersionProtocol(packConverter.getGson(), "1.20.5"))
versionInt = 22;
else if (to >= Util.getVersionProtocol(packConverter.getGson(), "1.20.2")
&& to < Util.getVersionProtocol(packConverter.getGson(), "1.20.3"))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.agentdid127.resourcepack.forwards.impl.textures;

import com.agentdid127.resourcepack.forwards.impl.textures.slicing.Slice;
import com.agentdid127.resourcepack.forwards.impl.textures.slicing.Slicer;
import com.agentdid127.resourcepack.library.Converter;
import com.agentdid127.resourcepack.library.PackConverter;
import com.agentdid127.resourcepack.library.pack.Pack;
import com.agentdid127.resourcepack.library.utilities.JsonUtil;
import com.google.gson.Gson;
import com.google.gson.JsonObject;

import java.io.File;
import java.io.IOException;
import java.nio.file.Path;

public class MapIconSlicerConverter extends Converter {
private final int protocolFrom;

public MapIconSlicerConverter(PackConverter packConverter, int protocolFrom) {
super(packConverter);
this.protocolFrom = protocolFrom;
}

/**
* Converts maps
*
* @param pack
* @throws IOException
*/
@Override
public void convert(Pack pack) throws IOException {
Path texturesPath = pack.getWorkingPath().resolve("assets/minecraft/textures".replace("/", File.separator));
if (!texturesPath.toFile().exists())
return;
Path mapIconsPath = texturesPath.resolve("map/".replace("/", File.separator));
if (!mapIconsPath.toFile().exists())
return;
Gson gson = packConverter.getGson();
JsonObject mapIconsJson = JsonUtil.readJsonResource(gson, "/forwards/map_icons.json", JsonObject.class);
assert mapIconsJson != null;
Slice slice = Slice.parse(mapIconsJson);
Slicer.runSlicer(gson, slice, mapIconsPath, SlicerConverter.PredicateRunnable.class, protocolFrom, false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import com.agentdid127.resourcepack.library.Converter;
import com.agentdid127.resourcepack.library.PackConverter;
import com.agentdid127.resourcepack.library.pack.Pack;
import com.agentdid127.resourcepack.library.utilities.FileUtil;
import com.agentdid127.resourcepack.library.utilities.JsonUtil;
import com.agentdid127.resourcepack.library.utilities.*;
import com.google.gson.Gson;
import com.google.gson.JsonObject;

Expand All @@ -15,7 +14,8 @@
import java.nio.file.Path;

public class ParticleTextureConverter extends Converter {
int from, to;
private final int from;
private final int to;

public ParticleTextureConverter(PackConverter packConverter, int from, int to) {
super(packConverter);
Expand All @@ -25,7 +25,7 @@ public ParticleTextureConverter(PackConverter packConverter, int from, int to) {

/**
* Slice particles.png into multiple for 1.14+
*
*
* @param pack
* @throws IOException
*/
Expand All @@ -34,15 +34,38 @@ public void convert(Pack pack) throws IOException {
Path texturesPath = pack.getWorkingPath().resolve("assets/minecraft/textures".replace("/", File.separator));
if (!texturesPath.toFile().exists())
return;

Path particlePath = texturesPath.resolve("particle");
if (!particlePath.toFile().exists())
return;

Gson gson = packConverter.getGson();
JsonObject particlesJson = JsonUtil.readJsonResource(gson, "/forwards/particles.json",
JsonObject.class);

JsonObject particlesJson = JsonUtil.readJsonResource(gson, "/forwards/particles.json", JsonObject.class);
assert particlesJson != null;

Slice slice = Slice.parse(particlesJson);
Slicer.runSlicer(gson, slice, particlePath, SlicerConverter.PredicateRunnable.class, from, false);
Path entityPath = texturesPath.resolve("entity");
FileUtil.moveIfExists(particlePath.resolve("fishing_hook.png"), entityPath.resolve("fishing_hook.png"));
if (to >= Util.getVersionProtocol(gson, "1.13")) {
if (from <= Util.getVersionProtocol(gson, "1.12.2")) {
Path particlesPath = particlePath.resolve(slice.getPath());
if (particlesPath.toFile().exists()) {
Logger.log("Detected 'particles.png' from versions before 1.13, converting to newer size..");
ImageConverter converter = new ImageConverter(slice.getWidth(), slice.getHeight(), particlesPath);
converter.newImage(256, 256);
converter.subImage(0, 0, 128, 128, 0, 0);
converter.store();
}
}

slice.setWidth(256);
slice.setHeight(256);
}

if (from <= Util.getVersionProtocol(gson, "1.13.2") &&
to >= Util.getVersionProtocol(gson, "1.14")) {
Slicer.runSlicer(gson, slice, particlePath, SlicerConverter.PredicateRunnable.class, from, false);
Path entityPath = texturesPath.resolve("entity");
FileUtil.moveIfExists(particlePath.resolve("fishing_hook.png"), entityPath.resolve("fishing_hook.png"));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.agentdid127.resourcepack.forwards.impl.textures.slicing;

import java.io.File;
import java.util.LinkedList;
import java.util.List;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

import java.io.File;
import java.util.LinkedList;
import java.util.List;

public class Slice {
private String path;
private String name;
Expand All @@ -33,6 +33,18 @@ public int getHeight() {
return height;
}

public void setWidth(int width) {
if (this.width == width)
return;
this.width = width;
}

public void setHeight(int height) {
if (this.height == height)
return;
this.height = height;
}

public JsonObject getPredicate() {
return predicate;
}
Expand Down
Loading

0 comments on commit 1ebcd4c

Please sign in to comment.