Skip to content

Commit

Permalink
Hacky fix for EpicFight
Browse files Browse the repository at this point in the history
Fixes #114 #62 #309
  • Loading branch information
Asek3 committed Sep 5, 2023
1 parent 063f75c commit 9a0790f
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 2 deletions.
11 changes: 10 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ loom {
"mixins.oculus.fixes.maxfpscrash.json",
"mixins.oculus.optimized-stitching.json",
"oculus-batched-entity-rendering.mixins.json",
"mixins.oculus.compat.sodium.json"
"mixins.oculus.compat.sodium.json",
"mixins.oculus.compat.json"
]
}
}
Expand All @@ -29,6 +30,13 @@ group = project.maven_group

repositories {
mavenLocal()
maven {
name = "CurseForge"
url = "https://cursemaven.com"
content {
includeGroup "curse.maven"
}
}
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
Expand All @@ -50,6 +58,7 @@ dependencies {
compileOnly "org.apache.ant:ant:1.8.2"
//modCompileOnly "maven.modrinth:rubidium:0.2.12"
modCompileOnly "me.jellysquid.mods:Rubidium:0.2.13"
modCompileOnly "curse.maven:epic-fight-mod-405076:4029362"

implementation fileTree(include: ['*.jar'], dir: 'libs')
toJar fileTree(include: ['antlr4-runtime-4.10.1.jar', 'glsl-transformer-1.0.0-pre21.2.jar'], dir: 'libs')
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/coderbot/iris/config/IrisConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
public class IrisConfig {
private static final String COMMENT =
"This file stores configuration options for Iris, such as the currently active shaderpack";
"This file stores configuration options for " + Iris.MODNAME + ", such as the currently active shaderpack";

/**
* The path to the current shaderpack. Null if the internal shaderpack is being used.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package net.coderbot.iris.mixin.compat;

import net.minecraftforge.fml.loading.FMLLoader;
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 class CompatMixinPlugin implements IMixinConfigPlugin {
@Override
public void onLoad(String mixinPackage) {

}

@Override
public String getRefMapperConfig() {
return null;
}

@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
int startIndex = mixinClassName.indexOf("compat.") + "compat.".length();
int endIndex = mixinClassName.indexOf(".", startIndex);
String modid = mixinClassName.substring(startIndex, endIndex);
return FMLLoader.getLoadingModList().getModFileById(modid) != null;
}

@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) {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package net.coderbot.iris.mixin.compat.epicfight;

import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import yesman.epicfight.client.renderer.EpicFightRenderTypes;

@Mixin(EpicFightRenderTypes.class)
public class MixinEpicFightRenderTypes {

@Shadow
private static RenderType enchantedAnimatedArmor() {
return null;
}

@Inject(method = "getArmorVertexBuilder", at = @At("HEAD"), cancellable = true)
private static void getArmorVertexBuilder(MultiBufferSource buffer, RenderType renderType, boolean withGlint, CallbackInfoReturnable<VertexConsumer> cir) {
if(withGlint)
cir.setReturnValue(buffer.getBuffer(enchantedAnimatedArmor()));
}

}
14 changes: 14 additions & 0 deletions src/main/resources/mixins.oculus.compat.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"required": true,
"minVersion": "0.8",
"package": "net.coderbot.iris.mixin.compat",
"plugin": "net.coderbot.iris.mixin.compat.CompatMixinPlugin",
"refmap": "oculus-refmap.json",
"compatibilityLevel": "JAVA_8",
"client": [
"epicfight.MixinEpicFightRenderTypes"
],
"injectors": {
"defaultRequire": 1
}
}

0 comments on commit 9a0790f

Please sign in to comment.