Skip to content

Commit

Permalink
0.7.2 Better .world command! Shows all gamerules and KnownPlayers for…
Browse files Browse the repository at this point in the history
… server


**0.7.2**
- Better **.world** info command.
- Added the **KnownPlayers** value. This returns all the historical players that have played on a server, no need for a fancy database that pings servers and tracks player names just use the **.world** command. (Doesnt work on all servers)
- Replaced DO_DAYLIGHT_CYCLE value with the "GameRules" value which returns all the gamerules on a server.
- Added Day Count, and Simulation distance (in chunks).
- Added a "save" option to the .world command which saves the world info data to a txt file in your .minecraft folder in the SavedWorldInfo folder.
  • Loading branch information
etianl authored Nov 6, 2023
1 parent 62d888f commit 610651d
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ This will return the lowest block placed with AutoMountain until AutoLavacast is
- **TrouserBuild:** It can build either horizontally or vertically according to a 5x5 grid centered on the block you are aiming at. Right click to build at the targeted location. (Credits to etianl, and to Banana for the checkboxes and idea. :D)
- **ViewNbtCommand:** Returns the nbt data for the item in your hand in the chat box. There is also a Save option for the command that saves the data to a text file in your .minecraft folder in the "SavedNBT" folder.
- **Voider+:** Replaces the world from the top down. (Credits to Allah-Hack) I added a 3x3 voiding script, a TP foward option for deleting strips, as well as options to set max and minimum height for voiding, and instead of just air it can do whatever block you want now too.
- **WorldInfoCommand** Type .world in chat to tell you the precise coordinates of each of the world borders, as well as some other world info. (Credits to etianl :D)
- **WorldInfoCommand** Type .world in chat to tell you the gamerules on the server, the players that have played there (may not work on all servers), as well as some other world info like world border coordinates. (Credits to etianl :D)

## Known Bugs:
- **AutoLavaCaster Bugs**
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ yarn_mappings=1.20.2+build.4
loader_version=0.14.22

