Skip to content

Commit

Permalink
New easter egg expXibao
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendrix-Shen committed Aug 8, 2022
1 parent 38cc59b commit beebf84
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
package top.hendrixshen.tweakmyclient;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import top.hendrixshen.magiclib.config.Option;
import top.hendrixshen.magiclib.dependency.annotation.OptionDependencyPredicate;
import top.hendrixshen.tweakmyclient.config.Configs;

import java.util.List;

public class TweakMyClientPredicate {
public static final List<String> xibaoLang = ImmutableList.of("lzh ", "zh_cn", "zh_hk", "zh_tw");

public static class AllowBreakAnimation implements OptionDependencyPredicate {
@Override
public boolean test(Option option) {
Expand All @@ -29,7 +35,15 @@ public boolean test(Option option) {
public static class ExperimentalMode implements OptionDependencyPredicate {
@Override
public boolean test(Option option) {
return Configs.debugExperimentalMode;
return Configs.debugExperimentalMode && Configs.debugMode;
}
}

public static class ExpXibao implements OptionDependencyPredicate {
@Override
public boolean test(Option option) {
return Configs.debugExperimentalMode && Configs.debugMode &&
TweakMyClientPredicate.xibaoLang.contains(TweakMyClient.getMinecraftClient().options.languageCode);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,9 @@ public class Configs {
@Config(category = ConfigCategory.DEBUG, dependencies = @Dependencies(and = @Dependency(value = "minecraft", versionPredicate = ">=1.17")), predicate = TweakMyClientPredicate.ExperimentalMode.class)
public static boolean expCustomBlockHitBoxOverlayLinkedAdapterSupportPointedDripstoneBlock = false;

@Config(category = ConfigCategory.DEBUG, predicate = TweakMyClientPredicate.ExpXibao.class)
public static boolean expXibao = false;

public static void initCallbacks(ConfigManager cm) {
// Set callback for all BooleanHotkeyed config.
/* TODO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import top.hendrixshen.tweakmyclient.TweakMyClient;
import top.hendrixshen.tweakmyclient.TweakMyClientPredicate;
import top.hendrixshen.tweakmyclient.config.Configs;
import top.hendrixshen.tweakmyclient.util.AutoReconnectUtil;

@Mixin(value = DisconnectedScreen.class, priority = 900)
Expand Down Expand Up @@ -44,4 +47,13 @@ private void onInitDisconnectedScreen(CallbackInfo ci) {
public void tick() {
AutoReconnectUtil.tickAutoReconnectButton(this.parent);
}

@Override
public void renderDirtBackground(int i) {
if (Configs.expXibao && TweakMyClientPredicate.xibaoLang.contains(TweakMyClient.getMinecraftClient().options.languageCode)) {
AutoReconnectUtil.renderXibao(this);
return;
}
super.renderDirtBackground(i);
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
package top.hendrixshen.tweakmyclient.util;

import com.google.common.collect.Maps;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.*;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.ConnectScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.multiplayer.resolver.ServerAddress;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.contents.TranslatableContents;
import net.minecraft.resources.ResourceLocation;
import top.hendrixshen.magiclib.compat.minecraft.blaze3d.vertex.VertexFormatCompatApi;
import top.hendrixshen.magiclib.compat.minecraft.network.chat.ComponentCompatApi;
import top.hendrixshen.tweakmyclient.TweakMyClient;
import top.hendrixshen.tweakmyclient.TweakMyClientReference;
Expand All @@ -20,6 +25,7 @@
import java.util.concurrent.atomic.AtomicInteger;

public class AutoReconnectUtil {
private static final ResourceLocation resourceLocation = new ResourceLocation(TweakMyClientReference.getModId(), "gui/disconnect/xibao.png");
public static int ReconnectTimer;
public static int reAuthenticateButtonOffsetY;
private static boolean initialized = false;
Expand All @@ -35,6 +41,28 @@ public static AutoReconnectUtil getInstance() {

private static final LinkedHashMap<String, Screen> modHashMap = Maps.newLinkedHashMap();

//#if MC < 11700
//$$ @SuppressWarnings("deprecation")
//#endif
public static void renderXibao(Screen screen) {
Tesselator tesselator = Tesselator.getInstance();
BufferBuilder bufferbuilder = tesselator.getBuilder();
//#if MC > 11605
RenderSystem.setShader(GameRenderer::getPositionTexColorShader);
RenderSystem.setShaderTexture(0, AutoReconnectUtil.resourceLocation);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
//#else
//$$ TweakMyClient.getMinecraftClient().getTextureManager().bind(AutoReconnectUtil.resourceLocation);
//$$ RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
//#endif
bufferbuilder.begin(VertexFormatCompatApi.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR);
bufferbuilder.vertex(0.0D, screen.height, 0.0D).uv(0F, 1F).color(255, 255, 255, 255).endVertex();
bufferbuilder.vertex(screen.width, screen.height, 0.0D).uv(1F, 1F).color(255, 255, 255, 255).endVertex();
bufferbuilder.vertex(screen.width, 0.0D, 0.0D).uv(1F, 0F).color(255, 255, 255, 255).endVertex();
bufferbuilder.vertex(0.0D, 0.0D, 0.0D).uv(0F, 0F).color(255, 255, 255, 255).endVertex();
tesselator.end();
}

private void init(Screen parent) {
if (TweakMyClientReference.isAuthMeLoaded) {
Screen screen = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import snownee.jade.overlay.DatapackBlockManager;
import snownee.jade.overlay.OverlayRenderer;
import snownee.jade.overlay.TooltipRenderer;
import snownee.jade.overlay.WailaTickHandler;
import top.hendrixshen.tweakmyclient.TweakMyClient;
import top.hendrixshen.tweakmyclient.mixin.accessor.PlayerTabOverlayAccessor;
//#endif
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/main/resources/assets/tweakmyclient/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@
"tweakmyclient.config.debug.debugExperimentalMode.comment": "Enable experimental functions.",
"tweakmyclient.config.debug.expCustomBlockHitBoxOverlayLinkedAdapterSupportPointedDripstoneBlock.name": "§eexpCustomBlockHitBoxOverlayLinkedAdapterSupportPointedDripstoneBlock",
"tweakmyclient.config.debug.expCustomBlockHitBoxOverlayLinkedAdapterSupportPointedDripstoneBlock.comment": "Experimental functions.",
"tweakmyclient.config.debug.expXibao.name": "§eexpXibao",
"tweakmyclient.config.debug.expXibao.comment": "Experimental functions.",

"tweakmyclient.label.autoDropListType.blackList": "Black List",
"tweakmyclient.label.autoDropListType.whiteList": "White List",
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/tweakmyclient/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@
"tweakmyclient.config.debug.debugExperimentalMode.comment": "启用实验性功能.",
"tweakmyclient.config.debug.expCustomBlockHitBoxOverlayLinkedAdapterSupportPointedDripstoneBlock.name": "§e自定义方块碰撞箱覆盖连接体方块适配支持滴水石锥",
"tweakmyclient.config.debug.expCustomBlockHitBoxOverlayLinkedAdapterSupportPointedDripstoneBlock.comment": "实验性功能.",
"tweakmyclient.config.debug.expXibao.name": "§e喜报",
"tweakmyclient.config.debug.expXibao.comment": "实验性功能.",

"tweakmyclient.label.autoDropListType.blackList": "黑名单",
"tweakmyclient.label.autoDropListType.whiteList": "白名单",
Expand Down

0 comments on commit beebf84

Please sign in to comment.