How can I make a non-floating block (like carpets?)

Started by TropicalPanda on

Topic category: Help with modding (Java Edition)

Last seen on 16:22, 21. Sep 2023
Joined Sep 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How can I make a non-floating block (like carpets?)
Mon, 09/18/2023 - 19:34 (edited)

Hello, is it possible for me to make a custom block that can only be placed on solid ground, similar to carpet blocks? I didn't see anything related to this while looking through the editor, so is there any specific java code I can manually input to give my block these properties? Any help would be much appreciated!

MCreator version: 2023.3

Forge version: 1.20.1

Edited by TropicalPanda on Mon, 09/18/2023 - 19:34
Last seen on 22:41, 16. Oct 2023
Joined Mar 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Put this on update tick of…
Mon, 09/18/2023 - 21:01


Put this on update tick of your block. this will make it so it cannot be placed on anything except solid blocks underneath. Remove the liquid if you want it to be placed on that block. Also if you want to make it so it can't be placed on any block even air in any amount of y direction, you'll have to use y-1*y+random) for up and y-1*y-random like shown in second pic. Add that to any or all below for ultimate removal of your block. Hope this helps. 

Image

Image

Last seen on 22:41, 16. Oct 2023
Joined Mar 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I forgot to mention you can…
Mon, 09/18/2023 - 21:04

I forgot to mention you can also just put your material as carpet in the block gui to make it work like the carpet, but you wouldn't be able to push it or pull it with a piston then. 

Last seen on 16:22, 21. Sep 2023
Joined Sep 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks for the reply…
Mon, 09/18/2023 - 23:28

Thanks for the reply. Correct me if I'm wrong, but it seems like that procedure will allow the block to be placed, but immediately break it afterwards if it's not on a flat surface. I want the block to be not placeable in the air to begin with, like how right-clicking to place a carpet in midair results in no action at all.

I tried the carpet material method, but my block is still placeable in midair, unfortunately. It didn't seem to do much of anything.

Last seen on 22:41, 16. Oct 2023
Joined Mar 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
it'll try to place but break…
Tue, 09/19/2023 - 05:05

it'll try to place but break immediately yes but it won't even leave anything, Their is no known way to prevent a block from being placed period unless you use code. And for that I would recommend using chatgpt and knowing how code works. Other wise, this is the best method.