Upgrade to Pro — share decks privately, control downloads, hide ads and more …

LチカCraft

 LチカCraft

Minecraft内でブロックを設置すると、LEDがつく。

suzakutakumi

June 19, 2021
Tweet

More Decks by suzakutakumi

Other Decks in Programming

Transcript

  1. Mod作り ブロックに関するクラスのあるメソッド @Override public void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos

    pos, @Nonnull BlockState state, @Nullable LivingEntity placer, @Nonnull ItemStack stack) { super.onBlockPlacedBy(worldIn, pos, state, placer, stack); boolean powered = worldIn.isBlockPowered(pos); write.Write(); // シリアル通信をする関数 }
  2. Serial通信 try { for (int j = 0; j <

    1000; ++j) out.write(1); //何故か複数回送らないと反応しない inputStream.read(); out.close(); inputStream.close(); } catch (Exception e) { e.printStackTrace(); } commPort.closePort();