Compare commits

..

10 Commits

Author SHA1 Message Date
Justus Wolff
53b4f6a04a first commit-ish, forked and updated for 1.21.11
Some checks failed
Compile / gradle (ubuntu-latest) (push) Has been cancelled
2026-03-02 15:40:11 +01:00
Evan
ff9220654b Merge pull request #73 from TheMisterFish/bots_cant_jump_over_full_blocks
Updated jumping logic so bots can jump over blocks
2024-12-04 17:31:31 -05:00
Fish
8132d7073a Updated jumping logic so bots can jump over blocks.
Updated patch version +1.
2024-12-04 22:47:38 +01:00
Evan
553e2c4963 chore: include api jar in actions artifact 2024-12-03 17:25:55 -05:00
Evan
eb59870632 Merge pull request #70 from TheMisterFish/master
1.21.1 update & all required updates
2024-11-30 19:39:47 -05:00
Evan
4c0a61342a fix: set java version to 21 2024-11-30 15:47:18 -05:00
Fish
9d3db734bc Updated gradle from 7.4 to latest (8.11.1) + required build.gradle.kts changes
Updated minecraft version from 1.20.4 to 1.21.1.
Updated java from 17 to 21.
Bumped up version from 4.4.0-BETA to 4.5.0-BETA.

Added damageSource to botDeathEvent as it is now required for 1.21.
Added boolean (false) to comonListenerCookie.createInitial as this is now required.
Updated addEntityPacket method to take all required arguments.
Updated overridden setListener method to setListenerForServerboundHandshake as it seems this is the new method required (needs to be tested).

Updated imports to use org.bukkit.craftbukkit instead of org.bukkit.craftbukkit .v1_20_r3 (it seems craftbukkit updated and versioning is not required anymore).
2024-11-30 13:43:15 +01:00
Evan
673451779a Merge pull request #68 from ThisTestUser/master
Fixes and more features
2024-09-26 20:24:48 -04:00
ThisTestUser
dbfdef89ac Add CustomListMode enum 2024-09-25 18:07:27 -04:00
ThisTestUser
77b9915b39 Remove Magma-dependent code 2024-09-25 17:14:09 -04:00
502 changed files with 98768 additions and 260 deletions

View File

@@ -13,7 +13,7 @@ jobs:
- uses: actions/setup-java@v4 - uses: actions/setup-java@v4
with: with:
distribution: temurin distribution: temurin
java-version: 17 java-version: 21
- name: Setup Gradle - name: Setup Gradle
uses: gradle/actions/setup-gradle@v4 uses: gradle/actions/setup-gradle@v4
@@ -26,4 +26,6 @@ jobs:
if: success() if: success()
with: with:
name: TerminatorPlus name: TerminatorPlus
path: build/libs/ path: |
build/libs/
TerminatorPlus-API/build/libs

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.

View File

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.

View File

Binary file not shown.

View File

@@ -0,0 +1,2 @@
#Mon Mar 02 13:41:08 CET 2026
gradle.version=9.0.0

Binary file not shown.

BIN
.gradle/file-system.probe Normal file

Binary file not shown.

Binary file not shown.

View File

View File

