From a33f8a09ddcc5e32ac1a2450a64eb964569ca4aa Mon Sep 17 00:00:00 2001 From: MrSphay Date: Thu, 7 May 2026 00:06:32 +0200 Subject: [PATCH] Stub intro and config client screens --- .../client/BackgroundParticle.java | 91 +----- .../client/IntroMusicManager.java | 119 +------- .../client/IntroSplashScreen.java | 137 +-------- .../client/LowPassConcussionEffect.java | 287 ++---------------- .../client/ModConfigScreen.java | 249 +-------------- .../client/SpriteSheetAnimator.java | 122 +------- .../client/VinlanxSplashScreen.java | 139 +-------- 7 files changed, 51 insertions(+), 1093 deletions(-) diff --git a/src/main/java/com/vinlanx/explosionoverhaul/client/BackgroundParticle.java b/src/main/java/com/vinlanx/explosionoverhaul/client/BackgroundParticle.java index 3764116..c4de321 100644 --- a/src/main/java/com/vinlanx/explosionoverhaul/client/BackgroundParticle.java +++ b/src/main/java/com/vinlanx/explosionoverhaul/client/BackgroundParticle.java @@ -1,111 +1,44 @@ -/* - * Decompiled with CFR 0.152. - */ package com.vinlanx.explosionoverhaul.client; -import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; public class BackgroundParticle { public float x; public float y; - public float vx; - public float vy; public float size; - public float life; - public float maxLife; public int color; - public ParticleType type; - - public BackgroundParticle(float x, float y, float vx, float vy, float size, float life, int color, ParticleType type) { - this.x = x; - this.y = y; - this.vx = vx; - this.vy = vy; - this.size = size; - this.life = life; - this.maxLife = life; - this.color = color; - this.type = type; - } public void tick(float deltaTime) { - this.x += this.vx * deltaTime * 60.0f; - this.y += this.vy * deltaTime * 60.0f; - this.life -= deltaTime; - if (this.type == ParticleType.EMBER) { - this.vy += 0.5f * deltaTime * 60.0f; - } - if (this.type == ParticleType.SMOKE) { - this.size += 0.3f * deltaTime * 60.0f; - } } public boolean isDead() { - return this.life <= 0.0f; + return true; } public float getAlpha() { - float lifeRatio = this.life / this.maxLife; - if (this.type == ParticleType.FLASH) { - return lifeRatio > 0.7f ? 1.0f - (lifeRatio - 0.7f) / 0.3f : lifeRatio / 0.7f; - } - return Mth.m_14036_((float)lifeRatio, (float)0.0f, (float)1.0f); + return 0.0f; } public static BackgroundParticle createSpark(RandomSource random, int screenWidth, int screenHeight) { - float x = random.m_188501_() * (float)screenWidth; - float y = random.m_188501_() * (float)screenHeight; - float angle = random.m_188501_() * (float)Math.PI * 2.0f; - float speed = 2.0f + random.m_188501_() * 4.0f; - float vx = (float)Math.cos(angle) * speed; - float vy = (float)Math.sin(angle) * speed; - float size = 1.0f + random.m_188501_() * 2.0f; - float life = 0.5f + random.m_188501_() * 1.5f; - int[] colors = new int[]{-881908, -21965, -8841, -86}; - int color = colors[random.m_188503_(colors.length)]; - return new BackgroundParticle(x, y, vx, vy, size, life, color, ParticleType.SPARK); + return new BackgroundParticle(); } public static BackgroundParticle createEmber(RandomSource random, int screenWidth, int screenHeight) { - float x = random.m_188501_() * (float)screenWidth; - float y = -20.0f; - float vx = (random.m_188501_() - 0.5f) * 2.0f; - float vy = 1.0f + random.m_188501_() * 2.0f; - float size = 2.0f + random.m_188501_() * 4.0f; - float life = 3.0f + random.m_188501_() * 4.0f; - int[] colors = new int[]{-4250588, -2529701, -10939115, -48094}; - int color = colors[random.m_188503_(colors.length)]; - return new BackgroundParticle(x, y, vx, vy, size, life, color, ParticleType.EMBER); - } - - public static BackgroundParticle createFlash(RandomSource random, int screenWidth, int screenHeight) { - float x = random.m_188501_() * (float)screenWidth; - float y = random.m_188501_() * (float)screenHeight; - float size = 30.0f + random.m_188501_() * 70.0f; - float life = 0.2f + random.m_188501_() * 0.4f; - int[] colors = new int[]{-881908, -4250588, -21948}; - int color = colors[random.m_188503_(colors.length)]; - return new BackgroundParticle(x, y, 0.0f, 0.0f, size, life, color, ParticleType.FLASH); + return new BackgroundParticle(); } public static BackgroundParticle createSmoke(RandomSource random, int screenWidth, int screenHeight) { - float x = random.m_188501_() * (float)screenWidth; - float y = (float)screenHeight + 20.0f; - float vx = (random.m_188501_() - 0.5f) * 1.0f; - float vy = -1.0f - random.m_188501_() * 2.0f; - float size = 15.0f + random.m_188501_() * 30.0f; - float life = 4.0f + random.m_188501_() * 6.0f; - int gray = 13 + random.m_188503_(30); - int color = 0xFF000000 | gray << 16 | gray << 8 | gray; - return new BackgroundParticle(x, y, vx, vy, size, life, color, ParticleType.SMOKE); + return new BackgroundParticle(); } - public static enum ParticleType { + public static BackgroundParticle createFlash(RandomSource random, int screenWidth, int screenHeight) { + return new BackgroundParticle(); + } + + public enum ParticleType { SPARK, EMBER, - FLASH, - SMOKE; - + SMOKE, + FLASH } } diff --git a/src/main/java/com/vinlanx/explosionoverhaul/client/IntroMusicManager.java b/src/main/java/com/vinlanx/explosionoverhaul/client/IntroMusicManager.java index 27f3350..f8ace37 100644 --- a/src/main/java/com/vinlanx/explosionoverhaul/client/IntroMusicManager.java +++ b/src/main/java/com/vinlanx/explosionoverhaul/client/IntroMusicManager.java @@ -1,139 +1,32 @@ -/* - * Decompiled with CFR 0.152. - */ package com.vinlanx.explosionoverhaul.client; -import com.vinlanx.explosionoverhaul.ExplosionOverhaul; -import com.vinlanx.explosionoverhaul.ModSounds; -import com.vinlanx.explosionoverhaul.client.FadingMusicInstance; -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.sounds.SimpleSoundInstance; -import net.minecraft.client.resources.sounds.SoundInstance; -import net.minecraft.client.sounds.SoundManager; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.sounds.SoundSource; - public class IntroMusicManager { - private static IntroMusicManager INSTANCE; - private static final float FADE_OUT_DURATION = 3.0f; - private FadingMusicInstance musicInstance; - private SimpleSoundInstance boomInstance; - private boolean isPlaying = false; - private boolean isFadingOut = false; - private boolean vanillaMusicBlocked = false; - - private IntroMusicManager() { - } + private static final IntroMusicManager INSTANCE = new IntroMusicManager(); public static IntroMusicManager getInstance() { - if (INSTANCE == null) { - INSTANCE = new IntroMusicManager(); - } return INSTANCE; } public void start() { - if (this.isPlaying) { - return; - } - SoundManager soundManager = Minecraft.getInstance().m_91106_(); - this.musicInstance = new FadingMusicInstance((SoundEvent)ModSounds.INTRO_MUSIC.get(), 0.25f, SoundSource.MASTER); - soundManager.m_120367_((SoundInstance)this.musicInstance); - ExplosionOverhaul.LOGGER.info("Started intro music with FadingMusicInstance"); - this.boomInstance = SimpleSoundInstance.m_119755_((SoundEvent)((SoundEvent)ModSounds.INTRO_BOOM.get()), (float)1.0f, (float)1.0f); - soundManager.m_120367_((SoundInstance)this.boomInstance); - this.isPlaying = true; - this.vanillaMusicBlocked = true; - this.stopVanillaMusic(); } public void startFadeOut() { - ExplosionOverhaul.LOGGER.info("startFadeOut called. isPlaying={}, isFadingOut={}", (Object)this.isPlaying, (Object)this.isFadingOut); - if (!this.isPlaying || this.isFadingOut) { - ExplosionOverhaul.LOGGER.warn("Cannot start fade out - already fading or not playing"); - return; - } - if (this.musicInstance != null) { - this.musicInstance.fadeOutAndStop(3.0f); - ExplosionOverhaul.LOGGER.info("Started smooth fade out over {} seconds", (Object)Float.valueOf(3.0f)); - } - this.isFadingOut = true; - } - - public void stopBoomSound() { - if (this.boomInstance != null) { - try { - SoundManager soundManager = Minecraft.getInstance().m_91106_(); - soundManager.m_120399_((SoundInstance)this.boomInstance); - this.boomInstance = null; - ExplosionOverhaul.LOGGER.info("Boom sound stopped."); - } - catch (Exception e) { - ExplosionOverhaul.LOGGER.warn("Failed to stop boom sound: {}", (Object)e.toString()); - } - } } public void stop() { - ExplosionOverhaul.LOGGER.info("stop() called! Stack trace:", (Throwable)new Exception("Music stop trace")); - SoundManager soundManager = Minecraft.getInstance().m_91106_(); - if (this.musicInstance != null) { - soundManager.m_120399_((SoundInstance)this.musicInstance); - this.musicInstance = null; - } - if (this.boomInstance != null) { - soundManager.m_120399_((SoundInstance)this.boomInstance); - this.boomInstance = null; - } - this.isPlaying = false; - this.isFadingOut = false; - this.vanillaMusicBlocked = false; - ExplosionOverhaul.LOGGER.info("Music stopped completely."); + } + + public void stopBoomSound() { } public void tick(float deltaTime) { - if (!this.isPlaying) { - return; - } - if (this.isFadingOut && this.musicInstance != null) { - if (this.musicInstance.hasFinishedFading()) { - ExplosionOverhaul.LOGGER.info("Music fade out complete!"); - this.stop(); - return; - } - float currentVolume = this.musicInstance.getCurrentVolume(); - if (currentVolume % 0.1f < 0.05f) { - ExplosionOverhaul.LOGGER.info("Fade out progress - volume: {}", (Object)Float.valueOf(currentVolume)); - } - } - if (this.vanillaMusicBlocked) { - this.stopVanillaMusic(); - } - } - - private void stopVanillaMusic() { - Minecraft mc = Minecraft.getInstance(); - if (mc.m_91397_() != null) { - mc.m_91397_().m_120186_(); - } } public boolean isPlaying() { - return this.isPlaying; + return false; } public boolean isFadingOut() { - return this.isFadingOut; - } - - public boolean isVanillaMusicBlocked() { - return this.vanillaMusicBlocked; - } - - public float getFadeProgress() { - if (!this.isFadingOut || this.musicInstance == null) { - return 0.0f; - } - return 1.0f - this.musicInstance.getCurrentVolume(); + return false; } } diff --git a/src/main/java/com/vinlanx/explosionoverhaul/client/IntroSplashScreen.java b/src/main/java/com/vinlanx/explosionoverhaul/client/IntroSplashScreen.java index 76f9954..c9ba1a9 100644 --- a/src/main/java/com/vinlanx/explosionoverhaul/client/IntroSplashScreen.java +++ b/src/main/java/com/vinlanx/explosionoverhaul/client/IntroSplashScreen.java @@ -1,143 +1,16 @@ -/* - * Decompiled with CFR 0.152. - */ package com.vinlanx.explosionoverhaul.client; -import com.mojang.blaze3d.systems.RenderSystem; -import com.vinlanx.explosionoverhaul.client.IntroMusicManager; -import com.vinlanx.explosionoverhaul.client.SpriteSheetAnimator; -import com.vinlanx.explosionoverhaul.client.VinlanxSplashScreen; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.gui.screens.TitleScreen; -import net.minecraft.client.renderer.GameRenderer; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; - -public class IntroSplashScreen -extends Screen { - private static final ResourceLocation SPRITE_SHEET = ResourceLocation.fromNamespaceAndPath((String)"explosionoverhaul", (String)"intro_gui/screen.png"); - private static final int FRAME_WIDTH = 1280; - private static final int FRAME_HEIGHT = 720; - private static final int COLUMNS = 14; - private static final int ROWS = 14; - private static final int TOTAL_FRAMES = 196; - private static final int FPS = 24; - private SpriteSheetAnimator animator; - private IntroMusicManager musicManager; - private long lastFrameTime = System.currentTimeMillis(); - private boolean animationFinished = false; +public class IntroSplashScreen extends Screen { public IntroSplashScreen() { - super((Component)Component.literal((String)"Intro")); + super(Component.empty()); } - protected void m_7856_() { - super.m_7856_(); - this.animator = new SpriteSheetAnimator(SPRITE_SHEET, 1280, 720, 14, 14, 196, 24); - this.animator.load(); - this.animator.play(); - this.musicManager = IntroMusicManager.getInstance(); - this.musicManager.start(); - } - - public void m_86600_() { - super.m_86600_(); - long currentTime = System.currentTimeMillis(); - float deltaTime = (float)(currentTime - this.lastFrameTime) / 1000.0f; - this.lastFrameTime = currentTime; - if (this.animator != null) { - this.animator.tick(deltaTime); - if (this.animator.getCurrentFrame() >= 195 && !this.animationFinished) { - this.animationFinished = true; - this.transitionToFirstTimeScreen(); - } - } - if (this.musicManager != null) { - this.musicManager.tick(deltaTime); - } - } - - public void m_88315_(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) { - int displayWidth; - int displayHeight; - graphics.fill(0, 0, this.f_96543_, this.f_96544_, -16777216); - if (this.animator == null) { - return; - } - ResourceLocation texture = this.animator.getTextureLocation(); - if (texture == null) { - return; - } - float screenAspectRatio = (float)this.f_96543_ / (float)this.f_96544_; - float targetAspectRatio = 1.7777778f; - if (screenAspectRatio > targetAspectRatio) { - displayHeight = this.f_96544_; - displayWidth = (int)((float)displayHeight * targetAspectRatio); - } else { - displayWidth = this.f_96543_; - displayHeight = (int)((float)displayWidth / targetAspectRatio); - } - int x = (this.f_96543_ - displayWidth) / 2; - int y = (this.f_96544_ - displayHeight) / 2; - RenderSystem.setShader(GameRenderer::m_172817_); - RenderSystem.setShaderTexture((int)0, (ResourceLocation)texture); - RenderSystem.setShaderColor((float)1.0f, (float)1.0f, (float)1.0f, (float)1.0f); - RenderSystem.enableBlend(); - RenderSystem.defaultBlendFunc(); - graphics.m_280411_(texture, x, y, displayWidth, displayHeight, 0.0f, 0.0f, 1280, 720, 1280, 720); - RenderSystem.disableBlend(); - } - - public boolean m_6913_() { - return true; - } - - public boolean m_7933_(int keyCode, int scanCode, int modifiers) { - if (keyCode == 256) { - this.skipToNext(); - return true; - } - return super.m_7933_(keyCode, scanCode, modifiers); - } - - public boolean m_6375_(double mouseX, double mouseY, int button) { - this.skipToNext(); - return true; - } - - public boolean m_7043_() { - return false; - } - - public void m_7861_() { - super.m_7861_(); - if (this.animator != null) { - this.animator.close(); - } - if (this.musicManager != null) { - this.musicManager.stopBoomSound(); - } - } - - private void skipToNext() { - this.animationFinished = true; - this.transitionToFirstTimeScreen(); - } - - private void transitionToFirstTimeScreen() { - Minecraft mc = Minecraft.getInstance(); - if (!(mc.screen instanceof TitleScreen)) { - mc.execute(() -> { - if (mc.screen instanceof TitleScreen) { - mc.m_91152_((Screen)new VinlanxSplashScreen()); - } else { - mc.m_91152_((Screen)new VinlanxSplashScreen()); - } - }); - return; - } - mc.m_91152_((Screen)new VinlanxSplashScreen()); + @Override + public void render(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) { + super.render(graphics, mouseX, mouseY, partialTick); } } diff --git a/src/main/java/com/vinlanx/explosionoverhaul/client/LowPassConcussionEffect.java b/src/main/java/com/vinlanx/explosionoverhaul/client/LowPassConcussionEffect.java index 327c685..51eba9a 100644 --- a/src/main/java/com/vinlanx/explosionoverhaul/client/LowPassConcussionEffect.java +++ b/src/main/java/com/vinlanx/explosionoverhaul/client/LowPassConcussionEffect.java @@ -1,311 +1,60 @@ -/* - * Decompiled with CFR 0.152. - */ package com.vinlanx.explosionoverhaul.client; -import com.vinlanx.explosionoverhaul.Config; -import com.vinlanx.explosionoverhaul.client.SoundEngineAudioQueue; -import com.vinlanx.explosionoverhaul.client.SoundPhysicsCompatibility; -import java.util.concurrent.atomic.AtomicBoolean; -import net.minecraft.ChatFormatting; -import net.minecraft.client.Minecraft; -import net.minecraft.network.chat.Component; -import net.neoforged.api.distmarker.Dist; -import net.neoforged.api.distmarker.OnlyIn; -import net.neoforged.neoforge.event.TickEvent; -import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.common.Mod; -import net.neoforged.fml.common.EventBusSubscriber; -import org.lwjgl.openal.AL10; -import org.lwjgl.openal.ALC10; -import org.lwjgl.openal.EXTEfx; - -@OnlyIn(value=Dist.CLIENT) -@EventBusSubscriber(modid="explosionoverhaul", value={Dist.CLIENT}) public class LowPassConcussionEffect { - private static final float HF_MIN = 0.01f; - private static final float HF_MAX = 1.0f; - private static final float GAIN_MIN = 0.1f; - private static final int FADE_IN_TICKS = 40; - private static final int FADE_OUT_TICKS = 100; - private static volatile Phase phase = Phase.IDLE; - private static volatile int holdTicks = 0; - private static volatile int ticksInPhase = 0; - private static final AtomicBoolean efxAvailable = new AtomicBoolean(false); - private static volatile int filterId = 0; - private static volatile float targetHfMin = 1.0f; - private static volatile float targetGainMin = 1.0f; - private static volatile float currentDeafnessGain = 1.0f; + public static boolean debugShowChat = false; public static volatile boolean enabled = true; - public static volatile boolean debugShowChat = false; - private static volatile boolean compatibilityMode = false; - private static volatile float lastAppliedHf = 1.0f; - private static volatile float lastAppliedGain = 1.0f; - public static void setDeafnessGain(float gain) { - currentDeafnessGain = Math.max(0.0f, Math.min(1.0f, gain)); - if (phase == Phase.IDLE && currentDeafnessGain < 0.99f && !compatibilityMode) { - SoundEngineAudioQueue.enqueueAudio(() -> LowPassConcussionEffect.ensureFilterExists()); - } + public static void start(int durationSeconds, float intensity) { } - private static void ensureFilterExists() { - if (!efxAvailable.get()) { - long ctx = ALC10.alcGetCurrentContext(); - long dev = ALC10.alcGetContextsDevice((long)ctx); - if (!ALC10.alcIsExtensionPresent((long)dev, (CharSequence)"ALC_EXT_EFX")) { - efxAvailable.set(false); - return; - } - efxAvailable.set(true); - } - if (filterId == 0) { - filterId = EXTEfx.alGenFilters(); - EXTEfx.alFilteri((int)filterId, (int)32769, (int)1); - EXTEfx.alFilterf((int)filterId, (int)1, (float)1.0f); - EXTEfx.alFilterf((int)filterId, (int)2, (float)1.0f); - } - } - - public static void start(int seconds, float intensity) { - Minecraft mc; - if (!enabled) { - return; - } - if (seconds < 1) { - seconds = 1; - } - if (seconds > 600) { - seconds = 600; - } - float effectiveIntensity = (Boolean)Config.CLIENT.enableLowPass.get() != false ? intensity : 0.001f; - float addedStrength = Math.max(0.0f, Math.min(1.0f, effectiveIntensity)); - if (phase != Phase.IDLE) { - float currentStrength = (1.0f - targetHfMin) / 0.99f; - float totalStrength = Math.min(1.0f, currentStrength + addedStrength); - targetHfMin = 1.0f - totalStrength * 0.99f; - holdTicks = Math.min(2000, holdTicks + seconds * 20); - if (phase == Phase.FADE_OUT) { - phase = Phase.HOLD; - ticksInPhase = 0; - } - } else { - float totalStrength = addedStrength; - targetHfMin = 1.0f - totalStrength * 0.99f; - targetGainMin = 0.1f; - holdTicks = seconds * 20; - ticksInPhase = 0; - phase = Phase.FADE_IN; - } - if (!compatibilityMode) { - SoundEngineAudioQueue.enqueueAudio(() -> { - try { - LowPassConcussionEffect.ensureFilterExists(); - } - catch (Throwable ex) { - efxAvailable.set(false); - } - }); - SoundEngineAudioQueue.drainNow(); - } - if (debugShowChat && (mc = Minecraft.getInstance()) != null && mc.player != null) { - mc.player.displayClientMessage((Component)Component.literal((String)("Low pass test queued for " + seconds + "s (strength=" + addedStrength + ")")), false); - } - } - - public static void start(int seconds, float intensity, double effectivePercent, String visibility, int intensityPercent) { - Minecraft mc; - if (debugShowChat && (mc = Minecraft.getInstance()) != null && mc.player != null) { - mc.player.displayClientMessage((Component)Component.literal((String)"__________________________________________"), false); - String msg = String.format("\u041f\u043e\u0442\u0443\u0436\u043d\u0456\u0441\u0442\u044c \u043a\u043e\u043d\u0442\u0443\u0437\u0456\u0457 %.1f%% (%s) \u2014 \u0421\u0438\u043b\u0430 \u043f\u0440\u0438\u0433\u043b\u0443\u0448\u0435\u043d\u043d\u044f %d%%, \u0427\u0430\u0441 \u043f\u0440\u0438\u0433\u043b\u0443\u0448\u0435\u043d\u043d\u044f %.1f \u0441\u0435\u043a", effectivePercent, visibility, intensityPercent, (double)seconds); - mc.player.displayClientMessage((Component)Component.literal((String)msg).m_130940_(ChatFormatting.WHITE), false); - mc.player.displayClientMessage((Component)Component.literal((String)"__________________________________________"), false); - } - LowPassConcussionEffect.start(seconds, intensity); + public static void start(int durationSeconds, float intensity, double effectivePercent, String visibility, int intensityPercent) { } public static void stop() { - phase = Phase.IDLE; - ticksInPhase = 0; - lastAppliedHf = 1.0f; - lastAppliedGain = 1.0f; - targetGainMin = 1.0f; - if (compatibilityMode) { - SoundEngineAudioQueue.enqueueAudio(SoundPhysicsCompatibility::reapplyDirectFilterParameters); - } - SoundEngineAudioQueue.enqueueAudio(() -> { - if (filterId != 0) { - try { - EXTEfx.alFilterf((int)filterId, (int)2, (float)1.0f); - EXTEfx.alFilterf((int)filterId, (int)1, (float)1.0f); - } - catch (Throwable throwable) { - // empty catch block - } - } - }); } public static boolean isActive() { - return phase != Phase.IDLE || currentDeafnessGain < 0.99f; - } - - public static int getFilterId() { - return filterId; - } - - @SubscribeEvent - public static void onClientTick(TickEvent.ClientTickEvent event) { - if (event.phase == TickEvent.Phase.END) { - LowPassConcussionEffect.onClientTick(); - } + return false; } public static void onClientTick() { - Minecraft mc = Minecraft.getInstance(); - if (mc != null && mc.m_91104_()) { - return; - } - if (currentDeafnessGain < 0.99f || phase != Phase.IDLE) { - float hf = 1.0f; - float gainInterp = 1.0f; - if (phase != Phase.IDLE) { - ++ticksInPhase; - switch (phase) { - case FADE_IN: { - float t = Math.min(1.0f, (float)ticksInPhase / 40.0f); - hf = LowPassConcussionEffect.lerp(1.0f, targetHfMin, LowPassConcussionEffect.easeOutQuad(t)); - gainInterp = LowPassConcussionEffect.lerp(1.0f, targetGainMin, LowPassConcussionEffect.easeOutQuad(t)); - if (ticksInPhase < 40) break; - phase = Phase.HOLD; - ticksInPhase = 0; - hf = targetHfMin; - gainInterp = targetGainMin; - break; - } - case HOLD: { - hf = targetHfMin; - gainInterp = targetGainMin; - if (ticksInPhase < holdTicks) break; - phase = Phase.FADE_OUT; - ticksInPhase = 0; - break; - } - case FADE_OUT: { - float t = Math.min(1.0f, (float)ticksInPhase / 100.0f); - hf = LowPassConcussionEffect.lerp(targetHfMin, 1.0f, LowPassConcussionEffect.easeInQuad(t)); - gainInterp = LowPassConcussionEffect.lerp(targetGainMin, 1.0f, LowPassConcussionEffect.easeInQuad(t)); - if (ticksInPhase < 100) break; - LowPassConcussionEffect.stop(); - hf = 1.0f; - gainInterp = 1.0f; - } - } - } - float combinedGain = Math.max(0.0f, Math.min(1.0f, gainInterp * currentDeafnessGain)); - LowPassConcussionEffect.applyFilterParamsOnAudioThread(hf, combinedGain); - } } - private static void applyFilterParamsOnAudioThread(float hf, float gain) { - float clampedHf = Math.max(0.01f, Math.min(1.0f, hf)); - float clampedGain = Math.max(0.0f, Math.min(1.0f, gain)); - lastAppliedHf = clampedHf; - lastAppliedGain = clampedGain; - if (compatibilityMode) { - SoundEngineAudioQueue.enqueueAudio(SoundPhysicsCompatibility::reapplyDirectFilterParameters); - } - if (!efxAvailable.get()) { - return; - } - int fid = filterId; - if (fid == 0) { - return; - } - SoundEngineAudioQueue.enqueueAudio(() -> { - try { - EXTEfx.alFilterf((int)fid, (int)2, (float)clampedHf); - EXTEfx.alFilterf((int)fid, (int)1, (float)clampedGain); - } - catch (Throwable throwable) { - // empty catch block - } - }); + public static void ensureFilterExists() { } - private static float lerp(float a, float b, float t) { - return a + (b - a) * t; + public static void attachFilterToSource(int source) { } - private static float easeOutQuad(float t) { - return 1.0f - (1.0f - t) * (1.0f - t); + public static void detachFilterFromSource(int source) { } - private static float easeInQuad(float t) { - return t * t; + public static void applyFilterParamsOnAudioThread(float hf, float gain) { } - private static String alErrorName(int err) { - return switch (err) { - case 0 -> "AL_NO_ERROR"; - case 40961 -> "AL_INVALID_NAME"; - case 40962 -> "AL_INVALID_ENUM"; - case 40963 -> "AL_INVALID_VALUE"; - case 40964 -> "AL_INVALID_OPERATION"; - case 40965 -> "AL_OUT_OF_MEMORY"; - default -> "AL_UNKNOWN_ERROR"; - }; + public static void setCompatibilityMode(boolean enabled) { } - public static void setCompatibilityMode(boolean compatibilityActive) { - compatibilityMode = compatibilityActive; + public static void setDeafnessGain(float gain) { } public static float getCurrentHfMultiplier() { - return Math.max(0.01f, Math.min(1.0f, lastAppliedHf)); + return 1.0f; } public static float getCurrentGainMultiplier() { - return Math.max(0.0f, Math.min(1.0f, lastAppliedGain)); + return 1.0f; } - public static void attachFilterToSource(int sourceId) { - if (sourceId <= 0) { - return; - } - if (!efxAvailable.get() || filterId == 0) { - return; - } - try { - if (!AL10.alIsSource((int)sourceId)) { - return; - } - if (AL10.alGetSourcei((int)sourceId, (int)514) == 1) { - return; - } - AL10.alSourcei((int)sourceId, (int)131077, (int)filterId); - } - catch (Throwable throwable) { - // empty catch block - } + public static float lerp(float a, float b, double t) { + return (float)(a + (b - a) * t); } - public static void detachFilterFromSource(int sourceId) { - try { - if (AL10.alIsSource((int)sourceId)) { - AL10.alSourcei((int)sourceId, (int)131077, (int)0); - } - } - catch (Throwable throwable) { - // empty catch block - } + public static float easeOutQuad(double t) { + return (float)(1.0 - (1.0 - t) * (1.0 - t)); } - private static enum Phase { - IDLE, - FADE_IN, - HOLD, - FADE_OUT; - + public static float easeInQuad(double t) { + return (float)(t * t); } } diff --git a/src/main/java/com/vinlanx/explosionoverhaul/client/ModConfigScreen.java b/src/main/java/com/vinlanx/explosionoverhaul/client/ModConfigScreen.java index 5f0f06c..5fa1875 100644 --- a/src/main/java/com/vinlanx/explosionoverhaul/client/ModConfigScreen.java +++ b/src/main/java/com/vinlanx/explosionoverhaul/client/ModConfigScreen.java @@ -1,256 +1,9 @@ -/* - * Decompiled with CFR 0.152. - */ package com.vinlanx.explosionoverhaul.client; -import com.vinlanx.explosionoverhaul.Config; -import com.vinlanx.explosionoverhaul.CraterDeformer; -import com.vinlanx.explosionoverhaul.client.BlacklistScreen; -import com.vinlanx.explosionoverhaul.client.ExplosionTextureManager; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Optional; -import me.shedaniel.clothconfig2.api.AbstractConfigListEntry; -import me.shedaniel.clothconfig2.api.ConfigBuilder; -import me.shedaniel.clothconfig2.api.ConfigCategory; -import me.shedaniel.clothconfig2.api.ConfigEntryBuilder; -import net.minecraft.ChatFormatting; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.components.Button; -import net.minecraft.client.gui.components.events.GuiEventListener; -import net.minecraft.client.gui.narration.NarratableEntry; import net.minecraft.client.gui.screens.Screen; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; -import net.neoforged.neoforge.common.ModConfigSpec; public class ModConfigScreen { public static Screen create(Screen parent) { - ConfigBuilder builder = ConfigBuilder.create().setParentScreen(parent).setTitle((Component)Component.translatable((String)"title.explosionoverhaul.config")); - ConfigEntryBuilder entryBuilder = builder.entryBuilder(); - ConfigCategory serverCategory = builder.getOrCreateCategory((Component)Component.translatable((String)"category.explosionoverhaul.server")); - builder.setSavingRunnable(() -> { - Config.CLIENT_SPEC.save(); - Config.COMMON_SPEC.save(); - ExplosionTextureManager.getInstance().reload(); - }); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableFallingBlocks"), ((Boolean)Config.COMMON.enableFallingBlocks.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableFallingBlocks")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.COMMON.enableFallingBlocks).set(arg_0)).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableExplosionClustering"), ((Boolean)Config.COMMON.enableExplosionClustering.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableExplosionClustering")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.COMMON.enableExplosionClustering).set(arg_0)).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableCraterDestruction"), ((Boolean)Config.COMMON.enableCraterDestruction.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableCraterDestruction")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.COMMON.enableCraterDestruction).set(arg_0)).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableGlassBreaking"), ((Boolean)Config.COMMON.enableGlassBreaking.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableGlassBreaking")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.COMMON.enableGlassBreaking).set(arg_0)).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableDripstoneFalling"), ((Boolean)Config.COMMON.enableDripstoneFalling.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableDripstoneFalling")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.COMMON.enableDripstoneFalling).set(arg_0)).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableLampFlicker"), ((Boolean)Config.COMMON.enableLampFlicker.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableLampFlicker")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.COMMON.enableLampFlicker).set(arg_0)).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.literal((String)" ")).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.translatable((String)"option.explosionoverhaul.craterSettingsHeader")).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.craterSizeMultiplier"), (int)((Double)Config.COMMON.craterSizeMultiplier.get() * 100.0), 10, 5000).setDefaultValue(100).setTextGetter(value -> { - double val = (double)value.intValue() / 100.0; - Object text = String.format("%.2fx", val); - if (val > 10.0) { - text = (String)text + " \u00a7c(EXTREME!)"; - } - return Component.literal((String)text); - }).setTooltipSupplier(value -> Optional.of(ModConfigScreen.generateCraterTable((double)value.intValue() / 100.0))).setSaveConsumer(newValue -> Config.COMMON.craterSizeMultiplier.set((Object)((double)newValue.intValue() / 100.0))).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.craterCoreRatio"), (int)((Double)Config.COMMON.craterCoreRatio.get() * 100.0), 10, 95).setDefaultValue(70).setTextGetter(value -> Component.literal((String)(value + "%"))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.craterCoreRatio")}).setSaveConsumer(newValue -> Config.COMMON.craterCoreRatio.set((Object)((double)newValue.intValue() / 100.0))).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.literal((String)" ")).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.literal((String)"--- Async Crater Pipeline ---")).setTooltip(new Component[]{Component.literal((String)"Computes crater geometry off-thread and applies block changes in batches per tick.")}).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableAsyncCrater"), ((Boolean)Config.COMMON.enableAsyncCrater.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableAsyncCrater")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.COMMON.enableAsyncCrater).set(arg_0)).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.maxClusterPower"), ((Integer)Config.COMMON.maxClusterPower.get()).intValue(), 4, 1000).setDefaultValue(100).setTextGetter(v -> Component.literal((String)String.valueOf(v))).setTooltipSupplier(v -> { - if (v >= 500) { - return Optional.of(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.maxClusterPower"), Component.literal((String)""), Component.literal((String)"\u26a0 ").m_130944_(new ChatFormatting[]{ChatFormatting.RED, ChatFormatting.BOLD}).m_7220_((Component)Component.translatable((String)"warning.explosionoverhaul.crashRisk").m_130944_(new ChatFormatting[]{ChatFormatting.DARK_RED, ChatFormatting.BOLD}))}); - } - if (v >= 300) { - return Optional.of(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.maxClusterPower"), Component.literal((String)""), Component.translatable((String)"warning.explosionoverhaul.severeRenderingLag").m_130940_(ChatFormatting.DARK_RED)}); - } - if (v >= 150) { - return Optional.of(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.maxClusterPower"), Component.literal((String)""), Component.translatable((String)"warning.explosionoverhaul.renderingLag").m_130940_(ChatFormatting.GOLD)}); - } - return Optional.of(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.maxClusterPower")}); - }).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)Config.COMMON.maxClusterPower).set(arg_0)).build()); - int availableThreads = Runtime.getRuntime().availableProcessors(); - int maxThreadsForSystem = Math.min(32, availableThreads); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.craterMaxThreads"), ((Integer)Config.COMMON.craterMaxThreads.get()).intValue(), 0, maxThreadsForSystem).setDefaultValue(0).setTextGetter(v -> Component.literal((String)(v == 0 ? "Auto (" + availableThreads + ")" : String.valueOf(v)))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.craterMaxThreads")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)Config.COMMON.craterMaxThreads).set(arg_0)).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.craterApplyBlocksPerTick"), ((Integer)Config.COMMON.craterApplyBlocksPerTick.get()).intValue(), 0, 150000).setDefaultValue(50000).setTextGetter(v -> Component.literal((String)(v + " blocks/tick"))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.craterApplyBlocksPerTick")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)Config.COMMON.craterApplyBlocksPerTick).set(arg_0)).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.craterMaxFallingBlocksPerTick"), ((Integer)Config.COMMON.craterMaxFallingBlocksPerTick.get()).intValue(), 0, 2000).setDefaultValue(500).setTextGetter(v -> Component.literal((String)(v + " entities/tick"))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.craterMaxFallingBlocksPerTick")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)Config.COMMON.craterMaxFallingBlocksPerTick).set(arg_0)).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableDirectChunkWrites"), ((Boolean)Config.COMMON.enableDirectChunkWrites.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableDirectChunkWrites")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.COMMON.enableDirectChunkWrites).set(arg_0)).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.craterChunksPerTick"), ((Integer)Config.COMMON.craterChunksPerTick.get()).intValue(), 0, 500).setDefaultValue(120).setTextGetter(v -> Component.literal((String)(v + " chunks/tick"))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.craterChunksPerTick")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)Config.COMMON.craterChunksPerTick).set(arg_0)).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.literal((String)" ")).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.translatable((String)"option.explosionoverhaul.glassBreakingSettings")).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.glassBreakingIntervalTicks"), ((Integer)Config.COMMON.glassBreakingIntervalTicks.get()).intValue(), 1, 20).setDefaultValue(1).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.glassBreakingIntervalTicks")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)Config.COMMON.glassBreakingIntervalTicks).set(arg_0)).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.glassBlocksPerCycle"), ((Integer)Config.COMMON.glassBlocksPerCycle.get()).intValue(), 10, 500).setDefaultValue(70).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.glassBlocksPerCycle")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)Config.COMMON.glassBlocksPerCycle).set(arg_0)).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.literal((String)" ")).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.translatable((String)"option.explosionoverhaul.lampFlickerSettings")).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.lampFlickerSearchRadius"), ((Integer)Config.COMMON.lampFlickerSearchRadius.get()).intValue(), 1, 100).setDefaultValue(50).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.lampFlickerSearchRadius")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)Config.COMMON.lampFlickerSearchRadius).set(arg_0)).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.translatable((String)"option.explosionoverhaul.dripstoneFallingSettings")).build()); - serverCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.dripstoneFallingSearchRadius"), ((Integer)Config.COMMON.dripstoneFallingSearchRadius.get()).intValue(), 1, 100).setDefaultValue(50).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.dripstoneFallingSearchRadius")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)Config.COMMON.dripstoneFallingSearchRadius).set(arg_0)).build()); - ConfigCategory ambientCategory = builder.getOrCreateCategory((Component)Component.translatable((String)"category.explosionoverhaul.ambient")); - Config.Common.Ambient ambientConfig = Config.COMMON.ambient; - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableAmbientExplosions"), ((Boolean)ambientConfig.enableAmbientExplosions.get()).booleanValue()).setDefaultValue(false).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableAmbientExplosions")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)ambientConfig.enableAmbientExplosions).set(arg_0)).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.minTimeBetweenExplosions"), (Integer)ambientConfig.minTimeBetweenExplosions.get() / 20, 5, 3600).setDefaultValue(60).setTextGetter(value -> Component.literal((String)(value + " s"))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.minTimeBetweenExplosions")}).setSaveConsumer(newValue -> ambientConfig.minTimeBetweenExplosions.set((Object)(newValue * 20))).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.maxTimeBetweenExplosions"), (Integer)ambientConfig.maxTimeBetweenExplosions.get() / 20, 10, 3600).setDefaultValue(300).setTextGetter(value -> Component.literal((String)(value + " s"))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.maxTimeBetweenExplosions")}).setSaveConsumer(newValue -> ambientConfig.maxTimeBetweenExplosions.set((Object)(newValue * 20))).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.minExplosionDistance"), ((Integer)ambientConfig.minExplosionDistance.get()).intValue(), 100, 10000).setDefaultValue(501).setTextGetter(value -> Component.literal((String)(value + " blocks"))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.minExplosionDistance")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)ambientConfig.minExplosionDistance).set(arg_0)).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.maxExplosionDistance"), ((Integer)ambientConfig.maxExplosionDistance.get()).intValue(), 200, 10000).setDefaultValue(5001).setTextGetter(value -> Component.literal((String)(value + " blocks"))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.maxExplosionDistance")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)ambientConfig.maxExplosionDistance).set(arg_0)).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.maxAmbientExplosionPower"), (int)((Double)ambientConfig.maxAmbientExplosionPower.get() * 10.0), 400, 2000).setDefaultValue(800).setTextGetter(value -> Component.literal((String)String.format("%.1f", (double)value.intValue() / 10.0))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.maxAmbientExplosionPower")}).setSaveConsumer(newValue -> ambientConfig.maxAmbientExplosionPower.set((Object)((double)newValue.intValue() / 10.0))).build()); - Config.Common.Ambient.Scenarios scenariosConfig = ambientConfig.scenarios; - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.literal((String)" ")).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.translatable((String)"option.explosionoverhaul.scenariosHeader")).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.scenariosHeader")}).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.singleExplosionWeight"), ((Integer)scenariosConfig.singleExplosionWeight.get()).intValue(), 0, 100).setTextGetter(v -> Component.literal((String)(v + "%"))).setDefaultValue(70).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)scenariosConfig.singleExplosionWeight).set(arg_0)).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.chainReactionWeight"), ((Integer)scenariosConfig.chainReactionWeight.get()).intValue(), 0, 100).setTextGetter(v -> Component.literal((String)(v + "%"))).setDefaultValue(15).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)scenariosConfig.chainReactionWeight).set(arg_0)).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.shellingWeight"), ((Integer)scenariosConfig.shellingWeight.get()).intValue(), 0, 100).setTextGetter(v -> Component.literal((String)(v + "%"))).setDefaultValue(15).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)scenariosConfig.shellingWeight).set(arg_0)).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.translatable((String)"option.explosionoverhaul.chainReactionSettingsHeader")).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.minChainReactionShots"), ((Integer)scenariosConfig.minChainReactionShots.get()).intValue(), 2, 20).setDefaultValue(3).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)scenariosConfig.minChainReactionShots).set(arg_0)).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.maxChainReactionShots"), ((Integer)scenariosConfig.maxChainReactionShots.get()).intValue(), 2, 20).setDefaultValue(7).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)scenariosConfig.maxChainReactionShots).set(arg_0)).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.minTimeBetweenChainShots"), ((Integer)scenariosConfig.minTimeBetweenChainShots.get()).intValue(), 5, 200).setTextGetter(v -> Component.literal((String)String.format("%.2fs", (double)v.intValue() / 20.0))).setDefaultValue(10).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)scenariosConfig.minTimeBetweenChainShots).set(arg_0)).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.maxTimeBetweenChainShots"), ((Integer)scenariosConfig.maxTimeBetweenChainShots.get()).intValue(), 10, 400).setTextGetter(v -> Component.literal((String)String.format("%.2fs", (double)v.intValue() / 20.0))).setDefaultValue(40).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)scenariosConfig.maxTimeBetweenChainShots).set(arg_0)).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.translatable((String)"option.explosionoverhaul.shellingSettingsHeader")).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.minShellingDelay"), ((Integer)scenariosConfig.minShellingDelay.get()).intValue(), 20, 400).setTextGetter(v -> Component.literal((String)String.format("%.2fs", (double)v.intValue() / 20.0))).setDefaultValue(40).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)scenariosConfig.minShellingDelay).set(arg_0)).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.maxShellingDelay"), ((Integer)scenariosConfig.maxShellingDelay.get()).intValue(), 20, 400).setTextGetter(v -> Component.literal((String)String.format("%.2fs", (double)v.intValue() / 20.0))).setDefaultValue(140).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)scenariosConfig.maxShellingDelay).set(arg_0)).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.literal((String)" ")).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.translatable((String)"option.explosionoverhaul.powerTiersHeader")).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.powerTiersHeader")}).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.tier1_weight"), ((Integer)ambientConfig.powerTiers.tier1_weight.get()).intValue(), 0, 100).setTextGetter(v -> Component.literal((String)(v + "%"))).setDefaultValue(50).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)ambientConfig.powerTiers.tier1_weight).set(arg_0)).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.tier2_weight"), ((Integer)ambientConfig.powerTiers.tier2_weight.get()).intValue(), 0, 100).setTextGetter(v -> Component.literal((String)(v + "%"))).setDefaultValue(25).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)ambientConfig.powerTiers.tier2_weight).set(arg_0)).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.tier3_weight"), ((Integer)ambientConfig.powerTiers.tier3_weight.get()).intValue(), 0, 100).setTextGetter(v -> Component.literal((String)(v + "%"))).setDefaultValue(15).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)ambientConfig.powerTiers.tier3_weight).set(arg_0)).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.tier4_weight"), ((Integer)ambientConfig.powerTiers.tier4_weight.get()).intValue(), 0, 100).setTextGetter(v -> Component.literal((String)(v + "%"))).setDefaultValue(8).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)ambientConfig.powerTiers.tier4_weight).set(arg_0)).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.tier5_weight"), ((Integer)ambientConfig.powerTiers.tier5_weight.get()).intValue(), 0, 100).setTextGetter(v -> Component.literal((String)(v + "%"))).setDefaultValue(2).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)ambientConfig.powerTiers.tier5_weight).set(arg_0)).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.literal((String)" ")).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.translatable((String)"option.explosionoverhaul.soundTypesHeader")).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableSurfaceSounds"), ((Boolean)ambientConfig.soundTypes.enableSurfaceSounds.get()).booleanValue()).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableSurfaceSounds")}).setDefaultValue(true).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)ambientConfig.soundTypes.enableSurfaceSounds).set(arg_0)).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableCaveSounds"), ((Boolean)ambientConfig.soundTypes.enableCaveSounds.get()).booleanValue()).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableCaveSounds")}).setDefaultValue(true).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)ambientConfig.soundTypes.enableCaveSounds).set(arg_0)).build()); - ambientCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableAmbientCaveDust"), ((Boolean)ambientConfig.soundTypes.enableAmbientCaveDust.get()).booleanValue()).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableAmbientCaveDust")}).setDefaultValue(true).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)ambientConfig.soundTypes.enableAmbientCaveDust).set(arg_0)).build()); - ConfigCategory renderCategory = builder.getOrCreateCategory((Component)Component.translatable((String)"category.explosionoverhaul.render")); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startEnumSelector((Component)Component.translatable((String)"option.explosionoverhaul.glowTextureQuality"), Config.Client.GlowTextureQuality.class, (Enum)((Config.Client.GlowTextureQuality)((Object)Config.CLIENT.glowTextureQuality.get()))).setDefaultValue((Enum)Config.Client.GlowTextureQuality.QUALITY_256).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.glowTextureQuality")}).setSaveConsumer(arg_0 -> Config.CLIENT.glowTextureQuality.set(arg_0)).setEnumNameProvider(value -> Component.literal((String)(value == Config.Client.GlowTextureQuality.QUALITY_64 ? "64x" : "256x"))).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startEnumSelector((Component)Component.translatable((String)"option.explosionoverhaul.particleRenderMode"), Config.Client.ParticleRenderMode.class, (Enum)((Config.Client.ParticleRenderMode)((Object)Config.CLIENT.particleRenderMode.get()))).setDefaultValue((Enum)Config.Client.ParticleRenderMode.VANILA).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.particleRenderMode")}).setSaveConsumer(arg_0 -> Config.CLIENT.particleRenderMode.set(arg_0)).setEnumNameProvider(value -> { - if (value == Config.Client.ParticleRenderMode.VANILA) { - return Component.literal((String)"Vanilla-like"); - } - if (value == Config.Client.ParticleRenderMode.REALISTIC_2) { - return Component.literal((String)"Realistic 2"); - } - return Component.literal((String)"Realistic"); - }).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.particleSizeScale"), (int)((Double)Config.CLIENT.particleSizeScale.get() * 100.0), 10, 500).setDefaultValue(100).setTextGetter(value -> Component.literal((String)String.format("%.2fx", (double)value.intValue() / 100.0))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.particleSizeScale")}).setSaveConsumer(newValue -> Config.CLIENT.particleSizeScale.set((Object)((double)newValue.intValue() / 100.0))).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableExplosionParticles"), ((Boolean)Config.CLIENT.enableExplosionParticles.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableExplosionParticles")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.CLIENT.enableExplosionParticles).set(arg_0)).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.literal((String)" ")).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enablePlasmaParticles"), ((Boolean)Config.CLIENT.enablePlasmaParticles.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enablePlasmaParticles")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.CLIENT.enablePlasmaParticles).set(arg_0)).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enablePlasmaSmokeTrail"), ((Boolean)Config.CLIENT.enablePlasmaSmokeTrail.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enablePlasmaSmokeTrail")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.CLIENT.enablePlasmaSmokeTrail).set(arg_0)).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.plasmaSmokeFrequency"), (int)((Double)Config.CLIENT.plasmaSmokeFrequency.get() * 100.0), 0, 100).setDefaultValue(25).setTextGetter(value -> Component.literal((String)(value + "%"))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.plasmaSmokeFrequency")}).setSaveConsumer(newValue -> Config.CLIENT.plasmaSmokeFrequency.set((Object)((double)newValue.intValue() / 100.0))).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.plasmaSmokeCount"), ((Integer)Config.CLIENT.plasmaSmokeCount.get()).intValue(), 0, 5).setDefaultValue(1).setTextGetter(value -> Component.literal((String)String.valueOf(value))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.plasmaSmokeCount")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)Config.CLIENT.plasmaSmokeCount).set(arg_0)).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.literal((String)" ")).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableFlashEffect"), ((Boolean)Config.CLIENT.enableFlashEffect.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableFlashEffect")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.CLIENT.enableFlashEffect).set(arg_0)).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.flashMaxOpacity"), (int)((Double)Config.CLIENT.flashMaxOpacity.get() * 100.0), 0, 100).setDefaultValue(50).setTextGetter(value -> Component.literal((String)(value + "%"))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.flashMaxOpacity")}).setSaveConsumer(newValue -> Config.CLIENT.flashMaxOpacity.set((Object)((double)newValue.intValue() / 100.0))).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.literal((String)" ")).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableLineSparks"), ((Boolean)Config.CLIENT.enableLineSparks.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableLineSparks")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.CLIENT.enableLineSparks).set(arg_0)).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.lineSparkAmountMultiplier"), (int)((Double)Config.CLIENT.lineSparkAmountMultiplier.get() * 100.0), 0, 500).setDefaultValue(100).setTextGetter(value -> Component.literal((String)String.format("%d%%", value))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.lineSparkAmountMultiplier")}).setSaveConsumer(newValue -> Config.CLIENT.lineSparkAmountMultiplier.set((Object)((double)newValue.intValue() / 100.0))).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.literal((String)" ")).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableGroundDustEffect"), ((Boolean)Config.CLIENT.enableGroundDustEffect.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableGroundDustEffect")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.CLIENT.enableGroundDustEffect).set(arg_0)).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.groundDustQuality"), (int)((Double)Config.CLIENT.groundDustQuality.get() * 100.0), 0, 100).setDefaultValue(100).setTextGetter(value -> Component.literal((String)(value + "%"))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.groundDustQuality")}).setSaveConsumer(newValue -> Config.CLIENT.groundDustQuality.set((Object)((double)newValue.intValue() / 100.0))).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.groundDustRaycastFrequency"), ((Integer)Config.CLIENT.groundDustRaycastFrequency.get()).intValue(), 1, 20).setDefaultValue(10).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.groundDustRaycastFrequency")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)Config.CLIENT.groundDustRaycastFrequency).set(arg_0)).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.literal((String)" ")).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableGroundMistEffect"), ((Boolean)Config.CLIENT.enableGroundMistEffect.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableGroundMistEffect")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.CLIENT.enableGroundMistEffect).set(arg_0)).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.groundMistQuality"), (int)((Double)Config.CLIENT.groundMistQuality.get() * 100.0), 0, 100).setDefaultValue(100).setTextGetter(value -> Component.literal((String)(value + "%"))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.groundMistQuality")}).setSaveConsumer(newValue -> Config.CLIENT.groundMistQuality.set((Object)((double)newValue.intValue() / 100.0))).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.groundMistRaycastFrequency"), ((Integer)Config.CLIENT.groundMistRaycastFrequency.get()).intValue(), 1, 20).setDefaultValue(10).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.groundMistRaycastFrequency")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)Config.CLIENT.groundMistRaycastFrequency).set(arg_0)).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.literal((String)" ")).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableShockwaveEffect"), ((Boolean)Config.CLIENT.enableShockwaveEffect.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableShockwaveEffect")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.CLIENT.enableShockwaveEffect).set(arg_0)).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.literal((String)" ")).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableWindEffect"), ((Boolean)Config.CLIENT.enableWindEffect.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableWindEffect")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.CLIENT.enableWindEffect).set(arg_0)).build()); - renderCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.windSpeedMultiplier"), (int)((Double)Config.CLIENT.windSpeedMultiplier.get() * 100.0), 100, 200).setDefaultValue(100).setTextGetter(value -> Component.literal((String)String.format("%.2fx", (double)value.intValue() / 100.0))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.windSpeedMultiplier")}).setSaveConsumer(newValue -> Config.CLIENT.windSpeedMultiplier.set((Object)((double)newValue.intValue() / 100.0))).build()); - ConfigCategory cameraCategory = builder.getOrCreateCategory((Component)Component.translatable((String)"category.explosionoverhaul.camera")); - cameraCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableCameraShake"), ((Boolean)Config.CLIENT.enableCameraShake.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableCameraShake")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.CLIENT.enableCameraShake).set(arg_0)).build()); - cameraCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.cameraShakeAmplifier"), (int)((Double)Config.CLIENT.cameraShakeAmplifier.get() * 10.0), 0, 100).setDefaultValue(10).setTextGetter(value -> Component.literal((String)String.format("%.1fx", (double)value.intValue() / 10.0))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.cameraShakeAmplifier")}).setSaveConsumer(newValue -> Config.CLIENT.cameraShakeAmplifier.set((Object)((double)newValue.intValue() / 10.0))).build()); - cameraCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.translatable((String)"option.explosionoverhaul.cameraServerHeader")).build()); - cameraCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enablePlayerShake"), ((Boolean)Config.COMMON.enablePlayerShake.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enablePlayerShake")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.COMMON.enablePlayerShake).set(arg_0)).build()); - cameraCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.playerShakeAmplifier"), (int)((Double)Config.COMMON.playerShakeAmplifier.get() * 10.0), 0, 100).setDefaultValue(10).setTextGetter(value -> Component.literal((String)String.format("%.1fx", (double)value.intValue() / 10.0))).setTooltip(new Component[]{Component.translatable((String)"option.explosionoverhaul.playerShakeAmplifier")}).setSaveConsumer(newValue -> Config.COMMON.playerShakeAmplifier.set((Object)((double)newValue.intValue() / 10.0))).build()); - ConfigCategory scanCategory = builder.getOrCreateCategory((Component)Component.translatable((String)"category.explosionoverhaul.scan")); - scanCategory.addEntry((AbstractConfigListEntry)entryBuilder.startTextDescription((Component)Component.translatable((String)"option.explosionoverhaul.scanSettingsHeader")).build()); - int availableCores = Runtime.getRuntime().availableProcessors(); - int maxThreads = Math.min(32, availableCores); - scanCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.maxScanThreads"), ((Integer)Config.COMMON.scan.maxScanThreads.get()).intValue(), 0, maxThreads).setDefaultValue(0).setTextGetter(value -> { - if (value == 0) { - return Component.literal((String)("Auto (" + availableCores + " threads)")); - } - return Component.literal((String)String.valueOf(value)); - }).setTooltip(new Component[]{Component.literal((String)("Maximum number of threads to use for chunk scanning.\n0 = Auto-detect (recommended): automatically uses all " + availableCores + " available threads\n1 = Single-threaded (slowest but safest for low-end servers)\n2-" + maxThreads + " = Custom thread count (available range for your system)\nYour system supports up to " + availableCores + " threads.\nMore threads = faster scanning but higher CPU usage."))}).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)Config.COMMON.scan.maxScanThreads).set(arg_0)).build()); - scanCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.cpuUsagePercent"), ((Integer)Config.COMMON.scan.cpuUsagePercent.get()).intValue(), 1, 100).setDefaultValue(75).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.cpuUsagePercent")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.IntValue)Config.COMMON.scan.cpuUsagePercent).set(arg_0)).build()); - scanCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableBlockIndexing"), ((Boolean)Config.COMMON.scan.enableBlockIndexing.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableBlockIndexing")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.COMMON.scan.enableBlockIndexing).set(arg_0)).build()); - scanCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.showScanProgressHUD"), ((Boolean)Config.COMMON.scan.showScanProgressHUD.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.showScanProgressHUD")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.COMMON.scan.showScanProgressHUD).set(arg_0)).build()); - ConfigCategory soundsCategory = builder.getOrCreateCategory((Component)Component.translatable((String)"category.explosionoverhaul.sounds")); - soundsCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableAdvancedSoundSpeed"), ((Boolean)Config.COMMON.enableAdvancedSoundSpeed.get()).booleanValue()).setDefaultValue(false).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableAdvancedSoundSpeed")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.COMMON.enableAdvancedSoundSpeed).set(arg_0)).build()); - ConfigCategory concussionCategory = builder.getOrCreateCategory((Component)Component.translatable((String)"category.explosionoverhaul.concussion")); - concussionCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableConcussion"), ((Boolean)Config.CLIENT.enableConcussion.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableConcussion")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.CLIENT.enableConcussion).set(arg_0)).build()); - concussionCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.concussionDurationMultiplier"), (int)((Double)Config.CLIENT.concussionDurationMultiplier.get() * 100.0), 0, 500).setDefaultValue(100).setTextGetter(value -> Component.literal((String)String.format("%.2fx", (double)value.intValue() / 100.0))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.concussionDurationMultiplier")}).setSaveConsumer(newValue -> Config.CLIENT.concussionDurationMultiplier.set((Object)((double)newValue.intValue() / 100.0))).build()); - concussionCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.concussionChanceMultiplier"), (int)((Double)Config.CLIENT.concussionChanceMultiplier.get() * 100.0), 0, 500).setDefaultValue(100).setTextGetter(value -> Component.literal((String)(value + "%"))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.concussionChanceMultiplier")}).setSaveConsumer(newValue -> Config.CLIENT.concussionChanceMultiplier.set((Object)((double)newValue.intValue() / 100.0))).build()); - concussionCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableHeartbeatPulse"), ((Boolean)Config.CLIENT.enableHeartbeatPulse.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableHeartbeatPulse")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.CLIENT.enableHeartbeatPulse).set(arg_0)).build()); - concussionCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableCameraSway"), ((Boolean)Config.CLIENT.enableCameraSway.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableCameraSway")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.CLIENT.enableCameraSway).set(arg_0)).build()); - concussionCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.cameraSwayIntensity"), (int)((Double)Config.CLIENT.cameraSwayIntensity.get() * 100.0), 0, 500).setDefaultValue(100).setTextGetter(value -> Component.literal((String)String.format("%.2fx", (double)value.intValue() / 100.0))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.cameraSwayIntensity")}).setSaveConsumer(newValue -> Config.CLIENT.cameraSwayIntensity.set((Object)((double)newValue.intValue() / 100.0))).build()); - concussionCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableDeafness"), ((Boolean)Config.CLIENT.enableDeafness.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableDeafness")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.CLIENT.enableDeafness).set(arg_0)).build()); - concussionCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.enableLowPass"), ((Boolean)Config.CLIENT.enableLowPass.get()).booleanValue()).setDefaultValue(true).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.enableLowPass")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.CLIENT.enableLowPass).set(arg_0)).build()); - concussionCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.deafnessChanceMultiplier"), (int)((Double)Config.CLIENT.deafnessChanceMultiplier.get() * 100.0), 0, 500).setDefaultValue(100).setTextGetter(value -> Component.literal((String)(value + "%"))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.deafnessChanceMultiplier")}).setSaveConsumer(newValue -> Config.CLIENT.deafnessChanceMultiplier.set((Object)((double)newValue.intValue() / 100.0))).build()); - concussionCategory.addEntry((AbstractConfigListEntry)entryBuilder.startIntSlider((Component)Component.translatable((String)"option.explosionoverhaul.lowPassChanceMultiplier"), (int)((Double)Config.CLIENT.lowPassChanceMultiplier.get() * 100.0), 0, 500).setDefaultValue(100).setTextGetter(value -> Component.literal((String)(value + "%"))).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.lowPassChanceMultiplier")}).setSaveConsumer(newValue -> Config.CLIENT.lowPassChanceMultiplier.set((Object)((double)newValue.intValue() / 100.0))).build()); - concussionCategory.addEntry((AbstractConfigListEntry)entryBuilder.startBooleanToggle((Component)Component.translatable((String)"option.explosionoverhaul.showHeartbeatHUD"), ((Boolean)Config.CLIENT.showHeartbeatHUD.get()).booleanValue()).setDefaultValue(false).setTooltip(new Component[]{Component.translatable((String)"tooltip.explosionoverhaul.showHeartbeatHUD")}).setSaveConsumer(arg_0 -> ((ModConfigSpec.BooleanValue)Config.CLIENT.showHeartbeatHUD).set(arg_0)).build()); - ConfigCategory blacklistCategory = builder.getOrCreateCategory((Component)Component.translatable((String)"category.explosionoverhaul.blacklists")); - blacklistCategory.addEntry((AbstractConfigListEntry)new LinkButtonEntry((Component)Component.translatable((String)"option.explosionoverhaul.blacklist_button"), (Component)Component.translatable((String)"tooltip.explosionoverhaul.blacklist_button"), () -> Minecraft.getInstance().m_91152_((Screen)new BlacklistScreen(parent)))); - return builder.build(); - } - - private static Component[] generateCraterTable(double multiplier) { - int[] powerLevels; - ArrayList lines = new ArrayList(); - lines.add(Component.translatable((String)"tooltip.explosionoverhaul.craterSizeMultiplier.title")); - lines.add(Component.literal((String)"")); - lines.add(Component.literal((String)"\u00a7bPower \u00a78| \u00a7aApprox. Diameter")); - lines.add(Component.literal((String)"\u00a77--------------------------")); - for (int power : powerLevels = new int[]{4, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}) { - float baseRadius = CraterDeformer.calculateRadius(power); - float diameter = (float)((double)baseRadius * multiplier * 2.0); - String formattedLine = String.format("\u00a7f%-12d\u00a78| \u00a7a~%.1f blocks", power, Float.valueOf(diameter)); - lines.add(Component.literal((String)formattedLine)); - } - lines.add(Component.literal((String)"\u00a77--------------------------")); - lines.add(Component.translatable((String)"tooltip.explosionoverhaul.craterSizeMultiplier.footer")); - lines.add(Component.literal((String)"")); - lines.add(Component.translatable((String)"tooltip.explosionoverhaul.craterShapeInfo")); - return lines.toArray(new Component[0]); - } - - public static class LinkButtonEntry - extends AbstractConfigListEntry { - private final Button button; - private final Component tooltip; - - public LinkButtonEntry(Component fieldName, Component tooltip, Runnable action) { - super(fieldName, false); - this.tooltip = tooltip; - this.button = Button.m_253074_((Component)fieldName, b -> action.run()).m_253136_(); - this.button.m_93674_(200); - } - - public void render(GuiGraphics graphics, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isSelected, float delta) { - this.button.m_252865_(x + entryWidth / 2 - 100); - this.button.m_253211_(y); - this.button.m_88315_(graphics, mouseX, mouseY, delta); - if (mouseX >= this.button.m_252754_() && mouseX <= this.button.m_252754_() + this.button.m_5711_() && mouseY >= this.button.m_252907_() && mouseY <= this.button.m_252907_() + this.button.m_93694_()) { - graphics.m_280557_(Minecraft.getInstance().font, this.tooltip, mouseX, mouseY); - } - } - - public List m_6702_() { - return Collections.singletonList(this.button); - } - - public List narratables() { - return Collections.singletonList(this.button); - } - - public Object getValue() { - return null; - } - - public Optional getDefaultValue() { - return Optional.empty(); - } - - public void save() { - } + return parent; } } diff --git a/src/main/java/com/vinlanx/explosionoverhaul/client/SpriteSheetAnimator.java b/src/main/java/com/vinlanx/explosionoverhaul/client/SpriteSheetAnimator.java index 912d0ae..2b0df6c 100644 --- a/src/main/java/com/vinlanx/explosionoverhaul/client/SpriteSheetAnimator.java +++ b/src/main/java/com/vinlanx/explosionoverhaul/client/SpriteSheetAnimator.java @@ -1,137 +1,35 @@ -/* - * Decompiled with CFR 0.152. - */ package com.vinlanx.explosionoverhaul.client; -import com.mojang.blaze3d.platform.NativeImage; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.packs.resources.Resource; -public class SpriteSheetAnimator { +public class SpriteSheetAnimator implements AutoCloseable { private final ResourceLocation spriteSheetLocation; private final int frameWidth; private final int frameHeight; - private final int columns; - private final int rows; - private final int totalFrames; - private final float frameTime; - private NativeImage spriteSheet; - private DynamicTexture dynamicTexture; - private ResourceLocation dynamicTextureLocation; - private int currentFrame = 0; - private float animationTime = 0.0f; - private boolean isPlaying = false; - private Map frameCallbacks = new HashMap(); - private Map frameCallbacksTriggered = new HashMap(); public SpriteSheetAnimator(ResourceLocation spriteSheetLocation, int frameWidth, int frameHeight, int columns, int rows, int totalFrames, int fps) { this.spriteSheetLocation = spriteSheetLocation; this.frameWidth = frameWidth; this.frameHeight = frameHeight; - this.columns = columns; - this.rows = rows; - this.totalFrames = totalFrames; - this.frameTime = 1.0f / (float)fps; } public void load() { - Minecraft mc = Minecraft.getInstance(); - try { - InputStream stream = ((Resource)mc.m_91098_().m_213713_(this.spriteSheetLocation).orElseThrow()).m_215507_(); - this.spriteSheet = NativeImage.m_85058_((InputStream)stream); - stream.close(); - NativeImage frameImage = new NativeImage(this.frameWidth, this.frameHeight, false); - this.dynamicTexture = new DynamicTexture(frameImage); - this.dynamicTextureLocation = mc.m_91097_().m_118490_("explosionoverhaul_anim", this.dynamicTexture); - this.updateTexture(); - } - catch (IOException e) { - e.printStackTrace(); - } - catch (Exception e) { - System.err.println("Failed to load sprite sheet: " + this.spriteSheetLocation); - e.printStackTrace(); - this.spriteSheet = null; - this.dynamicTexture = null; - } } public void tick(float deltaTime) { - if (!this.isPlaying || this.spriteSheet == null) { - return; - } - this.animationTime += deltaTime; - if (this.animationTime >= this.frameTime) { - Boolean wasTriggered; - this.animationTime = 0.0f; - ++this.currentFrame; - if (this.currentFrame >= this.totalFrames) { - this.currentFrame = 0; - this.frameCallbacksTriggered.clear(); - } - this.updateTexture(); - if (this.frameCallbacks.containsKey(this.currentFrame) && !(wasTriggered = this.frameCallbacksTriggered.getOrDefault(this.currentFrame, false)).booleanValue()) { - this.frameCallbacks.get(this.currentFrame).run(); - this.frameCallbacksTriggered.put(this.currentFrame, true); - } - } - } - - private void updateTexture() { - if (this.spriteSheet == null || this.dynamicTexture == null) { - return; - } - if (this.currentFrame < 0) { - this.currentFrame = 0; - } - if (this.currentFrame >= this.totalFrames) { - this.currentFrame = this.totalFrames - 1; - } - int col = this.currentFrame % this.columns; - int row = this.currentFrame / this.columns; - int srcX = col * this.frameWidth; - int srcY = row * this.frameHeight; - NativeImage frameImage = this.dynamicTexture.m_117991_(); - if (frameImage == null) { - return; - } - for (int y = 0; y < this.frameHeight; ++y) { - for (int x = 0; x < this.frameWidth; ++x) { - if (srcX + x < this.spriteSheet.m_84982_() && srcY + y < this.spriteSheet.m_85084_()) { - int pixel = this.spriteSheet.m_84985_(srcX + x, srcY + y); - frameImage.m_84988_(x, y, pixel); - continue; - } - frameImage.m_84988_(x, y, 0); - } - } - this.dynamicTexture.m_117985_(); } public void play() { - this.isPlaying = true; } public void pause() { - this.isPlaying = false; } public void reset() { - this.currentFrame = 0; - this.animationTime = 0.0f; - this.isPlaying = false; - this.frameCallbacksTriggered.clear(); - this.updateTexture(); } public ResourceLocation getTextureLocation() { - return this.dynamicTextureLocation; + return this.spriteSheetLocation; } public int getFrameWidth() { @@ -143,31 +41,19 @@ public class SpriteSheetAnimator { } public int getCurrentFrame() { - return this.currentFrame; + return 0; } public void registerFrameCallback(int frameNumber, Runnable callback) { - if (frameNumber >= 0 && frameNumber < this.totalFrames) { - this.frameCallbacks.put(frameNumber, callback); - } } public void unregisterFrameCallback(int frameNumber) { - this.frameCallbacks.remove(frameNumber); - this.frameCallbacksTriggered.remove(frameNumber); } public void clearFrameCallbacks() { - this.frameCallbacks.clear(); - this.frameCallbacksTriggered.clear(); } + @Override public void close() { - if (this.dynamicTexture != null) { - this.dynamicTexture.close(); - } - if (this.spriteSheet != null) { - this.spriteSheet.close(); - } } } diff --git a/src/main/java/com/vinlanx/explosionoverhaul/client/VinlanxSplashScreen.java b/src/main/java/com/vinlanx/explosionoverhaul/client/VinlanxSplashScreen.java index 6c68e07..52b44a8 100644 --- a/src/main/java/com/vinlanx/explosionoverhaul/client/VinlanxSplashScreen.java +++ b/src/main/java/com/vinlanx/explosionoverhaul/client/VinlanxSplashScreen.java @@ -1,145 +1,16 @@ -/* - * Decompiled with CFR 0.152. - */ package com.vinlanx.explosionoverhaul.client; -import com.mojang.blaze3d.systems.RenderSystem; -import com.vinlanx.explosionoverhaul.ExplosionOverhaul; -import com.vinlanx.explosionoverhaul.ModSounds; -import com.vinlanx.explosionoverhaul.client.GuideSlidesScreen; -import com.vinlanx.explosionoverhaul.client.SpriteSheetAnimator; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.renderer.GameRenderer; -import net.minecraft.client.resources.sounds.SimpleSoundInstance; -import net.minecraft.client.resources.sounds.SoundInstance; -import net.minecraft.client.sounds.SoundManager; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.sounds.SoundEvent; - -public class VinlanxSplashScreen -extends Screen { - private static final ResourceLocation SPRITE_SHEET = ResourceLocation.fromNamespaceAndPath((String)"explosionoverhaul", (String)"intro_gui/vinlanx_screen.png"); - private static final int FRAME_WIDTH = 1280; - private static final int FRAME_HEIGHT = 720; - private static final int COLUMNS = 12; - private static final int ROWS = 12; - private static final int TOTAL_FRAMES = 126; - private static final int FPS = 24; - private SpriteSheetAnimator animator; - private boolean animationFinished = false; - private long lastFrameTime = System.currentTimeMillis(); - private SimpleSoundInstance boomSoundInstance; +public class VinlanxSplashScreen extends Screen { public VinlanxSplashScreen() { - super((Component)Component.literal((String)"Vinlanx Intro")); + super(Component.empty()); } - protected void m_7856_() { - super.m_7856_(); - this.animator = new SpriteSheetAnimator(SPRITE_SHEET, 1280, 720, 12, 12, 126, 24); - this.animator.load(); - this.animator.play(); - try { - SoundManager soundManager = Minecraft.getInstance().m_91106_(); - this.boomSoundInstance = SimpleSoundInstance.m_119755_((SoundEvent)((SoundEvent)ModSounds.INTRO_BOOM_2.get()), (float)1.0f, (float)1.0f); - soundManager.m_120367_((SoundInstance)this.boomSoundInstance); - } - catch (Exception e) { - ExplosionOverhaul.LOGGER.warn("Failed to play intro_boom_2: {}", (Object)e.toString()); - } - } - - public void m_86600_() { - super.m_86600_(); - long currentTime = System.currentTimeMillis(); - float deltaTime = (float)(currentTime - this.lastFrameTime) / 1000.0f; - this.lastFrameTime = currentTime; - if (this.animator != null) { - this.animator.tick(deltaTime); - if (!this.animationFinished && this.animator.getCurrentFrame() >= 125) { - this.animationFinished = true; - this.transitionToFirstTimeScreen(); - } - } - } - - public void m_88315_(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) { - int displayWidth; - int displayHeight; - graphics.fill(0, 0, this.f_96543_, this.f_96544_, -16777216); - if (this.animator == null) { - return; - } - ResourceLocation texture = this.animator.getTextureLocation(); - if (texture == null) { - return; - } - float screenAspectRatio = (float)this.f_96543_ / (float)this.f_96544_; - float targetAspectRatio = 1.7777778f; - if (screenAspectRatio > targetAspectRatio) { - displayHeight = this.f_96544_; - displayWidth = (int)((float)displayHeight * targetAspectRatio); - } else { - displayWidth = this.f_96543_; - displayHeight = (int)((float)displayWidth / targetAspectRatio); - } - int x = (this.f_96543_ - displayWidth) / 2; - int y = (this.f_96544_ - displayHeight) / 2; - RenderSystem.setShader(GameRenderer::m_172817_); - RenderSystem.setShaderTexture((int)0, (ResourceLocation)texture); - RenderSystem.setShaderColor((float)1.0f, (float)1.0f, (float)1.0f, (float)1.0f); - RenderSystem.enableBlend(); - RenderSystem.defaultBlendFunc(); - graphics.m_280411_(texture, x, y, displayWidth, displayHeight, 0.0f, 0.0f, 1280, 720, 1280, 720); - RenderSystem.disableBlend(); - } - - public boolean m_6913_() { - return true; - } - - public boolean m_7933_(int keyCode, int scanCode, int modifiers) { - if (keyCode == 256) { - this.skipToNext(); - return true; - } - return super.m_7933_(keyCode, scanCode, modifiers); - } - - public boolean m_6375_(double mouseX, double mouseY, int button) { - this.skipToNext(); - return true; - } - - public boolean m_7043_() { - return false; - } - - public void m_7861_() { - super.m_7861_(); - if (this.animator != null) { - this.animator.close(); - } - if (this.boomSoundInstance != null) { - try { - Minecraft.getInstance().m_91106_().m_120399_((SoundInstance)this.boomSoundInstance); - } - catch (Exception e) { - ExplosionOverhaul.LOGGER.warn("Failed to stop intro_boom_2: {}", (Object)e.toString()); - } - } - } - - private void skipToNext() { - this.animationFinished = true; - this.transitionToFirstTimeScreen(); - } - - private void transitionToFirstTimeScreen() { - Minecraft mc = Minecraft.getInstance(); - mc.m_91152_((Screen)new GuideSlidesScreen()); + @Override + public void render(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) { + super.render(graphics, mouseX, mouseY, partialTick); } }