Исходник Музыка в MainMenu | expensive 3.1

Начинающий
Статус
Оффлайн
Регистрация
20 Дек 2023
Сообщения
126
Реакции[?]
0
Поинты[?]
0
Нахуй оно вам я не знаю, но пусть будет =)


ClientUtil.java:
    //====================================================================================================
    private static boolean hasCheckedMM = false;
    private static float volumeMM = 0;
    public static boolean isMainMenuOpen() {
        Minecraft mc = Minecraft.getInstance();
        Screen currentScreen = mc.currentScreen;

        return currentScreen instanceof MainScreen;
    }
    public static void MainMenu() {
        boolean isMainMenuOpen = isMainMenuOpen();

        if (isMainMenuOpen) {
            if (!hasCheckedMM) {
                //System.out.println("MainMenu music - on"); //DEBUG
                volumeMM = 90;
                ClientUtil.playSound("MainMenu", volumeMM, true);
                hasCheckedMM = true;
            }
        } else {
            if (hasCheckedMM) {
                //System.out.println("MainMenu music - off"); //DEBUG
                volumeMM = 0;
                ClientUtil.stopSound();
                hasCheckedMM = false;
            }
        }
    }
    //====================================================================================================
Это вставляем в ClientUtil.java, пон?


Minecraft.java:
    public void runTick() {
        if (this.rightClickDelayTimer > 0) {
            --this.rightClickDelayTimer;
        }

        this.profiler.startSection("gui");

        if (!this.isGamePaused) {
            this.ingameGUI.tick();
        }

        this.profiler.endSection();
        this.gameRenderer.getMouseOver(1.0F);
        this.tutorial.onMouseHover(this.world, this.objectMouseOver);
        this.profiler.startSection("gameMode");

        if (!this.isGamePaused && this.world != null) {
            this.playerController.tick();
        }

        this.profiler.endStartSection("textures");

        if (this.world != null) {
            this.textureManager.tick();
        }

        if (this.currentScreen == null && this.player != null) {
            if (this.player.getShouldBeDead() && !(this.currentScreen instanceof DeathScreen)) {
                this.displayGuiScreen((Screen) null);
            } else if (this.player.isSleeping() && this.world != null) {
                this.displayGuiScreen(new SleepInMultiplayerScreen());
            }
        } else if (this.currentScreen != null && this.currentScreen instanceof SleepInMultiplayerScreen
                && !this.player.isSleeping()) {
            this.displayGuiScreen((Screen) null);
        }

        if (this.currentScreen != null) {
            this.leftClickCounter = 10000;
        }

        if (this.currentScreen != null) {
            Screen.wrapScreenError(() -> {
                this.currentScreen.tick();
            }, "Ticking screen", this.currentScreen.getClass().getCanonicalName());
        }

        if (!this.gameSettings.showDebugInfo) {
            this.ingameGUI.reset();
        }

        if (this.loadingGui == null && (this.currentScreen == null || this.currentScreen.passEvents)) {
            this.profiler.endStartSection("Keybindings");
            this.processKeyBinds();

            if (this.leftClickCounter > 0) {
                --this.leftClickCounter;
            }
        }

        if (this.world != null) {
            Felon.getInstance().getEventBus().post(player.tick);

            this.profiler.endStartSection("gameRenderer");

            if (!this.isGamePaused) {
                this.gameRenderer.tick();
            }

            this.profiler.endStartSection("levelRenderer");

            if (!this.isGamePaused) {
                this.worldRenderer.tick();
            }

            this.profiler.endStartSection("level");

            if (!this.isGamePaused) {
                if (this.world.getTimeLightningFlash() > 0) {
                    this.world.setTimeLightningFlash(this.world.getTimeLightningFlash() - 1);
                }

                this.world.tickEntities();
            }
        } else if (this.gameRenderer.getShaderGroup() != null) {
            this.gameRenderer.stopUseShader();
        }

        if (!this.isGamePaused) {
            this.musicTicker.tick();
        }

        this.soundHandler.tick(this.isGamePaused);

        if (this.world != null) {
            if (!this.isGamePaused) {
                if (!this.gameSettings.field_244601_E && this.func_244600_aM()) {
                    ITextComponent itextcomponent = new TranslationTextComponent("tutorial.socialInteractions.title");
                    ITextComponent itextcomponent1 = new TranslationTextComponent(
                            "tutorial.socialInteractions.description",
                            Tutorial.createKeybindComponent("socialInteractions"));
                    this.field_244598_aV = new TutorialToast(TutorialToast.Icons.SOCIAL_INTERACTIONS, itextcomponent,
                            itextcomponent1, true);
                    this.tutorial.func_244698_a(this.field_244598_aV, 160);
                    this.gameSettings.field_244601_E = true;
                    this.gameSettings.saveOptions();
                }

                this.tutorial.tick();

                try {
                    this.world.tick(() -> {
                        return true;
                    });
                } catch (Throwable throwable) {
                    CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Exception in world tick");

                    if (this.world == null) {
                        CrashReportCategory crashreportcategory = crashreport.makeCategory("Affected level");
                        crashreportcategory.addDetail("Problem", "Level is null!");
                    } else {
                        this.world.fillCrashReport(crashreport);
                    }

                    throw new ReportedException(crashreport);
                }
            }

            this.profiler.endStartSection("animateTick");

            if (!this.isGamePaused && this.world != null) {
                this.world.animateTick(MathHelper.floor(this.player.getPosX()), MathHelper.floor(this.player.getPosY()),
                        MathHelper.floor(this.player.getPosZ()));
            }

            this.profiler.endStartSection("particles");

            if (!this.isGamePaused) {
                this.particles.tick();
            }
        } else if (this.networkManager != null) {
            this.profiler.endStartSection("pendingConnection");
            this.networkManager.tick();
        }

        this.profiler.endStartSection("keyboard");
        this.keyboardListener.tick();
        this.profiler.endSection();
       
        ClientUtil.MainMenu();
       
    }
А тут ты должен заменить оригинальный runTick() на этот (или просто добавить в конец ClientUtil.MainMenu();)
это в Minecraft.java


!!!! Звук должен быть в формате .wav и находиться в папке с ассетами софта (Пример: src/assets/minecraft/expensive/sounds/MainMenu.wav) !!!!

Пожалуйста, авторизуйтесь для просмотра ссылки.
:seemsgood:
 
Сверху Снизу