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

Adds Groovyscript support for crafting #325

Merged
merged 45 commits into from
Dec 19, 2023

Conversation

yor42
Copy link
Contributor

@yor42 yor42 commented Dec 19, 2023

📝 Description

This PR Adds Groovyscript support for crafting such as ammo press and workbench.

🎯 Goals

  • add Groovyscript support for crafting such as ammo press and workbench for easier modpack development.

❌ Non Goals

  • Completely replacing existing json recipe is not a goal for compatibility's sake

🚦 Testing

use following example script on Postinit Script of Groovyscript (E.G: run/groovy/postinit/main.groovy)

mods.mwc.craftingstation.removeAllinGroup("GUN")
mods.mwc.craftingstation.recipeBuilder().output(item('minecraft:clay')).addEntry(item('minecraft:nether_star')*4).register()
mods.mwc.craftingstation.recipeBuilder().output(item('minecraft:iron_ingot')).addOredict("oreIron", 4, 0.5).addOredict("oreCoal", 4).register()

this script should do 3 things:

  1. clear ALL the recipes in gun tab of workbench
  2. add 2 example script. 1 recipe that turns 4 nether star into 1 clay block with 100% yield, and 1 recipe that turns 4 Iron Ore (50% Yield) and 1 Coal Ore(100% Yield) (both are ore dictionary entry) into 1 Iron ingot.

image

image

Test video to prove that this PR doesn't break anything even if Groovyscript isn't present in runtime:

2023-12-19.20-49-10_1.mp4

⏮️ Backwards Compatibility

Exisiting JSON Recipe system is not replaced. since it should not cause issue with any existing modpack that utilizes the JSON for their costom recipes.

📚 Related Issues & Documents

N/A

🖼️ Screenshots/Recordings

image

image

📖 Added to documentation?

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

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

N/A

Summary by CodeRabbit

  • New Features

    • Introduced a new crafting system with enhanced recipe management and crafting stations.
    • Added compatibility with Groovy scripting for mod customization.
  • Enhancements

    • Updated user interfaces for crafting stations, improving user experience.
    • Streamlined crafting processes, allowing for more intuitive item crafting.
  • Bug Fixes

    • Resolved issues with item crafting logic that affected the correct item output.
    • Fixed tooltip rendering issues in crafting interfaces.
  • Refactor

    • Standardized item return types across various methods for consistency.
    • Optimized conditional checks and control flow for better performance.
  • Documentation

    • Updated in-game tooltips and help sections to reflect new crafting features.
  • Chores

    • Cleaned up unused import statements and redundant code.

yor42 and others added 30 commits November 15, 2023 23:47
Co-authored-by: Desoroxxx <desoroxxx@gmail.com>
Co-authored-by: Desoroxxx <desoroxxx@gmail.com>
….java

Co-authored-by: Desoroxxx <desoroxxx@gmail.com>
…tion.java

Co-authored-by: Desoroxxx <desoroxxx@gmail.com>
….java

Co-authored-by: Desoroxxx <desoroxxx@gmail.com>
…tion.java

Co-authored-by: Desoroxxx <desoroxxx@gmail.com>
Co-authored-by: Desoroxxx <desoroxxx@gmail.com>
…tion.java

Co-authored-by: Desoroxxx <desoroxxx@gmail.com>
…tion.java

Co-authored-by: Desoroxxx <desoroxxx@gmail.com>
…tion.java

Co-authored-by: Desoroxxx <desoroxxx@gmail.com>
@Desoroxxx Desoroxxx added this to the 0.1 milestone Dec 19, 2023
Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: OK

  • Declining Code Health: 1 findings(s) 🚩
  • Improving Code Health: 8 findings(s) ✅
  • Affected Hotspots: 0 files(s) 🔥

Recommended Review Level: Detailed -- Increased risk for defects: The risk is higher as much of the code in this repo (99% of all commits) is written by other authors.
View detailed results in CodeScene

🚩 Declining Code Health (highest to lowest):

✅ Improving Code Health:

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: OK

  • Declining Code Health: 1 findings(s) 🚩
  • Improving Code Health: 8 findings(s) ✅
  • Affected Hotspots: 0 files(s) 🔥

Recommended Review Level: Detailed -- Increased risk for defects: The risk is higher as much of the code in this repo (99% of all commits) is written by other authors.
View detailed results in CodeScene

🚩 Declining Code Health (highest to lowest):

✅ Improving Code Health:

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: OK

  • Declining Code Health: 1 findings(s) 🚩
  • Improving Code Health: 8 findings(s) ✅
  • Affected Hotspots: 0 files(s) 🔥

Recommended Review Level: Detailed -- Increased risk for defects: The risk is higher as much of the code in this repo (99% of all commits) is written by other authors.
View detailed results in CodeScene

🚩 Declining Code Health (highest to lowest):

✅ Improving Code Health:

@yor42 yor42 marked this pull request as ready for review December 19, 2023 12:04
@yor42 yor42 requested a review from Desoroxxx December 19, 2023 12:05
@Desoroxxx Desoroxxx marked this pull request as draft December 19, 2023 14:09
Desoroxxx
Desoroxxx previously approved these changes Dec 19, 2023
Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: OK

  • Declining Code Health: 1 findings(s) 🚩
  • Improving Code Health: 8 findings(s) ✅
  • Affected Hotspots: 0 files(s) 🔥

Recommended Review Level: Detailed -- Increased risk for defects: The risk is higher as much of the code in this repo (99% of all commits) is written by other authors.
View detailed results in CodeScene

🚩 Declining Code Health (highest to lowest):

✅ Improving Code Health:

@Desoroxxx Desoroxxx marked this pull request as ready for review December 19, 2023 14:12
@Desoroxxx
Copy link
Collaborator

@coderabbitai review

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 7035ca7 and c54c6d0.
Files selected for processing (24)
  • build.gradle (1 hunks)
  • src/main/java/com/paneedah/mwc/MWC.java (2 hunks)
  • src/main/java/com/paneedah/mwc/groovyscript/MWCGroovyPlugin.java (1 hunks)
  • src/main/java/com/paneedah/mwc/groovyscript/recipes/GSCrafting.java (1 hunks)
  • src/main/java/com/paneedah/mwc/groovyscript/script/CraftingStation.java (1 hunks)
  • src/main/java/com/paneedah/mwc/init/MWCRecipes.java (2 hunks)
  • src/main/java/com/paneedah/mwc/items/equipment/carryable/ItemCarryable.java (1 hunks)
  • src/main/java/com/paneedah/mwc/network/handlers/WorkbenchServerMessageHandler.java (1 hunks)
  • src/main/java/com/paneedah/weaponlib/CustomArmor.java (1 hunks)
  • src/main/java/com/paneedah/weaponlib/HighIQSpawnEgg.java (2 hunks)
  • src/main/java/com/paneedah/weaponlib/ItemAttachment.java (1 hunks)
  • src/main/java/com/paneedah/weaponlib/ItemVest.java (1 hunks)
  • src/main/java/com/paneedah/weaponlib/Weapon.java (1 hunks)
  • src/main/java/com/paneedah/weaponlib/command/MainCommand.java (1 hunks)
  • src/main/java/com/paneedah/weaponlib/config/BalancePackManager.java (1 hunks)
  • src/main/java/com/paneedah/weaponlib/crafting/CraftingEntry.java (1 hunks)
  • src/main/java/com/paneedah/weaponlib/crafting/CraftingRegistry.java (5 hunks)
  • src/main/java/com/paneedah/weaponlib/crafting/IModernCrafting.java (2 hunks)
  • src/main/java/com/paneedah/weaponlib/crafting/ammopress/GUIContainerAmmoPress.java (2 hunks)
  • src/main/java/com/paneedah/weaponlib/crafting/base/GUIContainerStation.java (5 hunks)
  • src/main/java/com/paneedah/weaponlib/crafting/base/TileEntityStation.java (1 hunks)
  • src/main/java/com/paneedah/weaponlib/crafting/workbench/GUIContainerWorkbench.java (1 hunks)
  • src/main/java/com/paneedah/weaponlib/crafting/workbench/TileEntityWorkbench.java (1 hunks)
  • src/main/java/com/paneedah/weaponlib/grenade/ItemGrenade.java (1 hunks)
