diff --git a/src/main/java/top/hendrixshen/tweakmyclient/config/Configs.java b/src/main/java/top/hendrixshen/tweakmyclient/config/Configs.java index 8d769335..424ffaab 100644 --- a/src/main/java/top/hendrixshen/tweakmyclient/config/Configs.java +++ b/src/main/java/top/hendrixshen/tweakmyclient/config/Configs.java @@ -14,10 +14,7 @@ import top.hendrixshen.tweakmyclient.TweakMyClientPredicate; import top.hendrixshen.tweakmyclient.event.CallBacks; import top.hendrixshen.tweakmyclient.fakeInterface.IMinecraft; -import top.hendrixshen.tweakmyclient.helper.AutoDropListType; -import top.hendrixshen.tweakmyclient.helper.BreakAnimationMode; -import top.hendrixshen.tweakmyclient.helper.EnderPortalRenderMode; -import top.hendrixshen.tweakmyclient.helper.TargetBlockPositionPrintMode; +import top.hendrixshen.tweakmyclient.helper.*; import top.hendrixshen.tweakmyclient.util.CustomWindowUtil; import java.util.ArrayList; @@ -35,6 +32,9 @@ public class Configs { @Config(category = ConfigCategory.GENERIC, predicate = TweakMyClientPredicate.AllowBreakAnimation.class) public static BreakAnimationMode breakAnimationMode = BreakAnimationMode.NONE; + @Config(category = ConfigCategory.GENERIC) + public static CrystalBeamsDisableMode crystalBeamsDisableMode = CrystalBeamsDisableMode.ALL; + @Config(category = ConfigCategory.GENERIC) public static boolean customBlockHitBoxOverlayDisableDepthTest = false; @@ -242,10 +242,6 @@ public class Configs { public static boolean featureUnfocusedCPU = false; // Disable configs - @Hotkey() - @Config(category = ConfigCategory.DISABLE) - public static boolean disableCrystalBeams = false; - @Hotkey() @Config(category = ConfigCategory.DISABLE) public static boolean disableAttackEntity = false; @@ -286,6 +282,10 @@ public class Configs { @Config(category = ConfigCategory.DISABLE) public static boolean disableClientEntityZombieVillagerRendering = false; + @Hotkey() + @Config(category = ConfigCategory.DISABLE) + public static boolean disableCrystalBeams = false; + @Hotkey() @Config(category = ConfigCategory.DISABLE) public static boolean disableFovAffectedBySpeed = false; diff --git a/src/main/java/top/hendrixshen/tweakmyclient/helper/CrystalBeamsDisableMode.java b/src/main/java/top/hendrixshen/tweakmyclient/helper/CrystalBeamsDisableMode.java new file mode 100644 index 00000000..86f595fd --- /dev/null +++ b/src/main/java/top/hendrixshen/tweakmyclient/helper/CrystalBeamsDisableMode.java @@ -0,0 +1,52 @@ +package top.hendrixshen.tweakmyclient.helper; + +import fi.dy.masa.malilib.config.IConfigOptionListEntry; +import top.hendrixshen.tweakmyclient.util.StringUtil; + +public enum CrystalBeamsDisableMode implements IConfigOptionListEntry { + ALL("all"), + FIXED("fixed"), + TRACKING("tracking"); + + private final String name; + + CrystalBeamsDisableMode(String name) { + this.name = name; + } + + @Override + public String getStringValue() { + return this.name; + } + + @Override + public String getDisplayName() { + return StringUtil.tr(String.format("label.crystalBeamsDisableMode.%s", this.name)); + } + + @Override + public IConfigOptionListEntry cycle(boolean forward) { + int id = this.ordinal(); + + if (forward) { + if (++id >= values().length) { + id = 0; + } + } else { + if (--id < 0) { + id = values().length - 1; + } + } + return values()[id % values().length]; + } + + @Override + public IConfigOptionListEntry fromString(String value) { + for (CrystalBeamsDisableMode mode : CrystalBeamsDisableMode.values()) { + if (mode.name.equalsIgnoreCase(value)) { + return mode; + } + } + return CrystalBeamsDisableMode.ALL; + } +} diff --git a/src/main/java/top/hendrixshen/tweakmyclient/mixin/disable/disableCrystalBeams/MixinEndCrystalRenderer.java b/src/main/java/top/hendrixshen/tweakmyclient/mixin/disable/disableCrystalBeams/MixinEndCrystalRenderer.java index cc7cc008..1588a272 100644 --- a/src/main/java/top/hendrixshen/tweakmyclient/mixin/disable/disableCrystalBeams/MixinEndCrystalRenderer.java +++ b/src/main/java/top/hendrixshen/tweakmyclient/mixin/disable/disableCrystalBeams/MixinEndCrystalRenderer.java @@ -18,6 +18,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import top.hendrixshen.tweakmyclient.config.Configs; +import top.hendrixshen.tweakmyclient.helper.CrystalBeamsDisableMode; @Mixin(EndCrystalRenderer.class) public abstract class MixinEndCrystalRenderer extends EntityRenderer { @@ -52,6 +53,10 @@ private void onRenderCrystalBeams(EndCrystal endCrystal, float f, float g, PoseS //$$ private void onRenderCrystalBeams(EndCrystal endCrystal, double d, double e, double f, float g, float h, CallbackInfo ci) { //#endif if (Configs.disableCrystalBeams) { + if (Configs.crystalBeamsDisableMode == CrystalBeamsDisableMode.TRACKING) { + return; + } + //#if MC >= 11500 super.render(endCrystal, f, g, poseStack, multiBufferSource, i); //#else diff --git a/src/main/java/top/hendrixshen/tweakmyclient/mixin/disable/disableCrystalBeams/MixinEnderDragonRenderer.java b/src/main/java/top/hendrixshen/tweakmyclient/mixin/disable/disableCrystalBeams/MixinEnderDragonRenderer.java new file mode 100644 index 00000000..6d3b3a82 --- /dev/null +++ b/src/main/java/top/hendrixshen/tweakmyclient/mixin/disable/disableCrystalBeams/MixinEnderDragonRenderer.java @@ -0,0 +1,68 @@ +package top.hendrixshen.tweakmyclient.mixin.disable.disableCrystalBeams; + +//#if MC >= 11500 +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.renderer.MultiBufferSource; +//#endif +import net.minecraft.client.renderer.entity.EnderDragonRenderer; +//#if MC < 11700 +//$$ import net.minecraft.client.renderer.entity.EntityRenderDispatcher; +//#endif +import net.minecraft.client.renderer.entity.EntityRenderer; +//#if MC >= 11700 +import net.minecraft.client.renderer.entity.EntityRendererProvider; +//#endif +import net.minecraft.world.entity.boss.enderdragon.EnderDragon; +import org.spongepowered.asm.mixin.Mixin; +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.config.Configs; +import top.hendrixshen.tweakmyclient.helper.CrystalBeamsDisableMode; + +@Mixin(EnderDragonRenderer.class) +public abstract class MixinEnderDragonRenderer extends EntityRenderer { + //#if MC >= 11700 + protected MixinEnderDragonRenderer(EntityRendererProvider.Context context) { + super(context); + //#else + //$$ protected MixinEnderDragonRenderer(EntityRenderDispatcher entityRenderDispatcher) { + //$$ super(entityRenderDispatcher); + //#endif + } + + @Inject( + //#if MC >= 11500 + method = "render(Lnet/minecraft/world/entity/boss/enderdragon/EnderDragon;FFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V", + //#else + //$$ method = "render(Lnet/minecraft/world/entity/boss/enderdragon/EnderDragon;DDDFF)V", + //#endif + at = @At( + value = "INVOKE", + //#if MC >= 11500 + target = "Lnet/minecraft/client/renderer/entity/EnderDragonRenderer;renderCrystalBeams(FFFFILcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V" + //#else + //$$ target = "Lnet/minecraft/client/renderer/entity/EnderDragonRenderer;renderCrystalBeams(DDDFDDDIDDD)V" + //#endif + ), + cancellable = true + ) + //#if MC >= 11500 + private void onRenderCrystalBeams(EnderDragon enderDragon, float f, float g, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, CallbackInfo ci) { + //#else + //$$ private void onRenderCrystalBeams(EnderDragon enderDragon, double d, double e, double f, float g, float h, CallbackInfo ci) { + //#endif + if (Configs.disableCrystalBeams) { + if (Configs.crystalBeamsDisableMode == CrystalBeamsDisableMode.FIXED) { + return; + } + //#if MC >= 11500 + + poseStack.popPose(); + super.render(enderDragon, f, g, poseStack, multiBufferSource, i); + + //#endif + ci.cancel(); + } + } +} diff --git a/src/main/resources/assets/tweakmyclient/lang/en_us.json b/src/main/resources/assets/tweakmyclient/lang/en_us.json index bf959afc..f19023a7 100644 --- a/src/main/resources/assets/tweakmyclient/lang/en_us.json +++ b/src/main/resources/assets/tweakmyclient/lang/en_us.json @@ -27,8 +27,6 @@ "tweakmyclient.config.color.colorWaterShallow.name": "colorWaterShallow", "tweakmyclient.config.color.colorWaterShallow.comment": "openWaterHelper open shallow outline color.", - "tweakmyclient.config.disable.disableCrystalBeams.name": "disableCrystalBeams", - "tweakmyclient.config.disable.disableCrystalBeams.comment": "Disable rendering of EndCrystal Beams on client.", "tweakmyclient.config.disable.disableAttackEntity.name": "disableAttackEntity", "tweakmyclient.config.disable.disableAttackEntity.comment": "Disable attacks on entities in the list.", "tweakmyclient.config.disable.disableClientBlockEvents.name": "disableClientBlockEvents", @@ -49,6 +47,8 @@ "tweakmyclient.config.disable.disableClientEntityWitherRendering.comment": "Disable wither entity rendering on the client.\nMaybe it's useful for fake peace.", "tweakmyclient.config.disable.disableClientEntityZombieVillagerRendering.name": "disableClientEntityZombieVillagerRendering", "tweakmyclient.config.disable.disableClientEntityZombieVillagerRendering.comment": "Disable zombie villager entity rendering on the client.\nMaybe it's useful for fake peace.", + "tweakmyclient.config.disable.disableCrystalBeams.name": "disableCrystalBeams", + "tweakmyclient.config.disable.disableCrystalBeams.comment": "Disable rendering of EndCrystal Beams on client.", "tweakmyclient.config.disable.disableFovAffectedBySpeed.name": "disableFovAffectedBySpeed", "tweakmyclient.config.disable.disableFovAffectedBySpeed.comment": "Disable speed multiplier effect fov transform.", "tweakmyclient.config.disable.disableGuiShadowLayer.name": "disableGuiShadowLayer", @@ -111,6 +111,8 @@ "tweakmyclient.config.generic.autoReconnectTimer.comment": "How many seconds to wait for auto reconnection.", "tweakmyclient.config.generic.breakAnimationMode.name": "breakAnimationMode", "tweakmyclient.config.generic.breakAnimationMode.comment": "For customBlockHitBoxOverlay digging animations, it is highly recommended to enable customBlockHitBoxOverlayDisableDepthTest.\nDown - As the excavation progresses, the size of the boxes of customBlockHitBoxOverlay slowly decreases from top to bottom.\nNone - No animation.\nShrink - As the excavation proceeds, the size of the boxes of customBlockHitBoxOverlay slowly shrink from the outside inwards. This option needs to be enabled for customBlockHitBoxOverlayDisableDepthTest to work properly", + "tweakmyclient.config.generic.crystalBeamsDisableMode.name": "crystalBeamsDisableMode", + "tweakmyclient.config.generic.crystalBeamsDisableMode.comment": "Select which mode of EndCrystal Beams to disable.\nALL - No beams will be rendered.\nFixed - Disable only the beams pointing to the specified coordinates.\nTracking - Only the beams closest to the EndDragon is disabled.", "tweakmyclient.config.generic.customBlockHitBoxOverlayDisableDepthTest.name": "customBlockHitBoxOverlayDisableDepthTest", "tweakmyclient.config.generic.customBlockHitBoxOverlayDisableDepthTest.comment": "Disable the depth test when rendering blockHitBoxOverlayFill and blockHitBoxOverlayOutline, which will not operate on occlusion relations. The general experience is better when breakAnimationMode is not None.", "tweakmyclient.config.generic.customBlockHitBoxOverlayFillRainbow.name": "customBlockHitBoxOverlayFillRainbow", @@ -195,6 +197,9 @@ "tweakmyclient.label.autoDropListType.blackList": "Black List", "tweakmyclient.label.autoDropListType.whiteList": "White List", + "tweakmyclient.label.crystalBeamsDisableMode.all": "All", + "tweakmyclient.label.crystalBeamsDisableMode.fixed": "Fixed", + "tweakmyclient.label.crystalBeamsDisableMode.tracking": "Tracking", "tweakmyclient.label.breakAnimationMode.down": "Down", "tweakmyclient.label.breakAnimationMode.none": "None", "tweakmyclient.label.breakAnimationMode.shrink": "Shrink", diff --git a/src/main/resources/assets/tweakmyclient/lang/zh_cn.json b/src/main/resources/assets/tweakmyclient/lang/zh_cn.json index bed224b6..0eaaf7be 100644 --- a/src/main/resources/assets/tweakmyclient/lang/zh_cn.json +++ b/src/main/resources/assets/tweakmyclient/lang/zh_cn.json @@ -27,8 +27,6 @@ "tweakmyclient.config.color.colorWaterShallow.name": "潜水域颜色", "tweakmyclient.config.color.colorWaterShallow.comment": "开阔水域助手潜水域轮廓颜色.", - "tweakmyclient.config.disable.disableCrystalBeams.name": "禁用水晶光柱", - "tweakmyclient.config.disable.disableCrystalBeams.comment": "关闭客户端侧末影水晶光柱渲染.", "tweakmyclient.config.disable.disableAttackEntity.name": "禁用实体攻击", "tweakmyclient.config.disable.disableAttackEntity.comment": "禁用攻击在列表中的实体.", "tweakmyclient.config.disable.disableClientBlockEvents.name": "禁用客户端侧方块事件", @@ -49,6 +47,8 @@ "tweakmyclient.config.disable.disableClientEntityWitherRendering.comment": "关闭游戏对凋零实体的渲染.\n也许对伪和平有帮助.", "tweakmyclient.config.disable.disableClientEntityZombieVillagerRendering.name": "禁用僵尸村民实体渲染", "tweakmyclient.config.disable.disableClientEntityZombieVillagerRendering.comment": "关闭游戏对僵尸村民实体的渲染.\n也许对伪和平有帮助.", + "tweakmyclient.config.disable.disableCrystalBeams.name": "禁用水晶光柱", + "tweakmyclient.config.disable.disableCrystalBeams.comment": "关闭客户端侧末影水晶光柱渲染.", "tweakmyclient.config.disable.disableFovAffectedBySpeed.name": "禁用速度倍率影响视角", "tweakmyclient.config.disable.disableFovAffectedBySpeed.comment": "关闭速度倍率对视角变换的影响.", "tweakmyclient.config.disable.disableGuiShadowLayer.name": "禁用GUI阴影层", @@ -111,6 +111,8 @@ "tweakmyclient.config.generic.autoReconnectTimer.comment": "等待多少秒后自动重连.", "tweakmyclient.config.generic.breakAnimationMode.name": "挖掘动画", "tweakmyclient.config.generic.breakAnimationMode.comment": "适用于 自定义方块碰撞箱覆盖 的挖掘动画, 强烈建议启用 自定义方块碰撞箱覆盖禁用深度测试.\n下降 - 随着挖掘的进行, 自定义方块碰撞箱覆盖 的方盒尺寸自上而下缓慢递减.\n无 - 无动画.\n收缩 - 随着挖掘的进行, 自定义方块碰撞箱覆盖 的方盒尺寸自外向内缓慢收缩. 该选项需要启用 自定义方块碰撞箱覆盖禁用深度测试 才能正常工作", + "tweakmyclient.config.generic.crystalBeamsDisableMode.name": "水晶光柱禁用模式", + "tweakmyclient.config.generic.crystalBeamsDisableMode.comment": "选择禁用哪种模式的末影水晶光柱.\n全部 - 不会渲染任何光柱.\n固定 - 只禁用指向指定坐标的光柱.\n追踪 - 只禁用与末影龙相距最近的光柱.", "tweakmyclient.config.generic.customBlockHitBoxOverlayDisableDepthTest.name": "自定义方块碰撞箱覆盖禁用深度测试", "tweakmyclient.config.generic.customBlockHitBoxOverlayDisableDepthTest.comment": "禁用渲染 方块碰撞箱覆盖填充 和 方块碰撞箱覆盖轮廓 时的深度测试, 这将不会运算遮挡关系. 一般的在 挖掘动画 不为 Vanilla 时体验更佳.", "tweakmyclient.config.generic.customBlockHitBoxOverlayFillRainbow.name": "自定义方块碰撞箱覆盖填充彩虹色", @@ -198,6 +200,9 @@ "tweakmyclient.label.breakAnimationMode.down": "下降", "tweakmyclient.label.breakAnimationMode.none": "无", "tweakmyclient.label.breakAnimationMode.shrink": "收缩", + "tweakmyclient.label.crystalBeamsDisableMode.all": "全部", + "tweakmyclient.label.crystalBeamsDisableMode.fixed": "固定", + "tweakmyclient.label.crystalBeamsDisableMode.tracking": "追踪", "tweakmyclient.label.enderPortalRenderMode.actual": "实际的", "tweakmyclient.label.enderPortalRenderMode.full": "完整的", "tweakmyclient.label.enderPortalRenderMode.legacy": "旧版的", diff --git a/src/main/resources/tweakmyclient.mixins.json b/src/main/resources/tweakmyclient.mixins.json index df410258..ef624ee3 100644 --- a/src/main/resources/tweakmyclient.mixins.json +++ b/src/main/resources/tweakmyclient.mixins.json @@ -13,6 +13,7 @@ "disable.disableClientEntityRendering.MixinEntityRenderDispatcher", "disable.disableClientEntityUpdates.MixinLevel", "disable.disableCrystalBeams.MixinEndCrystalRenderer", + "disable.disableCrystalBeams.MixinEnderDragonRenderer", "disable.disableFovAffectedBySpeed.MixinGameRenderer", "disable.disableGuiShadowLayer.MixinScreen", "disable.disableItemGlowing.MixinItemStack",