diff options
| author | shedaniel <daniel@shedaniel.me> | 2020-12-18 22:40:13 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2020-12-18 22:40:13 +0800 |
| commit | 71b927e69e5c69ec0e6855c183cf20202829d5eb (patch) | |
| tree | cf591d9123db11cad8a51adf599d73be74e0fcb7 /RoughlyEnoughItems-runtime/src/main | |
| parent | 739a78f33006716a288370524d96632d9e65a42b (diff) | |
| download | RoughlyEnoughItems-71b927e69e5c69ec0e6855c183cf20202829d5eb.tar.gz RoughlyEnoughItems-71b927e69e5c69ec0e6855c183cf20202829d5eb.tar.bz2 RoughlyEnoughItems-71b927e69e5c69ec0e6855c183cf20202829d5eb.zip | |
Update ConfigManagerImpl
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'RoughlyEnoughItems-runtime/src/main')
| -rw-r--r-- | RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java index d54f46d2e..33681066b 100644 --- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java +++ b/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(); |
