Open dependency floors and gate EMI, Elytra, and compiled-density fixes to the versions that need them
This commit is contained in:
parent
5c04905561
commit
17e5817faa
8 changed files with 550 additions and 8 deletions
|
|
@ -20,6 +20,7 @@ configurations { testImplementation.extendsFrom compileOnly }
|
|||
dependencies {
|
||||
compileOnly('net.createmod.ponder:ponder-neoforge:1.0.82+mc1.21.1') { transitive = false }
|
||||
compileOnly('maven.modrinth:iris:t3ruzodq') { transitive = false }
|
||||
compileOnly('maven.modrinth:jei:Tn0dgwL0') { transitive = false }
|
||||
compileOnly('dev.engine-room.flywheel:flywheel-neoforge-1.21.1:1.0.6') { transitive = false }
|
||||
testImplementation 'org.ow2.asm:asm-tree:9.8'
|
||||
testImplementation 'org.ow2.asm:asm-commons:9.8'
|
||||
|
|
|
|||
51
client/src/main/java/dev/quorate/client/mixin/EmiPlugin.java
Normal file
51
client/src/main/java/dev/quorate/client/mixin/EmiPlugin.java
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
package dev.quorate.client.mixin;
|
||||
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public final class EmiPlugin implements IMixinConfigPlugin {
|
||||
// 1.1.24 leaves JEI's aligned setPosition abstract. 1.1.25 is the next release.
|
||||
static final String EMI = "[1.1.24+1.21.1+neoforge,1.1.25+1.21.1+neoforge)";
|
||||
|
||||
// 19.57.0.450 declares the aligned method and places through getXPos/getYPos.
|
||||
static final String JEI = "[19.57.0.450,19.58)";
|
||||
|
||||
@Override
|
||||
public void onLoad(String mixinPackage) {}
|
||||
|
||||
@Override
|
||||
public String getRefMapperConfig() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
|
||||
return ModRanges.loaded("emi", EMI) && ModRanges.loaded("jei", JEI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {}
|
||||
|
||||
@Override
|
||||
public List<String> getMixins() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preApply(
|
||||
String targetClassName,
|
||||
ClassNode targetClass,
|
||||
String mixinClassName,
|
||||
IMixinInfo mixinInfo) {}
|
||||
|
||||
@Override
|
||||
public void postApply(
|
||||
String targetClassName,
|
||||
ClassNode targetClass,
|
||||
String mixinClassName,
|
||||
IMixinInfo mixinInfo) {}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package dev.quorate.client.mixin;
|
||||
|
||||
import mezz.jei.api.gui.builder.IRecipeSlotBuilder;
|
||||
import mezz.jei.api.gui.placement.HorizontalAlignment;
|
||||
import mezz.jei.api.gui.placement.VerticalAlignment;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(targets = "dev.emi.emi.jemi.impl.JemiRecipeSlotBuilder", remap = false)
|
||||
public abstract class EmiSlotMixin {
|
||||
@Shadow(remap = false)
|
||||
public abstract IRecipeSlotBuilder setPosition(int x, int y);
|
||||
|
||||
@Shadow(remap = false)
|
||||
public abstract int getWidth();
|
||||
|
||||
@Shadow(remap = false)
|
||||
public abstract int getHeight();
|
||||
|
||||
// Same placement as JEI PlaceableUtil: origin plus alignment inside the area.
|
||||
public IRecipeSlotBuilder setPosition(
|
||||
int areaX,
|
||||
int areaY,
|
||||
int areaWidth,
|
||||
int areaHeight,
|
||||
HorizontalAlignment horizontal,
|
||||
VerticalAlignment vertical) {
|
||||
return setPosition(
|
||||
areaX + horizontal.getXPos(areaWidth, getWidth()),
|
||||
areaY + vertical.getYPos(areaHeight, getHeight()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package dev.quorate.client.mixin;
|
||||
|
||||
import mezz.jei.api.gui.placement.HorizontalAlignment;
|
||||
import mezz.jei.api.gui.placement.VerticalAlignment;
|
||||
import mezz.jei.api.gui.widgets.ITextWidget;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(targets = "dev.emi.emi.jemi.impl.extras.JemiTextWidget", remap = false)
|
||||
public abstract class EmiTextMixin {
|
||||
@Shadow(remap = false)
|
||||
public int x;
|
||||
|
||||
@Shadow(remap = false)
|
||||
public int y;
|
||||
|
||||
@Shadow(remap = false)
|
||||
public abstract int getWidth();
|
||||
|
||||
@Shadow(remap = false)
|
||||
public abstract int getHeight();
|
||||
|
||||
// ITextWidget.setPosition returns ITextWidget. The parent method returns IPlaceable.
|
||||
public ITextWidget setPosition(int x, int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
return (ITextWidget) (Object) this;
|
||||
}
|
||||
|
||||
public ITextWidget setPosition(
|
||||
int areaX,
|
||||
int areaY,
|
||||
int areaWidth,
|
||||
int areaHeight,
|
||||
HorizontalAlignment horizontal,
|
||||
VerticalAlignment vertical) {
|
||||
return setPosition(
|
||||
areaX + horizontal.getXPos(areaWidth, getWidth()),
|
||||
areaY + vertical.getYPos(areaHeight, getHeight()));
|
||||
}
|
||||
}
|
||||
31
client/src/main/java/dev/quorate/client/mixin/ModRanges.java
Normal file
31
client/src/main/java/dev/quorate/client/mixin/ModRanges.java
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package dev.quorate.client.mixin;
|
||||
|
||||
import net.neoforged.fml.loading.LoadingModList;
|
||||
import net.neoforged.neoforgespi.language.MavenVersionAdapter;
|
||||
|
||||
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
||||
|
||||
public final class ModRanges {
|
||||
private ModRanges() {}
|
||||
|
||||
public static boolean contains(ArtifactVersion version, String spec) {
|
||||
return MavenVersionAdapter.createFromVersionSpec(spec).containsVersion(version);
|
||||
}
|
||||
|
||||
public static boolean loaded(String modId, String spec) {
|
||||
var mods = LoadingModList.get();
|
||||
if (mods == null) {
|
||||
return false;
|
||||
}
|
||||
var file = mods.getModFileById(modId);
|
||||
if (file == null) {
|
||||
return false;
|
||||
}
|
||||
for (var mod : file.getMods()) {
|
||||
if (modId.equals(mod.getModId())) {
|
||||
return contains(mod.getVersion(), spec);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -11,10 +11,13 @@ description="Create rendering and collision query optimizations."
|
|||
[[mixins]]
|
||||
config="client.mixins.json"
|
||||
|
||||
[[mixins]]
|
||||
config="client.jemi.mixins.json"
|
||||
|
||||
[[dependencies.saltatory_client]]
|
||||
modId="neoforge"
|
||||
type="required"
|
||||
versionRange="[21.1.250]"
|
||||
versionRange="[21.1.250,)"
|
||||
ordering="NONE"
|
||||
side="CLIENT"
|
||||
|
||||
|
|
@ -31,13 +34,13 @@ javaVersion="[25,)"
|
|||
[[dependencies.saltatory_client]]
|
||||
modId="ponder"
|
||||
type="required"
|
||||
versionRange="[1.0.82+mc1.21.1]"
|
||||
versionRange="[1.0.82+mc1.21.1,)"
|
||||
ordering="AFTER"
|
||||
side="CLIENT"
|
||||
|
||||
[[dependencies.saltatory_client]]
|
||||
modId="iris"
|
||||
type="required"
|
||||
versionRange="[1.8.12-snapshot+mc1.21.1-local]"
|
||||
versionRange="[1.8.12-snapshot+mc1.21.1-local,)"
|
||||
ordering="AFTER"
|
||||
side="CLIENT"
|
||||
|
|
|
|||
14
client/src/main/resources/client.jemi.mixins.json
Normal file
14
client/src/main/resources/client.jemi.mixins.json
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8.7",
|
||||
"package": "dev.quorate.client.mixin",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"plugin": "dev.quorate.client.mixin.EmiPlugin",
|
||||
"client": [
|
||||
"EmiSlotMixin",
|
||||
"EmiTextMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package dev.quorate.client.mixin;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
final class ModRangesTest {
|
||||
@Test
|
||||
void jemiGateMatchesTheBrokenPairOnly() {
|
||||
assertTrue(
|
||||
ModRanges.contains(
|
||||
new DefaultArtifactVersion("1.1.24+1.21.1+neoforge"), EmiPlugin.EMI));
|
||||
assertFalse(
|
||||
ModRanges.contains(
|
||||
new DefaultArtifactVersion("1.1.23+1.21.1+neoforge"), EmiPlugin.EMI));
|
||||
assertFalse(
|
||||
ModRanges.contains(
|
||||
new DefaultArtifactVersion("1.1.25+1.21.1+neoforge"), EmiPlugin.EMI));
|
||||
assertTrue(ModRanges.contains(new DefaultArtifactVersion("19.57.0.450"), EmiPlugin.JEI));
|
||||
assertTrue(ModRanges.contains(new DefaultArtifactVersion("19.57.0.451"), EmiPlugin.JEI));
|
||||
assertFalse(ModRanges.contains(new DefaultArtifactVersion("19.56.0.1"), EmiPlugin.JEI));
|
||||
assertFalse(ModRanges.contains(new DefaultArtifactVersion("19.58"), EmiPlugin.JEI));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue