Skip to content

Commit

Permalink
Update PostEffectRegistry.java
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexModGuy committed Mar 23, 2023
1 parent a0dca51 commit 6299ad7
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public class PostEffectRegistry {
private static Map<ResourceLocation, PostEffect> postEffects = new HashMap<>();

public static void clear(){
registry.clear();
for(PostEffect postEffect : postEffects.values()){
postEffect.close();
}
Expand All @@ -34,10 +33,7 @@ public static void registerEffect(ResourceLocation resourceLocation){
}

public static void onInitializeOutline(){
for(PostEffect postEffect : postEffects.values()){
postEffect.close();
}
postEffects.clear();
clear();
Minecraft minecraft = Minecraft.getInstance();
for(ResourceLocation resourceLocation : registry){
PostChain postChain;
Expand Down Expand Up @@ -91,6 +87,7 @@ public static void blitEffects() {
postEffect.getRenderTarget().blitToScreen(Minecraft.getInstance().getWindow().getWidth(), Minecraft.getInstance().getWindow().getHeight(), false);
postEffect.setEnabled(false);
postEffect.getRenderTarget().clear(Minecraft.ON_OSX);
Minecraft.getInstance().getMainRenderTarget().bindWrite(false);
}
}
RenderSystem.disableBlend();
Expand All @@ -101,7 +98,7 @@ public static void copyDepth(RenderTarget mainTarget) {
for(PostEffect postEffect : postEffects.values()) {
if (postEffect.getPostChain() != null && postEffect.isEnabled()) {
postEffect.getRenderTarget().clear(Minecraft.ON_OSX);
mainTarget.bindWrite(false);
postEffect.getRenderTarget().copyDepthFrom(mainTarget);
}
}
}
Expand All @@ -110,6 +107,7 @@ public static void processEffects(RenderTarget mainTarget, float f) {
for(PostEffect postEffect : postEffects.values()) {
if (postEffect.isEnabled() && postEffect.postChain != null) {
postEffect.postChain.process(Minecraft.getInstance().getFrameTime());
mainTarget.bindWrite(false);
}
}
}
Expand Down

0 comments on commit 6299ad7

Please sign in to comment.