Skip to content

Commit

Permalink
Merge pull request #41 from unilock/1.19.2-new
Browse files Browse the repository at this point in the history
1.19.2: Fix compatibility with Fabric API 0.77.0
  • Loading branch information
Pyrofab authored Dec 31, 2023
2 parents 0b46760 + 4fe1033 commit 9abef0f
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 121 deletions.
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ org.gradle.jvmargs=-Xmx2G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.19
yarn_mappings=1.19+build.2
loader_version=0.14.7
minecraft_version=1.19.2
yarn_mappings=1.19.2+build.28
loader_version=0.14.25
#Fabric api
fabric_version=0.50.0+1.19
fabric_version=0.77.0+1.19.2

# Mod Properties
mod_version = 1.9.0
Expand All @@ -19,8 +19,8 @@ archives_base_name = satin
findbugs_version = 3.0.2
jb_annotations_version = 18.0.0
apiguardian_version = 1.0.0
modmenu_version = 4.0.0
iris_version = mc1.18.1-1.1.3
modmenu_version = 4.1.2
iris_version = 1.6.11+1.19.2

#Publishing
display_name = Satin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import ladysnake.satin.Satin;
import ladysnake.satin.api.managed.ManagedCoreShader;
import ladysnake.satin.api.managed.uniform.SamplerUniform;
import net.fabricmc.fabric.impl.client.rendering.FabricShader;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.Shader;
Expand Down Expand Up @@ -54,7 +55,8 @@ public ResettableManagedCoreShader(Identifier location, VertexFormat vertexForma

@Override
protected Shader parseShader(ResourceManager resourceManager, MinecraftClient mc, Identifier location) throws IOException {
return new Shader(resourceManager, this.getLocation().toString(), this.vertexFormat);
// Easiest way of getting modded shader locations to work
return new FabricShader(resourceManager, this.getLocation(), this.vertexFormat);
}

@Override
Expand Down
10 changes: 4 additions & 6 deletions src/main/java/ladysnake/satin/mixin/SatinMixinPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;

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

Expand All @@ -37,6 +36,9 @@ public final class SatinMixinPlugin implements IMixinConfigPlugin {
if (loader.isModLoaded("canvas")) {
LOGGER.warn("[Satin] Canvas is present, custom block renders will not work");
ALLOW_RENDER_LAYER_MIXINS = false;
} else if (loader.isModLoaded("iris")) {
LOGGER.warn("[Satin] Iris is present, custom block renders will not work");
ALLOW_RENDER_LAYER_MIXINS = false;
} else {
if (loader.isModLoaded("sodium")) {
LOGGER.warn("[Satin] Sodium is present, custom block renders may not work");
Expand Down Expand Up @@ -70,11 +72,7 @@ public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {

@Override
public List<String> getMixins() {
List<String> compatMixins = new ArrayList<>();
if (FabricLoader.getInstance().isModLoaded("iris")) {
compatMixins.add("iris.IrisRenderLayerWrapperMixin");
}
return compatMixins;
return List.of();
}

@Override
Expand Down
32 changes: 2 additions & 30 deletions src/main/java/ladysnake/satin/mixin/client/gl/CoreShaderMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,11 @@
package ladysnake.satin.mixin.client.gl;

import ladysnake.satin.impl.SamplerAccess;
import net.minecraft.client.gl.Program;
import net.minecraft.client.render.Shader;
import net.minecraft.client.render.VertexFormat;
import net.minecraft.resource.ResourceFactory;
import net.minecraft.resource.ResourceManager;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.gen.Accessor;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.Redirect;

import java.util.List;
import java.util.Map;
Expand All @@ -49,31 +41,11 @@ public abstract class CoreShaderMixin implements SamplerAccess {
return this.samplers.containsKey(name);
}

@Override
@Accessor("samplerNames")
public abstract List<String> satin$getSamplerNames();

@Override
@Accessor("loadedSamplerIds")
public abstract List<Integer> satin$getSamplerShaderLocs();

/**
* @see JsonEffectGlShaderMixin#constructProgramIdentifier(String, ResourceManager, String)
*/
@Redirect(method = "<init>", at = @At(value = "NEW", target = "net/minecraft/util/Identifier", ordinal = 0))
private Identifier fixId(String arg, ResourceFactory factory, String name, VertexFormat format) {
if (!name.contains(":")) {
return new Identifier(arg);
}
Identifier split = new Identifier(name);
return new Identifier(split.getNamespace(), "shaders/core/" + split.getPath() + ".json");
}

@ModifyVariable(method = "loadProgram", at = @At("STORE"), ordinal = 1)
private static String fixPath(String path, final ResourceFactory factory, Program.Type type, String name) {
if (!name.contains(":")) {
return path;
}
Identifier split = new Identifier(name);
return split.getNamespace() + ":shaders/core/" + split.getPath() + type.getFileExtension();
}

}

This file was deleted.

27 changes: 0 additions & 27 deletions src/main/java/ladysnake/satin/mixin/client/iris/package-info.java

This file was deleted.

5 changes: 2 additions & 3 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@
],
"accessWidener": "satin.accesswidener",
"depends": {
"fabricloader": ">=0.11.3",
"fabricloader": "*",
"fabric-api-base": "*",
"fabric-resource-loader-v0": "*",
"minecraft": ">=1.18-",
"java": ">=16"
"minecraft": ">=1.19.2"
},
"conflicts": {
"optifabric": "*"
Expand Down

0 comments on commit 9abef0f

Please sign in to comment.