Skip to content

Commit

Permalink
v1.0.9 Detection for END chunks being updated from old version
Browse files Browse the repository at this point in the history
***66.6% Guaranteed Old Version Chunk Detection (End):***
- Applied the method for detecting chunks in the Nether being updated from versions <=1.17 to the detection in the End dimension. This method detects if there is too many air blockstates in the Palettes within a chunk.
- These chunks being updated in the End will be highlighted the same as chunks being updated from old build limits in the Overworld and Nether.
- This only works for the end islands, you can only detect if they are being updated from old version.

Also I edited the Readme entry for **AutoStaircase** to contain credits directly to [majorsopa](https://github.com/majorsopa) for writing the original. Thank you to them if that module wasn't made I might not have got into java coding in order to make it work good :)
  • Loading branch information
etianl authored Jul 20, 2024
1 parent 784cdf3 commit 24cf1c6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 126 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ In no particular order
- JumpKey adjusts spacing of stairs according to the OnDemandSpacing value.
- Start building, then hold SneakKey and also hold Left or RightKey as well to build stairs diagonally. Release left or right key first to continue building in the direction you were prior.
- **AutoScoreboard:** Automates the creation of a custom scoreboard. Useful for advertising on griefed servers. Requires OP status. Credits to [aaaasdfghjkllll](https://github.com/aaaasdfghjkllll)
- **AutoStaircase:** Builds stairs upward in the direction you are facing by running forward and jumping. (Credits to etianl for bringing it to life! As well as Credits to Frostburn for writing the original. <3) I just had to fix up some stuff for this one but Frostburn had the base code there. I believe this is the first publicly available automatic staircase builder in a Meteor addon, correct me if I'm wrong maybe I didn't have to learn some Java to do this.
- **AutoStaircase:** Builds stairs upward in the direction you are facing by running forward and jumping. (Credits to etianl for bringing it to life! As well as Credits to [majorsopa](https://github.com/majorsopa) for writing the original. <3) I just had to fix up some stuff for this one but Frostburn Client had the base code there. I believe this is the first publicly available automatic staircase builder in a Meteor addon, correct me if I'm wrong maybe I didn't have to learn some Java to do this.
- **AutoTitles:** Displays text (such as advertisements) across the screen of all the individuals who are online on a server at the time. Requires OP status. Credits to [ogmur](https://www.youtube.com/@Ogmur) for figuring out these commands, and to etianl for writing a module for it.
- **AutoVclipCommand** Automatically selects the nearest two block gap going either up or down to vclip into. (Credits to etianl, and credits to the original [AutoVclip](https://github.com/kittenvr/AutoVclip) for minecraft 1.19.2 which inspired me to make this one. :D)
- **BaseFinder:** Automatically detects if a Base or Build could be in a chunk by checking every block in each chunk to see if there are "Un-natural" blocks within them. (Credits to etianl :D, and to Meteor-Rejects for some code from newchunks.)
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.21+build.2
loader_version=0.15.11

# Mod Properties
mod_version=1.0.8-1.21
mod_version=1.0.9-1.21
maven_group=pwn.noobs
archives_base_name=1trouser-streak

Expand Down
137 changes: 14 additions & 123 deletions src/main/java/pwn/noobs/trouserstreak/modules/NewerNewChunks.java
Original file line number Diff line number Diff line change
Expand Up @@ -630,118 +630,6 @@ else if (!(event.packet instanceof PlayerMoveC2SPacket) && event.packet instance
PacketByteBuf buf = packet.getChunkData().getSectionsDataBuf();
boolean isNewChunk = false;
boolean firstchunkappearsnew = false;

if (mc.world.getRegistryKey() == World.END) {
// Chunk Section structure
if (buf.readableBytes() < 2) return; // Ensure we have at least 2 bytes for block count

short blockCount = buf.readShort();
//System.out.println("Block count: " + blockCount);

// Block states Paletted Container
if (buf.readableBytes() < 1) return;
int blockBitsPerEntry = buf.readUnsignedByte();
//System.out.println("Block Bits Per Entry: " + blockBitsPerEntry);

if (blockBitsPerEntry == 0) {
// Single valued palette
int singleBlockValue = buf.readVarInt();
//System.out.println("Single Block Value: " + singleBlockValue);
buf.readVarInt(); // Data Array Length (should be 0)
} else if (blockBitsPerEntry >= 4 && blockBitsPerEntry <= 8) {
// Indirect palette
int blockPaletteLength = buf.readVarInt();
//System.out.println("Block palette length: " + blockPaletteLength);
for (int i = 0; i < blockPaletteLength; i++) {
int blockPaletteEntry = buf.readVarInt();
//System.out.println("Block palette entry " + i + ": " + blockPaletteEntry);
}

// Data Array
int blockDataArrayLength = buf.readVarInt();
//System.out.println("Block Data Array Length: " + blockDataArrayLength);
if (buf.readableBytes() >= blockDataArrayLength * 8) {
for (int i = 0; i < blockDataArrayLength; i++) {
long dataEntry = buf.readLong();
// Process dataEntry if needed
}
} else {
//System.out.println("Not enough data for block array");
return;
}
} else if (blockBitsPerEntry == 15) {
// Direct palette (no palette sent)
int blockDataArrayLength = buf.readVarInt();
//System.out.println("Block Data Array Length: " + blockDataArrayLength);
if (buf.readableBytes() >= blockDataArrayLength * 8) {
for (int i = 0; i < blockDataArrayLength; i++) {
long dataEntry = buf.readLong();
// Process dataEntry if needed
}
} else {
//System.out.println("Not enough data for block array");
return;
}
} else {
//System.out.println("Invalid block bits per entry: " + blockBitsPerEntry);
return;
}

// Biomes Paletted Container
if (buf.readableBytes() < 1) {
//System.out.println("No biome data available");
return;
}

int biomeBitsPerEntry = buf.readUnsignedByte();
//System.out.println("Biome Bits Per Entry: " + biomeBitsPerEntry);

if (biomeBitsPerEntry == 0) {
// Single valued palette
int singleBiomeValue = buf.readVarInt();
//System.out.println("Single Biome Value: " + singleBiomeValue);
if (singleBiomeValue == 39) isNewChunk = true;
buf.readVarInt(); // Data Array Length (should be 0)
} else if (biomeBitsPerEntry >= 1 && biomeBitsPerEntry <= 3) {
// Indirect palette
int biomePaletteLength = buf.readVarInt();
//System.out.println("Biome palette length: " + biomePaletteLength);
for (int i = 0; i < biomePaletteLength; i++) {
int biomePaletteEntry = buf.readVarInt();
//System.out.println("Biome palette entry " + i + ": " + biomePaletteEntry);
if (i == 0 && biomePaletteEntry == 39) isNewChunk = true;
}

// Data Array
int biomeDataArrayLength = buf.readVarInt();
//System.out.println("Biome Data Array Length: " + biomeDataArrayLength);
if (buf.readableBytes() >= biomeDataArrayLength * 8) {
for (int i = 0; i < biomeDataArrayLength; i++) {
long dataEntry = buf.readLong();
// Process dataEntry if needed
}
} else {
//System.out.println("Not enough data for biome array");
return;
}
} else if (biomeBitsPerEntry == 6) {
// Direct palette (no palette sent)
int biomeDataArrayLength = buf.readVarInt();
//System.out.println("Biome Data Array Length: " + biomeDataArrayLength);
if (buf.readableBytes() >= biomeDataArrayLength * 8) {
for (int i = 0; i < biomeDataArrayLength; i++) {
long dataEntry = buf.readLong();
// Process dataEntry if needed
}
} else {
//System.out.println("Not enough data for biome array");
return;
}
} else {
//System.out.println("Invalid biome bits per entry: " + biomeBitsPerEntry);
return;
}
} else if (mc.world.getRegistryKey() == World.OVERWORLD || mc.world.getRegistryKey() == World.NETHER) {
PacketByteBuf bufferCopy = new PacketByteBuf(Unpooled.copiedBuffer(buf.nioBuffer())); //copy the packetByteBuf for later use
if (buf.readableBytes() < 3) return; // Ensure we have at least 3 bytes (short + byte)

Expand All @@ -752,8 +640,9 @@ else if (!(event.packet instanceof PlayerMoveC2SPacket) && event.packet instance
int blockPaletteLength = buf.readVarInt();
//System.out.println("Block palette length: " + blockPaletteLength);
int blockPaletteEntry = buf.readVarInt();
if (blockPaletteEntry == 0) firstchunkappearsnew = true;
//System.out.println("Block palette entry " + i + ": " + blockPaletteEntry);
if (blockPaletteEntry == 0 && mc.world.getRegistryKey() != World.END) firstchunkappearsnew = true;
//BlockState blockState = Block.STATE_IDS.get(blockPaletteEntry);
//System.out.println("Block palette entry: " + blockState);
}
if (bufferCopy.readableBytes() < 2) return; // Ensure we have at least 2 bytes for block count

Expand Down Expand Up @@ -820,7 +709,7 @@ else if (!(event.packet instanceof PlayerMoveC2SPacket) && event.packet instance
return;
}
}
if (blockPaletteEntry == 0 && mc.world.getRegistryKey() == World.NETHER) isOlderOldSection++;
if (blockPaletteEntry == 0 && mc.world.getRegistryKey() == World.NETHER | mc.world.getRegistryKey() == World.END) isOlderOldSection++;
}
if (isOlderOldSection>=2) oldChunkQuantifier++;
if (isNewSection >= 2) newChunkQuantifier++;
Expand Down Expand Up @@ -863,9 +752,10 @@ else if (!(event.packet instanceof PlayerMoveC2SPacket) && event.packet instance
if (biomeBitsPerEntry == 0) {
// Single valued palette
int singleBiomeValue = bufferCopy.readVarInt();
Registry<Biome> biomeRegistry = mc.world.getRegistryManager().get(RegistryKeys.BIOME);
Biome biome = biomeRegistry.get(singleBiomeValue);
//Registry<Biome> biomeRegistry = mc.world.getRegistryManager().get(RegistryKeys.BIOME);
//Biome biome = biomeRegistry.get(singleBiomeValue);
//System.out.println("Section: " + loops + " | Single Biome Value: " + singleBiomeValue + " | Biome: " + biome.toString());
if (singleBiomeValue == 39 && mc.world.getRegistryKey() == World.END) isNewChunk = true;
bufferCopy.readVarInt(); // Data Array Length (should be 0)
} else if (biomeBitsPerEntry >= 1 && biomeBitsPerEntry <= 3) {
// Indirect palette
Expand All @@ -877,9 +767,10 @@ else if (!(event.packet instanceof PlayerMoveC2SPacket) && event.packet instance
break;
}
int biomePaletteEntry = bufferCopy.readVarInt();
Registry<Biome> biomeRegistry = mc.world.getRegistryManager().get(RegistryKeys.BIOME);
Biome biome = biomeRegistry.get(biomePaletteEntry);
//Registry<Biome> biomeRegistry = mc.world.getRegistryManager().get(RegistryKeys.BIOME);
//Biome biome = biomeRegistry.get(biomePaletteEntry);
//System.out.println("Section: " + loops + " | Biome palette entry " + i + ": " + biomePaletteEntry + " | Biome: " + biome.toString());
if (i == 0 && biomePaletteEntry == 39 && mc.world.getRegistryKey() == World.END) isNewChunk = true;
}

// Data Array
Expand Down Expand Up @@ -918,7 +809,7 @@ else if (!(event.packet instanceof PlayerMoveC2SPacket) && event.packet instance

//System.out.println("newChunkQuantifier: " + newChunkQuantifier + ", loops: " + loops);
if (loops > 0) {
if (mc.world.getRegistryKey() == World.NETHER){
if (mc.world.getRegistryKey() == World.NETHER || mc.world.getRegistryKey() == World.END){
double oldpercentage = ((double) oldChunkQuantifier / loops) * 100;
//System.out.println("Percentage: " + oldpercentage);
if (oldpercentage >= 25) {
Expand All @@ -942,9 +833,9 @@ else if (!(event.packet instanceof PlayerMoveC2SPacket) && event.packet instance
}
} catch (Exception e) {
e.printStackTrace();
if (mc.world.getRegistryKey() == World.NETHER){
if (mc.world.getRegistryKey() == World.NETHER || mc.world.getRegistryKey() == World.END){
double oldpercentage = ((double) oldChunkQuantifier / loops) * 100;
//System.out.println("Percentage: " + percentage);
//System.out.println("Percentage: " + oldpercentage);
if (oldpercentage >= 25) {
isNewChunk = false;
if (!olderOldChunks.contains(oldpos) && !oldChunks.contains(oldpos) && !tickexploitChunks.contains(oldpos) && !newChunks.contains(oldpos)) {
Expand All @@ -964,7 +855,7 @@ else if (!(event.packet instanceof PlayerMoveC2SPacket) && event.packet instance
}
}
}
}

if (firstchunkappearsnew) isNewChunk = true;
if (!isNewChunk) {
try {
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.8",
"version": "1.0.9",
"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 24cf1c6

Please sign in to comment.