fix baritone in oresim and remove autoez
This commit is contained in:
@@ -43,7 +43,6 @@ public class MeteorRejectsAddon extends MeteorAddon {
|
||||
modules.add(new AutoBedTrap());
|
||||
modules.add(new AutoCraft());
|
||||
modules.add(new AutoExtinguish());
|
||||
modules.add(new AutoEz());
|
||||
modules.add(new AutoPot());
|
||||
modules.add(new AutoTNT());
|
||||
modules.add(new AutoWither());
|
||||
|
||||
@@ -5,12 +5,15 @@ 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.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import anticope.rejects.modules.OreSim;
|
||||
import baritone.api.utils.BlockOptionalMetaLookup;
|
||||
import baritone.pathing.movement.CalculationContext;
|
||||
import baritone.process.MineProcess;
|
||||
import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
@@ -20,13 +23,22 @@ public class MineProcessMixin {
|
||||
private static final String RESCAN_METHOD = "Lbaritone/process/MineProcess;a(Ljava/util/List;Lbaritone/pathing/movement/CalculationContext;)V";
|
||||
|
||||
@Shadow
|
||||
private List<BlockPos> a; //knownOreLocations
|
||||
private List<BlockPos> a; // knownOreLocations
|
||||
|
||||
@Inject(method = RESCAN_METHOD, at=@At("HEAD"), cancellable = true, remap = false)
|
||||
@Inject(method = RESCAN_METHOD, 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;
|
||||
if (oreSim == null || !oreSim.baritone())
|
||||
return;
|
||||
a = oreSim.oreGoals;
|
||||
ci.cancel();
|
||||
}
|
||||
|
||||
@Redirect(method = "a(Lbaritone/pathing/movement/CalculationContext;Lbaritone/api/utils/BlockOptionalMetaLookup;Ljava/util/List;Lnet/minecraft/util/math/BlockPos;)Z", at = @At(value = "INVOKE", target = "Lbaritone/api/utils/BlockOptionalMetaLookup;has(Lnet/minecraft/block/BlockState;)Z"), remap = false)
|
||||
private static boolean onPruneStream(BlockOptionalMetaLookup instance, BlockState blockState) {
|
||||
OreSim oreSim = Modules.get().get(OreSim.class);
|
||||
if (oreSim == null || !oreSim.baritone())
|
||||
return instance.has(blockState);
|
||||
return !blockState.isAir();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.meteorclient.events.entity.player.AttackEntityEvent;
|
||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||
import meteordevelopment.meteorclient.settings.*;
|
||||
import meteordevelopment.meteorclient.systems.friends.Friends;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.network.MeteorExecutor;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.decoration.EndCrystalEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.Pair;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class AutoEz extends Module {
|
||||
|
||||
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<String> format = sgGeneral.add(new StringSetting.Builder()
|
||||
.name("message")
|
||||
.description("Send a chat message about killing a player.")
|
||||
.defaultValue("EZ! {name}!")
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Integer> minArmor = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("min-armor")
|
||||
.description("Minimum number of armor elements.")
|
||||
.defaultValue(2)
|
||||
.min(0)
|
||||
.max(4)
|
||||
.sliderMin(0)
|
||||
.sliderMax(4)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> ignoreFriends = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("ignore-friends")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
ArrayList<Pair<UUID, Long>> players = new ArrayList<>();
|
||||
ArrayList<String> msgplayers = new ArrayList<>();
|
||||
|
||||
|
||||
public AutoEz() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "auto-ez", "Send a chat message after killing a player.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivate() {
|
||||
players.clear();
|
||||
msgplayers.clear();
|
||||
}
|
||||
|
||||
private boolean checkArmor(PlayerEntity p) {
|
||||
|
||||
int armor = 0;
|
||||
|
||||
if (p.getEquippedStack(EquipmentSlot.HEAD).getItem() != Items.AIR) armor++;
|
||||
if (p.getEquippedStack(EquipmentSlot.CHEST).getItem() != Items.AIR) armor++;
|
||||
if (p.getEquippedStack(EquipmentSlot.LEGS).getItem() != Items.AIR) armor++;
|
||||
if (p.getEquippedStack(EquipmentSlot.FEET).getItem() != Items.AIR) armor++;
|
||||
|
||||
return armor < minArmor.get();
|
||||
}
|
||||
|
||||
|
||||
private boolean checkFriend(PlayerEntity p) {
|
||||
return (ignoreFriends.get() && Friends.get().isFriend(p));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void AttackEntity(AttackEntityEvent e) {
|
||||
if (e.entity instanceof EndCrystalEntity) {
|
||||
List<AbstractClientPlayerEntity> worldplayers = mc.world.getPlayers();
|
||||
for (int x = 0; x < worldplayers.size(); x++) {
|
||||
PlayerEntity p = worldplayers.get(x);
|
||||
if (!p.isSpectator() && !p.isCreative() && !p.isInvulnerable() && !mc.player.equals(p) && !checkArmor(p) && !checkFriend(p) && p.distanceTo(e.entity) < 12) {
|
||||
|
||||
Pair<UUID, Long> pair = new Pair<>(p.getUuid(), System.currentTimeMillis());
|
||||
int index = -1;
|
||||
for (int w = 0; w < players.size(); w++) {
|
||||
if (players.get(w).getLeft().equals(p.getUuid())) {
|
||||
index = w;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index == -1) {
|
||||
players.add(pair);
|
||||
} else {
|
||||
players.set(index, pair);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (e.entity instanceof PlayerEntity) {
|
||||
PlayerEntity p = (PlayerEntity) e.entity;
|
||||
if (!p.isSpectator() && !p.isCreative() && !p.isInvulnerable() && !mc.player.equals(p) && !checkArmor(p) && !checkFriend(p)) {
|
||||
|
||||
Pair<UUID, Long> pair = new Pair<>(p.getUuid(), System.currentTimeMillis());
|
||||
int index = -1;
|
||||
for (int w = 0; w < players.size(); w++) {
|
||||
if (players.get(w).getLeft().equals(p.getUuid())) {
|
||||
index = w;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index == -1) {
|
||||
players.add(pair);
|
||||
} else {
|
||||
players.set(index, pair);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
private void onTick(TickEvent.Pre e) {
|
||||
if (players.size() == 0) return;
|
||||
|
||||
ArrayList<Pair<UUID, Long>> newPlayers = players;
|
||||
|
||||
for (int x = 0; x < players.size(); x++) {
|
||||
Pair<UUID, Long> w = players.get(x);
|
||||
long time = w.getRight();
|
||||
|
||||
PlayerEntity p = mc.world.getPlayerByUuid(w.getLeft());
|
||||
|
||||
if (System.currentTimeMillis() - time > 2000 || p == null) {
|
||||
newPlayers.remove(x);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (p.isDead()) {
|
||||
if (!msgplayers.contains(p.getName().asString()))
|
||||
msgplayers.add(p.getName().asString());
|
||||
newPlayers.remove(x);
|
||||
MeteorExecutor.execute(() -> send());
|
||||
}
|
||||
}
|
||||
|
||||
players = newPlayers;
|
||||
}
|
||||
|
||||
private void send() {
|
||||
int size = msgplayers.size();
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (size != msgplayers.size()) {
|
||||
MeteorExecutor.execute(() -> send());
|
||||
return;
|
||||
}
|
||||
|
||||
if (msgplayers.size() == 0) return;
|
||||
String message = format.get();
|
||||
message = message.replace("{name}", String.join(", ", msgplayers));
|
||||
mc.player.sendChatMessage(message);
|
||||
|
||||
msgplayers.clear();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,7 +25,6 @@ import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.world.Heightmap;
|
||||
import net.minecraft.world.chunk.ChunkStatus;
|
||||
import net.minecraft.world.gen.random.ChunkRandom;
|
||||
@@ -71,7 +70,7 @@ public class OreSim extends Module {
|
||||
.build()
|
||||
);
|
||||
|
||||
public final Setting<Boolean> baritone = sgGeneral.add(new BoolSetting.Builder()
|
||||
private final Setting<Boolean> baritone = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("baritone")
|
||||
.description("Set baritone ore positions to the simulated ones.")
|
||||
.defaultValue(false)
|
||||
@@ -84,6 +83,10 @@ public class OreSim extends Module {
|
||||
Ore.oreSettings.forEach(sgOres::add);
|
||||
}
|
||||
|
||||
public boolean baritone() {
|
||||
return isActive() && baritone.get();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onRender(Render3DEvent event) {
|
||||
if (mc.player == null || oreConfig == null) {
|
||||
|
||||
Reference in New Issue
Block a user