@@ -36,7 +36,7 @@ Terminator terminator = TerminatorPlusAPI.getBotManager().createBot(location, "B
### Version Support ### Version Support
This plugin requires [Paper 1.20.4](https://papermc.io/downloads/all). This plugin requires [Paper 1.21.1](https://papermc.io/downloads/all).
### Future Updates ### Future Updates

View File

@@ -1,5 +1,5 @@
plugins { plugins {
id("java") java
id("net.nuggetmc.java-conventions") id("net.nuggetmc.java-conventions")
} }
@@ -17,6 +17,7 @@ repositories {
} }
dependencies { dependencies {
compileOnly("io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT") compileOnly("io.papermc.paper:paper-api:1.21.11-R0.1-SNAPSHOT")
compileOnly("com.mojang:authlib:3.2.38") compileOnly("com.mojang:authlib:3.2.38")
compileOnly("com.googlecode.json-simple:json-simple:1.1.1")
} }

View File

@@ -21,15 +21,15 @@ public interface BotManager {
List<String> fetchNames(); List<String> fetchNames();
Terminator createBot(Location loc, String name, String skin, String signature); Terminator createBot(Location loc, String name, String skin);
void createBots(CommandSender sender, String name, String skinName, int n, Location location); void createBots(CommandSender sender, String name, String skinName, int n, Location location);
void createBots(CommandSender sender, String name, String skinName, int n, NeuralNetwork network, Location location); void createBots(CommandSender sender, String name, String skinName, int n, NeuralNetwork network, Location location);
Set<Terminator> createBots(Location loc, String name, String[] skin, List<NeuralNetwork> networks); Set<Terminator> createBots(Location loc, String name, String skin, List<NeuralNetwork> networks);
Set<Terminator> createBots(Location loc, String name, String[] skin, int n, NeuralNetwork network); Set<Terminator> createBots(Location loc, String name, String skin, int n, NeuralNetwork network);
void remove(Terminator bot); void remove(Terminator bot);

View File

@@ -0,0 +1,28 @@
package net.nuggetmc.tplus.api.agent.legacyagent;
import java.util.Arrays;
import java.util.stream.Collectors;
public enum CustomListMode {
HOSTILE,
RAIDER,
MOB,
CUSTOM;
public static boolean isValid(String name) {
return from(name) != null;
}
public static CustomListMode from(String name) {
for (CustomListMode mode : values()) {
if (mode.name().equalsIgnoreCase(name)) {
return mode;
}
}
return null;
}
public static String listModes() {
return Arrays.stream(values()).map(e -> e.name().toLowerCase()).collect(Collectors.joining("|"));
}
}

View File

@@ -58,7 +58,7 @@ public class LegacyAgent extends Agent {
private double regionWeightZ; private double regionWeightZ;
public static final Set<EntityType> CUSTOM_MOB_LIST = new HashSet<>(); public static final Set<EntityType> CUSTOM_MOB_LIST = new HashSet<>();
public static String customListMode = "custom"; public static CustomListMode customListMode = CustomListMode.CUSTOM;
public LegacyAgent(BotManager manager, Plugin plugin) { public LegacyAgent(BotManager manager, Plugin plugin) {
super(manager, plugin); super(manager, plugin);
@@ -1068,6 +1068,7 @@ public class LegacyAgent extends Agent {
} }
private void blockBreakEffect(Terminator bot, LivingEntity player, Block block, LegacyLevel.LevelWrapper wrapper) { private void blockBreakEffect(Terminator bot, LivingEntity player, Block block, LegacyLevel.LevelWrapper wrapper) {
if (bot == null) {return;}
if (LegacyMats.NO_CRACK.contains(block.getType())) return; if (LegacyMats.NO_CRACK.contains(block.getType())) return;
@@ -1314,7 +1315,7 @@ public class LegacyAgent extends Agent {
bot.look(BlockFace.DOWN); bot.look(BlockFace.DOWN);
bot.punch(); bot.punch();
Boat boat = (Boat) world.spawnEntity(place, EntityType.BOAT); Boat boat = (Boat) world.spawnEntity(place, EntityType.OAK_BOAT);
scheduler.runTaskLater(plugin, () -> { scheduler.runTaskLater(plugin, () -> {
if (!boat.isDead()) { if (!boat.isDead()) {
@@ -1462,7 +1463,7 @@ public class LegacyAgent extends Agent {
case NEAREST_HOSTILE: { case NEAREST_HOSTILE: {
for (LivingEntity entity : bot.getBukkitEntity().getWorld().getLivingEntities()) { for (LivingEntity entity : bot.getBukkitEntity().getWorld().getLivingEntities()) {
if ((entity instanceof Monster || (customListMode.equals("hostile") && CUSTOM_MOB_LIST.contains(entity.getType()))) && validateCloserEntity(entity, loc, result)) { if ((entity instanceof Monster || (customListMode == CustomListMode.HOSTILE && CUSTOM_MOB_LIST.contains(entity.getType()))) && validateCloserEntity(entity, loc, result)) {
result = entity; result = entity;
} }
} }
@@ -1473,7 +1474,7 @@ public class LegacyAgent extends Agent {
case NEAREST_RAIDER: { case NEAREST_RAIDER: {
for (LivingEntity entity : bot.getBukkitEntity().getWorld().getLivingEntities()) { for (LivingEntity entity : bot.getBukkitEntity().getWorld().getLivingEntities()) {
boolean raider = entity instanceof Raider || (entity instanceof Vex vex && vex.getSummoner() instanceof Raider); boolean raider = entity instanceof Raider || (entity instanceof Vex vex && vex.getSummoner() instanceof Raider);
if ((raider || (customListMode.equals("raider") && CUSTOM_MOB_LIST.contains(entity.getType()))) && validateCloserEntity(entity, loc, result)) { if ((raider || (customListMode == CustomListMode.RAIDER && CUSTOM_MOB_LIST.contains(entity.getType()))) && validateCloserEntity(entity, loc, result)) {
result = entity; result = entity;
} }
} }
@@ -1483,7 +1484,7 @@ public class LegacyAgent extends Agent {
case NEAREST_MOB: { case NEAREST_MOB: {
for (LivingEntity entity : bot.getBukkitEntity().getWorld().getLivingEntities()) { for (LivingEntity entity : bot.getBukkitEntity().getWorld().getLivingEntities()) {
if ((entity instanceof Mob || (customListMode.equals("mob") && CUSTOM_MOB_LIST.contains(entity.getType()))) && validateCloserEntity(entity, loc, result)) { if ((entity instanceof Mob || (customListMode == CustomListMode.MOB && CUSTOM_MOB_LIST.contains(entity.getType()))) && validateCloserEntity(entity, loc, result)) {
result = entity; result = entity;
} }
} }
@@ -1539,7 +1540,7 @@ public class LegacyAgent extends Agent {
case CUSTOM_LIST: { case CUSTOM_LIST: {
for (LivingEntity entity : bot.getBukkitEntity().getWorld().getLivingEntities()) { for (LivingEntity entity : bot.getBukkitEntity().getWorld().getLivingEntities()) {
if (customListMode.equals("custom") && CUSTOM_MOB_LIST.contains(entity.getType()) && validateCloserEntity(entity, loc, result)) { if (customListMode == CustomListMode.CUSTOM && CUSTOM_MOB_LIST.contains(entity.getType()) && validateCloserEntity(entity, loc, result)) {
result = entity; result = entity;
} }
} }
@@ -1565,6 +1566,8 @@ public class LegacyAgent extends Agent {
} }
private boolean validateCloserEntity(LivingEntity entity, Location loc, LivingEntity result) { private boolean validateCloserEntity(LivingEntity entity, Location loc, LivingEntity result) {
if (entity == null)
return false;
double regionDistEntity = getWeightedRegionDist(entity.getLocation()); double regionDistEntity = getWeightedRegionDist(entity.getLocation());
if (regionDistEntity == Double.MAX_VALUE) if (regionDistEntity == Double.MAX_VALUE)
return false; return false;

View File

@@ -132,7 +132,7 @@ public class LegacyMats {
public static final Set<Material> OBSTACLES = new HashSet<>(concatTypes(Lists.newArrayList( public static final Set<Material> OBSTACLES = new HashSet<>(concatTypes(Lists.newArrayList(
Material.IRON_BARS, Material.IRON_BARS,
Material.CHAIN, Material.IRON_CHAIN,
Material.END_ROD, Material.END_ROD,
Material.LIGHTNING_ROD, Material.LIGHTNING_ROD,
Material.COBWEB, Material.COBWEB,
@@ -282,7 +282,7 @@ public class LegacyMats {
public static boolean canPlaceWater(Block block, Optional<Double> entityYPos) { public static boolean canPlaceWater(Block block, Optional<Double> entityYPos) {
if (isSolid(block.getType())) { if (isSolid(block.getType())) {
if (block.getType() == Material.CHAIN && ((Chain)block.getBlockData()).getAxis() == Axis.Y if (block.getType() == Material.IRON_CHAIN && ((Chain)block.getBlockData()).getAxis() == Axis.Y
&& !((Chain)block.getBlockData()).isWaterlogged()) && !((Chain)block.getBlockData()).isWaterlogged())
return false; return false;
if ((block.getType().data == Leaves.class || block.getType() == Material.MANGROVE_ROOTS if ((block.getType().data == Leaves.class || block.getType() == Material.MANGROVE_ROOTS
@@ -387,7 +387,7 @@ public class LegacyMats {
case CACTUS: case CACTUS:
case DRAGON_EGG: case DRAGON_EGG:
case TURTLE_EGG: case TURTLE_EGG:
case CHAIN: case IRON_CHAIN:
case IRON_BARS: case IRON_BARS:
case LANTERN: case LANTERN:
case SOUL_LANTERN: case SOUL_LANTERN:

View File

@@ -7,7 +7,6 @@ import net.nuggetmc.tplus.api.agent.legacyagent.EnumTargetGoal;
import net.nuggetmc.tplus.api.agent.legacyagent.LegacyAgent; import net.nuggetmc.tplus.api.agent.legacyagent.LegacyAgent;
import net.nuggetmc.tplus.api.utils.ChatUtils; import net.nuggetmc.tplus.api.utils.ChatUtils;
import net.nuggetmc.tplus.api.utils.MathUtils; import net.nuggetmc.tplus.api.utils.MathUtils;
import net.nuggetmc.tplus.api.utils.MojangAPI;
import net.nuggetmc.tplus.api.utils.PlayerUtils; import net.nuggetmc.tplus.api.utils.PlayerUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@@ -102,14 +101,12 @@ public class IntelligenceAgent {
print("Starting generation " + ChatColor.RED + generation + ChatColor.RESET + "..."); print("Starting generation " + ChatColor.RED + generation + ChatColor.RESET + "...");
sleep(2000); //sleep(2000);
String skinName = botSkin == null ? this.botName : botSkin; String skinName = botSkin == null ? this.botName : botSkin;
print("Fetching skin data for " + ChatColor.GREEN + skinName + ChatColor.RESET + "..."); print("Fetching skin data for " + ChatColor.GREEN + skinName + ChatColor.RESET + "...");
String[] skinData = MojangAPI.getSkin(skinName);
String botName = this.botName.endsWith("%") ? this.botName : this.botName + "%"; String botName = this.botName.endsWith("%") ? this.botName : this.botName + "%";
print("Creating " + (populationSize == 1 ? "new bot" : ChatColor.RED + NumberFormat.getInstance(Locale.US).format(populationSize) + ChatColor.RESET + " new bots") print("Creating " + (populationSize == 1 ? "new bot" : ChatColor.RED + NumberFormat.getInstance(Locale.US).format(populationSize) + ChatColor.RESET + " new bots")
@@ -124,7 +121,7 @@ public class IntelligenceAgent {
Set<Terminator> bots; Set<Terminator> bots;
if (loadedProfiles == null) { if (loadedProfiles == null) {
bots = manager.createBots(loc, botName, skinData, populationSize, NeuralNetwork.RANDOM); bots = manager.createBots(loc, botName, skinName, populationSize, NeuralNetwork.RANDOM);
} else { } else {
List<NeuralNetwork> networks = new ArrayList<>(); List<NeuralNetwork> networks = new ArrayList<>();
loadedProfiles.forEach(profile -> networks.add(NeuralNetwork.createNetworkFromProfile(profile))); loadedProfiles.forEach(profile -> networks.add(NeuralNetwork.createNetworkFromProfile(profile)));
@@ -136,7 +133,7 @@ public class IntelligenceAgent {
return; return;
} }
bots = manager.createBots(loc, botName, skinData, networks); bots = manager.createBots(loc, botName, skinName, networks);
} }
bots.forEach(bot -> { bots.forEach(bot -> {
@@ -151,16 +148,16 @@ public class IntelligenceAgent {
}); });
while (bots.size() != populationSize) { while (bots.size() != populationSize) {
sleep(1000); sleep(100);
} }
sleep(2000); //sleep(2000);
print("The bots will now attack each other."); print("The bots will now attack each other.");
agent.setTargetType(EnumTargetGoal.NEAREST_BOT); agent.setTargetType(EnumTargetGoal.NEAREST_BOT);
while (aliveCount() > 1) { while (aliveCount() > 1) {
sleep(1000); sleep(100);
} }
print("Generation " + ChatColor.RED + generation + ChatColor.RESET + " has ended."); print("Generation " + ChatColor.RED + generation + ChatColor.RESET + " has ended.");
@@ -188,7 +185,7 @@ public class IntelligenceAgent {
i++; i++;
} }
sleep(3000); //sleep(3000);
Map<BotNode, Map<BotDataType, List<Double>>> lists = new HashMap<>(); Map<BotNode, Map<BotDataType, List<Double>>> lists = new HashMap<>();
@@ -236,9 +233,12 @@ public class IntelligenceAgent {
genProfiles.put(generation + 1, profiles); genProfiles.put(generation + 1, profiles);
sleep(2000); //sleep(2000);
clearBots(); clearBots();
while (bots.size() != 0) {
sleep(100);
}
agent.setTargetType(EnumTargetGoal.NONE); agent.setTargetType(EnumTargetGoal.NONE);
} }
@@ -326,8 +326,11 @@ public class IntelligenceAgent {
if (!bots.isEmpty()) { if (!bots.isEmpty()) {
print("Removing all cached bots..."); print("Removing all cached bots...");
bots.values().forEach(Terminator::removeBot); scheduler.runTask(plugin, () -> {
bots.clear(); bots.values().forEach(Terminator::removeBot);
bots.clear();
});
} }
/*print("Removing all current bots..."); /*print("Removing all current bots...");

View File

@@ -8,7 +8,7 @@ public class BotDeathEvent extends EntityDeathEvent {
private final Terminator bot; private final Terminator bot;
public BotDeathEvent(EntityDeathEvent event, Terminator bot) { public BotDeathEvent(EntityDeathEvent event, Terminator bot) {
super(event.getEntity(), event.getDrops(), event.getDroppedExp()); super(event.getEntity(), event.getDamageSource(), event.getDrops(), event.getDroppedExp());
this.bot = bot; this.bot = bot;
} }

View File

@@ -0,0 +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 1642.84 ms.

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More