Jump to content

Fahrenheit451

Members
  • Posts

    5
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Fahrenheit451's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Thanks again. I was looking at an old 1.12 mod source that retrieved the world (eg overworld) and dimension (eg DIM7). If they are one and the same then I will have this mod just output the dimension and see if the map js works with it. Thanks again for the replies!
  2. Thanks. Unfortunately I can't upgrade the server right now. How do I get the world and dimension the player is in?
  3. Hi. I have a small mod in the works which just needs to capture the world name, dimension name, and x, y, z position of all online players. This is data that is used by an external map web page, so the mod will dump this data out periodically. How do I do this in 1.17? I can't seem to find this information in the forge documentation on how to iterate over online players and get this data? Thanks!
  4. Thanks a lot both of you. That go me on the right track and I have this working nicely. For those interested (and for any further refinements, gotchas or improvements): I created a new basic ticker class that I registered in the preInit eventhandler routine of the main class: @EventHandler public void preInit (FMLPreInitializationEvent event) { . . FMLCommonHandler.instance().bus().register(new OBTicker("config/"+metafile)); and in the ticker class I created a subscribe event onServerTick routine that counts 200 ticks (5 seconds) and runs the command to dump the meta data out: @SubscribeEvent public void onServerTick(TickEvent.ServerTickEvent event) { tickcount++; if (tickcount == 200 ) { task.run(metafile); tickcount = 0; } } Pretty straightforward, and thanks again. F451
  5. Hi. Anyone know how to accomlish this with the Forge API? I have been searching for a number of days and simply can not find the appropriate information on the web. I wrote a simple bukkit plugin for our servers that writes out player positions into a file every 200 ticks, but I now need to write this for our Forge servers also. This meta data is used by scripts and programs outside of the minecraft server. Pretty Simple piece of code, but I simply haven't found suitable info to convert to Forge. I have the basic forge Mod running based on the example provided with Forge API. BukkitScheduler scheduler = Bukkit.getServer().getScheduler(); scheduler.scheduleSyncRepeatingTask(this, new Runnable() { @Override public void run() { // open the meta file for writing File mfile = new File(metafile); FileWriter writer; try { writer = new FileWriter(mfile, false); pw = new PrintWriter(writer); } catch(IOException e) { e.printStackTrace(); } for(Player i : Bukkit.getServer().getOnlinePlayers()){ pw.println(i.getName()+ ":" + i.getLocation().getX() + ":" + i.getLocation().getY() + ":" + i.getLocation().getZ()); } pw.close(); } }, 0L, 200L); Any information appreciated.
×
×
  • Create New...

Important Information

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