Skip to content

returned magizen and grenade crafting functionality to the ammo press#627

Open
voroxity wants to merge 4 commits intoCubed-Development:nextfrom
voroxity:voroxity-patch-1
Open

returned magizen and grenade crafting functionality to the ammo press#627
voroxity wants to merge 4 commits intoCubed-Development:nextfrom
voroxity:voroxity-patch-1

Conversation

@voroxity
Copy link

@voroxity voroxity commented Feb 8, 2026

📝 Description

This pull request fixes the magizen and grenade crafting functionality of the ammo press by updating the values in GUIContainerAmmoPress.java after PR #540 broke it.

🎯 Goals

Return full crafting functionality to the ammo press.

❌ Non Goals

It is not a goal to cause any bug or make future implementation of additional crafting tabs difficult/impossible without an overhaul or rewrite.

🚦 Testing

  1. forked the main up-to-date repository.
  2. Implemented initial fix.
  3. committed changes to a test branch.
  4. compiled and built .jar file.
  5. Replaced the old .jar file with the new edited one.
  6. attempted to replicate the previous issue.
  7. Repeat steps 2-6 untill issue is fixed.

⏮️ Backwards Compatibility

Yes, this change is backwards compatible, but not before #540, as this is what caused the bug in the first place

📚 Related Issues & Documents

Fixes: #624 (bug present in MWC 2.0 Dev 5-7)
pull request: #540 (source of initial issue)

🖼️ Screenshots/Recordings

📖 Added to documentation?

  • 📜 README.md
  • 📑 Documentation
  • 📓 Javadoc
  • 🍕 Comments
  • 🙅 No documentation needed

😄 [optional] What gif best describes this PR or how it makes you feel?

…page 2

changed 
if (getCraftingMode() == CraftingGroup.BULLET.getID()) {
to 
if (getCraftingMode() == CraftingGroup.BULLET.getID() || getCraftingMode() == 1) {
so that the initial crafting mode value that is defined in GUIContainerStation.java is valid for this argument
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 8, 2026

Walkthrough

Updated GUIContainerAmmoPress.fillFilteredList() to use CraftingGroup ID comparisons (BULLET, MAGAZINE, GRENADE) instead of numeric literals when filtering by mode; logic now treats the default visible tab as BULLET when mode equals 1 or the BULLET ID. No public signatures changed.

Changes

Cohort / File(s) Summary
Ammo Press Filter Logic
src/main/java/com/paneedah/weaponlib/crafting/ammopress/GUIContainerAmmoPress.java
Replaced numeric mode checks (1, 2, 3) with CraftingGroup.BULLET.getID(), ...MAGAZINE.getID(), ...GRENADE.getID() in fillFilteredList(). Treats mode==1 as default BULLET tab and accepts BULLET when mode equals the BULLET ID; added explanatory note about default-tab initialization dependency.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change—restoring magazine and grenade crafting functionality to the ammo press—matching the code modifications to GUIContainerAmmoPress.java.
Description check ✅ Passed The description is directly related to the changeset, explaining the fix for magazine and grenade crafting broken by PR #540 with testing steps and backwards compatibility notes.
Linked Issues check ✅ Passed The code changes replace numeric literals with ID-based comparisons for BULLET, MAGAZINE, and GRENADE crafting groups, directly addressing issue #624's requirement to restore magazine and grenade crafting UI functionality.
Out of Scope Changes check ✅ Passed All modifications are scoped to fixing the ammo press crafting tabs; no unrelated changes or features outside the stated objectives are present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@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.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@src/main/java/com/paneedah/weaponlib/crafting/ammopress/GUIContainerAmmoPress.java`:
- Around line 102-107: Update the Javadoc comment in GUIContainerAmmoPress.java
to fix the spelling: change "corisponding" to "corresponding" in the sentence
that references getCraftingMode() and GUIContainerStation.java so the comment
reads correctly about the default tab not showing until its corresponding GUI
button is clicked.
🧹 Nitpick comments (1)
src/main/java/com/paneedah/weaponlib/crafting/ammopress/GUIContainerAmmoPress.java (1)

111-117: Consider initializing craftingMode to CraftingGroup.BULLET.getID() in initGui() to eliminate the magic number 1.

The || getCraftingMode() == 1 fallback couples this method to the parent class's default initialization value. The existing comment (lines 102–107) acknowledges this constraint, but the initialization can be made explicit and more maintainable.

Add the following after line 82:

  bulletSelector.toggleOn();
+ setCraftingMode(CraftingGroup.BULLET.getID());
+ fillFilteredList();

Then simplify the condition on line 111:

- if (getCraftingMode() == CraftingGroup.BULLET.getID() || getCraftingMode() == 1) {
+ if (getCraftingMode() == CraftingGroup.BULLET.getID()) {

…tainerAmmoPress.java

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@strubium strubium left a comment

Choose a reason for hiding this comment

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

LGTM

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.

It is not possible to craft any of the magazines

2 participants