-
Notifications
You must be signed in to change notification settings - Fork 182
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 + Misc Fixes #2455
Port/Rework Crafting Station to MUI2 + Misc Fixes #2455
Conversation
270a020
to
85a5c84
Compare
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:
|
f528df5
to
07a2377
Compare
2c0f220
to
f4e1615
Compare
9914d3b
to
6160fd7
Compare
d88f038
to
1558a94
Compare
3350a30
to
f542e0b
Compare
@@ -58,7 +58,7 @@ static ItemStackHashStrategy comparingItemDamageCount() { | |||
*/ | |||
class ItemStackHashStrategyBuilder { | |||
|
|||
private boolean item, count, damage, tag; | |||
private boolean item, count, damage, tag, meta; |
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.
Why is damage not enough?
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.
iirc because of GT Tools or something like that, i made this change a long time ago.
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.
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.
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?
src/main/java/gregtech/common/inventory/handlers/SingleItemStackHandler.java
Outdated
Show resolved
Hide resolved
src/main/java/gregtech/common/mui/widget/workbench/RecipeMemorySlot.java
Outdated
Show resolved
Hide resolved
src/main/java/gregtech/common/mui/widget/workbench/RecipeMemorySlot.java
Show resolved
Hide resolved
src/main/java/gregtech/common/mui/widget/workbench/RecipeMemorySlot.java
Show resolved
Hide resolved
src/main/java/gregtech/common/mui/widget/workbench/CraftingOutputSlot.java
Outdated
Show resolved
Hide resolved
src/main/java/gregtech/common/mui/widget/workbench/CraftingOutputSlot.java
Outdated
Show resolved
Hide resolved
src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java
Outdated
Show resolved
Hide resolved
4539e5a
to
e217b29
Compare
it should craft the item once (at least it does for me)
uh, not sure how that could happen, and i don't think i'm reproducing it.
this is a mui2 issue i think, would need to look into it more
that's the grid default, but i might be able to change it
i don't think previous logic checked the player inventory, but i could look into adding that |
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 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.
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.
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.
these recipes work fine for me
this is fixed.
fixed
i'm actually not sure how to get the tool crafting sound
couldn't reproduce
i couldn't reproduce this, but it might be fixed now
this is fixed now |
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 implemented dragging ghost ingredients from JEI doesn't really work. You can get the ghost ingredient onto your cursor, but when you click the grid with the item, nothing happens.
Durability render for tools in the crafting matrix is offcenter.
Can't click items from the output slot if there are items on the players cursor, even if the items match. You might want to look at the previous implementation of the various button clicks on the output slot, and see what all edge cases they solved.
Cannot use R/U JEI buttons on items in the memorized recipe widget
You can have both a locked and nonlocked memorized recipe of the same output (Tested with invar plates). If there is a locked recipe already, a new one should not be added, especially if it is the same recipe.
This may be hard, but right now, if the internal inventory is full, shift clicking a recipe will not complete the recipe, even if all the inputs would be consumed, thus freeing a slot in the internal inventory. Maybe it would be possible to calculate if a slot would be freed after using all the inputs, and if so craft the item, depositing the output into the now vacant input slot?
src/main/java/gregtech/common/gui/widget/craftingstation/CraftingSlotWidget.java
Show resolved
Hide resolved
src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityWorkbench.java
Outdated
Show resolved
Hide resolved
src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeLogic.java
Show resolved
Hide resolved
6162861
to
c6dce01
Compare
this is a consequence of setting the input event for Mui2 to "HIGH", it's fixed in mui2 master and i've implemented a mixin to fix it until the next mui2 release
this was a minor oversight in checking if there was enough space to fit the outputs, fixed now
both fixed
i think this is doable, but it's general convention to check if there's space first and only run if there is space. |
3d25f6b
to
91c440f
Compare
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.
Some visual desync with the crafting input grid. I had in a recipe for neutronium plates with a hammer, dragged in a random item from JEI to the bottom slot to break the recipe, closed the GUI and reopened the GUI. The bottom slot showed a neutronium ingot instead of the item that I dragged in, but the output slot was empty. Closed and reopened the GUI again and the output slot was occupied.
Dragging items from JEI does not update the missing items red tint if the recipe is broken. EG, I had the neutronium plate recipe loaded in the crafting input, with no ingots in the table so that the two ingots in the crafting matrix were red. I then dragged in something completly random from JEI to break the output of the recipe and turn it to nothing, and the two plates were still highlighted red. This doesn't happen when clicking items into the crafting grid from a stack on the cursor, just when dragging from JEI.
Items being dragged from JEI render under items in the crafting matrix and output slot and memorized recipe widget. But the green target area renders over tooltips of hovered items.
You can start the JEI dragging ghost item when you are on the storage tab, which renders the green target square over the items in the storage tab list. Dragging should only be available when on the crafting tab.
You can use the JEI +
recipe transfer when in the storage tab, and it will change the recipe in the crafting matrix. This should either be disabled in the storage tab, or set the crafting tab as the main active tab.
For some reason, you cannot JEI ghost drag enchanted books
src/main/java/gregtech/common/metatileentities/storage/CachedRecipeData.java
Outdated
Show resolved
Hide resolved
public void setItemsCraftedAmount(int itemsCrafted) { | ||
this.itemsCrafted = itemsCrafted; | ||
public void updateInventory(IItemHandlerModifiable handler) { | ||
this.availableHandlers = handler; | ||
} | ||
|
||
public void clearCraftingGrid() { | ||
fillCraftingGrid(Collections.emptyMap()); | ||
} | ||
|
||
public void fillCraftingGrid(Map<Integer, ItemStack> ingredients) { |
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.
Does this need to be passed a Map? Can't it just be passed a ItemStack to fill the grid with? The only use of this method is to clear the grid by passing an empty map to fill with empty itemstacks.
Findings from playing around ingame:
|
could not reproduce
fixed
green area is from JEI i think? fixed input items over dragged item
fixed
fixed
JEI returns "EnchantmentData" instead of the item stack itself for some reason
the toolbelt seems to be damaging the right tool from what i can see, but there are some other issues involving the active index of the toolbelt
didn't reproduce any duping, but maybe it's fixed now
only the root page is disabled for page widgets, all children are still enabled and active |
simplify attemptMatchRecipe() add method to get base index offset from ItemHandlerList
a461cf1
to
e6589f0
Compare
The crafting station seems to have issues with electric tools, but I only got this to happen once. I can't reproduce it 😕 |
If you have multiple tools in a toolbelt, it won't visually have the right tool selected. In my test it has a screwdriver (slot 1) and a wrench (slot 2), and putting it in marks the screwdriver as valid, but the TB is shown to be on the wrench. Putting another wrench in the crafting station makes it work and the TB shows as the screwdriver. |
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.
When doing a fluid container craft, eg our treated wood recipe, if you get to a point where the container is empty, the container is consumed instead of the recipe not being possible. You can then repeat the recipe, voiding the container, by providing extra empty containers.
Clicking a tab, Storage/Crafting, with an item in the cursor throws the item in the cursor to the ground.
Not sure at what point we should truncate item counts in the storage window. I had 1,664 items in an adjacent quantum chest, and the crafting storage window displayed that as 1.664k
, which could be truncated.
The Storage panel does not work with the qunatum storage network if you add a chest onto an existing, powered network that is connected to the workbench. You have to power off the network and then repower it, and then the new inventory in the quantum network gets synced.
src/main/java/gregtech/common/mui/widget/workbench/RecipeMemorySlot.java
Show resolved
Hide resolved
src/main/java/gregtech/common/mui/widget/workbench/CraftingOutputSlot.java
Outdated
Show resolved
Hide resolved
src/main/java/gregtech/common/mui/widget/workbench/CraftingOutputSlot.java
Outdated
Show resolved
Hide resolved
src/main/java/gregtech/common/mui/widget/workbench/CraftingOutputSlot.java
Outdated
Show resolved
Hide resolved
src/main/java/gregtech/common/mui/widget/workbench/CraftingOutputSlot.java
Outdated
Show resolved
Hide resolved
int j = toStack.getCount() + fromStack.getCount(); | ||
int maxSize = Math.min(toSlot.getSlotStackLimit(), fromStack.getMaxStackSize()); | ||
|
||
if (j <= maxSize) { |
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.
This should be j < maxSize
not <=
right? Since if it is equal, j will be the slot limit, or max stack size, and so nothing should be inserted into that slot, since it is full.
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.
j
is the combined stack sizes of toStack and fromStack. if the cursor has a size of 63 and the output slot a size of 1, then we couldn't take the stack because 63 + 1 < maxStackSize
would be false
finalStack.getCount() < outputStack.getMaxStackSize()) { | ||
if (!recipeLogic.performRecipe()) break; | ||
finalStack.setCount(finalStack.getCount() + outputStack.getCount()); | ||
handleItemCraft(outputStack, getSyncManager().getPlayer()); |
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.
Should this be passing finalStack
instead of ouputStack
?
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.
no, it gets called for each recipe craft, which will always be the original output stack. the final stack is what is sent to the slots
src/main/java/gregtech/common/mui/widget/workbench/CraftingOutputSlot.java
Show resolved
Hide resolved
src/main/java/gregtech/common/mui/widget/workbench/CraftingOutputSlot.java
Show resolved
Hide resolved
src/main/java/gregtech/common/mui/widget/workbench/CraftingOutputSlot.java
Show resolved
Hide resolved
this should be fixed now, it was an issue with the RecipeRepairItem mixin
this isn't easily fixable, since the toolbelt can only have one tool selected at a time |
rename method more appropriately
cannot reproduce
this is an issue that should be fixed in mui2
fixed
handler notifs weren't being sent when the network rebuilds itself when placing new quantum storages. fixed now |
store player in variable simplify empty slot insertion
clarify slot insertion
Can reproduce on the latest commit using a GT bronze drum. I filled the drum up all the way (32B), went the the workbench, placed in the ghost recipe using the drum and jungle wood. Shift clicked 4 times to empty the bucket, making 4 stacks of treated wood. Normal clicked once, and the bucket vanished from the input section. Then adding a stack more of empty drums and clicking the output voided the drums, but did not actually craft anything |
use format number for easy case in compact string
rename int sync value to be more appropriate
move ingredient list to CachedRecipeData apply the ingredient to the stack when extracting
okay, i see what i was doing differently. |
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.
You can pick up itemstacks when you are ghost dragging an item, which probably should not be allowed.
When you are ghost dragging an item, you can change the tab to the storage tab, which will leave the green highlighted slots. If the target of the ghost drag gets out of focus, ie on closed or not accesible GUI, the ghost dragging should maybe be cancelled.
You can still interact with the MemorizedRecipe Widget slots when dragging an item.
Minor: The move items +
in JEI shows up when you are in the crafting station GUI looking at JEI recipes, even if the recipe is not a crafting table recipe. IE, I can click the +
when looking at a fluid extractor recipe.
src/main/java/gregtech/common/mui/widget/workbench/CraftingInputSlot.java
Outdated
Show resolved
Hide resolved
src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityWorkbench.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
// this is actually supposed to include the tool and storage inventory | ||
// but that causes problems |
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.
eh, I don't think that the inventory page is supposed to contain the tool and internal inventory. It is really just a connected inventory page. So this comment is kinda not needed.
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 older inventory page used to include the tool and internal inventory as well as the connected inventory.
.mapTo(rowSize, list)); | ||
} | ||
|
||
public void sendHandlerToClient(PacketBuffer buffer) { |
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.
This just sends the connected inventories, but the readHandler method uses all the inventories. Do we need to write the internal inventory and the tool inventory as well?
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 internal and tool inventories exist on both sides and don't change. the only handler that can change is the connected inventory
src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java
Outdated
Show resolved
Hide resolved
src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeLogic.java
Outdated
Show resolved
Hide resolved
compact ids simplify crate change listener address todo only interact when not ghost dragging
ah, if it isn't the consequences of my actions. i've fixed all three of these by preventing interaction entirely with widgets while ghost dragging.
i'm actually not sure why this is happening or how to fix it. // register transfer handler for crafting recipes
registry.getRecipeTransferRegistry().addRecipeTransferHandler(new GregTechGuiTransferHandler(
jeiHelpers.recipeTransferHandlerHelper()), VanillaRecipeCategoryUid.CRAFTING); I pass in |
What
the fabled pr that ports the
crashingCrafting Station to cleanroom mui, and also reworks the crafting station logic.i now believe it is feature complete and ready for review
also a bunch of misc fixes because this pr is very old
Implementation Details
rework crafting station logic
port crafting station to mui2
fixes toolbelt crashing with bogosorter
implements fixes from mui2 master as mixins (jei ghost dragging)
makes crate notify neighbors on inventory change
minor fixes to Quantum Storage Network
improve RecipeRepairItem mixin
adds metadata to ItemStackHashStrategy
reworks ItemHandlerList
GTItemStackHandler
's setStackInSlot() now only sets the stack if the stack is differentformat easy case in
TextFormattingUtil#formatLongToCompactString()
add method to RenderUtil to render item stacks
deleted a bunch of old gui widget classes for the workbench
Todo/Notes
Outcome
crafting station will continue to exist