Skip to content

Commit

Permalink
Fixed serverside breaking
Browse files Browse the repository at this point in the history
  • Loading branch information
LudoCrypt committed Dec 29, 2022
1 parent c6477b9 commit 3896a31
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 13 deletions.
2 changes: 1 addition & 1 deletion limlib_effects/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ org.gradle.jvmargs = -Xmx1G
org.gradle.parallel = false
org.gradle.workers.max = 1

version=7.2.1
version=7.2.2
maven_group=net.ludocrypt
archives_base_name=limlib-effects
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class GameRendererMixin {
PostEffect postEffect = optionalPostEffect.get();
if (postEffect.shouldRender() && postEffect.getShaderLocation() != null && postEffect.getMemoizedShaderEffect().get() != null) {
postEffect.beforeRender();
postEffect.getMemoizedShaderEffect().get().render(tickDelta);
postEffect.getMemoizedShaderEffect().get().getShader().render(tickDelta);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;

import ladysnake.satin.api.managed.ManagedShaderEffect;
import net.ludocrypt.limlib.effects.render.post.holder.ShaderHolder;

public class EmptyPostEffect extends StaticPostEffect {

Expand All @@ -25,7 +25,7 @@ public boolean shouldRender() {
}

@Override
public Supplier<ManagedShaderEffect> getMemoizedShaderEffect() {
public Supplier<ShaderHolder> getMemoizedShaderEffect() {
return () -> null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
import com.google.common.base.Supplier;
import com.mojang.serialization.Codec;

import ladysnake.satin.api.managed.ManagedShaderEffect;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.event.registry.FabricRegistryBuilder;
import net.fabricmc.fabric.api.event.registry.RegistryAttribute;
import net.ludocrypt.limlib.effects.mixin.BuiltinRegistriesAccessor;
import net.ludocrypt.limlib.effects.mixin.RegistryAccessor;
import net.ludocrypt.limlib.effects.render.post.holder.ShaderHolder;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry;
Expand All @@ -36,5 +36,5 @@ public abstract class PostEffect {
public abstract Identifier getShaderLocation();

@Environment(EnvType.CLIENT)
public abstract Supplier<ManagedShaderEffect> getMemoizedShaderEffect();
public abstract Supplier<ShaderHolder> getMemoizedShaderEffect();
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;

import ladysnake.satin.api.managed.ManagedShaderEffect;
import ladysnake.satin.api.managed.ShaderEffectManager;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.ludocrypt.limlib.effects.render.post.holder.ShaderHolder;
import net.minecraft.util.Identifier;

public class StaticPostEffect extends PostEffect {
Expand All @@ -22,7 +21,7 @@ public class StaticPostEffect extends PostEffect {
private final Identifier shaderName;

@Environment(EnvType.CLIENT)
private final Supplier<ManagedShaderEffect> memoizedShaderEffect = Suppliers.memoize(() -> ShaderEffectManager.getInstance().manage(this.getShaderLocation()));
private final Supplier<ShaderHolder> memoizedShaderEffect = Suppliers.memoize(() -> new ShaderHolder(this.getShaderLocation()));

public StaticPostEffect(Identifier shaderLocation) {
this.shaderName = shaderLocation;
Expand Down Expand Up @@ -50,7 +49,7 @@ public Identifier getShaderLocation() {

@Override
@Environment(EnvType.CLIENT)
public Supplier<ManagedShaderEffect> getMemoizedShaderEffect() {
public Supplier<ShaderHolder> getMemoizedShaderEffect() {
return memoizedShaderEffect;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package net.ludocrypt.limlib.effects.render.post.holder;

import ladysnake.satin.api.managed.ManagedShaderEffect;
import ladysnake.satin.api.managed.ShaderEffectManager;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.util.Identifier;

public class ShaderHolder {

@Environment(EnvType.CLIENT)
private final ManagedShaderEffect shaderEffect;

@Environment(EnvType.CLIENT)
public ShaderHolder(Identifier id) {
shaderEffect = ShaderEffectManager.getInstance().manage(id);
}

@Environment(EnvType.CLIENT)
public ManagedShaderEffect getShader() {
return shaderEffect;
}

}
2 changes: 1 addition & 1 deletion limlib_registry/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ org.gradle.jvmargs = -Xmx1G
org.gradle.parallel = false
org.gradle.workers.max = 1

version=7.2.1
version=7.2.2
maven_group=net.ludocrypt
archives_base_name=limlib-registry
2 changes: 1 addition & 1 deletion limlib_render/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ org.gradle.jvmargs = -Xmx1G
org.gradle.parallel = false
org.gradle.workers.max = 1

version=7.2.1
version=7.2.2
maven_group=net.ludocrypt
archives_base_name=limlib-render
2 changes: 1 addition & 1 deletion limlib_world/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ org.gradle.jvmargs = -Xmx1G
org.gradle.parallel = false
org.gradle.workers.max = 1

version=7.2.1
version=7.2.2
maven_group=net.ludocrypt
archives_base_name=limlib-world

0 comments on commit 3896a31

Please sign in to comment.