Skip to content

Commit

Permalink
Add litematica patch
Browse files Browse the repository at this point in the history
  • Loading branch information
kappa-maintainer committed Sep 30, 2024
1 parent 8ae81c0 commit eb2a8e8
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ build
eclipse
run
/mcmodsrepo/
libs/
11 changes: 11 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ buildscript {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '6.10.+', changing: true
classpath "org.spongepowered:mixingradle:0.7.+"
classpath "net.kyori:blossom:2.1.0"
classpath "de.undercouch:gradle-download-task:5.6.0"
}
}
apply plugin: 'net.minecraftforge.gradle'
Expand All @@ -18,6 +19,7 @@ apply plugin: 'maven-publish'
apply plugin: 'java'
apply plugin: 'org.spongepowered.mixin'
apply plugin: 'net.kyori.blossom'
apply plugin: "de.undercouch.download"

version = "${minecraft_version}-${mod_version}"
group = mod_base_package
Expand All @@ -27,6 +29,11 @@ archivesBaseName = "+" + mod_name

java.toolchain.languageVersion = JavaLanguageVersion.of(21)

tasks.register('downloadLitematica', Download) {
src 'https://masa.dy.fi/mcmods/litematica/litematica-forge-1.12.2-0.0.0-dev.20191217.195055.jar'
dest rootProject.mkdir("libs")
}

minecraft {

mappings channel: mappings_channel, version: mappings_version
Expand Down Expand Up @@ -130,6 +137,8 @@ repositories {
dependencies {
minecraft "com.cleanroommc:cleanroom:0.2.3-alpha"

compileOnly fileTree('libs') { include '*.jar' }

//Charset Lib
compileOnly(fg.deobf("curse.maven:charset-284523:3656492"))

Expand Down Expand Up @@ -268,6 +277,8 @@ jar {

jar.finalizedBy('reobfJar')

compileJava.dependsOn("downloadLitematica")

publishing {
publications {
mavenJava(MavenPublication) {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
case "jei" -> Loader.isModLoaded("jei") && FugueConfig.modPatchConfig.enableHEI && Fugue.isModNewerThan("jei", "4.17.0");
case "infinitylib" -> Loader.isModLoaded("infinitylib") && FugueConfig.modPatchConfig.enableInfLib;
case "carryon" -> Loader.isModLoaded("carryon") && FugueConfig.modPatchConfig.enableCarryon;
case "litematica" -> Loader.isModLoaded("litematica") && FugueConfig.modPatchConfig.enableLitematica;
default -> true;
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,6 @@ public class ModPatchConfig {
public boolean enableDropt = true;
@Config.Name("Enable Carryon Patch")
public boolean enableCarryon = true;
@Config.Name("Enable Litematica Patch")
public boolean enableLitematica = true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.cleanroommc.fugue.mixin.litematica;

import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import fi.dy.masa.litematica.render.schematic.ChunkRenderWorkerLitematica;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(value = ChunkRenderWorkerLitematica.class, remap = false)
public class ChunkRenderWorkerLitematicaMixin {
@Redirect(method = "processTask", at = @At(value = "INVOKE", target = "Lcom/google/common/util/concurrent/Futures;addCallback(Lcom/google/common/util/concurrent/ListenableFuture;Lcom/google/common/util/concurrent/FutureCallback;)V"))
protected void hackFuture(ListenableFuture listenableFuture, FutureCallback futureCallback) {
Futures.addCallback(listenableFuture, futureCallback, Runnable::run);
}
}
1 change: 1 addition & 0 deletions src/main/resources/fugue.mixin.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"howlingmoon.WerewolfCapabilityMixin",
"incontrol.CachePerWorldMixin",
"infinitylib.BakedInfBlockModelMixin",
"litematica.ChunkRenderWorkerLitematicaMixin",
"mage.ColorspacesMixin",
"minecraftmultipartcbe.ASMMixinCompilerMixin",
"minecraftmultipartcbe.StackAnalyserMixin",
Expand Down

0 comments on commit eb2a8e8

Please sign in to comment.