tr7zw / ItemSwapper

Tweaks to the inventory system based on Xisumavoid's video.
Other
101 stars 30 forks source link

Litematica mixin interferes with Litematica’s pick block behavior #177

Open xane256 opened 1 year ago

xane256 commented 1 year ago

Version information

itemswapper-fabric-0.5.3-mc1.20.1.jar

Other relevant installed mods

malilib 1.20.1-0.16.2, Litematica 1.20.1-0.15.3

Expected Behavior

  1. In survival, pick-block on a schematic block that is either Correct or Missing does not obey Litematica’s pickBlockableSlots setting, even when pickBlockAvoidTools is set to False. In other words filling the hotbar with tools is not the reason pickBlockableSlots is ignored. I suspect the reason is because ItemSwapper has its own pick block behavior in the Litematica mixin.
  2. In creative, pick block on a Missing schematic block does not give you the item, but if you have the item in "survival inventory" (in creative mode) then the item does get swapped to hotbar.

Actual Behavior

  1. The item should be swapped to the hotbar into a slot that obeys Litematica’s pickBlockableSlots setting. This is the observed behavior when ItemSwapper is not installed.
  2. The item should be given to the player in creative if necessary, similar to what Litematica does when ItemSwapper is not installed.

Reproduction Steps

  1. In survival:

    • Load a schematic containing stone blocks
    • set litematicas pickBlockableSlots to 4,5,6,7
    • put swords in slots 1,2,3
    • Fill hotbar with dirt
    • put stone in inventory
    • do pick block on the ghost stone while holding a sword. Notice that the sword is replaced with stone instead of the stone going into one of the dirt slots.
  2. in creative:

    • load a schematic of stone blocks
    • do /clear
    • pick block the stone
    • Notice that you dont get any stone

Render engine

Additional information

https://github.com/tr7zw/ItemSwapper/blob/38a3fdf6ef5b194590f915d66a692be44c2e7f2e/XTFabric/src/main/java/dev/tr7zw/itemswapper/mixin/LitematicaMixin.java#L23

tr7zw commented 1 year ago

I had to fully overwrite Litematicas pickblock logic since there is no way to hook it otherwise(it runs+canceles before any vanilla logic I could hook). Will have to look into how far I can simulate that behavior/hook further down in litematica.