Skip to content

Commit

Permalink
*v1.0.1* 100% accurate newchunks performance improvment
Browse files Browse the repository at this point in the history
**1.0.1**
- Slight performance improvement with NewerNewChunks (removed a couple unnecessary for loops)
  • Loading branch information
etianl authored Jul 8, 2024
1 parent 54793f2 commit 7587bda
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 29 deletions.
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.21+build.2
loader_version=0.15.11

# Mod Properties
mod_version=1.0.0-1.21
mod_version=1.0.1-1.21
maven_group=pwn.noobs
archives_base_name=1trouser-streak

Expand Down
33 changes: 6 additions & 27 deletions src/main/java/pwn/noobs/trouserstreak/modules/NewerNewChunks.java
Original file line number Diff line number Diff line change
Expand Up @@ -652,29 +652,10 @@ else if (event.packet instanceof ChunkDataS2CPacket && mc.world != null) {
// Indirect palette
int biomePaletteLength = buf.readVarInt();
//System.out.println("Biome palette length: " + biomePaletteLength);
for (int i = 0; i < biomePaletteLength; i++) {
if (buf.readableBytes() < 1) {
//System.out.println("Incomplete biome palette data");
return;
}
int biomePaletteEntry = buf.readVarInt();
if (i == 0 && biomePaletteEntry != 0) isNewChunk = true;
//System.out.println("Biome palette entry " + i + ": " + biomePaletteEntry);
}

// Skip biome data array
if (buf.readableBytes() >= 4) { // Ensure we can read the VarInt
int biomeDataArrayLength = buf.readVarInt();
int biomeBytesToSkip = biomeDataArrayLength * 8; // Each entry is a long (8 bytes)
if (buf.readableBytes() >= biomeBytesToSkip) {
buf.skipBytes(biomeBytesToSkip);
} else {
//System.out.println("Not enough data for biome array, skipping remaining: " + buf.readableBytes());
buf.skipBytes(buf.readableBytes());
}
} else {
//System.out.println("Not enough data for biome array length");
}
int biomePaletteEntry = buf.readVarInt();
if (biomePaletteEntry != 0) isNewChunk = true;
//System.out.println("Biome palette entry " + i + ": " + biomePaletteEntry);
} else {
//System.out.println("Invalid biome bits per entry: " + biomeBitsPerEntry);
return;
Expand All @@ -692,11 +673,9 @@ else if (event.packet instanceof ChunkDataS2CPacket && mc.world != null) {
// Indirect palette
int blockPaletteLength = buf.readVarInt();
//System.out.println("Block palette length: " + blockPaletteLength);
for (int i = 0; i < blockPaletteLength; i++) {
int blockPaletteEntry = buf.readVarInt();
if (i == 0 && blockPaletteEntry == 0) isNewChunk = true;
//System.out.println("Block palette entry " + i + ": " + blockPaletteEntry);
}
int blockPaletteEntry = buf.readVarInt();
if (blockPaletteEntry == 0) isNewChunk = true;
//System.out.println("Block palette entry " + i + ": " + blockPaletteEntry);
}
}

Expand Down
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": "1.0.0",
"version": "1.0.1",
"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 7587bda

Please sign in to comment.