Skip to content

Commit

Permalink
1.21.3 -> 1.21.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Sollace committed Dec 12, 2024
1 parent 3e87809 commit df07fa7
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 46 deletions.
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ org.gradle.daemon=false

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21.3
yarn_mappings=1.21.3+build.2
loader_version=0.16.7
fabric_version=0.106.1+1.21.3
minecraft_version=1.21.4
yarn_mappings=1.21.4+build.2
loader_version=0.16.9
fabric_version=0.111.0+1.21.4

# Mod Properties
group=com.minelittlepony
Expand All @@ -15,6 +15,6 @@ org.gradle.daemon=false
description=Embedded common code used across several Mine Little Pony projects to create their GUIs.

# Publishing
minecraft_version_range=>=1.21.3
minecraft_version_range=>=1.21.4
modrinth_loader_type=fabric
modrinth_project_id=9aNz8Zqn
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ default void drawCenteredLabel(DrawContext context, Text text, int x, int y, int
* @param color The font colour
*/
default void drawTextBlock(DrawContext context, StringVisitable text, int x, int y, int maxWidth, int color) {
context.drawTextWrapped(getFont(), text, x, y, maxWidth, color);
context.drawWrappedText(getFont(), text, x, y, maxWidth, color, false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,6 @@ public void tick() {
update.accept(this);
}

@Override
protected boolean clicked(double mouseX, double mouseY) {
return isMouseOver(mouseX, mouseY);
}

@Override
public boolean isMouseOver(double mouseX, double mouseY) {
return active && visible && getBounds().contains(mouseX, mouseY);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
package com.minelittlepony.common.mixin;

import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Share;
import com.llamalad7.mixinextras.sugar.ref.LocalIntRef;
import com.minelittlepony.common.event.SkinFilterCallback;
import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.texture.PlayerSkinTexture;
import net.minecraft.client.texture.ResourceTexture;
import net.minecraft.client.texture.PlayerSkinTextureDownloader;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(PlayerSkinTexture.class)
public abstract class MixinPlayerSkinTexture extends ResourceTexture {
private MixinPlayerSkinTexture() { super(null); }

private static final String FILTER_IMAGE = "remapTexture(Lnet/minecraft/client/texture/NativeImage;)Lnet/minecraft/client/texture/NativeImage;";
private static final String STRIP_COLOR = "net/minecraft/client/texture/PlayerSkinTexture.stripColor(Lnet/minecraft/client/texture/NativeImage;IIII)V";
private static final String STRIP_ALPHA = "net/minecraft/client/texture/PlayerSkinTexture.stripAlpha(Lnet/minecraft/client/texture/NativeImage;IIII)V";
@Mixin(PlayerSkinTextureDownloader.class)
abstract class MixinPlayerSkinTexture {
private static final String FILTER_IMAGE = "remapTexture(Lnet/minecraft/client/texture/NativeImage;Ljava/lang/String;)Lnet/minecraft/client/texture/NativeImage;";
private static final String STRIP_COLOR = "net/minecraft/client/texture/PlayerSkinTextureDownloader.stripColor(Lnet/minecraft/client/texture/NativeImage;IIII)V";
private static final String STRIP_ALPHA = "net/minecraft/client/texture/PlayerSkinTextureDownloader.stripAlpha(Lnet/minecraft/client/texture/NativeImage;IIII)V";

@Inject(method = FILTER_IMAGE, at = @At("HEAD"))
private void beforeUpdate(NativeImage image,
private void beforeUpdate(NativeImage image, String url,
CallbackInfoReturnable<NativeImage> ci,
@Share(value = "kirinmlp_initialWidth") LocalIntRef initialWidth,
@Share(value = "kirinmlp_initialHeight") LocalIntRef initialHeight) {
initialWidth.set(image.getWidth());
initialHeight.set(image.getHeight());
}

@Inject(method = FILTER_IMAGE, at = @At("RETURN"), cancellable = true)
private void update(NativeImage image,
CallbackInfoReturnable<NativeImage> ci,
@ModifyReturnValue(method = FILTER_IMAGE, at = @At("RETURN"))
private NativeImage update(NativeImage image,
@Share(value = "kirinmlp_initialWidth") LocalIntRef initialWidth,
@Share(value = "kirinmlp_initialHeight") LocalIntRef initialHeight) {
// convert skins from mojang server
ci.setReturnValue(SkinFilterCallback.EVENT.invoker().processImage(ci.getReturnValue(), initialWidth.get(), initialHeight.get()));
return SkinFilterCallback.EVENT.invoker().processImage(image, initialWidth.get(), initialHeight.get());
}

// Sorry, Mahjon. Input validation is good 'n all, but this interferes with our other mods.
@Inject(method = FILTER_IMAGE, at = {
@WrapOperation(method = FILTER_IMAGE, at = {
@At(value = "INVOKE", target = STRIP_ALPHA),
@At(value = "INVOKE", target = STRIP_COLOR)
}, cancellable = true)
private void cancelAlphaStrip(NativeImage image, CallbackInfoReturnable<NativeImage> ci,
})
private void cancelAlphaStrip(NativeImage image, int x1, int y1, int x2, int y2,
Operation<Void> operation,
@Share(value = "kirinmlp_initialWidth") LocalIntRef initialWidth,
@Share(value = "kirinmlp_initialHeight") LocalIntRef initialHeight) {
if (SkinFilterCallback.EVENT.invoker().shouldAllowTransparency(image, initialWidth.get(), initialHeight.get())) {
ci.cancel();
if (!SkinFilterCallback.EVENT.invoker().shouldAllowTransparency(image, initialWidth.get(), initialHeight.get())) {
operation.call(image, x1, y1, x2, y2);
}
}
// -
Expand Down
35 changes: 21 additions & 14 deletions src/main/java/com/minelittlepony/common/util/Color.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,48 @@
public interface Color {
/**
* Returns the ALPHA channel for the given colour hex code.
*
* @deprecated Will be removed in MC1.22. Replace with {@link ColorHelper#getAlphaFloat}
*/
@Deprecated(since = "1.20.1", forRemoval = true)
static float a(int hex) {
return ColorHelper.floatFromChannel(ColorHelper.getAlpha(hex));
return ColorHelper.getAlphaFloat(hex);
}

/**
* Returns the RED channel for the given colour hex code.
*
* @deprecated Will be removed in MC1.22. Replace with {@link ColorHelper#getRedFloat}
*/
@Deprecated(since = "1.20.1", forRemoval = true)
static float r(int hex) {
return ColorHelper.floatFromChannel(ColorHelper.getRed(hex));
return ColorHelper.getRedFloat(hex);
}

/**
* Returns the GREEN channel for the given colour hex code.
*
* @deprecated Will be removed in MC1.22. Replace with {@link ColorHelper#getGreenFloat}
*/
@Deprecated(since = "1.20.1", forRemoval = true)
static float g(int hex) {
return ColorHelper.floatFromChannel(ColorHelper.getGreen(hex));
return ColorHelper.getGreenFloat(hex);
}

/**
* Returns the BLUE channel for the given colour hex code.
*
* @deprecated Will be removed in MC1.22. Replace with {@link ColorHelper#getBlueFloat}
*/
@Deprecated(since = "1.20.1", forRemoval = true)
static float b(int hex) {
return ColorHelper.floatFromChannel(ColorHelper.getBlue(hex));
return ColorHelper.getBlueFloat(hex);
}

/**
* Converts the given rgb floats on a range of 0-1 into a colour hex code.
*
* @Deprecated(since = "1.19.4", forRemoval = true)
* @deprecated Will be removed in MC1.22. Replace with {@link ColorHelper#fromFloats}
*/
@Deprecated(since = "1.19.4", forRemoval = true)
static int argbToHex(float a, float r, float g, float b) {
Expand All @@ -47,7 +59,7 @@ static int argbToHex(float a, float r, float g, float b) {
/**
* Converts the given rbg int on a range of 0-255 into a colour hex code.
*
* @deprecated Will be removed in MC1.22
* @deprecated Will be removed in MC1.22. Replace with {@link ColorHelper#getArgb}
*/
@Deprecated(since = "1.19.4", forRemoval = true)
static int argbToHex(int a, int r, int g, int b) {
Expand All @@ -57,22 +69,17 @@ static int argbToHex(int a, int r, int g, int b) {
/**
* Converts a colour hex code from BGR to RGB (and back).
*
* @deprecated Will be removed in MC1.22
* @deprecated Will be removed in MC1.22. Replace with {@link ColorHelper#fromAbgr}
*/
@Deprecated
static int abgrToArgb(int color) {
return ColorHelper.getArgb(
ColorHelper.getAlpha(color),
ColorHelper.getBlue(color),
ColorHelper.getGreen(color),
ColorHelper.getRed(color)
);
return ColorHelper.fromAbgr(color);
}

/**
* Interpolates between two colours
*
* @deprecated Will be removed in MC1.22
* @deprecated Will be removed in MC1.22. Replace with {@link ColorHelper#lerp}
*/
@Deprecated(since = "1.19.4", forRemoval = true)
static int lerp(float delta, int from, int to) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.Strictness;
import com.google.gson.stream.JsonWriter;
import com.mojang.util.UUIDTypeAdapter;

Expand All @@ -25,7 +26,7 @@ public class HeirarchicalJsonConfigAdapter implements Config.Adapter {

public HeirarchicalJsonConfigAdapter(GsonBuilder builder) {
this.gson = builder
.setLenient()
.setStrictness(Strictness.LENIENT)
.setPrettyPrinting()
.registerTypeHierarchyAdapter(Path.class, new ToStringAdapter<>(Paths::get))
.registerTypeAdapter(UUID.class, new UUIDTypeAdapter())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* A specialised configuration container that loads from a json file.
*
* @deprecated Use Config with {@code Config#FLATTENED_JSON_ADAPTER}
* @deprecated Will be removed in MC1.22. Use Config with {@code Config#FLATTENED_JSON_ADAPTER}
*/
@Deprecated(forRemoval = true)
public class JsonConfig extends Config {
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
"links": {
"modmenu.discord": "https://discord.gg/zKSZ8Mg"
}
},
"loom:injected_interfaces": {
"net/minecraft/class_437": ["com/minelittlepony/common/client/gui/IViewRoot", "com/minelittlepony/common/client/gui/ITextContext"]
}
}
}

0 comments on commit df07fa7

Please sign in to comment.