ConfigReloadingScreen.java 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * This file is licensed under the MIT License, part of Roughly Enough Items.
  3. * Copyright (c) 2018, 2019, 2020 shedaniel
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6. * of this software and associated documentation files (the "Software"), to deal
  7. * in the Software without restriction, including without limitation the rights
  8. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. * copies of the Software, and to permit persons to whom the Software is
  10. * furnished to do so, subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be included in all
  13. * copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  21. * SOFTWARE.
  22. */
  23. package me.shedaniel.rei.gui;
  24. import me.shedaniel.rei.api.RecipeHelper;
  25. import net.minecraft.client.gui.screen.Screen;
  26. import net.minecraft.client.resource.language.I18n;
  27. import net.minecraft.client.util.NarratorManager;
  28. import net.minecraft.util.Util;
  29. import org.jetbrains.annotations.ApiStatus;
  30. @ApiStatus.Internal
  31. public class ConfigReloadingScreen extends Screen {
  32. private Screen parent;
  33. public ConfigReloadingScreen(Screen parent) {
  34. super(NarratorManager.EMPTY);
  35. this.parent = parent;
  36. }
  37. @Override
  38. public boolean shouldCloseOnEsc() {
  39. return false;
  40. }
  41. @Override
  42. public void render(int int_1, int int_2, float float_1) {
  43. this.renderDirtBackground(0);
  44. if (!RecipeHelper.getInstance().arePluginsLoading())
  45. minecraft.openScreen(parent);
  46. this.drawCenteredString(this.font, I18n.translate("text.rei.config.is.reloading"), this.width / 2, this.height / 2 - 50, 16777215);
  47. String string_3;
  48. switch ((int) (Util.getMeasuringTimeMs() / 300L % 4L)) {
  49. case 0:
  50. default:
  51. string_3 = "O o o";
  52. break;
  53. case 1:
  54. case 3:
  55. string_3 = "o O o";
  56. break;
  57. case 2:
  58. string_3 = "o o O";
  59. }
  60. this.drawCenteredString(this.font, string_3, this.width / 2, this.height / 2 - 41, 8421504);
  61. super.render(int_1, int_2, float_1);
  62. }
  63. @Override
  64. public boolean isPauseScreen() {
  65. return false;
  66. }
  67. }