wall only block placement (TUTORIAL)

Started by RipleysLuminous on

Topic category: Help with Minecraft modding (Java Edition)

Joined Aug 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
wall only block placement (TUTORIAL)
Mon, 06/03/2024 - 21:59 (edited)

So I had seen a bunch of forums regarding this topic, but half of them had no answer and the other half linked to NorthWestTrees torch placement video. I wanted to simplify it and provide my own answer, because I solved it.

first off, make sure that your block is set to Y axis rotation (FROM BLOCK FACE) this is important so that you don't end up placing the leaves on, for example, the wrong side of the block when looking at a block from an odd direction.

 

Next, here is the procedure I used. It goes under the "block valid placement condition" section. This procedure is ONLY for the sides of the block, and not top and bottom. I hope this helps anyone struggling with this!

 

 

Edited by RipleysLuminous on Mon, 06/03/2024 - 21:59
Joined Mar 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
is there a way to detect the…
Thu, 08/08/2024 - 20:21

is there a way to detect the "pitch rotation"? like the is on celling or floor

Joined Mar 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
nvm i got it to work
Thu, 08/08/2024 - 22:16

nvm i got it to work

Joined Aug 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
TYSM
Mon, 08/19/2024 - 12:43

TYSM

Joined Apr 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
ShadowMaskX could you…
Thu, 02/20/2025 - 08:07

ShadowMaskX could you provide an example? everything i try with pitch rotation isnt working

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
could you add a download, i…
Sun, 06/15/2025 - 19:43

could you add a download, i don't want to have to recreate the entire thing lol.

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
ehh nevermind ill just do it
Sun, 06/15/2025 - 19:50

ehh nevermind ill just do it

Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I managed after some hours…
Sat, 08/09/2025 - 19:17

I managed after some hours of serching, testing & working with AI to create code for Valid Placement that enables placing to walls, floors & ceilings; you only must in settings of block set "Y-axis rotation (S/W/N/E)" (as in original post) & enable "Has pitch rotation"

And then in Valid Placement procedure do this code:
picture

Joined Aug 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I needed to do this for a…
Thu, 08/14/2025 - 22:25

I needed to do this for a block I'm making and I found it can be done even easier by writing:

if: is block at [[x] - [x offset direction [get direction of [provided blockstate]]]], y, [[z] - [z offset direction [get direction of [provided blockstate]]]] solid?

do: Return logic: true,

Return logic: false

or the actual Java code version:

        if (world.getBlockState(BlockPos.containing(x - (getDirectionFromBlockState(blockstate)).getStepX(), y, z - (getDirectionFromBlockState(blockstate)).getStepZ())).canOcclude()) {
return true;
}
return false;
}
private static Direction getDirectionFromBlockState(BlockState blockState) { if (blockState.getBlock().getStateDefinition().getProperty("facing") instanceof EnumProperty ep && ep.getValueClass() == Direction.class) return (Direction) blockState.getValue(ep); if (blockState.getBlock().getStateDefinition().getProperty("axis") instanceof EnumProperty ep && ep.getValueClass() == Direction.Axis.class) return Direction.fromAxisAndDirection((Direction.Axis) blockState.getValue(ep), Direction.AxisDirection.POSITIVE); return Direction.NORTH;

And you can add the -y offset direction if you want it to be able to be placed up or down. It's a lot easier than using NBT tags or checking every direction.

Joined Aug 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
will it work 2025.2?
Tue, 08/19/2025 - 19:50
will it work 2025.2?