Litematica (Forge)

Litematica (Forge)

336k Downloads

EasyPlace cant prevent block placing while moving

Cruwzky opened this issue ยท 2 comments

commented

Minecraft version
1.17.1

Mod version and malilib version
litematica-fabric-1.17.1-0.0.0-dev.20210906.183617.jar
malilib-fabric-1.17.1-0.10.0-dev.26

Description of the bug
Turning on EasyPlace and trying to place blocks on a schematics the EasyPlace are supposed to prevent placing blocks outside of the schematic. This does work while standing still, if I start to move it does not prevent the placement. I have tested in mulitplayer and singleplayer. I have also tested on diffrent computers, its the same problem.

Update: I did not even notice, but EasyPlace cant even place blocks while moving on the schematic. It's only placeing blocks outside the schematic.

https://www.youtube.com/watch?v=j8OY91jM4Us

commented

It's a bit difficult to tell from both of those videos, but I think you are quite likely running into the same issue that you must initially click on a schematic block, otherwise the Easy Place mode does not "activate" at all and you just get vanilla placement if you keep holding down right click. So if you right click on air and then move the cursor over the schematic, you just get vanilla placement. Also if you eat, you get vanilla placement after the eating action finishes, if you keep holding down right click. It's because of how the Easy Place mode is only hooked up to the actual input handling (normally right click) in the 1.13+ code.

I entirely rewrote the Easy Place mode over a year ago in the 1.12.2 version, and there it's now hooked up to the actual item use code instead of just the input handling. So in other words it should work correctly in all cases there. (The rewrite was not just about that, but all the other issues the Easy Place mode has, such as with slabs and also fluids before 1.13, slabs + fluids at the same time being "the worst thing to ever exist" pre-1.13. The vanilla hooking from input -> item use was just done as part of the rewrite.)

commented

I also reproduced this issue:
https://www.youtube.com/watch?v=yi6Dq4Zmrto

(I have an edited version that doesn't spam easyPlace failure messages)

In my case, ray tracing in doEasyPlaceAction function occasionally returns a hit type of RayTraceWrapper.HitType.VANILLA_BLOCK instead of the usual RayTraceWrapper.HitType.SCHEMATIC_BLOCK. Afterwards, in placementRestrictionInEffect function, this happens:

            if (schematicHasAir && isPositionWithinRangeOfSchematicRegions(pos, 2))
            {
                return true;
            }

return true is converted to ActionResult.FAIL, which means the action should actually be cancelled, but it isn't.

I really don't know what's going on in here.