From 4e28f711ed6a777a7dce44e23e0fc3c0a5010f22 Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 18 Feb 2020 16:24:52 +0100 Subject: [PATCH] Whatever --- .../java/kaptainwutax/seedcracker/SeedCracker.java | 14 +++++++------- .../seedcracker/cracker/TimeMachine.java | 3 ++- .../kaptainwutax/seedcracker/finder/Finder.java | 5 +++-- .../java/kaptainwutax/seedcracker/util/Log.java | 10 +++++++--- .../kaptainwutax/seedcracker/util/PosIterator.java | 9 +++++---- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/main/java/kaptainwutax/seedcracker/SeedCracker.java b/src/main/java/kaptainwutax/seedcracker/SeedCracker.java index 998477e..7d7037f 100644 --- a/src/main/java/kaptainwutax/seedcracker/SeedCracker.java +++ b/src/main/java/kaptainwutax/seedcracker/SeedCracker.java @@ -102,7 +102,7 @@ public class SeedCracker implements ModInitializer { this.pillarSeeds = null; this.structureCache.clear(); this.biomeCache.clear(); - this.decoratorCache.clear(); + this.populationCache.clear(); } public synchronized boolean onPillarData(PillarData pillarData) { @@ -134,21 +134,21 @@ public class SeedCracker implements ModInitializer { if(this.structureSeeds == null && this.pillarSeeds != null && this.structureCache.size() + this.populationCache.size() >= 5) { this.structureSeeds = new ArrayList<>(); - LOG.warn("Looking for structure seeds with " + this.structureCache.size() + " structure features."); - LOG.warn("Looking for structure seeds with " + this.populationCache.size() + " population features."); + Log.warn("Looking for structure seeds with " + this.structureCache.size() + " structure features."); + Log.warn("Looking for structure seeds with " + this.populationCache.size() + " population features."); this.pillarSeeds.forEach(pillarSeed -> { - timeMachine.buildStructureSeeds(pillarSeed, this.structureCache, this.decoratorCache, this.structureSeeds); + timeMachine.buildStructureSeeds(pillarSeed, this.structureCache, this.populationCache, this.structureSeeds); }); if(this.structureSeeds.size() > 0) { - LOG.warn("Finished search with " + this.structureSeeds.size() + (this.structureSeeds.size() == 1 ? " seed." : " seeds.")); + Log.warn("Finished search with " + this.structureSeeds.size() + (this.structureSeeds.size() == 1 ? " seed." : " seeds.")); } else { Log.error("Finished search with no seeds."); } this.structureCache.clear(); - this.onDecoratorData(null); + this.onPopulationData(null); this.onBiomeData(null); } else if(this.structureSeeds != null && structureData != null) { this.structureSeeds.removeIf(structureSeed -> { @@ -188,7 +188,7 @@ public class SeedCracker implements ModInitializer { Log.warn("Looking for world seeds with " + this.biomeCache.size() + " biomes."); for(int i = 0; i < this.structureSeeds.size(); i++) { - SeedCracker.LOG.warn("Progress " + (i * 100.0f) / this.structureSeeds.size() + "%..."); + Log.warn("Progress " + (i * 100.0f) / this.structureSeeds.size() + "%..."); long structureSeed = this.structureSeeds.get(i); diff --git a/src/main/java/kaptainwutax/seedcracker/cracker/TimeMachine.java b/src/main/java/kaptainwutax/seedcracker/cracker/TimeMachine.java index cf3c608..d7d2d1c 100644 --- a/src/main/java/kaptainwutax/seedcracker/cracker/TimeMachine.java +++ b/src/main/java/kaptainwutax/seedcracker/cracker/TimeMachine.java @@ -2,6 +2,7 @@ package kaptainwutax.seedcracker.cracker; import kaptainwutax.seedcracker.SeedCracker; import kaptainwutax.seedcracker.cracker.population.PopulationData; +import kaptainwutax.seedcracker.util.Log; import kaptainwutax.seedcracker.util.Rand; import kaptainwutax.seedcracker.util.math.LCG; import net.minecraft.world.gen.ChunkRandom; @@ -21,7 +22,7 @@ public class TimeMachine { for(long i = 0; i < (1L << 32); i++) { if((i & ((1L << 28) - 1)) == 0) { - SeedCracker.LOG.warn("Progress " + (i * 100.0f) / (1L << 32) + "%..."); + Log.warn("Progress " + (i * 100.0f) / (1L << 32) + "%..."); } long structureSeed = this.timeMachine(i, pillarSeed); diff --git a/src/main/java/kaptainwutax/seedcracker/finder/Finder.java b/src/main/java/kaptainwutax/seedcracker/finder/Finder.java index 7b07815..09e9946 100644 --- a/src/main/java/kaptainwutax/seedcracker/finder/Finder.java +++ b/src/main/java/kaptainwutax/seedcracker/finder/Finder.java @@ -24,8 +24,9 @@ public abstract class Finder { static { for(int x = 0; x < 16; x++) { - for(int z = 0; z < 16; z++) { - for(int y = 0; y < 256; y++) { + for(int y = 0; y < 256; y++) { + for(int z = 0; z < 16; z++) { + BlockPos pos = new BlockPos(x, y, z); if(y < 16)SUB_CHUNK_POSITIONS.add(pos); CHUNK_POSITIONS.add(pos); diff --git a/src/main/java/kaptainwutax/seedcracker/util/Log.java b/src/main/java/kaptainwutax/seedcracker/util/Log.java index 5df4c3f..eb14d83 100644 --- a/src/main/java/kaptainwutax/seedcracker/util/Log.java +++ b/src/main/java/kaptainwutax/seedcracker/util/Log.java @@ -1,10 +1,14 @@ package kaptainwutax.seedcracker.util; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.util.TextFormat; +import net.minecraft.client.util.TextComponentUtil; +import net.minecraft.text.Texts; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.text.LiteralText; +import static net.minecraft.util.Formatting.RED; +import static net.minecraft.util.Formatting.YELLOW; + public class Log { public static void debug(String message) { @@ -19,7 +23,7 @@ public class Log { PlayerEntity player = getPlayer(); if(player != null) { - player.addChatMessage(new LiteralText(TextFormat.YELLOW + message), false); + player.addChatMessage(new LiteralText(YELLOW + message), false); } } @@ -27,7 +31,7 @@ public class Log { PlayerEntity player = getPlayer(); if(player != null) { - player.addChatMessage(new LiteralText(TextFormat.RED + message), false); + player.addChatMessage(new LiteralText(RED + message), false); } } diff --git a/src/main/java/kaptainwutax/seedcracker/util/PosIterator.java b/src/main/java/kaptainwutax/seedcracker/util/PosIterator.java index 9c9babd..93a4fe3 100644 --- a/src/main/java/kaptainwutax/seedcracker/util/PosIterator.java +++ b/src/main/java/kaptainwutax/seedcracker/util/PosIterator.java @@ -11,11 +11,12 @@ public class PosIterator { Set result = new HashSet<>(); for(int x = start.getX(); x <= end.getX(); x++) { - for(int z = start.getZ(); z <= end.getZ(); z++) { - for(int y = start.getY(); y <= end.getY(); y++) { - result.add(new BlockPos(x, y, z)); + + for(int y = start.getY(); y <= end.getY(); y++) { + for(int z = start.getZ(); z <= end.getZ(); z++) { + result.add(new BlockPos(x, y, z)); + } } - } } return result;