Skip to content

Spectators see more & Lobby F5#77

Open
LevAlTru wants to merge 18 commits intodoctor4t:mainfrom
LevAlTru:spectator-features-&-lobby-f3
Open

Spectators see more & Lobby F5#77
LevAlTru wants to merge 18 commits intodoctor4t:mainfrom
LevAlTru:spectator-features-&-lobby-f3

Conversation

@LevAlTru
Copy link
Contributor

@LevAlTru LevAlTru commented Nov 25, 2025

Copy of #49 because of its accidental closure.

  • Spectators & creative players can see the poison now.
  • Spectators had the ability to tell who the murderer is, but for some reason the murderers had the white outline instead of a red one.
  • F5 for players in the lobby, so they can be happy about how pretty their skin is.

Copy link
Contributor

@MrSquidson MrSquidson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like some of the things broke while moving your old PR to this one...

Main issue seems to be colors and the fact that no one can see poison particles now...

@ModifyReturnValue(method = "getPerspective", at = @At("RETURN"))
public Perspective getPerspective(Perspective original) {
if (GameFunctions.isPlayerAliveAndSurvival(MinecraftClient.getInstance().player)) {
if (TMMClient.isPlayerAliveAndInSurvival() && TMMClient.gameComponent.isRunning()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot open world because of a NullpointerException thrown by `TMMClient.gameComponent.isRunning()
I've changed the line to;

if (TMMClient.isPlayerAliveAndInSurvival() && (TMMClient.gameComponent != null && TMMClient.gameComponent.isRunning())) {

And now im able to enter the world again...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does actually throw a NullpointerException though... above does fix it...

if (target instanceof PlayerEntity player) {
if (GameFunctions.isPlayerSpectatingOrCreative(player)) return -1;
if (isKiller() && gameComponent.canUseKillerFeatures(player)) return MathHelper.hsvToRgb(0F, 1.0F, 0.6F);
if (isKiller() || gameComponent.canUseKillerFeatures(player)) return MathHelper.hsvToRgb(0F, 1.0F, 0.6F);

This comment was marked as resolved.

This comment was marked as resolved.

(!TMMClient.isKiller() &&
!TMMClient.isPlayerSpectatingOrCreative() &&
!CanSeePoison.EVENT.invoker().visible(MinecraftClient.getInstance().player)
) || tray.getPoisoner() == null) {

This comment was marked as resolved.

This comment was marked as resolved.

Copy link
Contributor

@MrSquidson MrSquidson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disregard above- I had the old PR checked out...

Copy link
Contributor

@MrSquidson MrSquidson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes are only needed in;
src/main/java/dev/doctor4t/trainmurdermystery/mixin/client/restrictions/GameOptionsMixin.java since it gives a NullpointerException... otherwise everything works :)

@ModifyReturnValue(method = "getPerspective", at = @At("RETURN"))
public Perspective getPerspective(Perspective original) {
if (GameFunctions.isPlayerAliveAndSurvival(MinecraftClient.getInstance().player)) {
if (TMMClient.isPlayerAliveAndInSurvival() && TMMClient.gameComponent.isRunning()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does actually throw a NullpointerException though... above does fix it...

if (target instanceof PlayerEntity player) {
if (GameFunctions.isPlayerSpectatingOrCreative(player)) return -1;
if (isKiller() && gameComponent.canUseKillerFeatures(player)) return MathHelper.hsvToRgb(0F, 1.0F, 0.6F);
if (isKiller() || gameComponent.canUseKillerFeatures(player)) return MathHelper.hsvToRgb(0F, 1.0F, 0.6F);

This comment was marked as resolved.

this.equals(MinecraftClient.getInstance().options.advancementsKey))
return true;
if (TMMClient.gameComponent != null && TMMClient.gameComponent.isRunning())
return this.equals(MinecraftClient.getInstance().options.togglePerspectiveKey);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can do f5 in the lobby as expected, if a game starts you enter first person.

(!TMMClient.isKiller() &&
!TMMClient.isPlayerSpectatingOrCreative() &&
!CanSeePoison.EVENT.invoker().visible(MinecraftClient.getInstance().player)
) || tray.getPoisoner() == null) {

This comment was marked as resolved.

@LevAlTru
Copy link
Contributor Author

@MrSquidson thank you for verifying my code all over again. I wouldn't have so much patience to do the same.

@DragonSlayr15001
Copy link

make sure you're not completely rewriting the borders: innocents should appear with a border corresponding to their mood, not just green all the time

@LevAlTru
Copy link
Contributor Author

The only change I made is one check for red colors. I dont think that affects the innocents in any way, but I will check when I will be able to.

@LevAlTru LevAlTru requested a review from MrSquidson November 26, 2025 08:00
@MrSquidson
Copy link
Contributor

I'll try and look if mood still displays... I'd expect so since the Innocent borders ain't changed here, but you never know...

@ModifyReturnValue(method = "getPerspective", at = @At("RETURN"))
public Perspective getPerspective(Perspective original) {
if (GameFunctions.isPlayerAliveAndSurvival(MinecraftClient.getInstance().player)) {
if (TMMClient.isPlayerAliveAndInSurvival() && (TMMClient.gameComponent != null && TMMClient.gameComponent.isRunning())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mood border still works! As expected ;)
Desktop Screenshot 2025 11 26 - 17 11 23 80
Desktop Screenshot 2025 11 26 - 17 12 44 97

@MrSquidson
Copy link
Contributor

I'd say this is ready for merge when a maintainer has looked it over :)

if (target instanceof PlayerEntity player) {
if (GameFunctions.isPlayerSpectatingOrCreative(player)) return -1;
if (isKiller() && gameComponent.canUseKillerFeatures(player)) return MathHelper.hsvToRgb(0F, 1.0F, 0.6F);
if (gameComponent.canUseKillerFeatures(player)) return MathHelper.hsvToRgb(0F, 1.0F, 0.6F);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this should check MoodType and return the role's color if the MoodType is fake, in addition to the original killer check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea, but i think it needs a little refactoring which this pull request was not created for, because we'd need to add another field to the role class and someone might did in another pull request and so and etc. etc. etc. I think we better wait until all the other pull requests are either approved or discarded.

Copy link
Contributor Author

@LevAlTru LevAlTru Nov 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(we'd need another field because not all roles should be highlighted to the killers, like the jester)

@LevAlTru LevAlTru marked this pull request as draft December 20, 2025 02:34
@LevAlTru LevAlTru closed this Dec 20, 2025
@LevAlTru LevAlTru force-pushed the spectator-features-&-lobby-f3 branch from ea642f4 to 7a336c9 Compare December 20, 2025 02:50
…nto spectator-features-&-lobby-f3

# Conflicts:
#	src/main/java/dev/doctor4t/wathe/block_entity/TrimmedBedBlockEntity.java
#	src/main/java/dev/doctor4t/wathe/mixin/client/restrictions/GameOptionsMixin.java
#	src/main/java/dev/doctor4t/wathe/mixin/client/restrictions/KeyBindingMixin.java
#	src/main/java/dev/doctor4t/wathe/mixin/client/self/BeveragePlateBlockEntityMixin.java
@LevAlTru LevAlTru reopened this Dec 20, 2025
@LevAlTru LevAlTru marked this pull request as ready for review December 20, 2025 03:14
@MrSquidson
Copy link
Contributor

@LevAlTru isn't the keybinding mixin supposed to still use wathe$ instead of tmm$ ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants