Skip to content

Commit

Permalink
Backport to 1.18.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dima-dencep committed Nov 27, 2023
1 parent f2c4c70 commit 3051fe2
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 28 deletions.
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ loom.platform=forge

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.19.2
yarn_mappings=1.19.2+build.28
loader_version=1.19.2-43.3.0
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.4
loader_version=1.18.2-40.2.0

# Mod Properties
mod_version=3.1.1
maven_group=com.github.dima_dencep.mods
archives_base_name=blur-forge

# Dependencies
satin_version=1.19.2+1.12.3
satin_version=1.7.3+1.18.2
13 changes: 3 additions & 10 deletions src/main/java/com/tterrag/blur/Blur.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.util.Identifier;
import net.minecraftforge.client.event.ScreenEvent;
import net.minecraftforge.client.event.ScreenOpenEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod;

Expand All @@ -21,7 +22,6 @@ public class Blur {
public static final MinecraftClient client = MinecraftClient.getInstance();
public static long start;
public static String prevScreen;
public static String oldScreen;
public static boolean screenHasBackground;

private static final ManagedShaderEffect blur = ShaderEffectManager.getInstance().manage(new Identifier(MODID, "shaders/post/fade_in_blur.json"),
Expand All @@ -38,15 +38,8 @@ public Blur() {
}
});

MinecraftForge.EVENT_BUS.<ScreenEvent.BackgroundRendered>addListener(event -> Blur.screenHasBackground = true);
MinecraftForge.EVENT_BUS.<ScreenEvent.Opening>addListener(event -> {
if (event.getCurrentScreen() != null) {
oldScreen = event.getCurrentScreen().getClass().getName();
}

Blur.onScreenChange(event.getNewScreen());
});
MinecraftForge.EVENT_BUS.<ScreenEvent.Closing>addListener(event -> Blur.onScreenChange(BlurConfig.INSTANCE.strangeEffect.get() ? null : Objects.equals(oldScreen, event.getScreen().getClass().getName()) ? event.getScreen() : null));
MinecraftForge.EVENT_BUS.<ScreenEvent.BackgroundDrawnEvent>addListener(event -> Blur.screenHasBackground = true);
MinecraftForge.EVENT_BUS.<ScreenOpenEvent>addListener(event -> Blur.onScreenChange(event.getScreen()));
}

private static boolean doFade = false;
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/com/tterrag/blur/config/BlurConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public class BlurConfig {
public final ForgeConfigSpec.ConfigValue<String> gradientEnd;
public final ForgeConfigSpec.IntValue gradientEndAlpha;
public final ForgeConfigSpec.BooleanValue showScreenTitle;
public final ForgeConfigSpec.BooleanValue strangeEffect;

public BlurConfig(ForgeConfigSpec.Builder builder) {
builder
Expand All @@ -51,10 +50,6 @@ public BlurConfig(ForgeConfigSpec.Builder builder) {
.translation("blur.midnightconfig.showScreenTitle")
.define("showScreenTitle", false);

strangeEffect = builder
.translation("blur.midnightconfig.strangeEffect")
.define("strangeEffect", false);

builder.pop();


Expand Down
9 changes: 4 additions & 5 deletions src/main/java/com/tterrag/blur/mixin/MixinInGameHud.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@
import com.tterrag.blur.config.BlurConfig;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.hud.InGameHud;
import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraftforge.client.gui.overlay.ForgeGui;
import net.minecraftforge.client.gui.ForgeIngameGui;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(ForgeGui.class)
@Mixin(ForgeIngameGui.class)
public abstract class MixinInGameHud extends InGameHud {
public MixinInGameHud(MinecraftClient client, ItemRenderer itemRenderer) {
super(client, itemRenderer);
public MixinInGameHud(MinecraftClient client) {
super(client);
}

@Inject(at = @At("TAIL"), method = "render")
Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/assets/blur/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
"blur.midnightconfig.gradientEnd": "Gradient End Color",
"blur.midnightconfig.gradientStartAlpha": "Gradient Start Alpha",
"blur.midnightconfig.gradientEndAlpha": "Gradient End Alpha",
"blur.midnightconfig.showScreenTitle": "Log screen title",
"blur.midnightconfig.strangeEffect": "Strange effect..."
"blur.midnightconfig.showScreenTitle": "Log screen title"
}
3 changes: 1 addition & 2 deletions src/main/resources/assets/blur/lang/ru_ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
"blur.midnightconfig.gradientEnd": "Нижний цвет градиента",
"blur.midnightconfig.gradientStartAlpha": "Альфа верхнего градиента",
"blur.midnightconfig.gradientEndAlpha": "Альфа нижнего градиента",
"blur.midnightconfig.showScreenTitle": "Отображение название экрана",
"blur.midnightconfig.strangeEffect": "Странный эффект..."
"blur.midnightconfig.showScreenTitle": "Отображение название экрана"
}

0 comments on commit 3051fe2

Please sign in to comment.