Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions common/src/main/java/net/xolt/freecam/config/ModConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ public static class VisualConfig {

@ConfigEntry.Gui.Tooltip
public boolean showSubmersion = false;

@ConfigEntry.Gui.Tooltip
public boolean outlinePlayer = false;
}

@ConfigEntry.Gui.Tooltip
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package net.xolt.freecam.mixins;

import net.minecraft.client.Camera;
import net.xolt.freecam.config.ModConfig;
import net.minecraft.client.DeltaTracker;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.client.renderer.culling.Frustum;
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
import net.minecraft.client.renderer.entity.state.EntityRenderState;
import net.minecraft.client.renderer.state.LevelRenderState;
import net.minecraft.util.ARGB;
import net.xolt.freecam.Freecam;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import static net.xolt.freecam.Freecam.MC;

@Mixin(LevelRenderer.class)
public class LevelRendererMixin {

@Shadow @Final private EntityRenderDispatcher entityRenderDispatcher;

// Add the local player to the visible entities when freecam is enabled so they get the outline
@Inject(method = "extractVisibleEntities", at = @At("TAIL"))
private void onExtractVisibleEntities(Camera camera, Frustum frustum, DeltaTracker deltaTracker, LevelRenderState levelRenderState, CallbackInfo ci) {
if (Freecam.isEnabled() && ModConfig.INSTANCE.visual.outlinePlayer && MC.player != null) {

float partialTick = deltaTracker.getGameTimeDeltaPartialTick(false);
EntityRenderState state = entityRenderDispatcher.extractEntity(MC.player, partialTick);

if (state != null) {
state.outlineColor = ARGB.opaque(MC.player.getTeamColor());
levelRenderState.entityRenderStates.add(state);
levelRenderState.haveGlowingEntities = true;
}
}
}
}
2 changes: 2 additions & 0 deletions common/src/main/resources/assets/freecam/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
"text.autoconfig.freecam.option.visual.fullBright": "Full Brightness",
"text.autoconfig.freecam.option.visual.fullBright.@Tooltip": "Increases brightness while in freecam.",
"text.autoconfig.freecam.option.visual.showSubmersion": "Show Submersion Fog",
"text.autoconfig.freecam.option.visual.outlinePlayer.@Tooltip": "Outlines the playermodel through walls.",
"text.autoconfig.freecam.option.visual.outlinePlayer": "Player Outline",
"text.autoconfig.freecam.option.visual.showSubmersion.@Tooltip": "Whether you see a fog overlay underwater, in lava, or powdered snow.",
"text.autoconfig.freecam.option.utility": "Utility Options",
"text.autoconfig.freecam.option.utility.@Tooltip": "Freecam enhancements.",
Expand Down
2 changes: 2 additions & 0 deletions common/src/main/resources/assets/freecam/lang/uk_ua.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
"text.autoconfig.freecam.option.visual.fullBright.@Tooltip": "Збільшує яскравість в режимі вільної камери.",
"text.autoconfig.freecam.option.visual.showSubmersion": "Показати занурювальний туман",
"text.autoconfig.freecam.option.visual.showSubmersion.@Tooltip": "Чи будете ви бачити туман під водою, у лаві або в сипкому снігу.",
"text.autoconfig.freecam.option.visual.outlinePlayer.@Tooltip": "Окреслює модель гравця крізь стіни.",
"text.autoconfig.freecam.option.visual.outlinePlayer": "Окреслення Гравця",
"text.autoconfig.freecam.option.utility": "Параметри корисности",
"text.autoconfig.freecam.option.utility.@Tooltip": "Покращення Freecam.",
"text.autoconfig.freecam.option.utility.disableOnDamage": "Вимкнути при отриманні шкоди",
Expand Down
1 change: 1 addition & 0 deletions common/src/main/resources/freecam-common.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"IrisHandRendererMixin",
"IrisShadowRendererMixin",
"ItemInHandRendererMixin",
"LevelRendererMixin",
"LightTextureMixin",
"LivingEntityMixin",
"LocalPlayerMixin",
Expand Down