Skip to content

BuildersWand: extrude mode + cell handler API - #305

Open
Cooble wants to merge 10 commits into
GTNewHorizons:masterfrom
Cooble:feature/multivariant-builders-wand
Open

Cooble wants to merge 10 commits into
GTNewHorizons:masterfrom
Cooble:feature/multivariant-builders-wand

Conversation

@Cooble

@Cooble Cooble commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

resolves #298
related to #288

Fixes

  • MovingObjectPosition.hitVec in onItemUse made consistent
  • more reliable entity collision avoidance on block placement
  • placing blocks now using tryPlaceItemIntoWorld that correctly hooks to Forge
  • decrement blocks AFTER successful placing into the world
  • adventure mode can no longer build
  • spawn protection and the Forge place event are checked per cell
  • materials are taken from storage first, hotbar next, offhand last
  • extrude aims at the empty cell, so slabs no longer merge into a double slab
  • ChickenLibRayTracer is CodeChickenLib's retraceBlock copied verbatim (credited in the file), needed to get a MOP that carries the multipart part data

Feature: Wand extrude mode

  • extrudes every cell in the selected surface
  • by default also copies metadata
  • added Scribe offhand item - to change the wand mode to extrude (analogous to Trowel)
  • ArchitectureCraft integration (soft-dep)
  • ForgeMicroBlocks integration (soft-dep)

Feature: Cell Handler API

  • Allows simple extensibility for new mod blocks
  • IBWCellHandler - claim a cell, report what it costs, build it
  • adding support for a mod means registering a handler
  • unclaimed cells fall back to DefaultBWCellHandler, so plain blocks need no handler
  • a handler can also correctblock.getPickBlock() functionality (AC has botched implementation for getPickBlock)
  • currently used for ArchitectureCraft and ForgeMicroblock
2026-08-11_19 31 47 2026-08-11_19 45 32
Offhand Mode Places Spreads over Copies rotation / TE state
Scribe EXTRUDE a copy of each source cell, cell by cell any surface, whatever it is made of yes — metadata, and whatever the cell handler carries (AC rotation, cladding, connections; all parts of a multipart)
Trowel (GregTech) TROWEL a random block from the hotbar, per cell any surface, whatever it is made of no
any block OFFHAND_BLOCK that block cells of the same kind as the clicked one no
empty, or a non-block item CLICKED_BLOCK a copy of the clicked block's item cells of the same kind as the clicked one (includes also all FMBlocks that contain the same part as was clicked) no

Tested on

  • ArchitectureCraft shapes (Slopes, Slabs...)
  • ArchitectureCraft glowstone shapes, shapes with disconnected faces, clad shapes
  • Stone, Multicolored Planks, Wool
  • Logs
  • Many Slabs, Many Stairs
  • Torches
  • GTNH combustion engines
  • FMB
  • Forge Block place event cancellation

Points to discuss

Scribe:

  • is it okay to introduce another item? it really fits as an analogous mode to the random-block trowel mode though --> OK
  • is it supposed to be damageable? --> No
  • [x] or use some item already in GTNH... though to be honest its kinda weird that the Guidelines speak of the UiE to be able to stand on its own, yet this nice trowel feature is gated behind GTNH... maybe worth adding UiE native trowel replacement IF gtnh is not present.
  • professional texture for the item... looks good to me
  • some other item name entirely
  • crafting recipe for Scribe

Other:

  • even in creative, user needs at least one of the blockItem to be able to copy = same behavior as XU
  • currently, the surface in the copy mode is "anything in inventory", there might be a use case for copy only the block looked at extrude spreads over anything now, the inventory only decides what can be afforded. And copying just the block looked at became its own mode - empty offhand.

Funny problem with copying

To preserve the rotation and whatnot, which does not get saved as "damage" into the itemStack, after placing, we apply setblockmetadata(destPos,getmetadata(srcPos)). (Same as BetterBuildersWands)
This is a slight problem for blocks that save something important to metadata, for example:

  • Cauldron - saves water level -> copying block also copies the water
  • Snow layer - full snow block metadata is copied onto a small layer of snow -> duping snow. (can be prevented by checking !getTickRandomly() before metadata copying)
  • crops are fine (placing is only valid from top, it cannot be extended that way)
    tldr; for mods that store the state in TE, its fine. This might introduce some inconsistency for mods relying on synced state between TE and metadata.
  • If problem is discovered -> simply add new CellHandler.

Currently in master the rotation preservation behavior is nearly random, resulting in correct rotation copying in some and wrong in other directions/blocks.

Cooble added 4 commits August 11, 2026 18:00
- MovingObjectPosition.hitVec in onItemUse made consistent
- more reliable entity collision avoidance on block placement
- added exact copy/extrude mode
- added Scribe offhand item - to change the wand mode to copy
- placing blocks now using tryPlaceItemIntoWorld that correctly hooks to Forge
- decrement blocks AFTER successful placing into the world
@Cooble

Cooble commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

@FourIsTheNumber

  • This Copy mode really seems to replicate some of the BetterBuildersWands behavior... but better :) Longterm Goal: Better Builder's Wands Replacements #288
  • Question is, whether we want CopyMode to be the default instead of the current exact block matching mode. I would advise against it though, since everybody is used to the original XU behavior anyway.
  • BBW does not care about TE (so no ArchitectureCraft) and does not fire BlockEvent.PlaceEvent.

@FourIsTheNumber

Copy link
Copy Markdown
Collaborator

I'll respond to more of this in full later but just RE:

though to be honest its kinda weird that the Guidelines speak of the UiE to be able to stand on its own, yet this nice trowel feature is gated behind GTNH... maybe worth adding UiE native trowel replacement IF gtnh is not present.

Being standalone/compatible outside nh doesn't mean the mod can't have nh-exclusive features. Though I do think we should add a trowel replacement to UiE and remove GT5's trowel, because there's no reason for that to be a metageneratedtool with durability and craftable out of every material.

@Cooble

Cooble commented Aug 23, 2026

Copy link
Copy Markdown
Contributor Author

@FourIsTheNumber

Being standalone/compatible outside nh doesn't mean the mod can't have nh-exclusive features. Though I do think we should add a trowel replacement to UiE and remove GT5's trowel, because there's no reason for that to be a metageneratedtool with durability and craftable out of every material.

That makes sense, and UiE trowel would sit nicely side by side with the Scribe.

I've since found that some ArchitectureCraft shapes still fail to copy their orientation, which stays only in the TileEntity.

So I added AC as a soft dependency, next to the existing ones. Is that okay? It seems reasonable, since the BuildersWand is exactly what you'd reach for with a building mod like AC.

The integration also lets cladding be optionally applied on placement (cladding = the secondary material you "paint" a shape block with).

@FourIsTheNumber

Copy link
Copy Markdown
Collaborator

Soft dependencies for mod compat are always ok with me. Only the hard dependencies I'm careful about

Cooble added 3 commits August 24, 2026 10:56
Refactored BW to be easily extensible for other mods.
Added ForgeMicroBlocks BuildersWand support.
Added javadoc for BWCellHandler
Renamed copy mode -> extrude mode
@Cooble Cooble changed the title BuildersWand Copy mode BuildersWand: extrude mode + cell handler API Sep 20, 2026
@Cooble
Cooble marked this pull request as ready for review September 20, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Multi-variant Builders Wand mode

2 participants