Skip to content

Commit

Permalink
small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
kotmatross28729 committed Feb 20, 2024
1 parent 70beaa0 commit 9b9a20f
Show file tree
Hide file tree
Showing 36 changed files with 213 additions and 213 deletions.
13 changes: 0 additions & 13 deletions .github/workflows/build-and-test.yml

This file was deleted.

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ catch (Exception ignored) {
'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' +
'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)'
)
versionOverride = '1.0.0'
versionOverride = '1.1'
identifiedVersion = versionOverride
}
version = identifiedVersion
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
modName = Fixer
modName = Shaders Fixer

# This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId = fixer
modId = shadersfixer

modGroup = com.kotmatross.fixer
modGroup = com.kotmatross.shadersfixer

# WHY is there no version field?
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
Expand Down Expand Up @@ -44,7 +44,7 @@ apiPackage =
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# There can be multiple files in a space-separated list.
# Example value: mymodid_at.cfg nei_at.cfg
accessTransformersFile = fixer_at.cfg
accessTransformersFile = shadersfixer_at.cfg

# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = true
Expand Down
11 changes: 0 additions & 11 deletions src/main/java/com/kotmatross/fixer/Tags.java

This file was deleted.

111 changes: 0 additions & 111 deletions src/main/java/com/kotmatross/fixer/asm/OptimizedMixinPlugin.java

This file was deleted.

4 changes: 0 additions & 4 deletions src/main/java/com/kotmatross/fixer/proxy/CommonProxy.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.kotmatross.fixer;
package com.kotmatross.shadersfixer;

import net.minecraftforge.common.config.Configuration;

