add baritone to oresim
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
package anticope.rejects.mixin.baritone;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
|
import anticope.rejects.modules.OreSim;
|
||||||
|
import baritone.pathing.movement.CalculationContext;
|
||||||
|
import baritone.process.MineProcess;
|
||||||
|
import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||||
|
|
||||||
|
@Mixin(MineProcess.class)
|
||||||
|
public class MineProcessMixin {
|
||||||
|
@Shadow
|
||||||
|
private List<BlockPos> a;
|
||||||
|
|
||||||
|
//rescan
|
||||||
|
@Inject(method = "Lbaritone/process/MineProcess;b(Ljava/util/List;Lbaritone/pathing/movement/CalculationContext;)V", at=@At("HEAD"), cancellable = true, remap = false)
|
||||||
|
private void onRescan(List<BlockPos> already, CalculationContext context, CallbackInfo ci) {
|
||||||
|
OreSim oreSim = Modules.get().get(OreSim.class);
|
||||||
|
if (oreSim == null || !oreSim.baritone.get()) return;
|
||||||
|
a = oreSim.oreGoals;
|
||||||
|
ci.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,8 +7,10 @@ import anticope.rejects.events.SeedChangedEvent;
|
|||||||
import anticope.rejects.utils.Ore;
|
import anticope.rejects.utils.Ore;
|
||||||
import anticope.rejects.utils.seeds.Seed;
|
import anticope.rejects.utils.seeds.Seed;
|
||||||
import anticope.rejects.utils.seeds.Seeds;
|
import anticope.rejects.utils.seeds.Seeds;
|
||||||
|
import baritone.api.BaritoneAPI;
|
||||||
import meteordevelopment.meteorclient.events.render.Render3DEvent;
|
import meteordevelopment.meteorclient.events.render.Render3DEvent;
|
||||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||||
|
import meteordevelopment.meteorclient.settings.BoolSetting;
|
||||||
import meteordevelopment.meteorclient.settings.EnumSetting;
|
import meteordevelopment.meteorclient.settings.EnumSetting;
|
||||||
import meteordevelopment.meteorclient.settings.IntSetting;
|
import meteordevelopment.meteorclient.settings.IntSetting;
|
||||||
import meteordevelopment.meteorclient.settings.Setting;
|
import meteordevelopment.meteorclient.settings.Setting;
|
||||||
@@ -40,6 +42,7 @@ public class OreSim extends Module {
|
|||||||
private final HashMap<Long, HashMap<Ore, HashSet<Vec3d>>> chunkRenderers = new HashMap<>();
|
private final HashMap<Long, HashMap<Ore, HashSet<Vec3d>>> chunkRenderers = new HashMap<>();
|
||||||
private Seed worldSeed = null;
|
private Seed worldSeed = null;
|
||||||
private List<Ore> oreConfig;
|
private List<Ore> oreConfig;
|
||||||
|
public ArrayList<BlockPos> oreGoals = new ArrayList<>();
|
||||||
private ChunkPos prevOffset = new ChunkPos(0, 0);
|
private ChunkPos prevOffset = new ChunkPos(0, 0);
|
||||||
|
|
||||||
public enum AirCheck {
|
public enum AirCheck {
|
||||||
@@ -53,7 +56,7 @@ public class OreSim extends Module {
|
|||||||
|
|
||||||
private final Setting<Integer> horizontalRadius = sgGeneral.add(new IntSetting.Builder()
|
private final Setting<Integer> horizontalRadius = sgGeneral.add(new IntSetting.Builder()
|
||||||
.name("chunk-range")
|
.name("chunk-range")
|
||||||
.description("taxi cap distance of chunks being shown")
|
.description("Taxi cap distance of chunks being shown.")
|
||||||
.defaultValue(5)
|
.defaultValue(5)
|
||||||
.min(1)
|
.min(1)
|
||||||
.sliderMax(10)
|
.sliderMax(10)
|
||||||
@@ -62,11 +65,18 @@ public class OreSim extends Module {
|
|||||||
|
|
||||||
private final Setting<AirCheck> airCheck = sgGeneral.add(new EnumSetting.Builder<AirCheck>()
|
private final Setting<AirCheck> airCheck = sgGeneral.add(new EnumSetting.Builder<AirCheck>()
|
||||||
.name("air-check-mode")
|
.name("air-check-mode")
|
||||||
.description("checks if there is air at a calculated ore pos")
|
.description("Checks if there is air at a calculated ore pos.")
|
||||||
.defaultValue(AirCheck.RECHECK)
|
.defaultValue(AirCheck.RECHECK)
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
public final Setting<Boolean> baritone = sgGeneral.add(new BoolSetting.Builder()
|
||||||
|
.name("baritone")
|
||||||
|
.description("Set baritone ore positions to the simulated ones.")
|
||||||
|
.defaultValue(false)
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
public OreSim() {
|
public OreSim() {
|
||||||
super(MeteorRejectsAddon.CATEGORY, "ore-sim", "Xray on crack.");
|
super(MeteorRejectsAddon.CATEGORY, "ore-sim", "Xray on crack.");
|
||||||
@@ -114,10 +124,9 @@ public class OreSim extends Module {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
private void onTick(TickEvent.Pre event) {
|
private void onTick(TickEvent.Pre event) {
|
||||||
|
if (mc.player == null || mc.world == null || oreConfig == null) return;
|
||||||
|
|
||||||
if (airCheck.get() == AirCheck.RECHECK) {
|
if (airCheck.get() == AirCheck.RECHECK) {
|
||||||
if (mc.player == null || mc.world == null || oreConfig == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
long chunkX = mc.player.getChunkPos().x;
|
long chunkX = mc.player.getChunkPos().x;
|
||||||
long chunkZ = mc.player.getChunkPos().z;
|
long chunkZ = mc.player.getChunkPos().z;
|
||||||
ClientWorld world = mc.world;
|
ClientWorld world = mc.world;
|
||||||
@@ -147,6 +156,39 @@ public class OreSim extends Module {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (baritone.get() && BaritoneAPI.getProvider().getPrimaryBaritone().getMineProcess().isActive()) {
|
||||||
|
oreGoals.clear();
|
||||||
|
var chunkPos = mc.player.getChunkPos();
|
||||||
|
int rangeVal = 4;
|
||||||
|
for(int range = 0; range <= rangeVal; ++range) {
|
||||||
|
for(int x = -range + chunkPos.x; x <= range + chunkPos.x; ++x) {
|
||||||
|
oreGoals.addAll(addToBaritone(x, chunkPos.z + range - rangeVal));
|
||||||
|
}
|
||||||
|
for(int x = -range + 1 + chunkPos.x; x < range + chunkPos.x; ++x) {
|
||||||
|
oreGoals.addAll(this.addToBaritone(x, chunkPos.z - range + rangeVal + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArrayList<BlockPos> addToBaritone(int chunkX, int chunkZ) {
|
||||||
|
ArrayList<BlockPos> baritoneGoals = new ArrayList();
|
||||||
|
long chunkKey = (long)chunkX + ((long)chunkZ << 32);
|
||||||
|
if (!this.chunkRenderers.containsKey(chunkKey)) {
|
||||||
|
return baritoneGoals;
|
||||||
|
} else {
|
||||||
|
this.oreConfig.stream().filter((config) -> {
|
||||||
|
return (Boolean)config.enabled.get();
|
||||||
|
}).forEach((ore) -> {
|
||||||
|
chunkRenderers
|
||||||
|
.get(chunkKey)
|
||||||
|
.getOrDefault(ore, new HashSet<>())
|
||||||
|
.stream()
|
||||||
|
.map((vec3d) -> new BlockPos(vec3d))
|
||||||
|
.forEach(baritoneGoals::add);
|
||||||
|
});
|
||||||
|
return baritoneGoals;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -13,7 +13,8 @@
|
|||||||
"MinecraftClientMixin",
|
"MinecraftClientMixin",
|
||||||
"StructureVoidBlockMixin",
|
"StructureVoidBlockMixin",
|
||||||
"ToastManagerMixin",
|
"ToastManagerMixin",
|
||||||
"TitleScreenMixin"
|
"TitleScreenMixin",
|
||||||
|
"baritone.MineProcessMixin"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|||||||
Reference in New Issue
Block a user