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
NoShieldOverlay #849
NoShieldOverlay #849
Conversation
This pull request has been open for a while with no recent activity. If you're still working on this or waiting for a review, please add a comment or commit within the next 7 days to keep it open. Otherwise, the pull request will be automatically closed to free up time for other tasks. Pull requests should be closed if:
|
Still relevant. Potential implementation of https://wurstforum.net/d/215. |
WalkthroughThe update introduces a new feature to a Minecraft mod that allows players to adjust the position of the shield overlay when blocking or not blocking. This enhancement includes the addition of a new hack, corresponding settings, and modifications to the item rendering system to apply these adjustments in real-time during gameplay. Changes
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this 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
Files ignored due to filter (2)
- src/main/resources/assets/wurst/lang/en_us.json
- src/main/resources/wurst.mixins.json
Files selected for processing (3)
- src/main/java/net/wurstclient/hack/HackList.java (1 hunks)
- src/main/java/net/wurstclient/hacks/NoShieldOverlayHack.java (1 hunks)
- src/main/java/net/wurstclient/mixin/HeldItemRendererMixin.java (1 hunks)
Additional comments: 7
src/main/java/net/wurstclient/hack/HackList.java (1)
- 138-144: The addition of
NoShieldOverlayHack
to theHackList
class is consistent with the pull request's goal of introducing a new feature to the Wurst Client. This change registers the new hack within the mod's system, allowing it to be accessed and used like the other existing hacks.Ensure that the
NoShieldOverlayHack
class is properly implemented and follows the conventions and structure of the other hack classes in the codebase. Also, verify that the hack is being initialized and managed correctly within the game's lifecycle.src/main/java/net/wurstclient/hacks/NoShieldOverlayHack.java (4)
1-45: The introduction of the
NoShieldOverlayHack
class appears to be well-structured and follows Java coding conventions. The class is correctly placed within thenet.wurstclient.hacks
package and includes appropriate imports and settings.18-23: The slider settings
nonBlockingOffset
andblockingOffset
are well-named and include descriptive tooltips for the user. The range and step values seem reasonable, but it would be important to ensure that these values provide a good user experience and that the shield can be adjusted to a position that is both useful and visually appealing.25-31: The constructor for
NoShieldOverlayHack
is straightforward and correctly sets the category and adds the settings to the hack. This is a good use of the constructor to initialize the hack's properties.33-42: The
adjustShieldPosition
method is concise and only performs the shield position adjustment if the hack is enabled. The use of theMatrixStack
to translate the shield position is appropriate for rendering transformations in Minecraft. The check for whether the player is blocking to determine which offset to apply is logical.Overall, the code is clean, and there are no apparent issues with logic, security, performance, or maintainability. The use of clear naming conventions and the organization of the code should make it easy to maintain and understand.
src/main/java/net/wurstclient/mixin/HeldItemRendererMixin.java (2)
- 1-50: The mixin implementation for
HeldItemRendererMixin
seems to be correctly structured, following the conventions of SpongePowered's Mixin framework for Minecraft modding. The@Inject
annotations are used to inject custom code into therenderFirstPersonItem
method of theHeldItemRenderer
class at specific points (denoted by the@At
annotations withordinal
values to specify the exact injection points).The methods
lowerShieldBlocking
andlowerShieldNonBlocking
are designed to adjust the shield's position based on the player's blocking state, which is determined by thehand
parameter and the type ofitem
held. The calls toWurstClient.INSTANCE.getHax().noShieldOverlayHack.adjustShieldPosition(matrices, true/false)
are used to apply the actual position adjustments, with the boolean parameter indicating whether the player is blocking.It's important to ensure that the
ordinal
values used in the@At
annotations correctly correspond to the intended injection points in therenderFirstPersonItem
method after any updates to the game or theHeldItemRenderer
class, as these values are dependent on the method's bytecode and can change with updates.Additionally, the mixin does not seem to directly modify any fields or methods in the target class, which is a good practice to avoid conflicts with other mods that might also be modifying the same class.
Overall, the code appears to be correct and should function as intended if the
ordinal
values are accurate and theWurstClient.INSTANCE.getHax().noShieldOverlayHack.adjustShieldPosition
method is implemented correctly.
- 48-49: This conditional check ensures that the shield position is only adjusted when the player is holding a shield in the off-hand and is not blocking. This is a good example of defensive programming, ensuring that the mixin only affects the game behavior when the specific conditions for the feature are met.
Lowers the shield in the offhand when blocking and when idle to prevent it from blocking the screen.
Summary by CodeRabbit
NoShieldOverlayHack
feature allowing players to adjust shield overlay visibility and position when blocking or not blocking in-game.