add NoRender module with entity/network hooks

This commit is contained in:
froslanz
2026-10-30 15:19:10 -04:00
parent 06386c9bbc
commit 2d6b4fb04b
7 changed files with 337 additions and 0 deletions
@@ -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> page = mode("Page", Page.Overlay);
// Overlay
private final Setting<Boolean> noPortalOverlay = bool("PortalOverlay", false);
private final Setting<Boolean> noSpyglassOverlay = bool("SpyglassOverlay", false);
private final Setting<Boolean> noNausea = bool("Nausea", false);
private final Setting<Boolean> noPumpkinOverlay = bool("PumpkinOverlay", false);
private final Setting<Boolean> noPowderedSnowOverlay = bool("PowderedSnowOverlay", false);
private final Setting<Boolean> noFireOverlay = bool("FireOverlay", false);
private final Setting<Boolean> noLiquidOverlay = bool("LiquidOverlay", false);
private final Setting<Boolean> noInWallOverlay = bool("InWallOverlay", false);
private final Setting<Boolean> noVignette = bool("Vignette", false);
private final Setting<Boolean> noGuiBackground = bool("GuiBackground", false);
private final Setting<Boolean> noTotemAnimation = bool("TotemAnimation", false);
private final Setting<Boolean> noParticles = bool("Particles", false);
private final Setting<Boolean> noEatParticles = bool("EatingParticles", false);
private final Setting<Boolean> noEnchantGlint = bool("EnchantGlint", false);
// HUD
private final Setting<Boolean> noBossBar = bool("BossBar", false);
private final Setting<Boolean> noScoreboard = bool("Scoreboard", false);
private final Setting<Boolean> noCrosshair = bool("Crosshair", false);
private final Setting<Boolean> noTitle = bool("Title", false);
private final Setting<Boolean> noHeldItemName = bool("HeldItemName", false);
private final Setting<Boolean> noObfuscation = bool("Obfuscation", false);
private final Setting<Boolean> noPotionIcons = bool("PotionIcons", false);
private final Setting<Boolean> noMessageSignatureIndicator = bool("MessageSignatureIndicator", false);
// World
private final Setting<Boolean> noWeather = bool("Weather", false);
private final Setting<Boolean> noWorldBorder = bool("WorldBorder", false);
private final Setting<Boolean> noBlindness = bool("Blindness", false);
private final Setting<Boolean> noDarkness = bool("Darkness", false);
private final Setting<Boolean> noFog = bool("Fog", false);
private final Setting<Boolean> noEnchTableBook = bool("EnchantTableBook", false);
private final Setting<Boolean> noSignText = bool("SignText", false);
private final Setting<Boolean> noBlockBreakOverlay = bool("BlockBreakOverlay", false);
private final Setting<Boolean> noBeaconBeams = bool("BeaconBeams", false);
private final Setting<Boolean> noFallingBlocks = bool("FallingBlocks", false);
private final Setting<Boolean> noCaveCulling = bool("CaveCulling", false);
private final Setting<Boolean> noMapMarkers = bool("MapMarkers", false);
private final Setting<Boolean> noMapContents = bool("MapContents", false);
private final Setting<Boolean> noFireworkExplosions = bool("FireworkExplosions", false);
private final Setting<Boolean> noBarrierInvis = bool("BarrierInvisibility", false);
private final Setting<Boolean> noTextureRotations = bool("TextureRotations", false);
// Entity
private final Setting<Set<EntityType<?>>> disabledEntities = register(new EntityListSetting("Entities", new LinkedHashSet<>()));
private final Setting<Boolean> dropSpawnPackets = bool("DropSpawnPackets", false);
private final Setting<Boolean> noArmor = bool("Armor", false);
private final Setting<Boolean> noElytra = bool("Elytra", false);
private final Setting<Boolean> noInvisibility = bool("Invisibility", false);
private final Setting<Boolean> noGlowing = bool("Glowing", false);
private final Setting<Boolean> noMobInSpawner = bool("SpawnerEntities", false);
private final Setting<Boolean> noDeadEntities = bool("DeadEntities", false);
private final Setting<Boolean> 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<EntityType<?>> 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
}
}
@@ -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());
@@ -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);
}
}
}
@@ -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<Boolean> 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;
}
}
@@ -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();
}
}
}
@@ -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();
}
}
}