Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added NoFog #904

Merged
merged 10 commits into from Dec 22, 2023
Merged

Added NoFog #904

merged 10 commits into from Dec 22, 2023

Conversation

IUDevman
Copy link
Contributor

@IUDevman IUDevman commented Nov 19, 2023

Description

New hack - NoFog

This hack removes fog from the world. This includes fog for the background, when in fluids, blindness effect, and packed snow effect.

Copy link

coderabbitai bot commented Nov 19, 2023

Walkthrough

Walkthrough

The changes involve the introduction of a new feature called NoFogHack to the Wurst client, a Minecraft mod. This feature appears to disable fog effects in the game. A new class has been created to handle the functionality of this hack, and an existing class has been modified to intercept and cancel the fog rendering process under certain conditions related to the Wurst client's state.

Changes

File Change Summary
.../hack/HackList.java
.../hacks/NoFogHack.java
Added NoFogHack declaration and initialization. Created NoFogHack class, extending Hack and setting category to RENDER.
.../mixin/BackgroundRendererMixin.java
.../resources/wurst.accesswidener
Updated BackgroundRendererMixin to handle fog rendering based on Wurst client's state. Added method getFogModifier to BackgroundRenderer class.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on X ?


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • You can reply to a review comment made by CodeRabbit.
  • You can tag CodeRabbit on specific lines of code or files in the PR by tagging @coderabbitai in a comment.
  • You can tag @coderabbitai in a PR comment and ask one-off questions about the PR and the codebase. Use quoted replies to pass the context for follow-up questions.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between e7f60fe and 9acc9b9.
Files ignored due to filter (1)
  • src/main/resources/assets/wurst/lang/en_us.json
Files selected for processing (3)
  • src/main/java/net/wurstclient/hack/HackList.java (1 hunks)
  • src/main/java/net/wurstclient/hacks/NoFogHack.java (1 hunks)
  • src/main/java/net/wurstclient/mixin/BackgroundRendererMixin.java (2 hunks)
Files skipped from review due to trivial changes (1)
  • src/main/java/net/wurstclient/hacks/NoFogHack.java
Additional comments: 4
src/main/java/net/wurstclient/hack/HackList.java (1)
  • 134-140: The addition of NoFogHack to the HackList class is consistent with the description of the new feature. It's important to ensure that the NoFogHack class is properly implemented and follows the same conventions as the other hack classes in the project. Additionally, the initialization of this hack should be tested to ensure it behaves as expected within the game environment.
src/main/java/net/wurstclient/mixin/BackgroundRendererMixin.java (3)
  • 7-17: The import statement for net.minecraft.client.render.Camera is correctly added to support the new functionality introduced in the mixin. Ensure that there are no unused imports after this addition.

  • 22-32: The onApplyFog method is correctly using the @Inject annotation to intercept the fog application process. The method checks if NoFogHack is enabled and cancels the fog rendering if it is. This is a good use of mixins to modify game behavior without altering the original game code. However, ensure that the WurstClient.INSTANCE.getHax().noFogHack is thread-safe since Minecraft is a multi-threaded application and this could potentially be accessed from multiple threads simultaneously.

  • 34-36: The onGetFogModifier method is not part of the changes described in the summary, but it seems to be related to a similar feature, antiBlindHack. If this is an intended change, ensure that it is documented in the pull request summary. If it's not related to the NoFogHack, it should be reviewed separately to ensure it's part of a relevant change set.

@IUDevman
Copy link
Contributor Author

Walkthrough

The changes involve the introduction of a new feature to the Wurst-Imperium project, specifically a hack called NoFogHack that allows users to disable fog rendering in the game. This feature is implemented through the addition of a new hack in the hack list and the creation of a new class to handle the fog rendering logic. Additionally, a mixin is used to inject code into the fog application process to conditionally cancel it.

Changes

File Path Change Summary
.../hack/HackList.java Added NoFogHack global variable to the list of hacks.
.../hacks/NoFogHack.java Created new NoFogHack class extending Hack with a constructor setting its category to RENDER.
.../mixin/BackgroundRendererMixin.java Added method to cancel fog application with conditions, and imported Camera class.

🐰🍂 "As autumn leaves fall, we hack away the fog,
Clearing our view, through the digital smog!" 🎮🌫️

Tips

Good AI

