Redstone block code?

Started by Xavion on

Topic category: Help with Minecraft modding (Java Edition)

Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Redstone block code?

  I want to make a block that emits a redstone signal when right-clicked (Like a lever). The right-click part is easy, I have that working already. I just have two variants (on and off) of the block, and right-clicking it switches which one it is. 

  However, upon looking through the forums, I have found that MCREATOR doesn't have a (working) "redstone output" option. So i'm going to try edit the code of the block itself. Ideally by copying whatever code the "Block of Redstone" uses. Problem is...I can't find that code anywhere. Anybody have the code for the Redstone block? 

Joined Nov 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Put this in your block class…
Tue, 03/30/2021 - 06:21

Put this in your block class:

public boolean canProvidePower(BlockState state) {
      return true;
   }

 

public int getWeakPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side) {
      return 15;
   }

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The other answer is perfect…
Tue, 03/30/2021 - 12:08

The other answer is perfect but you go to the third item down in the external libraries > net > minecraft > block > RedstoneBlock

 

 

Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
  Thanks guys! I have it…
Wed, 03/31/2021 - 07:44

  Thanks guys! I have it working perfectly now, thanks to the two of you (: !

Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I get to the external…
Thu, 05/05/2022 - 06:48

How do I get to the external libraries?

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
do you know how i could add…
Mon, 03/04/2024 - 20:34

do you know how i could add something like this? im trying to make essentially a duplicate of redstone