Redstone block code?

Started by Xavion on Tue, 03/30/2021 - 05:58

Topic category: Help with modding (Java Edition)

Last seen on 07:42, 5. Apr 2021
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Redstone block code?
Tue, 03/30/2021 - 05:58

  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? 

Last seen on 19:49, 3. Nov 2021
Joined Nov 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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;
   }

Last seen on 18:36, 11. May 2022
Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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

 

 

Last seen on 07:42, 5. Apr 2021
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 (: !

Last seen on 16:02, 21. May 2022
Joined Jul 2020
Points:

User statistics:

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

How do I get to the external libraries?