diff --git a/build.gradle b/build.gradle index e0e2bb9..d5961fd 100644 --- a/build.gradle +++ b/build.gradle @@ -129,9 +129,9 @@ repositories { // If you have mod jar dependencies in ./libs, you can declare them as a repository like so. // See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver - // flatDir { - // dir 'libs' - // } + flatDir { + dir 'libs' + } } dependencies { @@ -143,13 +143,12 @@ dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" implementation 'org.spongepowered:mixin:0.8.5' annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' - compileOnly files("libs/modernlife-1.20.1-1.74.jar") // Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime // compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}") // compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}") // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}") - + implementation fg.deobf("blank:modernlife-1.20.1:1.74") // Example mod dependency using a mod jar from ./libs with a flat dir repository // This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar // The group id is ignored when searching -- in this case, it is "blank" diff --git a/libs/modernlife-1.20.1-1.74.jar b/libs/modernlife-1.20.1-1.74.jar index 57f87f3..8554bbb 100644 Binary files a/libs/modernlife-1.20.1-1.74.jar and b/libs/modernlife-1.20.1-1.74.jar differ diff --git a/modernlife.jar b/modernlife.jar deleted file mode 100644 index e69de29..0000000 diff --git a/src/main/java/com/r3944realms/modernlifepatch/mixin/item/MixinCamera.java b/src/main/java/com/r3944realms/modernlifepatch/mixin/item/MixinCamera.java index 0f2179f..c8c615a 100644 --- a/src/main/java/com/r3944realms/modernlifepatch/mixin/item/MixinCamera.java +++ b/src/main/java/com/r3944realms/modernlifepatch/mixin/item/MixinCamera.java @@ -22,64 +22,6 @@ import java.util.List; @Mixin(CameraItem.class) public abstract class MixinCamera { - - @Unique - private static int modernLifePatch$toInternalRgbFormat(int nativeRgb) { - int r = nativeRgb & 255; - int g = (nativeRgb & '\uff00') >> 8; - int b = (nativeRgb & 16711680) >> 16; - return r << 16 | g << 8 | b; - } - @Inject(method = {"getAverageRgbAt"}, at = @At("HEAD"), remap = false, cancellable = true) - private static void getAverageRgbAt(NativeImage img, int x, int y, float pixelSampleWidth, float pixelSampleHeight, CallbackInfoReturnable cir) { - try { - int destX = (int) ((float) x * pixelSampleWidth); - int destY = (int) ((float) y * pixelSampleHeight); - int rSum = 0; - int gSum = 0; - int bSum = 0; - int iterations = 0; - int hStart = (int) (-pixelSampleHeight / 2.0F); - int hEnd = (int) (pixelSampleHeight / 2.0F); - int wStart = (int) (-pixelSampleWidth / 2.0F); - int wEnd = (int) (pixelSampleWidth / 2.0F); - ModernLifePatch.logger.info("[ModernLifePatch.MixinCamera] pixelSampleHeight: {} , pixelSampleWidth: {}", pixelSampleHeight, pixelSampleWidth); - if (hStart == hEnd) { - hStart = 0; - hEnd = 1; - wStart = 0; - wEnd = 1; - } - - int h; - int w; - int finalX; - ModernLifePatch.logger.info("[ModernLifePatch.MixinCamera] hEnd: {} , wEnd: {}", hEnd, wEnd); - for (h = hStart; h < hEnd; ++h) { - for (w = wStart; w < wEnd; ++w) { - finalX = destX + w; - int finalY = destY + h; - finalX = Math.max(finalX, 0); - finalY = Math.max(finalY, 0); - finalX = Math.min(finalX, img.getWidth() - 1); - finalY = Math.min(finalY, img.getHeight() - 1); - int rgb = modernLifePatch$toInternalRgbFormat(img.getPixelRGBA(finalX, finalY)); - rSum += CanvasData.getRValue(rgb); - gSum += CanvasData.getGValue(rgb); - bSum += CanvasData.getBValue(rgb); - ++iterations; - } - } - ModernLifePatch.logger.info("[ModernLifePatch.MixinCamera] rSum: {} , gSum: {}, bSum: {}", rSum, gSum, bSum); - ModernLifePatch.logger.info("[ModernLifePatch.MixinCamera] iterations: {} ", iterations); - h = rSum / iterations; - w = gSum / iterations; - finalX = bSum / iterations; - cir.setReturnValue(h << 16 | w << 8 | finalX); - } catch(ArrayIndexOutOfBoundsException e) { - cir.setReturnValue(0xffffffff); - } - } @Inject(method = {"appendHoverText"}, at= @At("HEAD"), cancellable = true) public void appendHoverText(ItemStack itemStack, Level world, List text, TooltipFlag flag, CallbackInfo ci) { int photoCount = 0;