start of finder profiles

This commit is contained in:
Unknown
2020-02-05 17:08:50 -05:00
parent 2f842b5fbe
commit a23b2bd9a9
4 changed files with 53 additions and 8 deletions
@@ -41,7 +41,7 @@ public class FinderCommand extends ClientCommand {
}
private int printFinderType(FinderConfig.Type finderType) {
this.sendFeedback("Finder " + finderType + " is set to [" + String.valueOf(FinderQueue.get().finderConfig.getTypeState(finderType)).toUpperCase() + "].", false);
this.sendFeedback("Finder " + finderType + " is set to [" + String.valueOf(FinderQueue.get().finderProfile.getTypeState(finderType)).toUpperCase() + "].", false);
return 0;
}
@@ -51,7 +51,7 @@ public class FinderCommand extends ClientCommand {
}
private int setFinderType(FinderConfig.Type finderType, boolean flag) {
FinderQueue.get().finderConfig.setTypeState(finderType, flag);
FinderQueue.get().finderProfile.setTypeState(finderType, flag);
this.sendFeedback("Finder " + finderType + " has been set to [" + String.valueOf(flag).toUpperCase() + "].", false);
return 0;
}
@@ -2,6 +2,7 @@ package kaptainwutax.seedcracker.finder;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import kaptainwutax.seedcracker.finder.profile.VanillaProfile;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.World;
@@ -16,7 +17,7 @@ public class FinderQueue {
public static ExecutorService SERVICE = Executors.newFixedThreadPool(5);
public RenderType renderType = RenderType.XRAY;
public FinderConfig finderConfig = new DefaultFinderConfig();
public FinderConfig finderProfile = new VanillaProfile();
private FinderQueue() {
this.clear();
@@ -27,15 +28,15 @@ public class FinderQueue {
}
public void onChunkData(World world, ChunkPos chunkPos) {
this.finderConfig.getActiveFinderTypes().forEach(type -> {
SERVICE.submit(() -> {
this.finderProfile.getActiveFinderTypes().forEach(type -> {
SERVICE.submit(() -> {
try {
List<Finder> finders = type.finderBuilder.build(world, chunkPos);
finders.forEach(finder -> {
if(finder.isValidDimension(world.dimension.getType())) {
finder.findInChunk();
this.finderConfig.addFinder(type, finder);
this.finderProfile.addFinder(type, finder);
}
});
} catch(Exception e) {
@@ -58,7 +59,7 @@ public class FinderQueue {
GlStateManager.disableDepthTest();
}
this.finderConfig.getActiveFinders().forEach(finder -> {
this.finderProfile.getActiveFinders().forEach(finder -> {
if(finder.shouldRender()) {
finder.render();
}
@@ -69,7 +70,7 @@ public class FinderQueue {
public void clear() {
this.renderType = RenderType.XRAY;
this.finderConfig = new DefaultFinderConfig();
this.finderProfile = new VanillaProfile();
}
public enum RenderType {
@@ -0,0 +1,17 @@
package kaptainwutax.seedcracker.finder.profile;
import kaptainwutax.seedcracker.finder.FinderConfig;
public abstract class FinderProfile extends FinderConfig {
public FinderProfile(boolean defaultState) {
super(defaultState);
}
public abstract String getAuthor();
public abstract boolean getLocked();
public abstract void setAuthor(String author);
public abstract void setLocked(boolean locked);
}
@@ -0,0 +1,27 @@
package kaptainwutax.seedcracker.finder.profile;
public class VanillaProfile extends FinderProfile {
public VanillaProfile() {
super(true);
}
@Override
public String getAuthor() {
return "KaptainWutax";
}
@Override
public boolean getLocked() {
return true;
}
@Override
public void setAuthor(String author) {
}
@Override
public void setLocked(boolean locked) {
}
}