Fabric mod for Litematica. Makes minecraft:light blocks placeable through Easy Place.
Client-side only. Nothing is required on the server.
Litematica's Easy Place cannot place a light block in mid-air.
On the rewritten path (easyPlacePostRewrite = on) Litematica builds the click through
getClickPosition, which branches on easyPlaceClickAdjacent:
if (EASY_PLACE_CLICK_ADJACENT.getBooleanValue())
return getAdjacentClickPosition(targetPos);
return hitResult;With the option on ΓÇö the default ΓÇö getAdjacentClickPosition has to find some block to click,
because vanilla cannot click air. It walks the target's six neighbours looking for the first one
that is not replaceable, and returns null when they are all air:
for (Direction dir : Direction.values()) {
BlockPos neighbour = targetPos.relative(dir);
if (!PlacementUtils.isReplaceable(level, neighbour, false))
return new BlockHitResult(facePoint(neighbour, dir), dir.getOpposite(), neighbour, false);
}
return null; // every neighbour was airA light block floating in space has six neighbours of air, so the loop finds nothing,
getClickPosition returns null, and handleEasyPlace bails with FAIL at its
clickPos == null || hand == null check ΓÇö holding a valid target, a valid item and a valid hand.
BlockItem#place accepts a click on an empty cell, so the server is perfectly willing to fill it;
only the search above stands in the way.
Three things, all scoped to minecraft:light:
-
Makes the block visible to Litematica's ray trace.
MixinRayTraceUtilsredirectsBlockState#getShapeand answers a full cube for a light block, but only inside Litematica's schematic trace. Vanilla'sLightBlock#getShapeis untouched, so collision shapes, rendering and every other context see stock behaviour. -
Clicks the target cell directly. Instead of searching for a neighbour to click, the mod substitutes a
BlockHitResultaimed at the target cell itself. The click location is the centre of the face pointing back at the player's eye; the server only ever range-checks theBlockPos, not the vector. Guarded so it applies only to aminecraft:lighttarget that is present in the loaded schematic and still empty in the client world ΓÇö everything else keeps stock behaviour. -
Sends the rotation Litematica Printer sends. A
ServerboundMovePlayerPacket.Rotis emitted before the click, from the head of vanillaMultiPlayerGameMode#useItemOn. Only the packet ΓÇö the camera never moves. This is visible to the server and to anti-cheat that tracks look direction;rotateForLightBlocks = falseturns it off.
The hook sits on getClickPosition rather than getAdjacentClickPosition because the latter only
runs on the easyPlaceClickAdjacent = on branch ΓÇö hooking it there would make this mod a silent
no-op with the option off.
Litematica ships two separate implementations and this option picks between them:
WorldUtils.handleEasyPlace(mc):
if (EASY_PLACE_POST_REWRITE.getBooleanValue()) return false; // -> EasyPlaceUtils
return doEasyPlaceAction(mc); // -> WorldUtilsWith the option on, EasyPlaceUtils#handleEasyPlace runs and all three of the fixes above
apply.
With the option off, easyplacefix takes over: it works by injecting into
doEasyPlaceAction and cancelling it, which happens before this mod's hooks are reached. Light
blocks are rejected at that point and no amount of configuration changes it. This is Litematica's
option, not this mod's.
Litematica's own easyPlaceClickAdjacent makes no difference either way.
Drop the jar in mods/. Requires Fabric Loader and Litematica 0.28.8 or newer.
Remove any older version of this mod first.
config/easyplace_lightfix.properties, created on first launch. All three default to true, which
is what makes the mod work without touching anything.
| Key | Meaning |
|---|---|
rotateForLightBlocks |
Send the rotation packet. Off if anti-cheat is a concern. |
rescueLightTarget |
Recover the target when a closer vanilla block wins the ray. |
directClickForLightBlocks |
Click a light block's target cell directly. Off means a mid-air light block cannot be placed. |
Requires JDK 21+.
./gradlew build
Output in build/libs/.
MIT. See LICENSE.