Jump to content

Alexanderqwerty

Members
  • Posts

    2
  • Joined

  • Last visited

Alexanderqwerty's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. @Override public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity playerEntity, Hand hand, BlockRayTraceResult result) { state = state.cycle(LOCKED); world.setBlock(pos, state, 10); return ActionResultType.sidedSuccess(world.isClientSide); } i change code to this and its work
  2. Im trying to change model in code like that @Override public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity playerEntity, Hand hand, BlockRayTraceResult result) { if (state.getValue(LOCKED)) { world.setBlock(pos, state.setValue(LOCKED, false), 3); System.out.println("unlocked"); } else { world.setBlock(pos, state.setValue(LOCKED, true), 3); System.out.println("locked"); } return ActionResultType.PASS; } { "variants": { "locked=true": { "model": "sovietmod:block/vinyl_record_player" }, "locked=false": { "model": "sovietmod:block/vinyl_record_player2" } } } But when i click. Block twice change its model. [17:47:12] [Server thread/INFO] [STDOUT/]: [com.Soviet.sovietmod.block.custom.VinylRecordPlayer:use:60]: locked [17:47:12] [Server thread/INFO] [STDOUT/]: [com.Soviet.sovietmod.block.custom.VinylRecordPlayer:use:57]: unlocked
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.