@Alexander01998 Alexander01998 added type:enhancement New feature or request type:new feature A new hack/command/etc. category:render labels Nov 28, 2023
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 9acc9b9 and 69bb2a5.
Files selected for processing (2)
  • src/main/java/net/wurstclient/hacks/NoFogHack.java (1 hunks)
  • src/main/java/net/wurstclient/mixin/BackgroundRendererMixin.java (1 hunks)
Files skipped from review due to trivial changes (1)
  • src/main/java/net/wurstclient/hacks/NoFogHack.java
Additional comments: 1
src/main/java/net/wurstclient/mixin/BackgroundRendererMixin.java (1)
  • 25-34: The implementation of the onApplyFog method correctly cancels the fog application when noFogHack is enabled.

Copy link
Member

@Alexander01998 Alexander01998 left a comment

Choose a reason for hiding this comment

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

Hi there, @IUDevman. Thanks for the pull request and your effort to contribute to the Wurst Client.

I've taken a look at your implementation for the NoFog hack, and I've encountered a few issues. Your approach has an unfortunate side effect in the form of a visual artifact: it turns the bottom half of the skybox into the fog color, creating a sharp line in the middle.

Skybox line issue

Additionally, the way you've addressed the removal of blindness and underwater fog seems to conflict with the existing AntiBlind and NoOverlay hacks. If a user enables NoFog but doesn't enable AntiBlind or NoOverlay, they likely still want those effects to be present.

Also, both AntiBlind and NoOverlay manage these effects in a different way than simply deactivating the fog, which makes it look a bit strange visually when NoFog is used instead.

AntiBlind / NoOverlay NoFog
Blindness blindness with AntiBlind blindness with NoFog
Underwater underwater with NoOverlay underwater with NoFog

As you can see, the rendering with NoFog doesn't quite match up to the other hacks' performance. I think the best way to address this would be to make NoFog leave these kinds of fog alone and focus solely on regular distance fog.

I think your NoFog hack can still be a great addition once these issues are addressed. Please take these points into consideration and push the improvements to your pull request.

@IUDevman
Copy link
Contributor Author

IUDevman commented Nov 29, 2023

Hi Alexander, thanks for the review.

I will work on taking your points in consideration and have NoFog work for only regular distance fog. As for the skybox, that might be a bit more challenging (its always there vanilla, fog hides it) but I should be able to find a solution.

Thank you again.

Still working on the skybox
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 69bb2a5 and 1accdfb.
Files ignored due to filter (1)
  • src/main/resources/assets/wurst/lang/en_us.json
Files selected for processing (1)
  • src/main/java/net/wurstclient/mixin/BackgroundRendererMixin.java (2 hunks)
Additional comments: 4
src/main/java/net/wurstclient/mixin/BackgroundRendererMixin.java (4)
  • 10-18: The import statements are correctly added to support the new methods introduced in the mixin.

  • 29-34: The getFogModifier method is correctly implemented as a shadow method, returning null.

  • 36-53: The onApplyFog method is correctly implemented to support the NoFog feature by checking the noFogHack status and cancelling the fog application under the right conditions.

  • 23-57: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [55-61]

The onGetFogModifier method is correctly implemented to support the AntiBlind feature by checking the antiBlindHack status and cancelling the fog modifier if it is enabled.

@IUDevman
Copy link
Contributor Author

This implementation cancels the distance fog while leaving other features such as blindness, fluid fog, and powdered snow effect intact. Still working on that skybox.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 1accdfb and fb109f1.
Files selected for processing (1)
  • src/main/java/net/wurstclient/mixin/BackgroundRendererMixin.java (2 hunks)
Additional comments: 2
src/main/java/net/wurstclient/mixin/BackgroundRendererMixin.java (2)
  • 26-55: The onApplyFog() method correctly implements the NoFog feature by checking if noFogHack is enabled and then preventing fog application under certain conditions. This aligns with the pull request description.

  • 57-59: The onGetFogModifier() method appears to be related to the antiBlindHack rather than the NoFog feature. Ensure that this change is intentional and correctly placed within this pull request, as it is not mentioned in the summary of changes.

@IUDevman
Copy link
Contributor Author

IUDevman commented Nov 29, 2023

I finally found the issue. It seems minecraft uses the fog rendering to add shading from the void, sunset, etc. Removing the opacity on the color instead of outright cancelling the render allows the shading to still be in place.

