codetaylor / artisan-worktables-1.12

Themed worktables with a tool slot.
Other
17 stars 6 forks source link

[Bug] Items in crafting grid slots deleted when logging out and back in in SSP #23

Closed thephoenixlodge closed 6 years ago

thephoenixlodge commented 6 years ago

Discovered by accident while testing my JEI recipe loading issue. Leaving items in the crafting grid in the shape of a valid staged recipe when exiting and reloading the world results in the ingredient items being deleted. It seems it only occurs when there is actually something showing in the output slot. Curiously, the tool slot remains intact, only the main 9 ingredient slots are affected.

Versions: Forge: 2590 Athaneum: 1.3.3 Artisan Worktables: 1.7.12

codetaylor commented 6 years ago

Attempted to reproduce using only the following mods:

Used these recipes:

import mods.artisanworktables.Worktable;

Worktable.addRecipeShapeless("mage", <minecraft:crafting_table>, <ore:carpenters_hammer>, 3, [<minecraft:string>, <minecraft:string>], <minecraft:stone> * 5, 0.12);

Worktable.addStagedRecipeShaped("two", "carpenter", <minecraft:string>, <ore:carpenters_hammer>, 3, false, [
    [<minecraft:planks>],
    [<minecraft:planks>],
    [<minecraft:planks>]],
    <minecraft:stone>, 0.15);

Worktable.addStagedRecipeShaped("one", "carpenter", <minecraft:crafting_table>, <ore:carpenters_hammer>, 3, false, [
    [<minecraft:planks>],
    [<minecraft:planks>],
    [<minecraft:planks>]]);

Attempt 0:

  1. Launch MC
  2. Place recipe pattern in 3x3 grid
  3. Verify result item in result slot (valid recipe)
  4. Exit to main menu
  5. Wait two minutes
  6. Re-load world and check each table
  7. Items not deleted

Attempt 1:

  1. Launch MC
  2. Place recipe pattern in 3x3 grid
  3. Verify result item in result slot (valid recipe)
  4. Exit the game
  5. Re-launch the game, load the world, and check each table
  6. Items not deleted

Tested with Carpenter's Worktable and Mage's Worktable.

Could not reproduce this issue.

codetaylor commented 6 years ago

This is a serious usability issue and I'd like to be able to reproduce it. Thus far I've been unable to reproduce it.

If you have the time, could you attempt to reproduce it using the absolute minimum of mods (ie. forge, the lib, the mod) and if you are able to get it to reproduce, please note the steps you took to reproduce it and the recipe involved. I'd love to be able to fix this, thanks.

codetaylor commented 6 years ago

I may have just reproduced this unintentionally.

Before: image

After: image

I quit the game while the container is open by clicking the X in the window and it seems to have deleted all items in the crafting grid.

codetaylor commented 6 years ago

Yes, twice in a row. I'm working in the feature branch, and this is the recipe:

Worktable.createRecipeBuilder("carpenter")
    .setShaped([
        [<minecraft:planks>],
        [<minecraft:planks>],
        [<minecraft:planks>]])
    .setTool(<ore:carpenters_hammer>, 3)
    .addOutput(<minecraft:dye:1>.withTag({name: "test1"}) * 5, 70)
    .addOutput(<minecraft:dye:1>.withTag({name: "test2"}) * 5, 90)
    .addOutput(<minecraft:dye:1>.withTag({name: "test3"}) * 5, 120)
    .setExtraOutputOne(<minecraft:stone> * 5, 0.12)
    .setExtraOutputTwo(<minecraft:stone> * 5, 0.12)
    .setExtraOutputThree(<minecraft:stone> * 5, 0.12)
    .requireGameStages("ANY", ["oneCamel"])
    .excludeGameStages(["twoCamel"])
    .create();
codetaylor commented 6 years ago

I've been able to get this issue by doing the following:

It seems to keep the items in the crafting grid if the layout doesn't complete a valid recipe.

codetaylor commented 6 years ago

Put this in the table: image

Exiting and reloading seems to load the last invalid recipe that was saved in the table: image

codetaylor commented 6 years ago

Okay. I've submitted a new build that may fix the problem. I've added observers to all the TE's stack handlers to mark the TE as dirty any time the handler is changed. Since making this change I haven't been able to reproduce the issue. Since I had a lot of trouble reproducing the issue to begin with, however, I'd like to keep this issue open for a while longer.

Please try the new build (1.12.2-1.7.14) and keep an eye out for this errant behavior. If you continue to have the issue, please let me know.

thephoenixlodge commented 6 years ago

I'm at work right now, but I'll definitely make sure to test it once I get home later

thephoenixlodge commented 6 years ago

as far as I can tell, it has indeed been fixed