Jump to content

Handschrift

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by Handschrift

  1. I am quite new at Minecraft modding, and i wanted to create my first mod, which writes the contents of all nearby signs in a Minecraft world by pressing a key. The code of my InputHandler here works for a singleplayer world. public class InputHandler { @SubscribeEvent public void onKeyInput(InputEvent.KeyInputEvent event) { if (KeyBind.test.isPressed()) { EntityPlayer player = Minecraft.getMinecraft().player; World world = Minecraft.getMinecraft().world; Iterable<BlockPos> spot = BlockPos.getAllInBox(new BlockPos(player.posX - 50, player.posY - 50, player.posZ - 50), new BlockPos(player.posX + 50, player.posY + 50, player.posZ + 50)); File file = new File(Minecraft.getMinecraft().mcDataDir.getPath() + "/sign.txt"); if (file.exists()) { file.delete(); } try { for (BlockPos pos : spot) { if (world.getTileEntity(pos) != null) { TileEntity state = world.getTileEntity(pos); if (state.getBlockType() instanceof BlockStandingSign) { for (int i = 0; i < 4; i++) { String t2 = ((TileEntitySign) world.getTileEntity(pos)).signText[i].toString(); String[] a = t2.split("'"); FileUtils.writeStringToFile(file, a[1] + "\n", "windows-1252", true); System.out.println(file.getAbsolutePath()); } FileUtils.writeStringToFile(file, "--------------------\n", "windows-1252", true); } } } } catch (IOException e) { e.printStackTrace(); } } } } But i want the mod to work on a server, so you have to get the world of the server, the player is connected to and check the blocks at the coords, like how i did it in my Code, but how do i do it, IF the Mod is clientside only? I appreciate every single help :)
×
×
  • Create New...

Important Information

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