fix more bugs

This commit is contained in:
Badbird-5907
2022-06-17 22:02:52 -04:00
parent 855d6ede79
commit e3533b9e92
8 changed files with 69 additions and 24 deletions

View File

@@ -31,9 +31,9 @@ public interface Terminator {
boolean isBotAlive(); //Has to be named like this because paper re-obfuscates it
float getHealth();
float getBotHealth();
float getMaxHealth();
float getBotMaxHealth();
void ignite();
@@ -45,11 +45,15 @@ public interface Terminator {
void block(int length, int cooldown);
boolean isInWater();
boolean isBotInWater();
boolean isOnGround();
boolean isBotOnGround();
void setXRot(float pitch);
void setBotPitch(float pitch);
default void setBotXRot(float pitch) {
setBotPitch(pitch);
}
void jump(Vector velocity);
@@ -77,6 +81,8 @@ public interface Terminator {
void removeVisually();
void removeBot();
int getKills();
void incrementKills();

View File

@@ -102,7 +102,7 @@ public class BotAgent extends Agent {
Vector vel = target.toVector().subtract(loc.toVector()).normalize();
if (bot.tickDelay(5)) bot.faceLocation(player.getLocation());
if (!bot.isOnGround()) return; // calling this a second time later on
if (!bot.isBotOnGround()) return; // calling this a second time later on
bot.stand(); // eventually create a memory system so packets do not have to be sent every tick
bot.setItem(null); // method to check item in main hand, bot.getItemInHand()

View File

@@ -144,7 +144,7 @@ public class LegacyAgent extends Agent {
if (btCheck.containsKey(botPlayer)) sameXZ = btCheck.get(botPlayer);
if (waterGround || bot.isOnGround() || onBoat(botPlayer)) {
if (waterGround || bot.isBotOnGround() || onBoat(botPlayer)) {
byte sideResult = 1;
if (towerList.containsKey(botPlayer)) {
@@ -192,7 +192,7 @@ public class LegacyAgent extends Agent {
Vector vel = target.toVector().subtract(position).normalize();
if (bot.tickDelay(5)) bot.faceLocation(livingTarget.getLocation());
if (!bot.isOnGround()) return; // calling this a second time later on
if (!bot.isBotOnGround()) return; // calling this a second time later on
bot.stand(); // eventually create a memory system so packets do not have to be sent every tick
bot.setItem(null); // method to check item in main hand, bot.getItemInHand()
@@ -572,7 +572,7 @@ public class LegacyAgent extends Agent {
}
}, 5);
if (npc.isOnGround()) {
if (npc.isBotOnGround()) {
if (target.getLocation().distance(playerNPC.getLocation()) < 16) {
if (noJump.contains(playerNPC)) {
@@ -593,7 +593,7 @@ public class LegacyAgent extends Agent {
return true;
}
} else {
if (npc.isOnGround()) {
if (npc.isBotOnGround()) {
Location locBlock = playerNPC.getLocation();
locBlock.setX(locBlock.getBlockX() + 0.5);
locBlock.setZ(locBlock.getBlockZ() + 0.5);
@@ -616,7 +616,7 @@ public class LegacyAgent extends Agent {
npc.look(BlockFace.UP);
preBreak(npc, playerNPC, block, LegacyLevel.ABOVE);
if (npc.isOnGround()) {
if (npc.isBotOnGround()) {
Location locBlock = playerNPC.getLocation();
locBlock.setX(locBlock.getBlockX() + 0.5);
locBlock.setZ(locBlock.getBlockZ() + 0.5);
@@ -682,7 +682,7 @@ public class LegacyAgent extends Agent {
npc.setVelocity(vector);
}
if (npc.isInWater()) {
if (npc.isBotInWater()) {
Location locBlock = player.getLocation();
locBlock.setX(locBlock.getBlockX() + 0.5);
locBlock.setZ(locBlock.getBlockZ() + 0.5);
@@ -737,7 +737,7 @@ public class LegacyAgent extends Agent {
bot.setItem(new ItemStack(item));
if (level == LegacyLevel.EAST_D || level == LegacyLevel.NORTH_D || level == LegacyLevel.SOUTH_D || level == LegacyLevel.WEST_D) {
bot.setXRot(69);
bot.setBotPitch(69);
scheduler.runTaskLater(plugin, () -> {
btCheck.put(player, true);

View File

@@ -20,7 +20,7 @@ public class BotData {
Location a = bot.getLocation();
Location b = target.getLocation();
float health = bot.getHealth();
float health = bot.getBotHealth();
values.put(BotDataType.CRITICAL_HEALTH, health >= 5 ? 0 : 5D - health);
values.put(BotDataType.DISTANCE_XZ, Math.sqrt(MathUtils.square(a.getX() - b.getX()) + MathUtils.square(a.getZ() - b.getZ())));

View File

@@ -326,7 +326,7 @@ public class IntelligenceAgent {
if (!bots.isEmpty()) {
print("Removing all cached bots...");
bots.values().forEach(Terminator::removeVisually);
bots.values().forEach(Terminator::removeBot);
bots.clear();
}