Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ runs:

- name: Build with Gradle
shell: pwsh
run: ./gradlew clean build --info --stacktrace -Pbuild_type=${{ github.event_name }}
run: |
./gradlew clean build --info --stacktrace -Pbuild_type=${{ github.event_name }}
./gradlew --stop

- name: Generate metadata JSONs
if: github.event_name != 'pull_request'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,15 @@ protected boolean matches(String range) {
}

protected boolean applyIfMatches(String range, String label, BooleanSupplier operation) {
return applyIfMatches(range, label, operation, true);
}

protected boolean applyIfMatches(String range, String label, BooleanSupplier operation, boolean required) {
if (!this.matches(range)) {
return false;
}

return this.requireModified(label, operation.getAsBoolean());
return this.requireModified(label, operation.getAsBoolean(), required);
}

protected boolean requireModified(String label, boolean modified) {
Expand All @@ -222,7 +226,7 @@ protected boolean requireModified(String label, boolean modified, boolean requir
throw new IllegalStateException(message);
}

if (!required && Boolean.getBoolean(IGNORE_PATCH_FAILURE_PROPERTY)) {
if (!required || Boolean.getBoolean(IGNORE_PATCH_FAILURE_PROPERTY)) {
LOGGER.warn(message);
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,27 +97,27 @@ private boolean patchCapeLayer(ClassTransformationContext context) {
modified |= this.applyIfMatches("[556,560]", "cape-layer.render.v1", () -> replaceEntitySolidWithTranslucent(
context, context.findMethod(CAPE_LAYER, "render", "(" + objectDesc(POSE_STACK) + objectDesc(MULTI_BUFFER_SOURCE) + "I" + objectDesc(ABSTRACT_CLIENT_PLAYER) + "FFFFFFF)V"),
RENDER_TYPE
));
), false);
// 19w45a ~ 1.21.1 (1.15 ~ 1.21.1)
modified |= this.applyIfMatches("[561,767],[801,803],[0x40000001,0x400000CC]", "cape-layer.render.v2", () -> replaceEntitySolidWithTranslucent(
context, context.findMethod(CAPE_LAYER, "render", "(" + objectDesc(POSE_STACK) + objectDesc(MULTI_BUFFER_SOURCE) + "I" + objectDesc(ABSTRACT_CLIENT_PLAYER) + "FFFFFF)V"),
RENDER_TYPE
));
), false);
// 24w33a ~ 1.21.8 (1.21.2 ~ 1.21.8)
modified |= this.applyIfMatches("[768,772],[0x400000CD,0x40000103]", "cape-layer.render.v3", () -> replaceEntitySolidWithTranslucent(
context, context.findMethod(CAPE_LAYER, "render", "(" + objectDesc(POSE_STACK) + objectDesc(MULTI_BUFFER_SOURCE) + "I" + objectDesc(PLAYER_RENDER_STATE) + "FF)V"),
RENDER_TYPE
));
), false);
// 25w31a ~ 25w42a (1.21.9 ~ 1.21.10)
modified |= this.applyIfMatches("773,[0x40000104,0x40000112]", "cape-layer.submit.v1", () -> replaceEntitySolidWithTranslucent(
context, context.findMethod(CAPE_LAYER, "submit", "(" + objectDesc(POSE_STACK) + objectDesc(SUBMIT_NODE_COLLECTOR) + "I" + objectDesc(AVATAR_RENDER_STATE) + "FF)V"),
RENDER_TYPE
));
), false);
// 25w43a+ (1.21.11+)
modified |= this.applyIfMatches("[774,800],[804,0x40000000],[0x40000113,]", "cape-layer.submit.v2", () -> replaceEntitySolidWithTranslucent(
context, context.findMethod(CAPE_LAYER, "submit", "(" + objectDesc(POSE_STACK) + objectDesc(SUBMIT_NODE_COLLECTOR) + "I" + objectDesc(AVATAR_RENDER_STATE) + "FF)V"),
RENDER_TYPES
));
), false);
return modified;
}

Expand All @@ -127,12 +127,12 @@ private boolean patchPlayerRenderer(ClassTransformationContext context) {
modified |= this.applyIfMatches("[556,560]", "player-renderer.render-hand.v1", () -> replaceEntitySolidWithTranslucent(
context, context.findMethod(PLAYER_RENDERER, "renderHand", "(" + objectDesc(POSE_STACK) + objectDesc(MULTI_BUFFER_SOURCE) + objectDesc(ABSTRACT_CLIENT_PLAYER) + objectDesc(MODEL_PART) + objectDesc(MODEL_PART) + ")V"),
RENDER_TYPE
));
), false);
// 19w45a ~ 1.21.1 (1.15 ~ 1.21.1)
modified |= this.applyIfMatches("[561,767],[801,803],[0x40000001,0x400000CC]", "player-renderer.render-hand.v2", () -> replaceEntitySolidWithTranslucent(
context, context.findMethod(PLAYER_RENDERER, "renderHand", "(" + objectDesc(POSE_STACK) + objectDesc(MULTI_BUFFER_SOURCE) + "I" + objectDesc(ABSTRACT_CLIENT_PLAYER) + objectDesc(MODEL_PART) + objectDesc(MODEL_PART) + ")V"),
RENDER_TYPE
));
), false);
return modified;
}

Expand All @@ -157,7 +157,9 @@ private boolean replaceEntitySolidWithTranslucent(ClassTransformationContext con
continue;
}

methodNode.instructions.set(instruction, new MethodInsnNode(INVOKESTATIC, remappedOwner, replacementName, remappedDesc, false));
methodNode.instructions.insertBefore(instruction, new InsnNode(DUP));
methodNode.instructions.insert(instruction, new MethodInsnNode(INVOKESTATIC, remappedOwner, replacementName, remappedDesc, false));
methodNode.instructions.insert(instruction, new InsnNode(POP));
modified = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ private static Runnable setProcessor(Runnable processor, MinecraftProfileTexture
}

public static class V2 extends SimpleTexture {
private static final String DOMAIN = "customskinloader:";
private static final String DOMAIN = "customskinloader";

private FakeCapeBuffer buffer;
private FakeNativeImage image;

public static Function<NativeImage, CompletableFuture<?>> createTexture(Function<NativeImage, CompletableFuture<?>> function, Identifier location, boolean isSkin) {
return isSkin ? _image -> {
if (location.toString().startsWith(DOMAIN)) {
if (location.toString().startsWith(DOMAIN + ":")) {
return CompletableFuture.completedFuture(new AbstractMap.SimpleEntry<>(_image, function.apply(_image)));
}
return function.apply(_image);
Expand Down
2 changes: 1 addition & 1 deletion build.info.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"mod_group": "customskinloader",
"mod_name": "CustomSkinLoader",
"mod_version": "15.0",
"mod_version": "15.0.1",
"edition": "Universal",

"loaders": [
Expand Down