Compare commits
3 Commits
e0ebe898b4
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4491025245 | ||
|
|
b553e36819 | ||
|
|
eab7fc2380 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
TerminatorPlus-API/build/libs/TerminatorPlus-API-4.5.1-BETA.jar
Normal file
BIN
TerminatorPlus-API/build/libs/TerminatorPlus-API-4.5.1-BETA.jar
Normal file
Binary file not shown.
Binary file not shown.
2
TerminatorPlus-API/build/tmp/jar/MANIFEST.MF
Normal file
2
TerminatorPlus-API/build/tmp/jar/MANIFEST.MF
Normal file
@@ -0,0 +1,2 @@
|
||||
Manifest-Version: 1.0
|
||||
|
||||
@@ -57,6 +57,7 @@ public class LegacyAgent extends Agent {
|
||||
private double regionWeightX;
|
||||
private double regionWeightY;
|
||||
private double regionWeightZ;
|
||||
private boolean waitformace = false;
|
||||
|
||||
public static final Set<EntityType> CUSTOM_MOB_LIST = new HashSet<>();
|
||||
public static CustomListMode customListMode = CustomListMode.CUSTOM;
|
||||
@@ -103,6 +104,26 @@ public class LegacyAgent extends Agent {
|
||||
btList.put(botEntity, loc);
|
||||
}
|
||||
|
||||
private boolean entholdsmace(LivingEntity target) {
|
||||
if (target instanceof Player player) {
|
||||
if (player.getInventory().getItemInMainHand().getType() == Material.MACE) return true;
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void placeblocking(Location location, Terminator bot) {
|
||||
Block block = location.getBlock();
|
||||
if (block.getType() == Material.AIR) {
|
||||
bot.setItem(new ItemStack(Material.COBBLESTONE));
|
||||
block.setType(Material.COBBLESTONE);
|
||||
bot.punch();
|
||||
for (Player all : Bukkit.getOnlinePlayers())
|
||||
all.playSound(bot.getLocation(), Sound.BLOCK_STONE_PLACE, SoundCategory.BLOCKS, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void tickBot(Terminator bot) {
|
||||
if (!bot.isBotAlive()) {
|
||||
return;
|
||||
@@ -120,6 +141,11 @@ public class LegacyAgent extends Agent {
|
||||
if (livingTarget == null) {
|
||||
stopMining(bot);
|
||||
return;
|
||||
} else if (bot.getVelocity().getY() < 0 || bot.isFalling()) {
|
||||
tryWindchargeMaceAttack(bot, livingTarget, false);
|
||||
} else if (bot.getLocation().getY() > livingTarget.getLocation().getY() && bot.getLocation().distanceSquared(livingTarget.getLocation()) <= 4 && macemode(bot)) {
|
||||
bot.jump();
|
||||
macesmash(bot, livingTarget, false, 10);
|
||||
}
|
||||
|
||||
blockCheck.clutch(bot, livingTarget);
|
||||
@@ -138,6 +164,9 @@ public class LegacyAgent extends Agent {
|
||||
network.feed(BotData.generate(bot, livingTarget));
|
||||
}
|
||||
|
||||
if (livingTarget.getLocation().getY() > bot.getLocation().getY()) {
|
||||
bot.block(10, 0);
|
||||
}
|
||||
if (bot.tickDelay(3) && !miningAnim.containsKey(botPlayer)) {
|
||||
Location botEyeLoc = botPlayer.getEyeLocation();
|
||||
Location playerEyeLoc = livingTarget.getEyeLocation();
|
||||
@@ -145,11 +174,21 @@ public class LegacyAgent extends Agent {
|
||||
|
||||
if (ai) {
|
||||
if (network.check(BotNode.BLOCK) && loc.distance(livingTarget.getLocation()) < 6) {
|
||||
bot.block(10, 10);
|
||||
bot.block(20, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (LegacyUtils.checkFreeSpace(botEyeLoc, playerEyeLoc) || LegacyUtils.checkFreeSpace(botEyeLoc, playerLoc) && bot.getLocation().distanceSquared(livingTarget.getLocation()) <= 10) {
|
||||
// place an block over the target such that he cant windcharge away or smth
|
||||
World world = livingTarget.getWorld();
|
||||
placeblocking(livingTarget.getLocation().add(new Location(world, 0, 2, 0)), bot); // over target
|
||||
placeblocking(livingTarget.getLocation().add(new Location(world, 0, 0, 1)), bot); // +z
|
||||
placeblocking(livingTarget.getLocation().add(new Location(world, 0, 0, -1)), bot); // -z
|
||||
placeblocking(livingTarget.getLocation().add(new Location(world, 1, 0, 0)), bot); // +x
|
||||
placeblocking(livingTarget.getLocation().add(new Location(world, -1, 0, 0)), bot); // -x
|
||||
|
||||
if (LegacyUtils.checkFreeSpace(botEyeLoc, playerEyeLoc) || LegacyUtils.checkFreeSpace(botEyeLoc, playerLoc)) {
|
||||
attack(bot, livingTarget, loc);
|
||||
}
|
||||
}
|
||||
@@ -188,7 +227,9 @@ public class LegacyAgent extends Agent {
|
||||
|
||||
if (checkDown(bot, botPlayer, livingTarget.getLocation(), bothXZ)) return;
|
||||
|
||||
if ((withinTargetXZ || sameXZ) && checkUp(bot, livingTarget, botPlayer, target, withinTargetXZ, sameXZ)) return;
|
||||
if ((withinTargetXZ || sameXZ) && !entholdsmace(livingTarget) && livingTarget.getLocation().getY() > bot.getLocation().getY() && bot.getLocation().distanceSquared(livingTarget.getLocation()) > 5) {
|
||||
if (checkUp(bot, livingTarget, botPlayer, target, withinTargetXZ, sameXZ)) return;
|
||||
}
|
||||
|
||||
if (bothXZ) sideResult = checkSide(bot, livingTarget, botPlayer);
|
||||
|
||||
@@ -802,6 +843,17 @@ public class LegacyAgent extends Agent {
|
||||
Material m1 = playerNPC.getLocation().add(0, 1, 0).getBlock().getType();
|
||||
Material m2 = playerNPC.getLocation().add(0, 2, 0).getBlock().getType();
|
||||
|
||||
if (macemode(npc)) {
|
||||
//npc.jump();
|
||||
//useWindcharge(npc);
|
||||
//Bukkit.getScheduler().scheduleAsyncDelayedTask(plugin, () -> {
|
||||
// while (npc.getVelocity().getY() > 0) {}
|
||||
// Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
|
||||
// blockCheck.placeBlock(npc, playerNPC, get);
|
||||
// }, 0);
|
||||
//}, 0);
|
||||
//return false;
|
||||
}
|
||||
if (LegacyMats.BREAK.contains(m0) && LegacyMats.BREAK.contains(m1) && LegacyMats.BREAK.contains(m2)) {
|
||||
|
||||
npc.setItem(new ItemStack(Material.COBBLESTONE));
|
||||
@@ -1403,7 +1455,86 @@ public class LegacyAgent extends Agent {
|
||||
return Math.abs(entity.getWorld().getHighestBlockYAt(entity.getLocation()) - entity.getLocation().getY());
|
||||
}*/
|
||||
|
||||
private boolean macemode(Terminator bot) {
|
||||
LivingEntity botEntity = bot.getBukkitEntity();
|
||||
if (botEntity == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack mainHand;
|
||||
if (botEntity instanceof Player player) {
|
||||
mainHand = player.getInventory().getItemInMainHand();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bot.getDefaultItem().getType() != Material.MACE && mainHand.getType() != Material.MACE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean useWindcharge(Terminator bot) {
|
||||
if (!bot.isBotOnGround() && Math.random() >= 0.5) return false;
|
||||
|
||||
// Face the ground at own position to launch upward
|
||||
bot.look(org.bukkit.block.BlockFace.DOWN);
|
||||
|
||||
// Jump boost from windcharge with higher velocity
|
||||
bot.setItem(new ItemStack(Material.WIND_CHARGE, 1));
|
||||
Vector jumpVel = new Vector(0, 0.6, 0);
|
||||
Vector cvel = bot.getVelocity().add(jumpVel);
|
||||
cvel.setX(clamp(cvel.getX(), -0.05, 0.05));
|
||||
cvel.setZ(clamp(cvel.getZ(), -0.05, 0.05));
|
||||
bot.setVelocity(cvel);
|
||||
World world = bot.getLocation().getWorld();
|
||||
if (world != null) {
|
||||
world.playSound(bot.getLocation(), Sound.ENTITY_WIND_CHARGE_WIND_BURST, SoundCategory.PLAYERS, 1, 1);
|
||||
world.spawnParticle(Particle.GUST_EMITTER_SMALL, bot.getLocation(), 1, 0, 0, 0, 0.1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean tryWindchargeMaceAttack(Terminator bot, LivingEntity target) {
|
||||
return tryWindchargeMaceAttack(bot, target, true);
|
||||
}
|
||||
|
||||
private void macesmash(Terminator bot, LivingEntity target, boolean setwaitmace, double extradmg) {
|
||||
bot.setItem(bot.getDefaultItem());
|
||||
bot.faceLocation(target.getLocation());
|
||||
bot.punch();
|
||||
|
||||
World world = bot.getBukkitEntity().getWorld();
|
||||
|
||||
if (bot.getLocation().distanceSquared(target.getLocation()) <= 5) {
|
||||
double exdmg = extradmg;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
|
||||
bot.attack(target, exdmg); // apply damage only if within range
|
||||
// effect stuff
|
||||
if (world != null && exdmg > 0) {
|
||||
bot.setVelocity(bot.getVelocity().setY(0.1)); // no fall damage
|
||||
|
||||
// schedule next mace attempt to make a streak potentially
|
||||
if (setwaitmace) waitformace = false;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {tryWindchargeMaceAttack(bot, target);}, 0);
|
||||
|
||||
world.playSound(bot.getLocation(), Sound.ITEM_MACE_SMASH_GROUND, SoundCategory.PLAYERS, 1, 1);
|
||||
world.spawnParticle(Particle.EXPLOSION, target.getLocation(), 10, 0.5, 0.5, 0.5, 0.1);
|
||||
} else {
|
||||
if (setwaitmace) waitformace = false;
|
||||
//Bukkit.getLogger().info("exdmg !> 0");
|
||||
}
|
||||
}, 1);
|
||||
} else {
|
||||
if (setwaitmace) waitformace = false;
|
||||
//Bukkit.getLogger().info("Bot out of range.");
|
||||
}
|
||||
}
|
||||
|
||||
private boolean tryWindchargeMaceAttack(Terminator bot, LivingEntity target, boolean attemptwindcharge) {
|
||||
if (waitformace) return false;
|
||||
|
||||
LivingEntity botEntity = bot.getBukkitEntity();
|
||||
if (botEntity == null) {
|
||||
return false;
|
||||
@@ -1422,35 +1553,21 @@ public class LegacyAgent extends Agent {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!bot.isBotOnGround() && Math.random() >= 0.5) return false;
|
||||
|
||||
// Face the ground at own position to launch upward
|
||||
bot.look(org.bukkit.block.BlockFace.DOWN);
|
||||
|
||||
// Jump boost from windcharge with higher velocity
|
||||
bot.setItem(new ItemStack(Material.WIND_CHARGE, 1));
|
||||
Vector jumpVel = new Vector(0, 0.6, 0);
|
||||
Vector cvel = bot.getVelocity().add(jumpVel);
|
||||
cvel.setX(clamp(cvel.getX(), -0.05, 0.05));
|
||||
cvel.setZ(clamp(cvel.getZ(), -0.05, 0.05));
|
||||
bot.setVelocity(cvel);
|
||||
World world = bot.getLocation().getWorld();
|
||||
if (world != null) {
|
||||
world.playSound(bot.getLocation(), Sound.ENTITY_WIND_CHARGE_WIND_BURST, SoundCategory.PLAYERS, 1, 1);
|
||||
world.spawnParticle(Particle.GUST_EMITTER_SMALL, target.getLocation(), 1, 0, 0, 0, 0.1);
|
||||
}
|
||||
if (attemptwindcharge)
|
||||
if (!useWindcharge(bot)) return false;
|
||||
|
||||
waitformace = true;
|
||||
Bukkit.getScheduler().scheduleAsyncDelayedTask(plugin, () -> {
|
||||
while (!bot.isBotOnGround() && bot.getLocation().distanceSquared(target.getLocation()) > 3) {}
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
|
||||
double falldist = -(bot.getVelocity().getY()*10); // CERTAINLY not the best way but meh
|
||||
double falldist = -(bot.getVelocity().getY()*15); // CERTAINLY not the best way but meh
|
||||
//Bukkit.getLogger().info("fall dist: "+falldist+" cvy: "+bot.getVelocity().getY());
|
||||
|
||||
if (bot.isBotOnGround()) {
|
||||
/*if (bot.isBotOnGround()) {
|
||||
//Bukkit.getLogger().info("Bot -> ground, no mace");
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
double extradmg = 0;
|
||||
if (falldist >= 1.5) {
|
||||
@@ -1460,31 +1577,9 @@ public class LegacyAgent extends Agent {
|
||||
falldist = clamp(falldist-5,0,Double.MAX_VALUE);
|
||||
extradmg += falldist; // remaining blocks handling
|
||||
}
|
||||
bot.setItem(bot.getDefaultItem());
|
||||
bot.faceLocation(target.getLocation());
|
||||
bot.punch();
|
||||
if (bot.getLocation().distanceSquared(target.getLocation()) <= 5) {
|
||||
double exdmg = extradmg;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
|
||||
bot.attack(target, exdmg); // apply damage only if within range
|
||||
// effect stuff
|
||||
if (world != null && exdmg > 0) {
|
||||
bot.setVelocity(bot.getVelocity().setY(0.1)); // no fall damage
|
||||
|
||||
// schedule next mace attempt to make a streak potentially
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {tryWindchargeMaceAttack(bot, target);}, 0);
|
||||
|
||||
world.playSound(bot.getLocation(), Sound.ITEM_MACE_SMASH_GROUND, SoundCategory.PLAYERS, 1, 1);
|
||||
world.spawnParticle(Particle.EXPLOSION, target.getLocation(), 10, 0.5, 0.5, 0.5, 0.1);
|
||||
} else {
|
||||
//Bukkit.getLogger().info("exdmg !> 0");
|
||||
}
|
||||
}, 1);
|
||||
} else {
|
||||
//Bukkit.getLogger().info("Bot out of range.");
|
||||
}
|
||||
macesmash(bot, target, true, extradmg);
|
||||
}, 0);
|
||||
}, 8);
|
||||
}, attemptwindcharge ? 8 : 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Command: C:\Program Files\Java\jdk-21.0.10\bin\java.exe -Xmx1G -classpath C:\Users\JUFS-STL-SECONDARY\.gradle\caches\modules-2\files-2.1\net.fabricmc\tiny-remapper\0.12.0\bfb93e1bfb66d47272ccd37ce894dcfc20ba0b6\tiny-remapper-0.12.0-fat.jar net.fabricmc.tinyremapper.Main C:\Users\JUFS-STL-SECONDARY\Desktop\terminatorplus\TerminatorPlus-Plugin\build\libs\TerminatorPlus-Plugin-4.5.1-BETA.jar C:\Users\JUFS-STL-SECONDARY\Desktop\terminatorplus\TerminatorPlus-Plugin\build\libs\TerminatorPlus-Plugin-4.5.1-BETA-reobf.jar C:\Users\JUFS-STL-SECONDARY\Desktop\terminatorplus\TerminatorPlus-Plugin\.gradle\caches\paperweight\taskCache\reobfMappings.tiny mojang spigot C:\Users\JUFS-STL-SECONDARY\Desktop\terminatorplus\TerminatorPlus-Plugin\.gradle\caches\paperweight\taskCache\mappedServerJar.jar --threads=1
|
||||
[INFO] Finished after 1622.09 ms.
|
||||
[INFO] Finished after 1693.73 ms.
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3
TerminatorPlus-Plugin/build/tmp/jar/MANIFEST.MF
Normal file
3
TerminatorPlus-Plugin/build/tmp/jar/MANIFEST.MF
Normal file
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
paperweight-mappings-namespace: mojang
|
||||
|
||||
@@ -166,7 +166,6 @@ public class BotManagerImpl implements BotManager, Listener {
|
||||
|
||||
if (botNetwork != null) {
|
||||
bot.setNeuralNetwork(botNetwork == NeuralNetwork.RANDOM ? NeuralNetwork.generateRandomNetwork() : botNetwork);
|
||||
bot.setShield(true);
|
||||
bot.setDefaultItem(new ItemStack(Material.WOODEN_AXE));
|
||||
//bot.setRemoveOnDeath(false);
|
||||
}
|
||||
@@ -177,6 +176,11 @@ public class BotManagerImpl implements BotManager, Listener {
|
||||
bot.setVelocity(randomVelocity().multiply(f));
|
||||
}
|
||||
|
||||
final TerminatorPlus plugin = TerminatorPlus.getInstance();
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
|
||||
bot.setShield(true);
|
||||
}, 100);
|
||||
|
||||
bots.add(bot);
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.mojang.authlib.GameProfile;
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.trait.SkinTrait;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.nuggetmc.tplus.TerminatorPlus;
|
||||
import net.nuggetmc.tplus.api.Terminator;
|
||||
import net.nuggetmc.tplus.api.agent.Agent;
|
||||
@@ -17,6 +18,7 @@ import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.Waterlogged;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Damageable;
|
||||
import org.bukkit.entity.Entity;
|
||||
@@ -117,7 +119,7 @@ public class CitizensNPC implements Terminator {
|
||||
} catch (Exception e) {
|
||||
Bukkit.getServer().getLogger().warning("Failed to get skin: "+e.getMessage()+Arrays.toString(e.getStackTrace()));
|
||||
}
|
||||
|
||||
|
||||
// Register with bot manager
|
||||
TerminatorPlus.getInstance().getManager().add(citizensNPC);
|
||||
|
||||
@@ -227,11 +229,20 @@ public class CitizensNPC implements Terminator {
|
||||
private void startBlocking() {
|
||||
this.blocking = true;
|
||||
this.blockUse = true;
|
||||
// start blocking ingame
|
||||
Player bukkitPlayer = (Player)getBukkitEntity();
|
||||
CraftPlayer craftPlayer = (CraftPlayer) bukkitPlayer;
|
||||
ServerPlayer handle = craftPlayer.getHandle();
|
||||
handle.startUsingItem(net.minecraft.world.InteractionHand.OFF_HAND);
|
||||
}
|
||||
|
||||
private void stopBlocking(int cooldown) {
|
||||
this.blocking = false;
|
||||
scheduler.runTaskLater(plugin, () -> this.blockUse = false, cooldown);
|
||||
Player bukkitPlayer = (Player)getBukkitEntity();
|
||||
CraftPlayer craftPlayer = (CraftPlayer) bukkitPlayer;
|
||||
ServerPlayer handle = craftPlayer.getHandle();
|
||||
handle.stopUsingItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user