Skip to content

Commit

Permalink
Add JEI support (fixes #6)
Browse files Browse the repository at this point in the history
  • Loading branch information
EnnuiL committed Oct 25, 2024
1 parent 3979e10 commit 6a18565
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 8 deletions.
15 changes: 12 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ loom {

repositories {
maven(uri("https://maven.terraformersmc.com/releases/"))
maven(uri("https://maven.blamejared.com/"))
exclusiveContent {
forRepository {
maven(uri("https://api.modrinth.com/maven"))
Expand All @@ -40,11 +41,15 @@ dependencies {
modCompileOnly(libs.ennuis.bigger.inventories)
modLocalRuntime(libs.ennuis.bigger.inventories)

modCompileOnly(libs.jei)
//modLocalRuntime(libs.jei)

modCompileOnly(libs.emi)
modLocalRuntime(libs.emi)
}

tasks.processResources {
tasks.named<ProcessResources>("processResources").configure {
var version = project.version
inputs.property("version", version)

filesMatching("fabric.mod.json") {
Expand All @@ -67,9 +72,13 @@ java {
}

// If you plan to use a different file for the license, don't forget to change the file name here!
tasks.jar {
tasks.named<Jar>("jar").configure {
var name = project.name
inputs.files("LICENSE.md")
inputs.property("name", name)

from("LICENSE.md") {
rename { "${it}_${base.archivesName.get()}" }
rename { "LICENSE_${name}.md" }
}
}

Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
org.gradle.jvmargs = -Xmx1G
org.gradle.parallel = true
org.gradle.caching = true
org.gradle.configuration-cache=true
org.gradle.configuration-cache.parallel=true
kotlin.experimental.tryK2=true

# Mod versioning is managed at build.gradle.kts
Expand Down
9 changes: 6 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
minecraft = "1.21.1"
quilt_mappings = "1.21.1+build.3"

quilt_loom = "1.7.4"
quilt_loader = "0.26.4"
quilt_loom = "1.8.4"
quilt_loader = "0.27.0-beta.1"

fabric_api = "0.105.0+1.21.1"
fabric_api = "0.106.0+1.21.1"
ennuis_bigger_inventories = "0.2.0-beta.3+1.21"
# Keep your friends closer and keep your rivals uh, close to each other???
emi = "1.1.16+1.21.1"
jei = "19.21.0.246"

[libraries]
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
Expand All @@ -18,6 +20,7 @@ quilt_loader = { module = "org.quiltmc:quilt-loader", version.ref = "quilt_loade
fabric_api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric_api" }
ennuis_bigger_inventories = { module = "maven.modrinth:ennuis_bigger_inventories", version.ref = "ennuis_bigger_inventories" }
emi = { module = "dev.emi:emi-fabric", version.ref = "emi" }
jei = { module = "mezz.jei:jei-1.21.1-fabric", version.ref = "jei" }

[bundles]

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.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package io.github.ennuil.ennuis_bigger_gambiarra.mixin.jei;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.sugar.Local;
import io.github.ennuil.ennuis_bigger_inventories.api.HackjobKit;
import mezz.jei.library.transfer.BasicRecipeTransferInfo;
import net.minecraft.screen.ScreenHandler;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(BasicRecipeTransferInfo.class)
public abstract class PlayerRecipeTransferHandlerMixin {
@ModifyExpressionValue(method = "getInventorySlots", at = @At(value = "FIELD", target = "Lmezz/jei/library/transfer/BasicRecipeTransferInfo;inventorySlotCount:I"))
private int modifySlotEnd(int original, @Local ScreenHandler screenHandler) {
// This hackjob is generic enough to affect everything that's needed but it might be overreaching!
// I recommend EMI for a better experience, but if you really want JEI, I guess we have this ticking time bomb
// Do *not* point fingers to JEI's mod authors!!! I'm the one doing the gambiarra in the first place!
return original == 36 && HackjobKit.isTenfoursized() ? 40 : original;
}
}
3 changes: 2 additions & 1 deletion src/main/resources/ennuis_bigger_gambiarra.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"emi.accessors.AbstractFurnaceScreenHandlerAccessor",
"emi.accessors.CraftingScreenHandlerAccessor",
"emi.accessors.PlayerScreenHandlerAccessor",
"emi.accessors.StonecutterScreenHandlerAccessor"
"emi.accessors.StonecutterScreenHandlerAccessor",
"jei.PlayerRecipeTransferHandlerMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit 6a18565

Please sign in to comment.