mirror of
https://github.com/AlmostReliable/almostunified.git
synced 2024-11-14 19:25:13 -05:00
parent
4923dd3034
commit
60b2eb339b
8 changed files with 92 additions and 1 deletions
|
@ -7,6 +7,7 @@ val junitVersion: String by project
|
||||||
val fabricLoaderVersion: String by project
|
val fabricLoaderVersion: String by project
|
||||||
val jeiVersion: String by project
|
val jeiVersion: String by project
|
||||||
val reiVersion: String by project
|
val reiVersion: String by project
|
||||||
|
val emiVersion: String by project
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("com.github.gmazzo.buildconfig") version "4.0.4"
|
id("com.github.gmazzo.buildconfig") version "4.0.4"
|
||||||
|
@ -35,6 +36,7 @@ dependencies {
|
||||||
modCompileOnly("mezz.jei:jei-$minecraftVersion-common-api:$jeiVersion") // required for jei plugin
|
modCompileOnly("mezz.jei:jei-$minecraftVersion-common-api:$jeiVersion") // required for jei plugin
|
||||||
modCompileOnly("mezz.jei:jei-$minecraftVersion-lib:$jeiVersion") // required for jei mixin
|
modCompileOnly("mezz.jei:jei-$minecraftVersion-lib:$jeiVersion") // required for jei mixin
|
||||||
modCompileOnly("me.shedaniel:RoughlyEnoughItems-api:$reiVersion") // required for rei plugin
|
modCompileOnly("me.shedaniel:RoughlyEnoughItems-api:$reiVersion") // required for rei plugin
|
||||||
|
modCompileOnly("dev.emi:emi-xplat-intermediary:$emiVersion+$minecraftVersion:api") // required for emi plugin
|
||||||
|
|
||||||
// compile time dependencies
|
// compile time dependencies
|
||||||
compileOnly("me.shedaniel:REIPluginCompatibilities-forge-annotations:9.+") // required to disable rei compat layer
|
compileOnly("me.shedaniel:REIPluginCompatibilities-forge-annotations:9.+") // required to disable rei compat layer
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.almostreliable.unified.compat;
|
||||||
|
|
||||||
|
import com.almostreliable.unified.AlmostUnified;
|
||||||
|
import com.almostreliable.unified.AlmostUnifiedFallbackRuntime;
|
||||||
|
import com.almostreliable.unified.config.UnifyConfig;
|
||||||
|
import com.almostreliable.unified.recipe.CRTLookup;
|
||||||
|
import dev.emi.emi.api.EmiEntrypoint;
|
||||||
|
import dev.emi.emi.api.EmiInitRegistry;
|
||||||
|
import dev.emi.emi.api.EmiPlugin;
|
||||||
|
import dev.emi.emi.api.EmiRegistry;
|
||||||
|
import dev.emi.emi.api.recipe.EmiRecipe;
|
||||||
|
import dev.emi.emi.api.recipe.EmiRecipeDecorator;
|
||||||
|
import dev.emi.emi.api.stack.EmiStack;
|
||||||
|
import dev.emi.emi.api.widget.WidgetHolder;
|
||||||
|
import net.minecraft.client.renderer.Rect2i;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
|
||||||
|
@SuppressWarnings("UnstableApiUsage")
|
||||||
|
@EmiEntrypoint
|
||||||
|
public class AlmostEMI implements EmiPlugin {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize(EmiInitRegistry registry) {
|
||||||
|
AlmostUnifiedFallbackRuntime.getInstance().reload();
|
||||||
|
|
||||||
|
var emiDisabled = AlmostUnified.getRuntime()
|
||||||
|
.getUnifyConfig()
|
||||||
|
.map(UnifyConfig::reiOrJeiDisabled)
|
||||||
|
.orElse(false);
|
||||||
|
if (emiDisabled) return;
|
||||||
|
|
||||||
|
for (ItemStack item : HideHelper.createHidingList(AlmostUnified.getRuntime())) {
|
||||||
|
registry.disableStack(EmiStack.of(item));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void register(EmiRegistry registry) {
|
||||||
|
registry.addRecipeDecorator(new IndicatorDecorator());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class IndicatorDecorator implements EmiRecipeDecorator {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void decorateRecipe(EmiRecipe recipe, WidgetHolder widgets) {
|
||||||
|
var recipeId = recipe.getId();
|
||||||
|
if (recipeId == null) return;
|
||||||
|
|
||||||
|
var link = CRTLookup.getLink(recipeId);
|
||||||
|
if (link == null) return;
|
||||||
|
|
||||||
|
var area = new Rect2i(
|
||||||
|
recipe.getDisplayWidth() - 5,
|
||||||
|
recipe.getDisplayHeight() - 3,
|
||||||
|
RecipeIndicator.RENDER_SIZE - 1,
|
||||||
|
RecipeIndicator.RENDER_SIZE - 1
|
||||||
|
);
|
||||||
|
widgets.addDrawable(0, 0, 0, 0, (stack, mX, mY, delta) -> RecipeIndicator.renderIndicator(stack, area));
|
||||||
|
widgets.addTooltipText(
|
||||||
|
RecipeIndicator.constructTooltip(link),
|
||||||
|
area.getX(),
|
||||||
|
area.getY(),
|
||||||
|
area.getWidth(),
|
||||||
|
area.getHeight()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ val fabricApiVersion: String by project
|
||||||
val fabricRecipeViewer: String by project
|
val fabricRecipeViewer: String by project
|
||||||
val jeiVersion: String by project
|
val jeiVersion: String by project
|
||||||
val reiVersion: String by project
|
val reiVersion: String by project
|
||||||
|
val emiVersion: String by project
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("com.github.johnrengelman.shadow") version "8.1.1"
|
id("com.github.johnrengelman.shadow") version "8.1.1"
|
||||||
|
@ -36,12 +37,14 @@ dependencies {
|
||||||
// compile time mods
|
// compile time mods
|
||||||
modCompileOnly("mezz.jei:jei-$minecraftVersion-fabric-api:$jeiVersion") // required for common jei plugin
|
modCompileOnly("mezz.jei:jei-$minecraftVersion-fabric-api:$jeiVersion") // required for common jei plugin
|
||||||
modCompileOnly("me.shedaniel:RoughlyEnoughItems-api-fabric:$reiVersion") // required for common rei plugin
|
modCompileOnly("me.shedaniel:RoughlyEnoughItems-api-fabric:$reiVersion") // required for common rei plugin
|
||||||
|
modCompileOnly("dev.emi:emi-fabric:$emiVersion+$minecraftVersion:api") // required for common emi plugin
|
||||||
|
|
||||||
// runtime dependencies
|
// runtime dependencies
|
||||||
modLocalRuntime(
|
modLocalRuntime(
|
||||||
when (fabricRecipeViewer) {
|
when (fabricRecipeViewer) {
|
||||||
"jei" -> "mezz.jei:jei-$minecraftVersion-fabric:$jeiVersion"
|
"jei" -> "mezz.jei:jei-$minecraftVersion-fabric:$jeiVersion"
|
||||||
"rei" -> "me.shedaniel:RoughlyEnoughItems-fabric:$reiVersion"
|
"rei" -> "me.shedaniel:RoughlyEnoughItems-fabric:$reiVersion"
|
||||||
|
"emi" -> "dev.emi:emi-fabric:$emiVersion+$minecraftVersion"
|
||||||
else -> throw GradleException("Invalid fabricRecipeViewer value: $fabricRecipeViewer")
|
else -> throw GradleException("Invalid fabricRecipeViewer value: $fabricRecipeViewer")
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -23,6 +23,9 @@
|
||||||
],
|
],
|
||||||
"rei_client": [
|
"rei_client": [
|
||||||
"com.almostreliable.unified.compat.AlmostREI"
|
"com.almostreliable.unified.compat.AlmostREI"
|
||||||
|
],
|
||||||
|
"emi": [
|
||||||
|
"com.almostreliable.unified.compat.AlmostEMI"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
|
@ -35,6 +38,7 @@
|
||||||
},
|
},
|
||||||
"suggests": {
|
"suggests": {
|
||||||
"jei": ">=${jeiVersion}",
|
"jei": ">=${jeiVersion}",
|
||||||
"roughlyenoughitems": ">=${reiVersion}"
|
"roughlyenoughitems": ">=${reiVersion}",
|
||||||
|
"emi": ">=${emiVersion}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ val forgeVersion: String by project
|
||||||
val forgeRecipeViewer: String by project
|
val forgeRecipeViewer: String by project
|
||||||
val jeiVersion: String by project
|
val jeiVersion: String by project
|
||||||
val reiVersion: String by project
|
val reiVersion: String by project
|
||||||
|
val emiVersion: String by project
|
||||||
|
|
||||||
val extraModsPrefix = "extra-mods"
|
val extraModsPrefix = "extra-mods"
|
||||||
|
|
||||||
|
@ -56,11 +57,13 @@ dependencies {
|
||||||
isTransitive = false // prevents breaking the forge runtime
|
isTransitive = false // prevents breaking the forge runtime
|
||||||
}
|
}
|
||||||
modCompileOnly("me.shedaniel:RoughlyEnoughItems-forge:$reiVersion") // required for common rei plugin
|
modCompileOnly("me.shedaniel:RoughlyEnoughItems-forge:$reiVersion") // required for common rei plugin
|
||||||
|
modCompileOnly("dev.emi:emi-forge:$emiVersion+$minecraftVersion:api") // required for common emi plugin
|
||||||
|
|
||||||
// runtime mods
|
// runtime mods
|
||||||
when (forgeRecipeViewer) {
|
when (forgeRecipeViewer) {
|
||||||
"jei" -> modLocalRuntime("mezz.jei:jei-$minecraftVersion-forge:$jeiVersion") { isTransitive = false }
|
"jei" -> modLocalRuntime("mezz.jei:jei-$minecraftVersion-forge:$jeiVersion") { isTransitive = false }
|
||||||
"rei" -> modLocalRuntime("me.shedaniel:RoughlyEnoughItems-forge:$reiVersion")
|
"rei" -> modLocalRuntime("me.shedaniel:RoughlyEnoughItems-forge:$reiVersion")
|
||||||
|
"emi" -> modLocalRuntime("dev.emi:emi-forge:$emiVersion+$minecraftVersion")
|
||||||
else -> throw GradleException("Invalid forgeRecipeViewer value: $forgeRecipeViewer")
|
else -> throw GradleException("Invalid forgeRecipeViewer value: $forgeRecipeViewer")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,3 +38,10 @@ mandatory = false
|
||||||
versionRange = "[${reiVersion},)"
|
versionRange = "[${reiVersion},)"
|
||||||
ordering = "BEFORE"
|
ordering = "BEFORE"
|
||||||
side = "BOTH"
|
side = "BOTH"
|
||||||
|
|
||||||
|
[[dependencies."${modId}"]]
|
||||||
|
modId = "emi"
|
||||||
|
mandatory = false
|
||||||
|
versionRange = "[${emiVersion},)"
|
||||||
|
ordering = "BEFORE"
|
||||||
|
side = "BOTH"
|
||||||
|
|
|
@ -17,6 +17,7 @@ val fabricApiVersion: String by project
|
||||||
val forgeVersion: String by project
|
val forgeVersion: String by project
|
||||||
val jeiVersion: String by project
|
val jeiVersion: String by project
|
||||||
val reiVersion: String by project
|
val reiVersion: String by project
|
||||||
|
val emiVersion: String by project
|
||||||
val githubRepo: String by project
|
val githubRepo: String by project
|
||||||
val githubUser: String by project
|
val githubUser: String by project
|
||||||
|
|
||||||
|
@ -74,6 +75,7 @@ subprojects {
|
||||||
maven("https://maven.parchmentmc.org") // Parchment
|
maven("https://maven.parchmentmc.org") // Parchment
|
||||||
maven("https://maven.shedaniel.me") // REI
|
maven("https://maven.shedaniel.me") // REI
|
||||||
maven("https://maven.blamejared.com/") // JEI
|
maven("https://maven.blamejared.com/") // JEI
|
||||||
|
maven("https://maven.terraformersmc.com/") // EMI
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,6 +124,7 @@ subprojects {
|
||||||
"forgeFMLVersion" to forgeVersion.substringBefore("."),
|
"forgeFMLVersion" to forgeVersion.substringBefore("."),
|
||||||
"jeiVersion" to jeiVersion,
|
"jeiVersion" to jeiVersion,
|
||||||
"reiVersion" to reiVersion,
|
"reiVersion" to reiVersion,
|
||||||
|
"emiVersion" to emiVersion,
|
||||||
"githubUser" to githubUser,
|
"githubUser" to githubUser,
|
||||||
"githubRepo" to githubRepo
|
"githubRepo" to githubRepo
|
||||||
)
|
)
|
||||||
|
|
|
@ -23,6 +23,7 @@ parchmentVersion = 2022.11.27
|
||||||
# Mod Dependencies
|
# Mod Dependencies
|
||||||
jeiVersion = 11.6.0.1012
|
jeiVersion = 11.6.0.1012
|
||||||
reiVersion = 9.1.580
|
reiVersion = 9.1.580
|
||||||
|
emiVersion = 1.1.2
|
||||||
|
|
||||||
# Fabric Dependencies
|
# Fabric Dependencies
|
||||||
fabricLoaderVersion = 0.14.19
|
fabricLoaderVersion = 0.14.19
|
||||||
|
|
Loading…
Reference in a new issue