From 2d6b4fb04b1724f7c72f818b09026e45a793b646 Mon Sep 17 00:00:00 2001 From: froslanz Date: Fri, 30 Oct 2026 15:19:10 -0400 Subject: [PATCH] add NoRender module with entity/network hooks --- .../modules/render/NoRenderModule.java | 232 ++++++++++++++++++ .../java/cc/fros/manager/ModuleManager.java | 2 + .../entity/MixinClientLevelNoRender.java | 26 ++ .../mixin/entity/MixinEntityNoRender.java | 31 +++ .../entity/MixinLivingEntityNoRender.java | 20 ++ .../MixinClientPacketListenerNoRender.java | 22 ++ src/main/resources/fros.mixins.json | 4 + 7 files changed, 337 insertions(+) create mode 100644 src/main/java/cc/fros/features/modules/render/NoRenderModule.java create mode 100644 src/main/java/cc/fros/mixin/entity/MixinClientLevelNoRender.java create mode 100644 src/main/java/cc/fros/mixin/entity/MixinEntityNoRender.java create mode 100644 src/main/java/cc/fros/mixin/entity/MixinLivingEntityNoRender.java create mode 100644 src/main/java/cc/fros/mixin/network/MixinClientPacketListenerNoRender.java diff --git a/src/main/java/cc/fros/features/modules/render/NoRenderModule.java b/src/main/java/cc/fros/features/modules/render/NoRenderModule.java new file mode 100644 index 0000000..a2aaa1d --- /dev/null +++ b/src/main/java/cc/fros/features/modules/render/NoRenderModule.java @@ -0,0 +1,232 @@ +package cc.fros.features.modules.render; + +import cc.fros.features.modules.Module; +import cc.fros.features.settings.EntityListSetting; +import cc.fros.features.settings.Setting; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; + +import java.util.LinkedHashSet; +import java.util.Set; + +/** + * NoRender — disables various overlays, effects and world/entity rendering. + * Ported from Meteor's {@code NoRender}. + */ +public class NoRenderModule extends Module { + private static NoRenderModule INSTANCE; + + private final Setting page = mode("Page", Page.Overlay); + + // Overlay + private final Setting noPortalOverlay = bool("PortalOverlay", false); + private final Setting noSpyglassOverlay = bool("SpyglassOverlay", false); + private final Setting noNausea = bool("Nausea", false); + private final Setting noPumpkinOverlay = bool("PumpkinOverlay", false); + private final Setting noPowderedSnowOverlay = bool("PowderedSnowOverlay", false); + private final Setting noFireOverlay = bool("FireOverlay", false); + private final Setting noLiquidOverlay = bool("LiquidOverlay", false); + private final Setting noInWallOverlay = bool("InWallOverlay", false); + private final Setting noVignette = bool("Vignette", false); + private final Setting noGuiBackground = bool("GuiBackground", false); + private final Setting noTotemAnimation = bool("TotemAnimation", false); + private final Setting noParticles = bool("Particles", false); + private final Setting noEatParticles = bool("EatingParticles", false); + private final Setting noEnchantGlint = bool("EnchantGlint", false); + + // HUD + private final Setting noBossBar = bool("BossBar", false); + private final Setting noScoreboard = bool("Scoreboard", false); + private final Setting noCrosshair = bool("Crosshair", false); + private final Setting noTitle = bool("Title", false); + private final Setting noHeldItemName = bool("HeldItemName", false); + private final Setting noObfuscation = bool("Obfuscation", false); + private final Setting noPotionIcons = bool("PotionIcons", false); + private final Setting noMessageSignatureIndicator = bool("MessageSignatureIndicator", false); + + // World + private final Setting noWeather = bool("Weather", false); + private final Setting noWorldBorder = bool("WorldBorder", false); + private final Setting noBlindness = bool("Blindness", false); + private final Setting noDarkness = bool("Darkness", false); + private final Setting noFog = bool("Fog", false); + private final Setting noEnchTableBook = bool("EnchantTableBook", false); + private final Setting noSignText = bool("SignText", false); + private final Setting noBlockBreakOverlay = bool("BlockBreakOverlay", false); + private final Setting noBeaconBeams = bool("BeaconBeams", false); + private final Setting noFallingBlocks = bool("FallingBlocks", false); + private final Setting noCaveCulling = bool("CaveCulling", false); + private final Setting noMapMarkers = bool("MapMarkers", false); + private final Setting noMapContents = bool("MapContents", false); + private final Setting noFireworkExplosions = bool("FireworkExplosions", false); + private final Setting noBarrierInvis = bool("BarrierInvisibility", false); + private final Setting noTextureRotations = bool("TextureRotations", false); + + // Entity + private final Setting>> disabledEntities = register(new EntityListSetting("Entities", new LinkedHashSet<>())); + private final Setting dropSpawnPackets = bool("DropSpawnPackets", false); + private final Setting noArmor = bool("Armor", false); + private final Setting noElytra = bool("Elytra", false); + private final Setting noInvisibility = bool("Invisibility", false); + private final Setting noGlowing = bool("Glowing", false); + private final Setting noMobInSpawner = bool("SpawnerEntities", false); + private final Setting noDeadEntities = bool("DeadEntities", false); + private final Setting noNametags = bool("Nametags", false); + + public NoRenderModule() { + super("NoRender", "Disables certain animations, overlays and entity rendering.", Category.RENDER); + INSTANCE = this; + refreshVisibility(); + } + + private void refreshVisibility() { + noPortalOverlay.setVisibility(v -> on(Page.Overlay)); + noSpyglassOverlay.setVisibility(v -> on(Page.Overlay)); + noNausea.setVisibility(v -> on(Page.Overlay)); + noPumpkinOverlay.setVisibility(v -> on(Page.Overlay)); + noPowderedSnowOverlay.setVisibility(v -> on(Page.Overlay)); + noFireOverlay.setVisibility(v -> on(Page.Overlay)); + noLiquidOverlay.setVisibility(v -> on(Page.Overlay)); + noInWallOverlay.setVisibility(v -> on(Page.Overlay)); + noVignette.setVisibility(v -> on(Page.Overlay)); + noGuiBackground.setVisibility(v -> on(Page.Overlay)); + noTotemAnimation.setVisibility(v -> on(Page.Overlay)); + noParticles.setVisibility(v -> on(Page.Overlay)); + noEatParticles.setVisibility(v -> on(Page.Overlay)); + noEnchantGlint.setVisibility(v -> on(Page.Overlay)); + + noBossBar.setVisibility(v -> on(Page.Hud)); + noScoreboard.setVisibility(v -> on(Page.Hud)); + noCrosshair.setVisibility(v -> on(Page.Hud)); + noTitle.setVisibility(v -> on(Page.Hud)); + noHeldItemName.setVisibility(v -> on(Page.Hud)); + noObfuscation.setVisibility(v -> on(Page.Hud)); + noPotionIcons.setVisibility(v -> on(Page.Hud)); + noMessageSignatureIndicator.setVisibility(v -> on(Page.Hud)); + + noWeather.setVisibility(v -> on(Page.World)); + noWorldBorder.setVisibility(v -> on(Page.World)); + noBlindness.setVisibility(v -> on(Page.World)); + noDarkness.setVisibility(v -> on(Page.World)); + noFog.setVisibility(v -> on(Page.World)); + noEnchTableBook.setVisibility(v -> on(Page.World)); + noSignText.setVisibility(v -> on(Page.World)); + noBlockBreakOverlay.setVisibility(v -> on(Page.World)); + noBeaconBeams.setVisibility(v -> on(Page.World)); + noFallingBlocks.setVisibility(v -> on(Page.World)); + noCaveCulling.setVisibility(v -> on(Page.World)); + noMapMarkers.setVisibility(v -> on(Page.World)); + noMapContents.setVisibility(v -> on(Page.World)); + noFireworkExplosions.setVisibility(v -> on(Page.World)); + noBarrierInvis.setVisibility(v -> on(Page.World)); + noTextureRotations.setVisibility(v -> on(Page.World)); + + disabledEntities.setVisibility(v -> on(Page.Entity)); + dropSpawnPackets.setVisibility(v -> on(Page.Entity)); + noArmor.setVisibility(v -> on(Page.Entity)); + noElytra.setVisibility(v -> on(Page.Entity)); + noInvisibility.setVisibility(v -> on(Page.Entity)); + noGlowing.setVisibility(v -> on(Page.Entity)); + noMobInSpawner.setVisibility(v -> on(Page.Entity)); + noDeadEntities.setVisibility(v -> on(Page.Entity)); + noNametags.setVisibility(v -> on(Page.Entity)); + } + + private boolean on(Page p) { + return page.getValue() == p; + } + + public static NoRenderModule get() { + return INSTANCE; + } + + public static boolean isActive() { + return INSTANCE != null && INSTANCE.isEnabled(); + } + + // --- Overlay getters --- + + public boolean noPortalOverlay() { return isActive() && noPortalOverlay.getValue(); } + public boolean noSpyglassOverlay() { return isActive() && noSpyglassOverlay.getValue(); } + public boolean noNausea() { return isActive() && noNausea.getValue(); } + public boolean noPumpkinOverlay() { return isActive() && noPumpkinOverlay.getValue(); } + public boolean noPowderedSnowOverlay() { return isActive() && noPowderedSnowOverlay.getValue(); } + public boolean noFireOverlay() { return isActive() && noFireOverlay.getValue(); } + public boolean noLiquidOverlay() { return isActive() && noLiquidOverlay.getValue(); } + public boolean noInWallOverlay() { return isActive() && noInWallOverlay.getValue(); } + public boolean noVignette() { return isActive() && noVignette.getValue(); } + public boolean noGuiBackground() { return isActive() && noGuiBackground.getValue(); } + public boolean noTotemAnimation() { return isActive() && noTotemAnimation.getValue(); } + public boolean noParticles() { return isActive() && noParticles.getValue(); } + public boolean noEatParticles() { return isActive() && noEatParticles.getValue(); } + public boolean noEnchantGlint() { return isActive() && noEnchantGlint.getValue(); } + + // --- HUD getters --- + + public boolean noBossBar() { return isActive() && noBossBar.getValue(); } + public boolean noScoreboard() { return isActive() && noScoreboard.getValue(); } + public boolean noCrosshair() { return isActive() && noCrosshair.getValue(); } + public boolean noTitle() { return isActive() && noTitle.getValue(); } + public boolean noHeldItemName() { return isActive() && noHeldItemName.getValue(); } + public boolean noObfuscation() { return isActive() && noObfuscation.getValue(); } + public boolean noPotionIcons() { return isActive() && noPotionIcons.getValue(); } + public boolean noMessageSignatureIndicator() { return isActive() && noMessageSignatureIndicator.getValue(); } + + // --- World getters --- + + public boolean noWeather() { return isActive() && noWeather.getValue(); } + public boolean noWorldBorder() { return isActive() && noWorldBorder.getValue(); } + public boolean noBlindness() { return isActive() && noBlindness.getValue(); } + public boolean noDarkness() { return isActive() && noDarkness.getValue(); } + public boolean noFog() { return isActive() && noFog.getValue(); } + public boolean noEnchTableBook() { return isActive() && noEnchTableBook.getValue(); } + public boolean noSignText() { return isActive() && noSignText.getValue(); } + public boolean noBlockBreakOverlay() { return isActive() && noBlockBreakOverlay.getValue(); } + public boolean noBeaconBeams() { return isActive() && noBeaconBeams.getValue(); } + public boolean noFallingBlocks() { return isActive() && noFallingBlocks.getValue(); } + public boolean noCaveCulling() { return isActive() && noCaveCulling.getValue(); } + public boolean noMapMarkers() { return isActive() && noMapMarkers.getValue(); } + public boolean noMapContents() { return isActive() && noMapContents.getValue(); } + public boolean noFireworkExplosions() { return isActive() && noFireworkExplosions.getValue(); } + public boolean noBarrierInvis() { return isActive() && noBarrierInvis.getValue(); } + public boolean noTextureRotations() { return isActive() && noTextureRotations.getValue(); } + + // --- Entity getters --- + + public boolean noArmor() { return isActive() && noArmor.getValue(); } + public boolean noElytra() { return isActive() && noElytra.getValue(); } + public boolean noInvisibility() { return isActive() && noInvisibility.getValue(); } + public boolean noGlowing() { return isActive() && noGlowing.getValue(); } + public boolean noMobInSpawner() { return isActive() && noMobInSpawner.getValue(); } + public boolean noDeadEntities() { return isActive() && noDeadEntities.getValue(); } + public boolean noNametags() { return isActive() && noNametags.getValue(); } + public Set> disabledEntities() { return disabledEntities.getValue(); } + public boolean dropSpawnPackets() { return isActive() && dropSpawnPackets.getValue(); } + + /** True when the given entity type is ticked off in the {@code Entities} list. */ + public boolean noEntity(EntityType type) { return isActive() && type != null && disabledEntities.getValue().contains(type); } + + /** True when this specific entity is ticked off in the {@code Entities} list. */ + public boolean noEntity(Entity entity) { return entity != null && noEntity(entity.getType()); } + + @Override + public void onEnable() { + if (noCaveCulling.getValue() || noTextureRotations.getValue()) { + mc.levelRenderer.allChanged(); + } + } + + @Override + public void onDisable() { + if (noCaveCulling.getValue() || noTextureRotations.getValue()) { + mc.levelRenderer.allChanged(); + } + } + + private enum Page { + Overlay, + Hud, + World, + Entity + } +} diff --git a/src/main/java/cc/fros/manager/ModuleManager.java b/src/main/java/cc/fros/manager/ModuleManager.java index ebcef67..41910b1 100644 --- a/src/main/java/cc/fros/manager/ModuleManager.java +++ b/src/main/java/cc/fros/manager/ModuleManager.java @@ -52,6 +52,7 @@ import cc.fros.features.modules.render.BlockHighlightModule; import cc.fros.features.modules.render.ChamsModule; import cc.fros.features.modules.render.FullbrightModule; import cc.fros.features.modules.render.NametagsModule; +import cc.fros.features.modules.render.NoRenderModule; import cc.fros.util.traits.Jsonable; import cc.fros.util.traits.Util; import org.slf4j.Logger; @@ -100,6 +101,7 @@ public class ModuleManager implements Jsonable, Util { register(new BlockHighlightModule()); register(new FullbrightModule()); register(new NametagsModule()); + register(new NoRenderModule()); register(new ChamsModule()); register(new NoFallModule()); register(new KeyPearlModule()); diff --git a/src/main/java/cc/fros/mixin/entity/MixinClientLevelNoRender.java b/src/main/java/cc/fros/mixin/entity/MixinClientLevelNoRender.java new file mode 100644 index 0000000..f56495d --- /dev/null +++ b/src/main/java/cc/fros/mixin/entity/MixinClientLevelNoRender.java @@ -0,0 +1,26 @@ +package cc.fros.mixin.entity; + +import cc.fros.features.modules.render.NoRenderModule; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.world.level.block.Blocks; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyArgs; +import org.spongepowered.asm.mixin.injection.invoke.arg.Args; + +/** + * NoRender "BarrierInvisibility": vanilla only outlines barrier blocks when you are holding one in + * creative (the marker particle target comes from {@code getMarkerParticleTarget}). Forcing that + * target to barriers draws the outline particle on every barrier regardless of what is held, so + * barriers are effectively visible. + */ +@Mixin(ClientLevel.class) +public abstract class MixinClientLevelNoRender { + @ModifyArgs(method = "animateTick", at = @At(value = "INVOKE", + target = "Lnet/minecraft/client/multiplayer/ClientLevel;doAnimateTick(IIIILnet/minecraft/util/RandomSource;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/core/BlockPos$MutableBlockPos;)V")) + private void noBarrierInvisibility(Args args) { + if (NoRenderModule.isActive() && NoRenderModule.get().noBarrierInvis()) { + args.set(5, Blocks.BARRIER); + } + } +} diff --git a/src/main/java/cc/fros/mixin/entity/MixinEntityNoRender.java b/src/main/java/cc/fros/mixin/entity/MixinEntityNoRender.java new file mode 100644 index 0000000..8b17f9c --- /dev/null +++ b/src/main/java/cc/fros/mixin/entity/MixinEntityNoRender.java @@ -0,0 +1,31 @@ +package cc.fros.mixin.entity; + +import cc.fros.features.modules.render.NoRenderModule; +import com.llamalad7.mixinextras.injector.ModifyReturnValue; +import net.minecraft.world.entity.Entity; +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.CallbackInfoReturnable; + +import static cc.fros.util.traits.Util.mc; + +@Mixin(Entity.class) +public class MixinEntityNoRender { + /** NoRender: the glowing outline pass keys off this — report "not glowing" to drop it. */ + @Inject(method = "isCurrentlyGlowing", at = @At("HEAD"), cancellable = true) + private void noGlowing(CallbackInfoReturnable cir) { + if (NoRenderModule.isActive() && NoRenderModule.get().noGlowing()) cir.setReturnValue(false); + } + + /** + * NoRender "Invisibility": what an invisible entity looks like to a viewer. Reporting false + * renders it fully opaque instead of the translucent-nothing vanilla uses. + */ + @ModifyReturnValue(method = "isInvisibleTo", at = @At("RETURN")) + private boolean noInvisibility(boolean original) { + if (!original) return original; + if (mc.level == null) return original; + return NoRenderModule.isActive() && NoRenderModule.get().noInvisibility() ? false : original; + } +} diff --git a/src/main/java/cc/fros/mixin/entity/MixinLivingEntityNoRender.java b/src/main/java/cc/fros/mixin/entity/MixinLivingEntityNoRender.java new file mode 100644 index 0000000..52b9083 --- /dev/null +++ b/src/main/java/cc/fros/mixin/entity/MixinLivingEntityNoRender.java @@ -0,0 +1,20 @@ +package cc.fros.mixin.entity; + +import cc.fros.features.modules.render.NoRenderModule; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +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; + +@Mixin(LivingEntity.class) +public abstract class MixinLivingEntityNoRender { + // NoRender "EatingParticles": the crumbs that spray off food / potions while they are used + @Inject(method = "spawnItemParticles", at = @At("HEAD"), cancellable = true) + private void noEatParticles(ItemStack stack, int count, CallbackInfo ci) { + if (NoRenderModule.isActive() && NoRenderModule.get().noEatParticles()) { + ci.cancel(); + } + } +} diff --git a/src/main/java/cc/fros/mixin/network/MixinClientPacketListenerNoRender.java b/src/main/java/cc/fros/mixin/network/MixinClientPacketListenerNoRender.java new file mode 100644 index 0000000..9353a51 --- /dev/null +++ b/src/main/java/cc/fros/mixin/network/MixinClientPacketListenerNoRender.java @@ -0,0 +1,22 @@ +package cc.fros.mixin.network; + +import cc.fros.features.modules.render.NoRenderModule; +import net.minecraft.client.multiplayer.ClientPacketListener; +import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; +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; + +@Mixin(ClientPacketListener.class) +public class MixinClientPacketListenerNoRender { + // NoRender "DropSpawnPackets": never even spawn the selected entity types client-side, so they + // stay absent from the world (and from nametags/ESP/hitboxes) instead of merely invisible. + @Inject(method = "handleAddEntity", at = @At("HEAD"), cancellable = true) + private void dropSpawnPacket(ClientboundAddEntityPacket packet, CallbackInfo ci) { + if (NoRenderModule.isActive() && NoRenderModule.get().dropSpawnPackets() + && NoRenderModule.get().noEntity(packet.getType())) { + ci.cancel(); + } + } +} diff --git a/src/main/resources/fros.mixins.json b/src/main/resources/fros.mixins.json index 5ac4e70..fb18ad6 100644 --- a/src/main/resources/fros.mixins.json +++ b/src/main/resources/fros.mixins.json @@ -10,10 +10,14 @@ "entity.ColorParticleOptionAccessor", "entity.LivingEntityEffectParticlesAccessor", "entity.MixinAbstractClientPlayer", + "entity.MixinClientLevelNoRender", "entity.MixinClientPlayerEntity", + "entity.MixinEntityNoRender", + "entity.MixinLivingEntityNoRender", "input.MixinKeyboardHandler", "input.MixinMouseHandler", "network.MixinClientPacketListener", + "network.MixinClientPacketListenerNoRender", "render.MixinAvatarRenderer", "render.MixinChatComponent", "render.MixinDeltaTrackerTimer",