Ver código fonte

Update ConfigManagerImpl

Signed-off-by: shedaniel <daniel@shedaniel.me>
shedaniel 4 anos atrás
pai
commit
db3f6528bf

+ 26 - 1
RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java

@@ -24,6 +24,7 @@
 package me.shedaniel.rei.impl;
 
 import com.google.common.collect.Lists;
+import com.google.common.io.BaseEncoding;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import com.google.gson.JsonElement;
@@ -45,10 +46,14 @@ import me.shedaniel.cloth.api.client.events.v0.ScreenHooks;
 import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
 import me.shedaniel.clothconfig2.api.Modifier;
 import me.shedaniel.clothconfig2.api.ModifierKeyCode;
+import me.shedaniel.clothconfig2.gui.GlobalizedClothConfigScreen;
 import me.shedaniel.clothconfig2.gui.entries.KeyCodeEntry;
 import me.shedaniel.clothconfig2.impl.EasingMethod;
 import me.shedaniel.rei.RoughlyEnoughItemsCore;
-import me.shedaniel.rei.api.*;
+import me.shedaniel.rei.api.ConfigManager;
+import me.shedaniel.rei.api.EntryRegistry;
+import me.shedaniel.rei.api.EntryStack;
+import me.shedaniel.rei.api.REIHelper;
 import me.shedaniel.rei.api.favorites.FavoriteEntry;
 import me.shedaniel.rei.gui.ContainerScreenOverlay;
 import me.shedaniel.rei.gui.TransformingScreen;
@@ -67,6 +72,7 @@ import net.fabricmc.loader.api.FabricLoader;
 import net.minecraft.Util;
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.Font;
+import net.minecraft.client.gui.components.AbstractButton;
 import net.minecraft.client.gui.components.Button;
 import net.minecraft.client.gui.screens.Screen;
 import net.minecraft.client.renderer.MultiBufferSource;
@@ -84,6 +90,7 @@ import org.apache.commons.lang3.mutable.MutableLong;
 import org.jetbrains.annotations.ApiStatus;
 
 import java.lang.reflect.Method;
+import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -264,6 +271,24 @@ public class ConfigManagerImpl implements ConfigManager {
                                 () -> 0,
                                 () -> Util.getMillis() - current.getValue() > 800));
                     }));
+                    LocalDateTime now = LocalDateTime.now();
+                    if (now.getMonthValue() == 12 && now.getDayOfMonth() >= 24 && now.getDayOfMonth() <= 26) {
+                        ((GlobalizedClothConfigScreen) screen).listWidget.bottom -= 10;
+                        ((ScreenHooks) screen).cloth$addButtonWidget(new AbstractButton(0, screen.height - 40, screen.width, 10, new TextComponent(new String(BaseEncoding.base64().decode("TWVycnkgQ2hyaXN0bWFz")))) {
+                            @Override
+                            public void onPress() { 
+                            }
+                            
+                            @Override
+                            public void renderButton(PoseStack poseStack, int i, int j, float f) {
+                                int color = this.active ? 16777215 : 10526880;
+                                Font font = Minecraft.getInstance().font;
+                                int centerX = this.x + this.width / 2 - font.width(getMessage()) / 2;
+                                int textY = this.y + (this.height - 8) / 2;
+                                font.drawShadow(poseStack, TextTransformations.applyRainbow(getMessage().getVisualOrderText(), centerX, textY), centerX, textY, color | Mth.ceil(this.alpha * 255.0F) << 24);
+                            }
+                        });
+                    }
                 }).setSavingRunnable(() -> {
                     saveConfig();
                     EntryRegistry.getInstance().refilter();

+ 1 - 1
gradle.properties

@@ -1,5 +1,5 @@
 org.gradle.jvmargs=-Xmx3G
-mod_version=5.8.9
+mod_version=5.8.10
 supported_version=1.16.2/3/4
 minecraft_version=1.16.4
 fabricloader_version=0.10.6+build.214