make a lever

Started by Mr. Semi the Keidran on

Topic category: Help with Minecraft modding (Java Edition)

Joined May 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
make a lever
Tue, 12/30/2025 - 06:46 (edited)

solved


i am trying to make a custom lever, but i cant seem to figure out how to make the redstone output toggle when right clicked

if anyone has any ideas as to how, i would be very grateful if you share them, thanks!

Edited by Mr. Semi the Keidran on Tue, 12/30/2025 - 06:46
Joined May 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
// this is the code that got…
Tue, 12/30/2025 - 06:42
// this is the code that got it working, i did use the blockstate procedures
public class Switchlevertesttype2EmittedRedstonePowerProcedure {
	public static double execute(LevelAccessor world, double x, double y, double z, BlockState blockstate) {
		if ((new Object() {
			public BlockState with(BlockState _bs, String _property, int _newValue) {
				Property<?> _prop = _bs.getBlock().getStateDefinition().getProperty(_property);
				return _prop instanceof IntegerProperty _ip && _prop.getPossibleValues().contains(_newValue) ? _bs.setValue(_ip, _newValue) : _bs;
			}
		}.with(blockstate, "blockstate", 1)) == (world.getBlockState(BlockPos.containing(x, y, z)))) {
			return 15;
		}
		return 0;
	}
}