I need help with a custom block

Started by SushyTurtle on

Topic category: Help with modding (Java Edition)

Last seen on 16:07, 4. Oct 2023
Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I need help with a custom block

Is there any way to make a block behave like a redstone lamp? i dont have any coding experiance

Last seen on 05:10, 3. Dec 2023
Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes, there is. The simple…
Sat, 09/23/2023 - 15:03

Yes, there is. The simple way would be to create two different blocks (one on and one off) and then have a procedure switch between the two. My personal gripe with this is that then you have two blocks in the game, and it looks "messy"

 

The complex way to do it would be the way that Mojang made the Redstone lamps using blockstates.

If you want it to look nice, and do some custom code, you can implement blockstates. You would need one that is a Boolean (on/off) and one that would be a light value (0-15). An then one that convers a blockstates to an integer.

Here is a similar topic on this. You will need to edit your block.java code to implement the blockstates and then modify the blockstate.json in order to tell the game when to use which texture - https://mcreator.net/comment/241516

Let me know if you need any further explainations/examples

Last seen on 05:10, 3. Dec 2023
Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Also, once you have all that…
Sat, 09/23/2023 - 15:05

Also, once you have all that set up, you can use MCreator procedures to control the blockstates. There are blocks that say (get boolean blockstates of block at x y z) etc. And also blocks to set the blockstates.

Last seen on 16:07, 4. Oct 2023
Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you!
Sun, 09/24/2023 - 15:09

Thank you!