Skip to content

Commit

Permalink
Changed CPU usage selector, optimized dependencies and changed quality.
Browse files Browse the repository at this point in the history
Added Readme with instructions
Release 1
  • Loading branch information
Dioswilson committed Feb 3, 2023
1 parent bddbfec commit 1c31314
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 53 deletions.
35 changes: 24 additions & 11 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Rng multiple witch hut finder

This application lets you find mansion areas for witch rng on witch huts, allowing you to have multiple on the same perimeter.

## How to use

- Execute the jar file (Download it from releases) normally, no parameters needed
- Insert seed and witch huts positions (chunks coords), if you don't want 4 WH just leave it empty
- Insert player coordinates, it does not need to be precise, player can move inside the chunk.
- Select the max amount of advancers (in this case dispensers) you are willing to use
- Select the CPU usage profile you want to use (More CPU also means more RAM). Use high or very high only if you are not planning to use a lot of advancers.
- "Generate Litematic" tab is made to input known values and compare them or just generate the litematic

### Extra information
- A higher value on Quality does not 100% guarantee higher rates, but it is as accurate as I could make it
- Program does not check if all with huts are in range of the player, if they are not in range it will never find an output.
- Not planning to implement other way of building the perimeter. Litematica is the only option. https://masa.dy.fi/mcmods/client_mods/ to download it
- It does not matter the order you put witch huts, heightmap result will always be in the same order (Depending on the hash)
- Chunk loading grid must be before mob spawning (TT is ok)
- DO NOT raise heightmap where litematic placed bedrock or a witch hut
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

group 'com.dioswilson'
version '1.0-SNAPSHOT'
version '1.0'

repositories {
mavenCentral()
Expand All @@ -17,12 +17,12 @@ repositories {
}
dependencies {
implementation('com.seedfinding:mc_core:1.192.1') { transitive = false }
implementation('com.seedfinding:mc_math:1.171.0') { transitive = false }
implementation('com.seedfinding:mc_biome:1.171.1') { transitive = false }
implementation('com.seedfinding:mc_seed:1.171.1') { transitive = false }
implementation('com.seedfinding:mc_noise:1.171.1') { transitive = false }
implementation('com.seedfinding:mc_biome:1.171.1') { transitive = false }
implementation('com.seedfinding:mc_terrain:1.171.1') { transitive = false }
implementation('com.seedfinding:mc_feature:1.171.1') { transitive = false }
implementation('com.seedfinding:mc_math:1.171.0') { transitive = false }
// implementation('com.seedfinding:mc_terrain:1.171.1') { transitive = false }
// implementation('com.seedfinding:mc_feature:1.171.1') { transitive = false }
implementation 'com.github.Querz:NBT:6.1'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
Expand Down
19 changes: 0 additions & 19 deletions src/main/java/com/dioswilson/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@
import com.dioswilson.gui.InputValuesPanel;
import com.dioswilson.gui.ResultsPanel;
import com.dioswilson.minecraft.Chunk;
import com.seedfinding.mcbiome.source.OverworldBiomeSource;
import com.seedfinding.mccore.version.MCVersion;

import java.awt.*;
import java.lang.reflect.Field;
import java.util.*;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicLong;
import javax.swing.*;
Expand Down Expand Up @@ -72,18 +67,4 @@ public static void main(String[] args) {
}




public void printSeed() {
try {
Field field = Random.class.getDeclaredField("seed");
field.setAccessible(true);
AtomicLong scrambledSeed = (AtomicLong) field.get(this.randy);
long theSeed = scrambledSeed.get();
System.out.println(theSeed);
} catch (Exception exception) {
}
}


}
13 changes: 6 additions & 7 deletions src/main/java/com/dioswilson/Witch.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import javax.swing.*;
import java.io.File;
import java.util.*;
import java.util.List;
import java.util.concurrent.Semaphore;

public class Witch {
Expand Down Expand Up @@ -45,7 +44,7 @@ public class Witch {
private int maxAdvancers;
private Set<Chunk> eligibleChunksForSpawning = new HashSet<>();

private int succesfulSpawns;
private double succesfulSpawns;

public Witch(int areaMansionX, int areaMansionZ, long seed, OverworldBiomeSource biomeSource, Semaphore semaphore, List<Chunk> witchChunks, Set<Chunk> neighbourChunks, Set<Chunk> chunksForSpawning, int maxAdvancers) {

Expand Down Expand Up @@ -79,7 +78,7 @@ public void print() {
String iter = Arrays.toString(this.finalHeightMap);
String advancers = "" + this.advancers;
String tp = " /tp " + fromX + " 150 " + fromZ + "\n";
String quality = "S:" + this.succesfulSpawns;
String quality = "S:" + String.format("%.3f",this.succesfulSpawns);

try {
this.semaphore.acquire();
Expand Down Expand Up @@ -156,7 +155,7 @@ private void calculateRandomChunkPositionsFull(int calls) {

for (int height : heightMap) {

int quality = 0;
double quality = 0;
int validSpawns = 0;
for (int specificCall : differentCalls) {

Expand All @@ -171,10 +170,10 @@ private void calculateRandomChunkPositionsFull(int calls) {

int spawns = simulatePackSpawns(staticX, staticY, staticZ, chunk, height, specificCall + moreCalls + extraCalls, differentCallsTemp, positionsTemp);
// if (spawns >= (54 / (i * 2 + 1))) {//max 64
if (spawns >= (246 / (1.5*i + 1))) {//max 256
if (spawns >= (246 / (1.5 * i + 1))) {//max 256
validSpawns++;
}
quality += spawns / (callsAmount*(i+1));
quality += (double) spawns / (callsAmount);

}
else {
Expand All @@ -183,7 +182,7 @@ private void calculateRandomChunkPositionsFull(int calls) {
}
}

if (validSpawns >= callsAmount * 0.75 / ( i + 1)) {
if (validSpawns >= callsAmount * 0.75 / (i + 1)) {
this.finalHeightMap[i] = height;
validChunks++;
this.succesfulSpawns += quality;// This number might not be not super representative
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/dioswilson/gui/InputValuesPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -301,19 +301,19 @@ public InputValuesPanel() throws HeadlessException {
});

low.addActionListener(e -> {
performace.set(0.25);
performace.set(0.5);
});

mid.addActionListener(e -> {
performace.set(0.5);
performace.set(1.0);
});
mid.setSelected(true);

high.addActionListener(e -> {
performace.set(1.0);
performace.set(70.0);
});
high.setSelected(true);
veryHigh.addActionListener(e -> {
performace.set(2.0);
performace.set(140.0);
});


Expand Down
10 changes: 4 additions & 6 deletions src/main/java/com/dioswilson/minecraft/Chunk.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.dioswilson.minecraft;

import java.util.Collection;

public class Chunk {

private int x;
Expand Down Expand Up @@ -29,14 +27,14 @@ public void setZ(int z) {
}

public boolean equals(Object object) {

Chunk blockPos = (Chunk) object;

if(this.x != blockPos.getX()) return false;
if(this.z != blockPos.getZ()) return false;

return true;

}
public int hashCode()
{
Expand Down

0 comments on commit 1c31314

Please sign in to comment.