fix baritone in oresim and remove autoez

This commit is contained in:
C10udburst
2022-03-06 15:04:07 +01:00
parent aeb0964da1
commit aae6d16899
5 changed files with 20 additions and 182 deletions

View File

@@ -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();
}
}

View File

@@ -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) {