Skip to content

Commit

Permalink
*1.1.1* OPTIMIZE NewerNewChunks
Browse files Browse the repository at this point in the history
***NewerNewChunks Code Optimizations:***
- Prevented color mixing. The new default chunk color format is as follows:

**Red:** New chunk, never loaded before.\
**Green:** Old chunk, only loaded in 1.18 or after.\
**Yellow-Green:** Old Generation chunk, only loaded in 1.17 or before for OVERWORLD, 1.13 or before in END, or 1.15 or before in NETHER (defined by static means, the state does not change).\
**Orange-Yellow:** Old chunk (1.17 or before) being currently updated to 1.18 or after (defined by dynamic means, the state does change if someone visits and leaves).\

- Optimized and fixed codes to make chunk detection run faster and with less lag. Made the code a bit cleaner too.
- Improved Nether and Overworld old generation chunk detectors by adding more blocks for them to detect.
- Made End old generation chunk detector only run it's code in the End (improve performance).
- Renamed "OlderOldChunkData.txt" to "BeingUpdatedChunkData.txt" to better represent what chunk positions it contains. To migrate that chunk data please rename the same files in this folder "TrouserStreak/NewChunks/" for each server you want to migrate the data.
- Changed module description removing the thing talking about writer index capacities because we do not use that anymore.
- Added the default color descriptions to README.md

- Updated the .world command to more often show if the chunk is pre 1.17 generation in the Overworld.
  • Loading branch information
etianl authored Jul 22, 2024
1 parent 8a26bc0 commit 00fccd5
Show file tree
Hide file tree
Showing 5 changed files with 225 additions and 413 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ In no particular order
- the **Pre 1.13 End OldChunk Detector** marks chunks as generated in an old version if they have the biome of minecraft:the_end.
- With the **Pre 1.13 End OldChunk Detector** chunks that are old in the End just around the central end island are always marked as old because that biome is minecraft:the_end.

**Default Color Descriptions:**\
**Red:** New chunk, never loaded before.\
**Green:** Old chunk, only loaded in 1.18 or after.\
**Yellow-Green:** Old Generation chunk, only loaded in 1.17 or before for OVERWORLD, 1.13 or before in END, or 1.15 or before in NETHER (defined by static means, the state does not change).\
**Orange-Yellow:** Old chunk (1.17 or before) being currently updated to 1.18 or after (defined by dynamic means, the state does change if someone visits and leaves).\

**More Detection Methods:**
- The **LiquidExploit** option estimates possible newchunks based on liquid being just starting to flow for the first time.
- The **BlockUpdateExploit** option estimates possible newchunks based on block update packets. SOME OF THESE CHUNKS MAY BE OLD. Advanced Mode is needed to filter any false positives out. See Special Options notes for usage.
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.1.0-1.21
mod_version=1.1.1-1.21
maven_group=pwn.noobs
archives_base_name=1trouser-streak

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import net.minecraft.util.WorldSavePath;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.GameRules;
import net.minecraft.world.World;
import net.minecraft.world.chunk.WorldChunk;

import java.io.File;
Expand All @@ -20,6 +21,8 @@
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

import static meteordevelopment.meteorclient.MeteorClient.mc;

Expand All @@ -30,6 +33,41 @@ public WorldInfoCommand() {
super("world", "Tells you the coordinates of each world border, and the spawn location.");
}

private static final Set<Block> NEW_OVERWORLD_BLOCKS = new HashSet<>();
static {
NEW_OVERWORLD_BLOCKS.add(Blocks.DEEPSLATE);
NEW_OVERWORLD_BLOCKS.add(Blocks.AMETHYST_BLOCK);
NEW_OVERWORLD_BLOCKS.add(Blocks.AZALEA);
NEW_OVERWORLD_BLOCKS.add(Blocks.BIG_DRIPLEAF);
NEW_OVERWORLD_BLOCKS.add(Blocks.BIG_DRIPLEAF_STEM);
NEW_OVERWORLD_BLOCKS.add(Blocks.SMALL_DRIPLEAF);
NEW_OVERWORLD_BLOCKS.add(Blocks.CAVE_VINES);
NEW_OVERWORLD_BLOCKS.add(Blocks.CAVE_VINES_PLANT);
NEW_OVERWORLD_BLOCKS.add(Blocks.SPORE_BLOSSOM);
NEW_OVERWORLD_BLOCKS.add(Blocks.COPPER_ORE);
NEW_OVERWORLD_BLOCKS.add(Blocks.DEEPSLATE_COPPER_ORE);
NEW_OVERWORLD_BLOCKS.add(Blocks.DEEPSLATE_IRON_ORE);
NEW_OVERWORLD_BLOCKS.add(Blocks.DEEPSLATE_COAL_ORE);
NEW_OVERWORLD_BLOCKS.add(Blocks.DEEPSLATE_REDSTONE_ORE);
NEW_OVERWORLD_BLOCKS.add(Blocks.DEEPSLATE_EMERALD_ORE);
NEW_OVERWORLD_BLOCKS.add(Blocks.DEEPSLATE_GOLD_ORE);
NEW_OVERWORLD_BLOCKS.add(Blocks.DEEPSLATE_LAPIS_ORE);
NEW_OVERWORLD_BLOCKS.add(Blocks.DEEPSLATE_DIAMOND_ORE);
NEW_OVERWORLD_BLOCKS.add(Blocks.GLOW_LICHEN);
NEW_OVERWORLD_BLOCKS.add(Blocks.RAW_COPPER_BLOCK);
NEW_OVERWORLD_BLOCKS.add(Blocks.RAW_IRON_BLOCK);
NEW_OVERWORLD_BLOCKS.add(Blocks.DRIPSTONE_BLOCK);
NEW_OVERWORLD_BLOCKS.add(Blocks.MOSS_BLOCK);
NEW_OVERWORLD_BLOCKS.add(Blocks.POINTED_DRIPSTONE);
NEW_OVERWORLD_BLOCKS.add(Blocks.SMOOTH_BASALT);
NEW_OVERWORLD_BLOCKS.add(Blocks.TUFF);
NEW_OVERWORLD_BLOCKS.add(Blocks.CALCITE);
NEW_OVERWORLD_BLOCKS.add(Blocks.HANGING_ROOTS);
NEW_OVERWORLD_BLOCKS.add(Blocks.ROOTED_DIRT);
NEW_OVERWORLD_BLOCKS.add(Blocks.AZALEA_LEAVES);
NEW_OVERWORLD_BLOCKS.add(Blocks.FLOWERING_AZALEA_LEAVES);
}

@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.executes(context -> {
Expand All @@ -49,10 +87,10 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {
for (int x = 0; x < 16; x++) {
for (int y = mc.world.getBottomY(); y < mc.world.getTopY(); y++) {
for (int z = 0; z < 16; z++) {
if (!foundAnyOre && isOreBlock(chunk.getBlockState(new BlockPos(x, y, z)).getBlock()) && mc.world.getRegistryKey().getValue().toString().toLowerCase().contains("overworld")) {
if (!foundAnyOre && isOreBlock(chunk.getBlockState(new BlockPos(x, y, z)).getBlock()) && mc.world.getRegistryKey() == World.OVERWORLD) {
foundAnyOre = true;
}
if (!isNewGeneration && y < 256 && y >= 0 && (chunk.getBlockState(new BlockPos(x, y, z)).getBlock() == Blocks.COPPER_ORE || chunk.getBlockState(new BlockPos(x, y, z)).getBlock() == Blocks.DEEPSLATE_COPPER_ORE) && mc.world.getRegistryKey().getValue().toString().toLowerCase().contains("overworld")) {
if (!isNewGeneration && y < 260 && y > 5 && NEW_OVERWORLD_BLOCKS.contains(chunk.getBlockState(new BlockPos(x, y, z)).getBlock()) && mc.world.getRegistryKey() == World.OVERWORLD) {
isNewGeneration = true;
}
}
Expand Down
Loading

0 comments on commit 00fccd5

Please sign in to comment.