Artisan Worktables 1.12

Artisan Worktables 1.12

3M Downloads

Inconsistencies with Vanilla CraftTweaker recipes

copygirl opened this issue · 5 comments

commented

Issue Description

CraftTweaker recipes function differently in Vanilla crafting tables and AW worktables.

Steps To Reproduce

  • /give @p pyrotech:bucket_wood
  • /give @p clay_ball 64
  • Craft empty bucket with clay ball in any AW worktable.
  • A partially damaged wooden bucket is left behind in the crafting grid.
  • Place the resulting partially filled bucket (with 4 units of clay) into the grid.
    (Make sure to not leave clay behind in the crafting grid, or... #240.)
  • The crafting result is a clay ball as expected.
  • The recipe puts an empty bucket into the player's inventory.
  • The partially filled bucket in the crafting grid now has 3 units of clay in it.
    This could be the result from applying getContainerItem..?

What You Expect to Happen

I expect the same behavior as in the Vanilla crafting table.

Script

bucket_of_clay.zs

Affected Versions / Used Mods

commented

how does that have anything to do with artisan worktable? 🤔
what you linked is just about pyrotech and vanilla crafting table recipes

commented

@Mrthomas20121: If you try crafting the same recipes in a Vanilla crafting table (or the 2x2 inventory grid), you get a different result. The bold highlighted points are what differs in AW tables.

commented

Can we simplify the reproduction? Can it be reproduced with just Minecraft, Forge, CrT, and AW (and lib)?

commented

This was caused because Artisan Worktables (AW) incorrectly handled remaining items. The call to getRemainingItems allowed returning items to the crafting grid, but did not allow explicitly declaring a slot empty. Items in the remaining items list were merged back into the crafting grid after all slots were reduced, while empty slots in the remaining items list were simply ignored.

The call to getRemainingItems now returns an authoritative list of the remaining items. Responsibility for reducing item slots has also been transferred to the getRemainingItems method.

This solves the issue and reveals another.

When removing a clay ball from a wooden bucket, the remaining wooden bucket always has 7 / 8 durability. With a vanilla table, the remaining wooden bucket is always 8 / 8.

I believe this discrepancy in behavior is caused by the order of operations.

Pyrotech (Pt) uses the PlayerEvent.ItemCraftedEvent to damage remaining buckets and CraftTweaker (CrT) also uses the same event. Both mods use the event at the same priority level which means dispatch order is undefined.

My assumption is that when crafted in the vanilla table, the event is received first by Pt, then by CrT, and when crafted in the AW tables, the transforms are always applied before the event is fired. When fired from the AW tables, the event will be ignored by the CrT stuff because its inventory isn't an instance of vanilla's InventoryCrafting, which is expected behavior. Pt still picks up the event, though, and damages the bucket after the transforms have been applied.

This is, however, an entirely new issue and shouldn't be tacked onto this one.

commented

This should be fixed in the next patch 1.23.3