Skip to content

Commit

Permalink
NoRender: map content (#4624)
Browse files Browse the repository at this point in the history
  • Loading branch information
Big-Iron-Cheems authored Jun 6, 2024
1 parent 580ad3f commit 94ee5c6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,23 @@
import meteordevelopment.meteorclient.systems.modules.render.NoRender;
import meteordevelopment.meteorclient.utils.misc.EmptyIterator;
import net.minecraft.client.render.MapRenderer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.map.MapDecoration;
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(MapRenderer.MapTexture.class)
public abstract class MapRendererMixin {
@ModifyExpressionValue(method = "draw(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ZI)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/map/MapState;getDecorations()Ljava/lang/Iterable;"))
private Iterable<MapDecoration> getIconsProxy(Iterable<MapDecoration> original) {
return (Modules.get().get(NoRender.class).noMapMarkers()) ? EmptyIterator::new : original;
}

@Inject(method = "draw(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ZI)V", at = @At("HEAD"), cancellable = true)
private void onDraw(MatrixStack matrices, VertexConsumerProvider vertexConsumers, boolean hidePlayerIcons, int light, CallbackInfo ci) {
if (Modules.get().get(NoRender.class).noMapContents()) ci.cancel();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,13 @@ public class NoRender extends Module {
.build()
);

private final Setting<Boolean> noMapContents = sgWorld.add(new BoolSetting.Builder()
.name("map-contents")
.description("Disable rendering of maps.")
.defaultValue(false)
.build()
);

private final Setting<BannerRenderMode> bannerRender = sgWorld.add(new EnumSetting.Builder<BannerRenderMode>()
.name("banners")
.description("Changes rendering of banners.")
Expand Down Expand Up @@ -517,6 +524,10 @@ public boolean noMapMarkers() {
return isActive() && noMapMarkers.get();
}

public boolean noMapContents() {
return isActive() && noMapContents.get();
}

public BannerRenderMode getBannerRenderMode() {
if (!isActive()) return BannerRenderMode.Everything;
else return bannerRender.get();
Expand Down

0 comments on commit 94ee5c6

Please sign in to comment.