import cpw.mods.fml.common.*;
import com.kotmatross.shadersfixer.proxy.CommonProxy;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import com.kotmatross.fixer.proxy.CommonProxy;
import net.minecraftforge.common.config.Configuration;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand All @@ -17,10 +17,10 @@
dependencies =
"required-after:gtnhmixins@[2.0.0,);" +
"required-after:fiskheroes@[2.3.1,);")
public class Fixer {
public class ShadersFixer {

@Mod.Instance(Tags.MODID)
public static Fixer instance;
public static ShadersFixer instance;
@SidedProxy(clientSide = Tags.CLIENTPROXY, serverSide = Tags.SERVERPROXY)
public static CommonProxy proxy;
public static Configuration config;
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/com/kotmatross/shadersfixer/Tags.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.kotmatross.shadersfixer;

public class Tags {

public static final String MODID = "shadersfixer";
public static final String MODNAME = "Shaders Fixer";
public static final String VERSION = "1.1";
public static final String MCVERSION = "1.7.10";
public static final String CLIENTPROXY = "com.kotmatross.shadersfixer.proxy.ClientProxy";
public static final String SERVERPROXY = "com.kotmatross.shadersfixer.proxy.CommonProxy";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package com.kotmatross.shadersfixer.asm;

import com.kotmatross.shadersfixer.ShadersFixer;
import com.kotmatross.shadersfixer.Tags;
import com.kotmatross.shadersfixer.config.ShaderFixerConfig;
import net.minecraft.launchwrapper.Launch;
import org.spongepowered.asm.lib.tree.ClassNode;
import org.spongepowered.asm.mixin.MixinEnvironment;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

public class OptimizedMixinPlugin implements IMixinConfigPlugin {

public static final MixinEnvironment.Side side = MixinEnvironment.getCurrentEnvironment().getSide();
@Override
public void onLoad(String mixinPackage) {
}

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

@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
return true;
}

@Override
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {
}

@Override
public List<String> getMixins() {
List<String> mixins = new ArrayList<>();

String configFolder = "config" + File.separator + Tags.MODID + File.separator;
ShaderFixerConfig.loadMixinConfig(new File(Launch.minecraftHome, configFolder + "mixins.cfg"));

if (side == MixinEnvironment.Side.CLIENT) {
ShadersFixer.logger.info("Integrating Shader-fixer client mixins...");
try {
if(ShaderFixerConfig.FixFisksuperheroesShaders) {
//FISK HEROES MIXINS START
ShadersFixer.logger.info("Trying to integrate fiskheroes mixins");
mixins.add("client.FiskHeroes.client.pack.json.beam.MixinBeamRendererLightning");
mixins.add("client.FiskHeroes.client.pack.json.beam.MixinBeamRendererLine");
mixins.add("client.FiskHeroes.client.pack.json.shape.MixinShapeFormatCircles");
mixins.add("client.FiskHeroes.client.pack.json.shape.MixinShapeFormatLines");
mixins.add("client.FiskHeroes.client.pack.json.shape.MixinShapeFormatWireframe");
mixins.add("client.FiskHeroes.client.particle.MixinEntitySHSpellWaveFX");
mixins.add("client.FiskHeroes.client.render.effect.MixinEffectTentacles");
mixins.add("client.FiskHeroes.client.render.entity.effect.MixinRenderEarthCrack");
mixins.add("client.FiskHeroes.client.render.entity.effect.MixinRenderGravityWave");
mixins.add("client.FiskHeroes.client.render.entity.projectile.MixinRenderEnergyBolt");
mixins.add("client.FiskHeroes.client.render.entity.projectile.MixinRenderGrapplingHook");
mixins.add("client.FiskHeroes.client.render.entity.projectile.MixinRenderSonicWave");
mixins.add("client.FiskHeroes.client.render.entity.projectile.MixinRenderSpellWhip");
mixins.add("client.FiskHeroes.client.render.entity.MixinRenderGrappleRope");
mixins.add("client.FiskHeroes.client.render.projectile.MixinBulletProjectileRenderer");
mixins.add("client.FiskHeroes.client.render.projectile.MixinProjectileRenderHandler");
mixins.add("client.FiskHeroes.client.render.tile.MixinRenderSuitFabricator");
mixins.add("client.FiskHeroes.client.MixinSHRenderHooks");
//FISK HEROES MIXINS END
}
} catch (Exception e) {
ShadersFixer.logger.error("Error loading mixins: " + e.getMessage());
e.printStackTrace();
}
}

return mixins;
}

@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,26 @@
package com.kotmatross.shadersfixer.config;

import java.io.File;

import net.minecraftforge.common.config.Configuration;

public class ShaderFixerConfig {
// Definitely does NOT look like a BugTorch config

//Base things
public static boolean FixFisksuperheroesShaders;

//Category
static final String categoryShadersfixes = "Shaders fixes";

public static void loadMixinConfig(File configFile) {
Configuration config = new Configuration(configFile);

FixFisksuperheroesShaders = config.getBoolean("FixFisksuperheroesShaders", categoryShadersfixes, true, "Fixes rendering errors in Fisk's Superheroes mod when using shaders.");

if(config.hasChanged()) {
config.save();
}
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kotmatross.fixer.mixins.client.FiskHeroes;
package com.kotmatross.shadersfixer.mixins.client.FiskHeroes.client;

import com.fiskmods.heroes.client.SHRenderHooks;
import com.fiskmods.heroes.common.config.SHConfig;
Expand All @@ -14,8 +14,7 @@
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;

import static com.fiskmods.heroes.client.SHRenderHooks.drawUntexturedRect;
import static com.kotmatross.fixer.utils.shaders_fix;
import static com.kotmatross.shadersfixer.utils.shaders_fix;

@Mixin(value = SHRenderHooks.class, priority = 999)
public class MixinSHRenderHooks {
Expand Down Expand Up @@ -174,7 +173,7 @@ public static void drawLoadingSquares(float x, float y, float width, float heigh
f *= 4.0F;

for(int i = 0; i < 2; f = (f + 2.0F) % 4.0F) {
drawUntexturedRect(x1 - (w + s) / 2.0F + s * FiskMath.curve(Math.min(f, 1.0F) - MathHelper.clamp_float(f - 2.0F, 0.0F, 1.0F)), y1 - (w + s) / 2.0F + s * FiskMath.curve(MathHelper.clamp_float(f - 1.0F, 0.0F, 1.0F) - MathHelper.clamp_float(f - 3.0F, 0.0F, 1.0F)), w, w, zLevel, -1);
SHRenderHooks.drawUntexturedRect(x1 - (w + s) / 2.0F + s * FiskMath.curve(Math.min(f, 1.0F) - MathHelper.clamp_float(f - 2.0F, 0.0F, 1.0F)), y1 - (w + s) / 2.0F + s * FiskMath.curve(MathHelper.clamp_float(f - 1.0F, 0.0F, 1.0F) - MathHelper.clamp_float(f - 3.0F, 0.0F, 1.0F)), w, w, zLevel, -1);
++i;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kotmatross.fixer.mixins.client.FiskHeroes;
package com.kotmatross.shadersfixer.mixins.client.FiskHeroes.client.pack.json.beam;

import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
Expand All @@ -9,7 +9,7 @@
import org.spongepowered.asm.mixin.injection.Slice;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import static com.kotmatross.fixer.utils.shaders_fix;
import static com.kotmatross.shadersfixer.utils.shaders_fix;

@Mixin(value = com.fiskmods.heroes.client.pack.json.beam.BeamRendererLightning.class, priority = 999)
public abstract class MixinBeamRendererLightning implements com.fiskmods.heroes.client.pack.json.beam.IBeamRenderer {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kotmatross.fixer.mixins.client.FiskHeroes;
package com.kotmatross.shadersfixer.mixins.client.FiskHeroes.client.pack.json.beam;

import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
Expand All @@ -9,7 +9,7 @@
import org.spongepowered.asm.mixin.injection.Slice;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import static com.kotmatross.fixer.utils.shaders_fix;
import static com.kotmatross.shadersfixer.utils.shaders_fix;

@Mixin(value = com.fiskmods.heroes.client.pack.json.beam.BeamRendererLine.class, priority = 999)
public abstract class MixinBeamRendererLine implements com.fiskmods.heroes.client.pack.json.beam.IBeamRenderer {
Expand Down
Loading

0 comments on commit 9b9a20f

Please sign in to comment.