# Mod Properties
mod_version=0.7.1-1.20.2
mod_version=0.7.2-1.20.2
maven_group=pwn.noobs
archives_base_name=1trouser-streak

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {
else error("No item in main hand.");
return SINGLE_SUCCESS;
});
builder.then(literal("Save").executes(ctx -> {
builder.then(literal("save").executes(ctx -> {
if (!mc.player.getMainHandStack().isEmpty()){
if (mc.player.getMainHandStack().getNbt() == null){
error("No NBT data for item.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
import meteordevelopment.meteorclient.commands.Command;
import meteordevelopment.meteorclient.utils.player.ChatUtils;
import net.minecraft.command.CommandSource;
import net.minecraft.network.packet.c2s.play.JigsawGeneratingC2SPacket;
import net.minecraft.network.packet.s2c.play.AdvancementUpdateS2CPacket;
import net.minecraft.text.Text;
import net.minecraft.world.GameRules;
import net.minecraft.util.WorldSavePath;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

import static meteordevelopment.meteorclient.MeteorClient.mc;

Expand All @@ -24,8 +28,59 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {
ChatUtils.sendMsg(Text.of("East World Border X: "+(int) mc.world.getWorldBorder().getBoundEast()+", West World Border X: "+(int) mc.world.getWorldBorder().getBoundWest()+", South World Border Z: "+(int) mc.world.getWorldBorder().getBoundSouth()+", North World Border Z: "+(int) mc.world.getWorldBorder().getBoundNorth()));
ChatUtils.sendMsg(Text.of("Default WorldSpawn Location (May be different if changed): "+mc.world.getSpawnPos()));
ChatUtils.sendMsg(Text.of("Difficulty: "+mc.world.getDifficulty().toString()));
ChatUtils.sendMsg(Text.of("DO_DAYLIGHT_CYCLE: "+mc.world.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)));
ChatUtils.sendMsg(Text.of("Simulation Distance (chunks): "+mc.world.getSimulationDistance()));
ChatUtils.sendMsg(Text.of("Day Count: "+Math.floor(mc.world.getTime()/24000)));
ChatUtils.sendMsg(Text.of("GameRules: "+mc.world.getGameRules().toNbt().toString()));
ChatUtils.sendMsg(Text.of("KnownPlayers (Names with a period are bedrock players): "+mc.world.getScoreboard().getKnownPlayers()));
return SINGLE_SUCCESS;
});
builder.then(literal("save").executes(ctx -> {
if (!mc.player.getMainHandStack().isEmpty()){
ChatUtils.sendMsg(Text.of("East World Border X: "+(int) mc.world.getWorldBorder().getBoundEast()+", West World Border X: "+(int) mc.world.getWorldBorder().getBoundWest()+", South World Border Z: "+(int) mc.world.getWorldBorder().getBoundSouth()+", North World Border Z: "+(int) mc.world.getWorldBorder().getBoundNorth()));
ChatUtils.sendMsg(Text.of("Default WorldSpawn Location (May be different if changed): "+mc.world.getSpawnPos()));
ChatUtils.sendMsg(Text.of("Difficulty: "+mc.world.getDifficulty().toString()));
ChatUtils.sendMsg(Text.of("Simulation Distance (chunks): "+mc.world.getSimulationDistance()));
ChatUtils.sendMsg(Text.of("Day Count: "+Math.floor(mc.world.getTime()/24000)));
ChatUtils.sendMsg(Text.of("GameRules: "+mc.world.getGameRules().toNbt().toString()));
ChatUtils.sendMsg(Text.of("KnownPlayers (Names with a period are bedrock players): "+mc.world.getScoreboard().getKnownPlayers()));

String serverip;
if (mc.isInSingleplayer()==true){
String[] array = mc.getServer().getSavePath(WorldSavePath.ROOT).toString().replace(':', '_').split("/|\\\\");
serverip=array[array.length-2];
} else {
serverip = mc.getCurrentServerEntry().address.replace(':', '_');
}

if (!Files.exists(Paths.get("SavedWorldInfo/"+serverip+"/WorldInfoData.txt"))){
File file = new File("SavedWorldInfo/"+serverip+"/WorldInfoData.txt");
try {
file.createNewFile();
} catch (IOException e) {}
}
try {
new File("SavedWorldInfo/"+serverip+"/").mkdirs();
FileWriter writer = new FileWriter("SavedWorldInfo/"+serverip+"/WorldInfoData.txt", true);
writer.write("East World Border X: "+(int) mc.world.getWorldBorder().getBoundEast()+", West World Border X: "+(int) mc.world.getWorldBorder().getBoundWest()+", South World Border Z: "+(int) mc.world.getWorldBorder().getBoundSouth()+", North World Border Z: "+(int) mc.world.getWorldBorder().getBoundNorth());
writer.write("\r\n"); // write new line
writer.write("Default WorldSpawn Location (May be different if changed): "+mc.world.getSpawnPos());
writer.write("\r\n"); // write new line
writer.write("Difficulty: "+mc.world.getDifficulty().toString());
writer.write("\r\n"); // write new line
writer.write("Simulation Distance (chunks): "+mc.world.getSimulationDistance());
writer.write("\r\n"); // write new line
writer.write("Day Count: "+Math.floor(mc.world.getTime()/24000));
writer.write("\r\n"); // write new line
writer.write("GameRules: "+mc.world.getGameRules().toNbt().toString());
writer.write("\r\n"); // write new line
writer.write("KnownPlayers (Names with a period are bedrock players): "+mc.world.getScoreboard().getKnownPlayers());
writer.write("\r\n"); // write new line
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
} else error("No item in main hand.");
return SINGLE_SUCCESS;
}));
}
}
}
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"id": "streak-addon",
"version": "0.7.1",
"version": "0.7.2",
"name": "TrouserStreak",
"description": "Trouser-Streak is a compilation of modules, updated to the latest version and optimized for maximum grief. I did not make all of these.",
"authors": [
Expand Down

0 comments on commit 610651d

Please sign in to comment.