Jump to content




CommandsPlus


12 replies to this topic

#1 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 31 May 2016 - 07:29 PM

The objective of CommandsPlus is to extract data from the results of running various commands. For example, teleporting an armor stand to a player gives us the player's coordinates and which way he's facing.
pastebin get eZRj0fAD commandsPlus.
List of Functions
If there are any commands you'd like me to add, please comment below ;)/>
Updates:
1.1 - Added getObservedBlock and getFormattedBlockInfos, added second argument to getPlayerPosition, changed behavior of getNearbyPlayers when no limit specified.
1.2 - Added getForgeTPS()
1.25 - Removed second argument from getPlayerPosition, added caching. The data is only cached for 1 tick, so that if you use getObservedBlock and getPlayerPosition or getPlayerRotation, it won't teleport things more than it needs to.
1.3 - Added listScoreboardTeams, listScoreboardObjectives, listScoreboardPlayers, and listScoreboardTeamPlayers

Edited by KingofGamesYami, 08 June 2016 - 03:01 PM.


#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 01 June 2016 - 02:23 PM

Maybe you could look into implementing the "get block looked at" functionality discussed here? moomoomoo may perhaps be willing to share the code he ended up using... NBT editing capabilities would also be handy in an API! :)

View PostKingofGamesYami, on 31 May 2016 - 07:29 PM, said:

If nLimit is not specified, the radius of the world border will be used instead.

Er, just to clarify, do you mean "the whole world will be checked", or do you really mean "a circular area sitting within the world bounds will be checked" (hence excluding the world's corners)?

View PostKingofGamesYami, on 31 May 2016 - 07:29 PM, said:

getDaysPassed()
Retrieves the number of (in game) days passed since the world's creation.

getDaytime()
Retrieves the (in game) time of day.

Truth be told, we've already go os.time() and os.day() for these ones. I suppose by extension they'd cover getGametime() as well.

#3 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 01 June 2016 - 02:41 PM

View PostBomb Bloke, on 01 June 2016 - 02:23 PM, said:

Maybe you could look into implementing the "get block looked at" functionality discussed here? moomoomoo may perhaps be willing to share the code he ended up using... NBT editing capabilities would also be handy in an API! :)/>
I'll look into it.

View PostBomb Bloke, on 01 June 2016 - 02:23 PM, said:

Er, just to clarify, do you mean "the whole world will be checked", or do you really mean "a circular area sitting within the world bounds will be checked" (hence excluding the world's corners)?

I mean "a circular area sitting within the world bounds will be checked". In the future, I might just remove the range limit entirely for this case.

View PostBomb Bloke, on 01 June 2016 - 02:23 PM, said:

Truth be told, we've already go os.time() and os.day() for these ones. I suppose by extension they'd cover getGametime() as well.

Actually, I think some of them are different. /time uses ticks, not seconds. Anyhow, I'm not going to remove the functionality.

#4 Wergat

  • Members
  • 18 posts

Posted 01 June 2016 - 05:10 PM

You could add some Scroreboard-Features to count the player's Deaths, Kills and more!

#5 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 02 June 2016 - 01:50 AM

Furthermore, something to parse the TPS values returned by the /forge tps command (or whatever it is) could be handy.

#6 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 04 June 2016 - 08:02 PM

View PostWergat, on 01 June 2016 - 05:10 PM, said:

You could add some Scroreboard-Features to count the player's Deaths, Kills and more!
I think scoreboard deserves it's own API. I also don't understand it :(

View PostBomb Bloke, on 02 June 2016 - 01:50 AM, said:

Furthermore, something to parse the TPS values returned by the /forge tps command (or whatever it is) could be handy.
I can't find any documentation on this, unfortunately.

Updated to 1.1!

#7 Emma

  • Members
  • 216 posts
  • Locationtmpim

Posted 04 June 2016 - 08:44 PM

View PostKingofGamesYami, on 04 June 2016 - 08:02 PM, said:

--snip--

View PostBomb Bloke, on 02 June 2016 - 01:50 AM, said:

Furthermore, something to parse the TPS values returned by the /forge tps command (or whatever it is) could be handy.
I can't find any documentation on this, unfortunately.
--snip--

The /tps command isn't a default command included with forge, but COFH-Core has it, which is in most modpacks.
http://teamcofh.com/...s/commands/#tps


Turns out I was mistaken, it is indeed /forge tps
Here is the output:
Spoiler
The format of the output is as follows. Each line denotes a different dimension that is being measured except for the last line which gives the overall tps (averaged tick over all dimensions)
Line format: Dim [dimension number] : Mean tick time: [time between processed ticks] ms. Mean TPS: [ticks per second]

Edited by Incinirate, 04 June 2016 - 08:55 PM.


#8 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 04 June 2016 - 09:17 PM

Strangely, my minecraft client adds a \ before each :. I've compensated for both in my pattern, but I would like someone to try it before I publish.
Spoiler

Edited by KingofGamesYami, 04 June 2016 - 09:22 PM.


#9 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 05 June 2016 - 12:09 PM

I guess the slash thing has something to do with later versions of Minecraft; I had to go back to one of my 1.7.10 installs to get rid of them.

I find the function works correctly with or without them, though I was thrown off for a moment when I didn't get data for dimension 1 (The End). Seems it isn't automatically chunk loaded in the older build.

#10 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 06 June 2016 - 01:09 PM

Thanks for testing BB! I've added getForgeTPS and caching now!

Updated to 1.25!

#11 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 06 June 2016 - 02:35 PM

This is really cool and very useful, definitely add support for Scoreboard.

#12 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 08 June 2016 - 02:28 PM

Updated with support for scoreboard! If there are any scoreboard commands that I'm not supporting, please let me know!

Updated to 1.3

#13 Reinified

  • Members
  • 30 posts

Posted 17 June 2017 - 06:07 PM

Incredibly useful, thanks so much!
Especially listScoreboardTeamPlayers.

THANKS!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users