In my research I saw that other mods push the fog rendering out, but that is still shown at a really far render distance and causes the same skybox problem.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between fb109f1 and 660d9f5.
Files selected for processing (1)
  • src/main/java/net/wurstclient/mixin/BackgroundRendererMixin.java (2 hunks)
Additional comments: 4
src/main/java/net/wurstclient/mixin/BackgroundRendererMixin.java (4)
  • 7-21: The added imports are necessary for the new functionality introduced in the mixin and are correctly placed at the top of the file.

  • 30-35: Verify that the getFogModifier method is intended to always return null, as this could potentially override behavior from the original BackgroundRenderer class.

  • 37-53: Ensure that WurstClient.INSTANCE.getHax().noFogHack is properly initialized before this mixin is loaded to prevent potential null pointer exceptions.

  • 55-57: Confirm that the antiBlindHack and noFogHack features do not conflict with each other, as they both affect fog rendering.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 660d9f5 and 28c6538.
Files ignored due to filter (1)
  • src/main/resources/assets/wurst/lang/en_us.json
Files selected for processing (2)
  • src/main/java/net/wurstclient/hack/HackList.java (1 hunks)
  • src/main/java/net/wurstclient/mixin/BackgroundRendererMixin.java (1 hunks)
Additional comments: 7
src/main/java/net/wurstclient/hack/HackList.java (1)
  • 137-137: The addition of NoFogHack to the HackList class appears to be implemented correctly and follows the established pattern for hack declarations.
src/main/java/net/wurstclient/mixin/BackgroundRendererMixin.java (6)
  • 38-56: The implementation of onApplyFog seems to correctly check if the NoFogHack is enabled and sets the fog color to transparent if certain conditions are met. However, it's important to ensure that the RenderSystem.setShaderFogColor(0, 0, 0, 0) call does not have any unintended side effects on the rendering system, as it sets the fog color to fully transparent.

  • 58-66: The onGetFogModifier method correctly cancels the fog modifier when the antiBlindHack is enabled. It's important to verify that this does not interfere with other game mechanics that might rely on the fog modifier, and that the antiBlindHack is intended to cancel all fog modifiers, not just those related to blindness effects.

  • 43-43: Verify that the NoFogHack is properly initialized and that its isEnabled method accurately reflects whether the hack is active. This is crucial for the correct functioning of the onApplyFog method.

  • 64-64: Ensure that the antiBlindHack is correctly registered and that its isEnabled method is reliable, as the onGetFogModifier method depends on this to cancel the fog modifier.

  • 38-41: Confirm that the method signature for onApplyFog matches the signature of the method it is injecting into. This is important for the mixin to function correctly.

  • 58-61: Verify that the method signature for onGetFogModifier is correct and matches the method it is supposed to inject into. This ensures that the mixin works as intended.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 28c6538 and 1bb7dbe.
Files selected for processing (2)
  • src/main/java/net/wurstclient/mixin/BackgroundRendererMixin.java (1 hunks)
  • src/main/resources/wurst.accesswidener (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/main/java/net/wurstclient/mixin/BackgroundRendererMixin.java
Additional comments: 1
src/main/resources/wurst.accesswidener (1)
  • 4-4: The addition of the getFogModifier method to the access widener file is consistent with the PR's objective to implement the NoFog feature by altering fog rendering behavior.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 1bb7dbe and 6cfd831.
Files selected for processing (1)
  • src/main/java/net/wurstclient/hacks/NoFogHack.java (1 hunks)
Additional comments: 3
src/main/java/net/wurstclient/hacks/NoFogHack.java (3)
  • 8-24: The NoFogHack class is correctly defined in the net.wurstclient.hacks package and extends the Hack base class. The use of @SearchTags is appropriate for discoverability of the feature within the client.

  • 17-21: The constructor of NoFogHack is well-defined, setting the name and category of the hack as expected.

  • 23-23: The comment referencing BackgroundRendererMixin provides a useful pointer to the related mixin functionality, which is a good practice for code maintainability.

@Alexander01998 Alexander01998 added this to the v7.41 milestone Dec 18, 2023
@Alexander01998 Alexander01998 merged commit a764953 into Wurst-Imperium:master Dec 22, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:render type:enhancement New feature or request type:new feature A new hack/command/etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants