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

Port/Rework Crafting Station to MUI2 #2455

Open
wants to merge 146 commits into
base: master
Choose a base branch
from

Conversation

ghzdude
Copy link
Contributor

@ghzdude ghzdude commented Apr 17, 2024

What

the fabled pr that ports the crashing Crafting Station to cleanroom mui, and also reworks the crafting station logic.
i now believe it is feature complete and ready for review

Implementation Details

rework crafting station logic
port crafting station to mui2

Todo/Notes

  • crafting grid - essentially complete
    • JEI transfer complete
    • should probably not be specific to the crafting station
    • no longer extends itemslot
  • output slot
    • no longer extends itemslot, syncing and interaction is handled manually
  • recipe memory slots
    • effectively feature complete
  • inventory tab - essentially complete
    • should correctly update and handle when inventories are added/removed

Outcome

crafting station will continue to exist

@ghzdude ghzdude added the type: feature New feature or request label Apr 17, 2024
@ghzdude ghzdude force-pushed the gh-crafting-station-mui-port branch from 270a020 to 85a5c84 Compare April 20, 2024 21:20
@ghzdude ghzdude marked this pull request as ready for review May 3, 2024 18:51
@ghzdude ghzdude requested review from a team as code owners May 3, 2024 18:51
@bruberu
Copy link
Member

bruberu commented Jun 4, 2024

To summarize a few things I found in an in-game review that would be good to have before I go all-in with reviewing 19 files:

  • Re-implement the red tint on top of missing items
  • Use the correct tool slot overlay
  • Add an output stack amount indicator
  • Allow JEI shortcuts on all of the different ghost slots
  • Prevent unlocked items in recipe memory from at least getting immediately overwritten
  • Remove unused classes from the pre-MUI widget system-
  • Move datacodes to the correct file
  • Fix the lock icon rendering under the items
  • Resolve the "tool damage" TODO (and in fact process all item crafting behaviors, such as that of buckets)
  • Re-implement shift-clicking behavior

@ghzdude ghzdude force-pushed the gh-crafting-station-mui-port branch 2 times, most recently from f528df5 to 07a2377 Compare June 9, 2024 19:46
@ghzdude ghzdude force-pushed the gh-crafting-station-mui-port branch from 2c0f220 to f4e1615 Compare July 20, 2024 17:24
@ghzdude ghzdude force-pushed the gh-crafting-station-mui-port branch from 9914d3b to 6160fd7 Compare August 25, 2024 06:53
@ghzdude ghzdude force-pushed the gh-crafting-station-mui-port branch from d88f038 to 1558a94 Compare October 17, 2024 00:13
@ghzdude ghzdude force-pushed the gh-crafting-station-mui-port branch from 3350a30 to f542e0b Compare January 10, 2025 01:46
@@ -58,7 +58,7 @@ static ItemStackHashStrategy comparingItemDamageCount() {
*/
class ItemStackHashStrategyBuilder {

private boolean item, count, damage, tag;
private boolean item, count, damage, tag, meta;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is damage not enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

iirc because of GT Tools or something like that, i made this change a long time ago.

Copy link
Contributor

@ALongStringOfNumbers ALongStringOfNumbers left a comment

Choose a reason for hiding this comment

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

Shift clicking the output slot of the crafting station does not do anything, when you have enough items in the inventory to craft multiple of the output.

When viewing the contents of connected inventories in the inventory tab, the contents are not sorted so that all the actual items are visible at the top of the tab. Instead items are separated by any empty inventory spaces remaining in one of the inventories before showing other existing items.

2025-01-28_16-53
this is 2 chests, 1 on either side of the station.

Crafting a recipe, locking the recipe in the memorized tab, and then crafting the recipe again removes the lock status in the memorized recipe tab.

There should be a way to clear the existing recipe displayed in the crafting slots widget, so you don't have to clock all the slots one by one. A little x or something in the top next to the grid.

I somehow managed to reset the count of the items crafted. Not sure how. I had crafted 16 LV motors, left the GUI, came back, crafted some other stuff, and the times crafted tooltip only showed 8.

There is some delay with the scroll bar in the item source window that can really be felt. If you scroll down and then immediately scroll back up, nothing happens on the scroll back up. You have to reach the bottom/top of the scroll bar distance for this to happen, if you change directions in the middle it feels ok.

The scroll bar for the item source tab is too close to the slots in the window, and cuts off the item counts of things in the right most slots.

The item source window should get some special handling for the quantum chest I believe, because right now is shows the virtualized items and the items in the output slot. It would be better if it showed a combined total of the two.

When the crafting station is checking if it can complete a recipe, it only checks its internal inventory and the connected inventories. Do we want to check the players inventory as well?

@Override
public void drawForeground(ModularGuiContext context) {
RichTooltip tooltip = getTooltip();
if (tooltip != null && isHoveringFor(tooltip.getShowUpTimer())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we using tooltip.getShowUpTimer()? We never set a time value for the hovering amount, and the default time is 0 ticks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this mimics mui2's item slot tooltip draw

@@ -42,6 +42,7 @@ dependencies {
api("codechicken:codechickenlib:3.2.3.358")
api("com.cleanroommc:modularui:2.5.0-rc2") { transitive = false }
api("com.cleanroommc:groovyscript:1.2.0-hotfix1") { transitive = false }
api("curse.maven:inventory-bogosorter-632327:4951607-deobf-4951608-sources-4951609")
Copy link
Contributor

Choose a reason for hiding this comment

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

This is added as a dep, but nothing is done with it in this PR that I can see, do we still need it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is required due to ModularContainer implementing a bogosorter interface, which is loaded from GregTechGuiTransferHandler

cleanup + clarify variables
@ghzdude ghzdude force-pushed the gh-crafting-station-mui-port branch from 4539e5a to e217b29 Compare January 29, 2025 21:31
@ghzdude
Copy link
Contributor Author

ghzdude commented Jan 30, 2025

Shift clicking the output slot of the crafting station does not do anything, when you have enough items in the inventory to craft multiple of the output.

it should craft the item once (at least it does for me)

I somehow managed to reset the count of the items crafted. Not sure how. I had crafted 16 LV motors, left the GUI, came back, crafted some other stuff, and the times crafted tooltip only showed 8.

uh, not sure how that could happen, and i don't think i'm reproducing it.

There is some delay with the scroll bar in the item source window that can really be felt. If you scroll down and then immediately scroll back up, nothing happens on the scroll back up. You have to reach the bottom/top of the scroll bar distance for this to happen, if you change directions in the middle it feels ok.

this is a mui2 issue i think, would need to look into it more

The scroll bar for the item source tab is too close to the slots in the window, and cuts off the item counts of things in the right most slots.

that's the grid default, but i might be able to change it

When the crafting station is checking if it can complete a recipe, it only checks its internal inventory and the connected inventories. Do we want to check the players inventory as well?

i don't think previous logic checked the player inventory, but i could look into adding that

Copy link
Contributor

@ALongStringOfNumbers ALongStringOfNumbers left a comment

Choose a reason for hiding this comment

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

The crafting station doesn't handle special crafting recipe with fluid containers. EG, you can use a drum of creosote to craft treated wood in a normal crafting table, but this is not recognized in the crafting station.

Some weird highlighting going on with the crafting grid when I placed in ghost ingredients by hand. Started in the bottom right, and then added items counter clockwise. I think it failed on the stick recipe when I added the two items into the grid, but then did not update the tint as I added more items into the grid. Yeah, testing this with jungle planks, it forms the stick recipe after placing in two planks, but then the tint does not disappear after invalidating the stick recipe by placing a third plank in the grid.

picture:
2025-01-29_19-45

Found a way to void items. When crafting a lot of an item, such that the internal inventory fills up, continueing to shift click craft the item will void the output, instead of placing it in the players inventory or dropping it on the ground if the players inventory is full (I don't remember if vanilla drops the items on the ground if the players inventory is full, or just prevents more crafts). I was testing this with the Invar Wrench recipe, and this only happened when shift clicking the craft.

No tool crafting sounds are played when crafting items with GT tools in the crafting station. This does not apply to the breaking sound though, that works fine.

Found some weird slot tinting issue, where some slots are tinted darker than other slots. I had the recipe for Circuit Boards in the table, and then shift clicked in the recipe for iron plates from JEI, and two of the slots were tinted darker than they should be for empty slots.

picture:
2025-01-29_20-05

For the memorized recipe grid, while it is not full, new crafts are added to the beginning of the list and displayed in the top right slot. However, after the grid is filled up new recipes are added to the bottom right slot. Previously new recipes would always be added to the top left slot, and if the grid was full the bottom right slot would be deleted, with the slot next to it taking its place. This is to always have the most recent crafted recipe not immediately be pushed off the grid if you craft another new recipe.

@ghzdude
Copy link
Contributor Author

ghzdude commented Jan 30, 2025

The crafting station doesn't handle special crafting recipe with fluid containers. EG, you can use a drum of creosote to craft treated wood in a normal crafting table, but this is not recognized in the crafting station.

these recipes work fine for me

Some weird highlighting going on with the crafting grid when I placed in ghost ingredients by hand. Started in the bottom right, and then added items counter clockwise. I think it failed on the stick recipe when I added the two items into the grid, but then did not update the tint as I added more items into the grid. Yeah, testing this with jungle planks, it forms the stick recipe after placing in two planks, but then the tint does not disappear after invalidating the stick recipe by placing a third plank in the grid.

this is fixed.

Found a way to void items. When crafting a lot of an item, such that the internal inventory fills up, continueing to shift click craft the item will void the output, instead of placing it in the players inventory or dropping it on the ground if the players inventory is full (I don't remember if vanilla drops the items on the ground if the players inventory is full, or just prevents more crafts). I was testing this with the Invar Wrench recipe, and this only happened when shift clicking the craft.

fixed

No tool crafting sounds are played when crafting items with GT tools in the crafting station. This does not apply to the breaking sound though, that works fine.

i'm actually not sure how to get the tool crafting sound

Found some weird slot tinting issue, where some slots are tinted darker than other slots. I had the recipe for Circuit Boards in the table, and then shift clicked in the recipe for iron plates from JEI, and two of the slots were tinted darker than they should be for empty slots.

couldn't reproduce

For the memorized recipe grid, while it is not full, new crafts are added to the beginning of the list and displayed in the top right slot.

i couldn't reproduce this, but it might be fixed now

However, after the grid is filled up new recipes are added to the bottom right slot. Previously new recipes would always be added to the top left slot, and if the grid was full the bottom right slot would be deleted, with the slot next to it taking its place. This is to always have the most recent crafted recipe not immediately be pushed off the grid if you craft another new recipe.

this is fixed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature New feature or request
Projects
Status: Hard
Development

Successfully merging this pull request may close these issues.

4 participants