Files skipped from review due to trivial changes (1)
  • src/main/java/com/paneedah/weaponlib/config/BalancePackManager.java
Additional comments: 3
src/main/java/com/paneedah/weaponlib/crafting/workbench/GUIContainerWorkbench.java (1)
  • 200-204: The change in method calls from getSelectedCraftingPiece().getItem() to getSelectedCraftingPiece().getItem().getItem() is consistent with the PR's objective to modify the getItem method's return type from Item to ItemStack. However, ensure that the getSelectedCraftingPiece().getItem() method itself correctly returns an ItemStack and not another wrapper that would require further unwrapping.
src/main/java/com/paneedah/weaponlib/crafting/workbench/TileEntityWorkbench.java (1)
  • 130-132: The change to pass this.craftingTarget.getItem() directly to addStackToInventoryRange suggests that the method signature for addStackToInventoryRange has been updated to accept an Item instead of an ItemStack. Verify that the addStackToInventoryRange method has been appropriately modified to handle an Item as its parameter and that this change is consistent across all usages of the method.
src/main/java/com/paneedah/weaponlib/grenade/ItemGrenade.java (1)
  • 50-51: The change in the getItem method's return type from Item to ItemStack is consistent with the PR's objective. Ensure that all usages of the getItem method within the ItemGrenade class and any other classes that interact with ItemGrenade objects are updated to handle an ItemStack return type.

Copy link
Collaborator

@Desoroxxx Desoroxxx left a comment

Choose a reason for hiding this comment

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

Missed some important things in previous reviews but apart from that looking ready to merge

src/main/java/com/paneedah/weaponlib/Weapon.java Outdated Show resolved Hide resolved
src/main/java/com/paneedah/weaponlib/HighIQSpawnEgg.java Outdated Show resolved Hide resolved
src/main/java/com/paneedah/weaponlib/CustomArmor.java Outdated Show resolved Hide resolved
Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: OK

  • Declining Code Health: 1 findings(s) 🚩
  • Improving Code Health: 8 findings(s) ✅
  • Affected Hotspots: 0 files(s) 🔥

Recommended Review Level: Detailed -- Increased risk for defects: The risk is higher as much of the code in this repo (99% of all commits) is written by other authors.
View detailed results in CodeScene

🚩 Declining Code Health (highest to lowest):

✅ Improving Code Health:

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: OK

  • Declining Code Health: 1 findings(s) 🚩
  • Improving Code Health: 8 findings(s) ✅
  • Affected Hotspots: 0 files(s) 🔥

Recommended Review Level: Detailed -- Increased risk for defects: The risk is higher as much of the code in this repo (99% of all commits) is written by other authors.
View detailed results in CodeScene

🚩 Declining Code Health (highest to lowest):

✅ Improving Code Health:

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: OK

  • Declining Code Health: 1 findings(s) 🚩
  • Improving Code Health: 8 findings(s) ✅
  • Affected Hotspots: 0 files(s) 🔥

Recommended Review Level: Detailed -- Increased risk for defects: The risk is higher as much of the code in this repo (99% of all commits) is written by other authors.
View detailed results in CodeScene

🚩 Declining Code Health (highest to lowest):

✅ Improving Code Health:

@Desoroxxx Desoroxxx merged commit fd189ab into Cubed-Development:next Dec 19, 2023
1 check passed
@yor42 yor42 deleted the groovyscript branch December 19, 2023 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants