Skip to content

Commit

Permalink
Bugs :c
Browse files Browse the repository at this point in the history
  • Loading branch information
19MisterX98 committed Nov 24, 2020
1 parent a815877 commit 92d031f
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 20 deletions.
13 changes: 6 additions & 7 deletions src/main/java/kaptainwutax/seedcrackerX/SeedCracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ public class SeedCracker implements ModInitializer {

private static final SeedCracker INSTANCE = new SeedCracker();
private final DataStorage dataStorage = new DataStorage();
private boolean active = true;
private static boolean active;

@Override
public void onInitialize() {
ConfigScreen.loadConfig();
this.active = ConfigScreen.getConfig().isActive();
active = ConfigScreen.getConfig().isActive();
Features.init(MC_VERSION);
RenderQueue.get().add("hand", FinderQueue.get()::renderFinders);
}
Expand All @@ -34,14 +34,14 @@ public DataStorage getDataStorage() {
}

public boolean isActive() {
return this.active;
return active;
}

public void setActive(boolean active) {
if(this.active == active) return;
this.active = active;
if(SeedCracker.active == active) return;
SeedCracker.active = active;

if(this.active) {
if(active) {
ClientCommand.sendFeedback("SeedCracker is active.", Formatting.GREEN, true);
} else {
ClientCommand.sendFeedback("SeedCracker is not active.", Formatting.RED, true);
Expand All @@ -52,5 +52,4 @@ public void reset() {
SeedCracker.get().getDataStorage().clear();
FinderQueue.get().clear();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static class Data extends Decorator.Data<Dungeon> {
public static final int COBBLESTONE_CALL = 0;
public static final int MOSSY_COBBLESTONE_CALL = 1;
public static final float MIN_FLOOR_BITS = 26.0F;
public static final float MAX_FLOOR_BITS = 48.0F;
public static final float MAX_FLOOR_BITS = 64.0F;

public final int offsetX;
public final int blockX;
Expand Down Expand Up @@ -188,7 +188,7 @@ public void onDataAdded(DataStorage dataStorage) {
}
}
if(dataStorage.getTimeMachine().worldSeeds == null) {
Log.warn("finished structure seed search");
Log.warn("finished structure seed search. You'll need another dungeon");
}
}else {
LCG failedDungeon = LCG.JAVA.combine(-5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import kaptainwutax.seedcrackerX.cracker.PillarData;
import kaptainwutax.seedcrackerX.cracker.decorator.Dungeon;
import kaptainwutax.seedcrackerX.cracker.decorator.EmeraldOre;
import kaptainwutax.seedcrackerX.finder.decorator.DungeonFinder;
import kaptainwutax.seedcrackerX.util.Log;

import java.util.ArrayList;
Expand Down Expand Up @@ -178,6 +179,7 @@ public void clear() {
this.hashedSeedData = null;
this.timeMachine.shouldTerminate = true;
this.timeMachine = new TimeMachine(this);
DungeonFinder.resetXRayDetected();
}

public static class Entry<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ protected boolean pokeBiomes() {
}
}

if(this.dataStorage.biomeSeedData.size() < 5 || this.structureSeeds.size() > 20) return false;

Log.warn("Looking for world seeds with "+ this.dataStorage.biomeSeedData.size() + " biomes...");
for(long structureSeed : this.structureSeeds) {
for(long upperBits = 0; upperBits < 1 << 16 && !this.shouldTerminate; upperBits++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
import java.util.Set;

public class DungeonFinder extends BlockFinder {
private static boolean xRayDetected = false;
public static void resetXRayDetected() {
xRayDetected = false;
}

protected static List<BlockPos> SEARCH_POSITIONS = buildSearchPositions(CHUNK_POSITIONS, pos -> {
return false;
Expand Down Expand Up @@ -57,10 +61,13 @@ private boolean AntiXRay(BlockPos pos) {
currentPos.move(0, -1, 0);
posCheck = this.world.getBlockState(currentPos).getBlock();
if (posCheck != Blocks.COBBLESTONE && posCheck != Blocks.MOSSY_COBBLESTONE) {
Log.error("This server probably uses AntiXray");
//TODO link a video that explains it better
Log.error("You may need to dig out the walls at footlevel in the marked dungeon");
Log.error("Reload the area so the mod scans again");
if(!xRayDetected) {
xRayDetected = true;
Log.error("This server probably uses AntiXray");
//TODO link a video that explains it better
Log.error("You may need to dig out the walls at footlevel in the marked dungeon");
Log.error("Reload the area so the mod scans again");
}
this.renderers.add(new Cube(currentPos, new Color(255, 0, 157)));
return true;
}
Expand Down Expand Up @@ -184,8 +191,7 @@ public static List<Finder> create(World world, ChunkPos chunkPos) {
finders.add(new DungeonFinder(world, chunkPos));


//what is this for???
/*finders.add(new DungeonFinder(world, new ChunkPos(chunkPos.x - 1, chunkPos.z)));
finders.add(new DungeonFinder(world, new ChunkPos(chunkPos.x - 1, chunkPos.z)));
finders.add(new DungeonFinder(world, new ChunkPos(chunkPos.x, chunkPos.z - 1)));
finders.add(new DungeonFinder(world, new ChunkPos(chunkPos.x - 1, chunkPos.z - 1)));

Expand All @@ -194,7 +200,7 @@ public static List<Finder> create(World world, ChunkPos chunkPos) {
finders.add(new DungeonFinder(world, new ChunkPos(chunkPos.x + 1, chunkPos.z + 1)));

finders.add(new DungeonFinder(world, new ChunkPos(chunkPos.x + 1, chunkPos.z - 1)));
finders.add(new DungeonFinder(world, new ChunkPos(chunkPos.x - 1, chunkPos.z + 1)));*/
finders.add(new DungeonFinder(world, new ChunkPos(chunkPos.x - 1, chunkPos.z + 1)));
return finders;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ public void onGameJoin(GameJoinS2CPacket packet, CallbackInfo ci) {
if(SeedCracker.get().getDataStorage().addHashedSeedData(hashedSeedData, DataAddedEvent.POKE_BIOMES)) {
Log.warn("Fetched hashed world seed [" + hashedSeedData.getHashedSeed() + "].");
}

SeedCracker.get().setActive(SeedCracker.get().isActive());
}

@Inject(method = "onPlayerRespawn", at = @At(value = "TAIL"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package kaptainwutax.seedcrackerX.mixin;

import kaptainwutax.seedcrackerX.SeedCracker;
import kaptainwutax.seedcrackerX.profile.config.ConfigScreen;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BuiltinBiomes;
Expand All @@ -16,6 +17,7 @@ public abstract class ClientWorldMixin {

@Inject(method = "disconnect", at = @At("HEAD"))
private void disconnect(CallbackInfo ci) {
SeedCracker.get().setActive(ConfigScreen.getConfig().isActive());
SeedCracker.get().reset();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ public class ConfigObj{
protected boolean BIOME = true;
protected MCVersion VERSION = MCVersion.v1_16_2;
protected RenderType RENDER = RenderType.XRAY;

protected boolean Active = true;

public boolean isActive() {
return Active;
return this.Active;
}

public boolean isDEBUG() {
Expand Down

0 comments on commit 92d031f

Please sign in to comment.