Posted February 27, 20196 yr 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 :)
February 27, 20196 yr You can't. This is basic server client logic. Act like the server doesnt exist on the physical client. You need to send an appropriate message tot eh server to tell it to do what you want. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.