start of finder profiles
This commit is contained in:
@@ -41,7 +41,7 @@ public class FinderCommand extends ClientCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int printFinderType(FinderConfig.Type finderType) {
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ public class FinderCommand extends ClientCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int setFinderType(FinderConfig.Type finderType, boolean flag) {
|
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);
|
this.sendFeedback("Finder " + finderType + " has been set to [" + String.valueOf(flag).toUpperCase() + "].", false);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package kaptainwutax.seedcracker.finder;
|
|||||||
|
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
import kaptainwutax.seedcracker.finder.profile.VanillaProfile;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.util.math.ChunkPos;
|
import net.minecraft.util.math.ChunkPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@@ -16,7 +17,7 @@ public class FinderQueue {
|
|||||||
public static ExecutorService SERVICE = Executors.newFixedThreadPool(5);
|
public static ExecutorService SERVICE = Executors.newFixedThreadPool(5);
|
||||||
|
|
||||||
public RenderType renderType = RenderType.XRAY;
|
public RenderType renderType = RenderType.XRAY;
|
||||||
public FinderConfig finderConfig = new DefaultFinderConfig();
|
public FinderConfig finderProfile = new VanillaProfile();
|
||||||
|
|
||||||
private FinderQueue() {
|
private FinderQueue() {
|
||||||
this.clear();
|
this.clear();
|
||||||
@@ -27,15 +28,15 @@ public class FinderQueue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onChunkData(World world, ChunkPos chunkPos) {
|
public void onChunkData(World world, ChunkPos chunkPos) {
|
||||||
this.finderConfig.getActiveFinderTypes().forEach(type -> {
|
this.finderProfile.getActiveFinderTypes().forEach(type -> {
|
||||||
SERVICE.submit(() -> {
|
SERVICE.submit(() -> {
|
||||||
try {
|
try {
|
||||||
List<Finder> finders = type.finderBuilder.build(world, chunkPos);
|
List<Finder> finders = type.finderBuilder.build(world, chunkPos);
|
||||||
|
|
||||||
finders.forEach(finder -> {
|
finders.forEach(finder -> {
|
||||||
if(finder.isValidDimension(world.dimension.getType())) {
|
if(finder.isValidDimension(world.dimension.getType())) {
|
||||||
finder.findInChunk();
|
finder.findInChunk();
|
||||||
this.finderConfig.addFinder(type, finder);
|
this.finderProfile.addFinder(type, finder);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
@@ -58,7 +59,7 @@ public class FinderQueue {
|
|||||||
GlStateManager.disableDepthTest();
|
GlStateManager.disableDepthTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.finderConfig.getActiveFinders().forEach(finder -> {
|
this.finderProfile.getActiveFinders().forEach(finder -> {
|
||||||
if(finder.shouldRender()) {
|
if(finder.shouldRender()) {
|
||||||
finder.render();
|
finder.render();
|
||||||
}
|
}
|
||||||
@@ -69,7 +70,7 @@ public class FinderQueue {
|
|||||||
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
this.renderType = RenderType.XRAY;
|
this.renderType = RenderType.XRAY;
|
||||||
this.finderConfig = new DefaultFinderConfig();
|
this.finderProfile = new VanillaProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum RenderType {
|
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) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user