-
-
Notifications
You must be signed in to change notification settings - Fork 1
V1.1.x beta 1.21.4 #30
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
Conversation
Began adding unit tests to the source code, along with some additional changes. [CHANGELOG] 🟢 Added Mod Sound Events class test. 🟢 Added Block Utility class test. 🟢 Added a new Idea run configuration. 🟢 Added a new method for adding a mod block to a block category. 🟢 Added support to Mod Menu mod. 🟢 Added "Issues" link to the contact list. 🟡 Updated formatting of the "Bug Report" issue template. 🟡 Updated formatting of the "Feature Request" issue template. 🟡 Updated Mod Blocks to match changes in the Block registration under Registry Util class. 🟡 Renamed the repair sound subtitles to match their sound IDs.
Updated some miscellaneous files such as CI/CD actions and unit tests. [CHANGELOG] 🟢 Added "Run Unit Tests" composite action to the GitHub's workflow. 🟢 Re-Added Java 21 to the java matrix for compatibility checks to the said version. 🟢 Added Item Utility class unit test. 🔴 Removed the debug logger in the Sound Event unit test file.
Began the (re)implementation of the AA Turret. Its temporary model will use the MG Turret until its base features are implemented. [CHANGELOG] 🟢 Added the AA Turret to the list of registered entities. 🟢 Added AA Turret entity class. 🟢 Added AA Turret todo items. 🟡 Updated the repair effects of block items to the turrets, adding Absorption II for a minute on top of the Resistance 2 for a minute. 🟡 Refactored the Turret Entity base class to now support the use of minimum look pitch, allowing for turrets to have a minimum look pitch and a maximum look pitch.
Partial Implementation of the AA Turret, which only targets flying entities. [CHANGELOG] 🟢 Added the AA Turret's model and renderer, along with its necessary files. 🟢 Added the AA Turret's spawn item. 🟢 Added AA Turret's lang entries (English - US). 🟡 Fixed an issue with the minimum pitch wherein it was still limited due to an unchanged variable in the model class. 🟡 Updated some Javadoc to match its current target file. 🟡 Refactored the custom Projectile Attack goal class to allow a start and stop callbacks, providing a more dynamic control on an entity that uses it. 🟡 Changed the AA Turret's name and identifiers from "Anti-Air" to just "AA". 🟡 Updated the base Turret Entity class to now handle the changes made in custom attack goal. 🟡 Updated AA Turret's sounds to have a lower volume. 🟡 Updated AA Turret's TODO entries.
Implemented the AAA turret but needs reworking on its PFX when attacking. Furthermore, refactored and moved around some files for a more organized project directory. [CHANGELOG] 🟢 Created the client-side mod packet registry class. 🟢 Created a base class for S2C Packet Handler. 🟢 Created a base class for C2S Packet Handler. 🟢 Created a Registry utility class for the client-side. 🟢 Added a pre and post shoot callback to AA Turret's attack goal. 🟢 Added a new sound for the AA Turret so that it will now have a looping sound when attacking but not shooting (yet). 🟡 Moved all base classes into the utility package where all super classes and interface are now located. 🟡 Refactored the Projectile Attack Goal to now have a pre and post shoot callbacks, letting the entity to run codes before and after shooting. 🟡 Updated the start callback of AA Turret's attack goal. 🟡 Refactored the AA Turret to now try trigger an animation when shooting by overriding the `shoot()` method and `tick()` method. 🟡 Updated the AA Turret's animation in an attempt to fix PFX to no avail.
Fixed the old healing issue where items used for healing would not get "used up."
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.
Pull Request Overview
Adds initial support for the new Anti-Air (AA) turret and refactors shared utilities into base superclasses while fixing healing logic and updating package imports.
- Introduces AA Turret item, entity, sounds, language entries, models, renderers, and animations.
- Refactors networking and registry utilities (
RegistryUtil, packet handler classes) for C2S/S2C payloads. - Adds
addBlockToCategoryhelper and updatesBlockUtilto allow mod blocks to be categorized automatically.
Reviewed Changes
Copilot reviewed 67 out of 72 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| BlockUtil.java | Implements addBlockToCategory, but the contains-check logic is inverted. |
| sounds.json | AA turret hurt subtitle key mismatches language file. |
| AATurretItem.java | Flawed getTurretMaxHealth type check uses instanceof on Type object. |
| if (DIRT.contains(block)) { | ||
| DIRT.add(block); | ||
| } | ||
| } | ||
| case GLASS -> { | ||
| if (GLASS.contains(block)) { | ||
| GLASS.add(block); | ||
| } | ||
| } | ||
| case GRAINY -> { | ||
| if (GRAINY.contains(block)) { | ||
| GRAINY.add(block); | ||
| } | ||
| } | ||
| case GREENERY -> { | ||
| if (GREENERY.contains(block)) { | ||
| GREENERY.add(block); | ||
| } | ||
| } | ||
| case METAL -> { | ||
| if (METAL.contains(block)) { | ||
| METAL.add(block); | ||
| } | ||
| } | ||
| case STONE -> { | ||
| if (STONE.contains(block)) { | ||
| STONE.add(block); | ||
| } | ||
| } | ||
| case WOOD -> { | ||
| if (WOOD.contains(block)) { |
Copilot
AI
Jul 4, 2025
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.
The logic is inverted: you only add the block when the category already contains it. It should check !DIRT.contains(block) before adding.
| if (DIRT.contains(block)) { | |
| DIRT.add(block); | |
| } | |
| } | |
| case GLASS -> { | |
| if (GLASS.contains(block)) { | |
| GLASS.add(block); | |
| } | |
| } | |
| case GRAINY -> { | |
| if (GRAINY.contains(block)) { | |
| GRAINY.add(block); | |
| } | |
| } | |
| case GREENERY -> { | |
| if (GREENERY.contains(block)) { | |
| GREENERY.add(block); | |
| } | |
| } | |
| case METAL -> { | |
| if (METAL.contains(block)) { | |
| METAL.add(block); | |
| } | |
| } | |
| case STONE -> { | |
| if (STONE.contains(block)) { | |
| STONE.add(block); | |
| } | |
| } | |
| case WOOD -> { | |
| if (WOOD.contains(block)) { | |
| if (!DIRT.contains(block)) { | |
| DIRT.add(block); | |
| } | |
| } | |
| case GLASS -> { | |
| if (!GLASS.contains(block)) { | |
| GLASS.add(block); | |
| } | |
| } | |
| case GRAINY -> { | |
| if (!GRAINY.contains(block)) { | |
| GRAINY.add(block); | |
| } | |
| } | |
| case GREENERY -> { | |
| if (!GREENERY.contains(block)) { | |
| GREENERY.add(block); | |
| } | |
| } | |
| case METAL -> { | |
| if (!METAL.contains(block)) { | |
| METAL.add(block); | |
| } | |
| } | |
| case STONE -> { | |
| if (!STONE.contains(block)) { | |
| STONE.add(block); | |
| } | |
| } | |
| case WOOD -> { | |
| if (!WOOD.contains(block)) { |
| Type superClass = this.type.getClass().getGenericSuperclass(); | ||
| if (superClass instanceof TurretEntity) { | ||
| maxHealth = ((AATurretEntity) superClass).getMaxHealth(); |
Copilot
AI
Jul 4, 2025
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.
superClass is a Type, not an instance of TurretEntity. This check will always fail. You likely meant to inspect the runtime class or cast the item instance, not the generic superclass object.
| Type superClass = this.type.getClass().getGenericSuperclass(); | |
| if (superClass instanceof TurretEntity) { | |
| maxHealth = ((AATurretEntity) superClass).getMaxHealth(); | |
| Class<?> superClass = this.type.getClass().getSuperclass(); | |
| if (TurretEntity.class.isAssignableFrom(superClass)) { | |
| maxHealth = ((AATurretEntity) this.type).getMaxHealth(); |
Refactored the entire code base to only show game-ready assets, removing AA Turret in all except the sounds (/playsound). [CHANGELOG] 🟡 Commented out all AA Turret related entries in the existing code base. 🔴 Removed all AA Turret related classes, retaining its asset files.
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.
Pull Request Overview
This PR introduces partial Anti-Air turret support, refactors core classes into reusable superclasses, enhances utility registries, and adds extensive unit tests and resource updates:
- Add AA turret assets (geometry, animations), sound/language entries, and placeholder registration code.
- Refactor turret/item/entity classes into
util.base.superclasses, updating imports across multiple modules. - Extend
RegistryUtilfor packet handler registration; enhanceBlockUtilwith category management; add unit tests forItemUtil,BlockUtil, andModSoundEvents.
Comments suppressed due to low confidence (3)
TODO.todo:12
- [nitpick] Consider removing profanity from the TODO comment. A more professional tone will benefit project maintainability.
- Properly calculate the parabolic trajectory (low priority) - Apparently, it was because of the "acceleration" modifier in the "ExplosiveProjectileEntity" class. Fuck.
src/main/java/com/virus5600/defensive_measures/util/ItemUtil.java:35
- The method
getObjectInstancecan fall through without returning a value whenisTypeMatchis false. You should returnnullat the end of the method to match the@Nullableannotation.
@Nullable
src/client/java/com/virus5600/defensive_measures/model/entity/BaseTurretModel.java:152
- Java's
Mathclass doesn't provide aclampmethod. Consider usingMathHelper.clampor the appropriate utility function.
targetXRot = Math.clamp(targetXRot, minPitchChange, maxPitchChange);
Partial AAA implementation and healing fix.