Moved to gradle & started work on separating API and plugin
This commit is contained in:
@@ -0,0 +1,91 @@
|
|||||||
|
package net.nuggetmc.tplus.api;
|
||||||
|
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import net.nuggetmc.tplus.api.agent.legacyagent.ai.NeuralNetwork;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
public interface Terminator {
|
||||||
|
|
||||||
|
String getBotName();
|
||||||
|
|
||||||
|
GameProfile getGameProfile();
|
||||||
|
|
||||||
|
NeuralNetwork getNeuralNetwork();
|
||||||
|
|
||||||
|
void setNeuralNetwork(NeuralNetwork neuralNetwork);
|
||||||
|
|
||||||
|
boolean hasNeuralNetwork();
|
||||||
|
|
||||||
|
Location getLocation();
|
||||||
|
|
||||||
|
float getHealth();
|
||||||
|
|
||||||
|
float getMaxHealth();
|
||||||
|
|
||||||
|
void ignite();
|
||||||
|
|
||||||
|
boolean isOnFire();
|
||||||
|
|
||||||
|
boolean isFalling();
|
||||||
|
|
||||||
|
boolean isBlocking();
|
||||||
|
|
||||||
|
void block(int length, int cooldown);
|
||||||
|
|
||||||
|
boolean isInWater();
|
||||||
|
|
||||||
|
void jump(Vector velocity);
|
||||||
|
|
||||||
|
void jump();
|
||||||
|
|
||||||
|
void walk(Vector velocity);
|
||||||
|
|
||||||
|
void look(BlockFace face);
|
||||||
|
|
||||||
|
void attack(Entity target);
|
||||||
|
|
||||||
|
void attemptBlockPlace(Location loc, Material type, boolean down);
|
||||||
|
|
||||||
|
void punch();
|
||||||
|
|
||||||
|
void swim();
|
||||||
|
|
||||||
|
void sneak();
|
||||||
|
|
||||||
|
void stand();
|
||||||
|
|
||||||
|
void addFriction(double factor);
|
||||||
|
|
||||||
|
void removeVisually();
|
||||||
|
|
||||||
|
int getKills();
|
||||||
|
|
||||||
|
void incrementKills();
|
||||||
|
|
||||||
|
void setItem(ItemStack item);
|
||||||
|
|
||||||
|
void setItem(ItemStack item, EquipmentSlot slot);
|
||||||
|
|
||||||
|
void setItemOffhand(ItemStack item);
|
||||||
|
|
||||||
|
void setDefaultItem(ItemStack item);
|
||||||
|
|
||||||
|
Vector getOffset();
|
||||||
|
|
||||||
|
Vector getVelocity();
|
||||||
|
|
||||||
|
void setVelocity(Vector velocity);
|
||||||
|
|
||||||
|
void addVelocity(Vector velocity);
|
||||||
|
|
||||||
|
int getAliveTicks();
|
||||||
|
|
||||||
|
boolean tickDelay(int ticks);
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package net.nuggetmc.tplus.bot.agent.legacyagent.ai;
|
package net.nuggetmc.tplus.api.agent.legacyagent.ai;
|
||||||
|
|
||||||
public enum ActivationType {
|
public enum ActivationType {
|
||||||
TANH,
|
TANH,
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package net.nuggetmc.tplus.bot.agent.legacyagent.ai;
|
package net.nuggetmc.tplus.api.agent.legacyagent.ai;
|
||||||
|
|
||||||
import net.nuggetmc.tplus.bot.Bot;
|
import net.nuggetmc.tplus.api.Terminator;
|
||||||
import net.nuggetmc.tplus.utils.MathUtils;
|
import net.nuggetmc.tplus.utils.MathUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -14,7 +14,7 @@ public class BotData {
|
|||||||
|
|
||||||
private final Map<BotDataType, Double> values;
|
private final Map<BotDataType, Double> values;
|
||||||
|
|
||||||
private BotData(Bot bot, LivingEntity target) {
|
private BotData(Terminator bot, LivingEntity target) {
|
||||||
this.values = new HashMap<>();
|
this.values = new HashMap<>();
|
||||||
|
|
||||||
Location a = bot.getLocation();
|
Location a = bot.getLocation();
|
||||||
@@ -25,10 +25,10 @@ public class BotData {
|
|||||||
values.put(BotDataType.CRITICAL_HEALTH, health >= 5 ? 0 : 5D - health);
|
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())));
|
values.put(BotDataType.DISTANCE_XZ, Math.sqrt(MathUtils.square(a.getX() - b.getX()) + MathUtils.square(a.getZ() - b.getZ())));
|
||||||
values.put(BotDataType.DISTANCE_Y, b.getY() - a.getY());
|
values.put(BotDataType.DISTANCE_Y, b.getY() - a.getY());
|
||||||
values.put(BotDataType.ENEMY_BLOCKING, target instanceof Player && ((Player)target).isBlocking() ? 1D : 0);
|
values.put(BotDataType.ENEMY_BLOCKING, target instanceof Player && ((Player) target).isBlocking() ? 1D : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BotData generate(Bot bot, LivingEntity target) {
|
public static BotData generate(Terminator bot, LivingEntity target) {
|
||||||
return new BotData(bot, target);
|
return new BotData(bot, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package net.nuggetmc.tplus.bot.agent.legacyagent.ai;
|
package net.nuggetmc.tplus.api.agent.legacyagent.ai;
|
||||||
|
|
||||||
public enum BotDataType {
|
public enum BotDataType {
|
||||||
CRITICAL_HEALTH("h"),
|
CRITICAL_HEALTH("h"),
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package net.nuggetmc.tplus.bot.agent.legacyagent.ai;
|
package net.nuggetmc.tplus.api.agent.legacyagent.ai;
|
||||||
|
|
||||||
public enum BotNode {
|
public enum BotNode {
|
||||||
BLOCK, // block (can't attack while blocking)
|
BLOCK, // block (can't attack while blocking)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package net.nuggetmc.tplus.bot.agent.legacyagent.ai;
|
package net.nuggetmc.tplus.api.agent.legacyagent.ai;
|
||||||
|
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
import net.nuggetmc.tplus.utils.MathUtils;
|
import net.nuggetmc.tplus.utils.MathUtils;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package net.nuggetmc.tplus.bot.agent.legacyagent.ai;
|
package net.nuggetmc.tplus.api.agent.legacyagent.ai;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package net.nuggetmc.tplus.utils;
|
package net.nuggetmc.tplus.utils;
|
||||||
|
|
||||||
import net.nuggetmc.tplus.bot.Bot;
|
import net.nuggetmc.tplus.api.Terminator;
|
||||||
import org.bukkit.util.NumberConversions;
|
import org.bukkit.util.NumberConversions;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@@ -22,9 +22,7 @@ public class MathUtils {
|
|||||||
|
|
||||||
if (x == 0.0D && z == 0.0D) {
|
if (x == 0.0D && z == 0.0D) {
|
||||||
out[1] = (float) (dir.getY() > 0.0D ? -90 : 90);
|
out[1] = (float) (dir.getY() > 0.0D ? -90 : 90);
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else {
|
|
||||||
double theta = Math.atan2(-x, z);
|
double theta = Math.atan2(-x, z);
|
||||||
out[0] = (float) Math.toDegrees((theta + 6.283185307179586D) % 6.283185307179586D);
|
out[0] = (float) Math.toDegrees((theta + 6.283185307179586D) % 6.283185307179586D);
|
||||||
|
|
||||||
@@ -45,9 +43,7 @@ public class MathUtils {
|
|||||||
|
|
||||||
if (x == 0.0D && z == 0.0D) {
|
if (x == 0.0D && z == 0.0D) {
|
||||||
result = (float) (dir.getY() > 0.0D ? -90 : 90);
|
result = (float) (dir.getY() > 0.0D ? -90 : 90);
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else {
|
|
||||||
double x2 = NumberConversions.square(x);
|
double x2 = NumberConversions.square(x);
|
||||||
double z2 = NumberConversions.square(z);
|
double z2 = NumberConversions.square(z);
|
||||||
double xz = Math.sqrt(x2 + z2);
|
double xz = Math.sqrt(x2 + z2);
|
||||||
@@ -92,8 +88,8 @@ public class MathUtils {
|
|||||||
return FORMATTER_2.format(n);
|
return FORMATTER_2.format(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Map.Entry<Bot, Integer>> sortByValue(HashMap<Bot, Integer> hm) {
|
public static List<Map.Entry<Terminator, Integer>> sortByValue(HashMap<Terminator, Integer> hm) {
|
||||||
List<Map.Entry<Bot, Integer>> list = new LinkedList<>(hm.entrySet());
|
List<Map.Entry<Terminator, Integer>> list = new LinkedList<>(hm.entrySet());
|
||||||
list.sort(Map.Entry.comparingByValue());
|
list.sort(Map.Entry.comparingByValue());
|
||||||
Collections.reverse(list);
|
Collections.reverse(list);
|
||||||
return list;
|
return list;
|
||||||
@@ -161,9 +157,9 @@ public class MathUtils {
|
|||||||
double dist = distribution(list, mid);
|
double dist = distribution(list, mid);
|
||||||
double p = mutationSize * dist / Math.sqrt(list.size());
|
double p = mutationSize * dist / Math.sqrt(list.size());
|
||||||
|
|
||||||
return new double[] {
|
return new double[]{
|
||||||
mid - p,
|
mid - p,
|
||||||
mid + p
|
mid + p
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8,8 +8,6 @@ import net.minecraft.network.Connection;
|
|||||||
import net.minecraft.network.protocol.Packet;
|
import net.minecraft.network.protocol.Packet;
|
||||||
import net.minecraft.network.protocol.PacketFlow;
|
import net.minecraft.network.protocol.PacketFlow;
|
||||||
import net.minecraft.network.protocol.game.*;
|
import net.minecraft.network.protocol.game.*;
|
||||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
|
||||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
@@ -26,18 +24,17 @@ import net.minecraft.world.level.chunk.LevelChunk;
|
|||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.nuggetmc.tplus.TerminatorPlus;
|
import net.nuggetmc.tplus.TerminatorPlus;
|
||||||
|
import net.nuggetmc.tplus.api.Terminator;
|
||||||
|
import net.nuggetmc.tplus.api.agent.legacyagent.ai.NeuralNetwork;
|
||||||
import net.nuggetmc.tplus.bot.agent.Agent;
|
import net.nuggetmc.tplus.bot.agent.Agent;
|
||||||
import net.nuggetmc.tplus.bot.agent.legacyagent.ai.NeuralNetwork;
|
|
||||||
import net.nuggetmc.tplus.bot.event.BotDamageByPlayerEvent;
|
import net.nuggetmc.tplus.bot.event.BotDamageByPlayerEvent;
|
||||||
import net.nuggetmc.tplus.bot.event.BotFallDamageEvent;
|
import net.nuggetmc.tplus.bot.event.BotFallDamageEvent;
|
||||||
import net.nuggetmc.tplus.bot.event.BotKilledByPlayerEvent;
|
import net.nuggetmc.tplus.bot.event.BotKilledByPlayerEvent;
|
||||||
import net.nuggetmc.tplus.utils.*;
|
import net.nuggetmc.tplus.utils.*;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.SoundCategory;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.craftbukkit.v1_18_R1.CraftEquipmentSlot;
|
||||||
import org.bukkit.craftbukkit.v1_18_R1.CraftServer;
|
import org.bukkit.craftbukkit.v1_18_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_18_R1.CraftWorld;
|
import org.bukkit.craftbukkit.v1_18_R1.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer;
|
||||||
@@ -46,7 +43,6 @@ import org.bukkit.entity.Damageable;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.scheduler.BukkitScheduler;
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
import org.bukkit.util.BoundingBox;
|
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@@ -55,47 +51,26 @@ import java.util.Collections;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class Bot extends ServerPlayer {
|
public class Bot extends ServerPlayer implements Terminator {
|
||||||
|
|
||||||
private final TerminatorPlus plugin;
|
private final TerminatorPlus plugin;
|
||||||
private final BukkitScheduler scheduler;
|
private final BukkitScheduler scheduler;
|
||||||
private final Agent agent;
|
private final Agent agent;
|
||||||
|
private final Vector offset;
|
||||||
private NeuralNetwork network;
|
|
||||||
|
|
||||||
public NeuralNetwork getNeuralNetwork() {
|
|
||||||
return network;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNeuralNetwork(NeuralNetwork network) {
|
|
||||||
this.network = network;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasNeuralNetwork() {
|
|
||||||
return network != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack defaultItem;
|
public ItemStack defaultItem;
|
||||||
|
private NeuralNetwork network;
|
||||||
private boolean shield;
|
private boolean shield;
|
||||||
private boolean blocking;
|
private boolean blocking;
|
||||||
private boolean blockUse;
|
private boolean blockUse;
|
||||||
|
|
||||||
private Vector velocity;
|
private Vector velocity;
|
||||||
private Vector oldVelocity;
|
private Vector oldVelocity;
|
||||||
|
|
||||||
private boolean removeOnDeath;
|
private boolean removeOnDeath;
|
||||||
|
|
||||||
private int aliveTicks;
|
private int aliveTicks;
|
||||||
private int kills;
|
private int kills;
|
||||||
|
|
||||||
private byte fireTicks;
|
private byte fireTicks;
|
||||||
private byte groundTicks;
|
private byte groundTicks;
|
||||||
private byte jumpTicks;
|
private byte jumpTicks;
|
||||||
private byte noFallTicks;
|
private byte noFallTicks;
|
||||||
|
|
||||||
private final Vector offset;
|
|
||||||
|
|
||||||
private Bot(MinecraftServer minecraftServer, ServerLevel worldServer, GameProfile profile) {
|
private Bot(MinecraftServer minecraftServer, ServerLevel worldServer, GameProfile profile) {
|
||||||
super(minecraftServer, worldServer, profile);
|
super(minecraftServer, worldServer, profile);
|
||||||
|
|
||||||
@@ -139,7 +114,7 @@ public class Bot extends ServerPlayer {
|
|||||||
bot.setRot(loc.getYaw(), loc.getPitch());
|
bot.setRot(loc.getYaw(), loc.getPitch());
|
||||||
bot.getBukkitEntity().setNoDamageTicks(0);
|
bot.getBukkitEntity().setNoDamageTicks(0);
|
||||||
Bukkit.getOnlinePlayers().forEach(p -> ((CraftPlayer) p).getHandle().connection.send(
|
Bukkit.getOnlinePlayers().forEach(p -> ((CraftPlayer) p).getHandle().connection.send(
|
||||||
new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, bot)));
|
new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, bot)));
|
||||||
nmsWorld.addFreshEntity(bot);
|
nmsWorld.addFreshEntity(bot);
|
||||||
bot.renderAll();
|
bot.renderAll();
|
||||||
|
|
||||||
@@ -148,6 +123,26 @@ public class Bot extends ServerPlayer {
|
|||||||
return bot;
|
return bot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getBotName() {
|
||||||
|
return displayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NeuralNetwork getNeuralNetwork() {
|
||||||
|
return network;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setNeuralNetwork(NeuralNetwork network) {
|
||||||
|
this.network = network;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasNeuralNetwork() {
|
||||||
|
return network != null;
|
||||||
|
}
|
||||||
|
|
||||||
private void renderAll() {
|
private void renderAll() {
|
||||||
Packet<?>[] packets = getRenderPacketsNoInfo();
|
Packet<?>[] packets = getRenderPacketsNoInfo();
|
||||||
Bukkit.getOnlinePlayers().forEach(p -> renderNoInfo(((CraftPlayer) p).getHandle().connection, packets, false));
|
Bukkit.getOnlinePlayers().forEach(p -> renderNoInfo(((CraftPlayer) p).getHandle().connection, packets, false));
|
||||||
@@ -181,38 +176,43 @@ public class Bot extends ServerPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Packet<?>[] getRenderPackets() {
|
private Packet<?>[] getRenderPackets() {
|
||||||
return new Packet[] {
|
return new Packet[]{
|
||||||
new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, this),
|
new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, this),
|
||||||
new ClientboundAddPlayerPacket(this),
|
new ClientboundAddPlayerPacket(this),
|
||||||
new ClientboundSetEntityDataPacket(this.getId(), this.entityData, true),
|
new ClientboundSetEntityDataPacket(this.getId(), this.entityData, true),
|
||||||
new ClientboundRotateHeadPacket(this, (byte) ((this.yHeadRot * 256f) / 360f))
|
new ClientboundRotateHeadPacket(this, (byte) ((this.yHeadRot * 256f) / 360f))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private Packet<?>[] getRenderPacketsNoInfo() {
|
private Packet<?>[] getRenderPacketsNoInfo() {
|
||||||
return new Packet[] {
|
return new Packet[]{
|
||||||
new ClientboundAddPlayerPacket(this),
|
new ClientboundAddPlayerPacket(this),
|
||||||
new ClientboundSetEntityDataPacket(this.getId(), this.entityData, true),
|
new ClientboundSetEntityDataPacket(this.getId(), this.entityData, true),
|
||||||
new ClientboundRotateHeadPacket(this, (byte) ((this.yHeadRot * 256f) / 360f))
|
new ClientboundRotateHeadPacket(this, (byte) ((this.yHeadRot * 256f) / 360f))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setDefaultItem(ItemStack item) {
|
public void setDefaultItem(ItemStack item) {
|
||||||
this.defaultItem = item;
|
this.defaultItem = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Vector getOffset() {
|
public Vector getOffset() {
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Vector getVelocity() {
|
public Vector getVelocity() {
|
||||||
return velocity.clone();
|
return velocity.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setVelocity(Vector vector) {
|
public void setVelocity(Vector vector) {
|
||||||
this.velocity = vector;
|
this.velocity = vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addVelocity(Vector vector) { // This can cause lag? (maybe i fixed it with the new static method)
|
public void addVelocity(Vector vector) { // This can cause lag? (maybe i fixed it with the new static method)
|
||||||
if (MathUtils.isNotFinite(vector)) {
|
if (MathUtils.isNotFinite(vector)) {
|
||||||
velocity = vector;
|
velocity = vector;
|
||||||
@@ -222,10 +222,12 @@ public class Bot extends ServerPlayer {
|
|||||||
velocity.add(vector);
|
velocity.add(vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getAliveTicks() {
|
public int getAliveTicks() {
|
||||||
return aliveTicks;
|
return aliveTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean tickDelay(int i) {
|
public boolean tickDelay(int i) {
|
||||||
return aliveTicks % i == 0;
|
return aliveTicks % i == 0;
|
||||||
}
|
}
|
||||||
@@ -273,7 +275,7 @@ public class Bot extends ServerPlayer {
|
|||||||
fireDamageCheck();
|
fireDamageCheck();
|
||||||
fallDamageCheck();
|
fallDamageCheck();
|
||||||
|
|
||||||
if(position().y < -64) {
|
if (position().y < -64) {
|
||||||
die(DamageSource.OUT_OF_WORLD);
|
die(DamageSource.OUT_OF_WORLD);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,6 +330,7 @@ public class Bot extends ServerPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void ignite() {
|
public void ignite() {
|
||||||
if (fireTicks <= 1) setOnFirePackets(true);
|
if (fireTicks <= 1) setOnFirePackets(true);
|
||||||
fireTicks = 100;
|
fireTicks = 100;
|
||||||
@@ -338,6 +341,7 @@ public class Bot extends ServerPlayer {
|
|||||||
//sendPacket(new ClientboundSetEntityDataPacket(getId(), entityData, false));
|
//sendPacket(new ClientboundSetEntityDataPacket(getId(), entityData, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isOnFire() {
|
public boolean isOnFire() {
|
||||||
return fireTicks != 0;
|
return fireTicks != 0;
|
||||||
}
|
}
|
||||||
@@ -354,10 +358,12 @@ public class Bot extends ServerPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isFalling() {
|
public boolean isFalling() {
|
||||||
return velocity.getY() < -0.8;
|
return velocity.getY() < -0.8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void block(int blockLength, int cooldown) {
|
public void block(int blockLength, int cooldown) {
|
||||||
if (!shield || blockUse) return;
|
if (!shield || blockUse) return;
|
||||||
startBlocking();
|
startBlocking();
|
||||||
@@ -378,6 +384,7 @@ public class Bot extends ServerPlayer {
|
|||||||
sendPacket(new ClientboundSetEntityDataPacket(getId(), entityData, true));
|
sendPacket(new ClientboundSetEntityDataPacket(getId(), entityData, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isBlocking() {
|
public boolean isBlocking() {
|
||||||
return blocking;
|
return blocking;
|
||||||
}
|
}
|
||||||
@@ -398,9 +405,7 @@ public class Bot extends ServerPlayer {
|
|||||||
y = Math.min(velocity.getY() + 0.1, 0.1);
|
y = Math.min(velocity.getY() + 0.1, 0.1);
|
||||||
addFriction(0.8);
|
addFriction(0.8);
|
||||||
velocity.setY(y);
|
velocity.setY(y);
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else {
|
|
||||||
if (groundTicks != 0) {
|
if (groundTicks != 0) {
|
||||||
velocity.setY(0);
|
velocity.setY(0);
|
||||||
addFriction(0.5);
|
addFriction(0.5);
|
||||||
@@ -431,6 +436,7 @@ public class Bot extends ServerPlayer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void jump(Vector vel) {
|
public void jump(Vector vel) {
|
||||||
if (jumpTicks == 0 && groundTicks > 1) {
|
if (jumpTicks == 0 && groundTicks > 1) {
|
||||||
jumpTicks = 4;
|
jumpTicks = 4;
|
||||||
@@ -438,10 +444,12 @@ public class Bot extends ServerPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void jump() {
|
public void jump() {
|
||||||
jump(new Vector(0, 0.5, 0));
|
jump(new Vector(0, 0.5, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void walk(Vector vel) {
|
public void walk(Vector vel) {
|
||||||
double max = 0.4;
|
double max = 0.4;
|
||||||
|
|
||||||
@@ -451,6 +459,7 @@ public class Bot extends ServerPlayer {
|
|||||||
velocity = sum;
|
velocity = sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void attack(org.bukkit.entity.Entity entity) {
|
public void attack(org.bukkit.entity.Entity entity) {
|
||||||
faceLocation(entity.getLocation());
|
faceLocation(entity.getLocation());
|
||||||
punch();
|
punch();
|
||||||
@@ -462,6 +471,7 @@ public class Bot extends ServerPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void punch() {
|
public void punch() {
|
||||||
swing(InteractionHand.MAIN_HAND);
|
swing(InteractionHand.MAIN_HAND);
|
||||||
}
|
}
|
||||||
@@ -476,14 +486,14 @@ public class Bot extends ServerPlayer {
|
|||||||
World world = getBukkitEntity().getWorld();
|
World world = getBukkitEntity().getWorld();
|
||||||
AABB box = getBoundingBox();
|
AABB box = getBoundingBox();
|
||||||
|
|
||||||
double[] xVals = new double[] {
|
double[] xVals = new double[]{
|
||||||
box.minX,
|
box.minX,
|
||||||
box.maxX
|
box.maxX
|
||||||
};
|
};
|
||||||
|
|
||||||
double[] zVals = new double[] {
|
double[] zVals = new double[]{
|
||||||
box.minZ,
|
box.minZ,
|
||||||
box.maxZ
|
box.maxZ
|
||||||
};
|
};
|
||||||
|
|
||||||
for (double x : xVals) {
|
for (double x : xVals) {
|
||||||
@@ -505,6 +515,7 @@ public class Bot extends ServerPlayer {
|
|||||||
return groundTicks != 0;
|
return groundTicks != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addFriction(double factor) {
|
public void addFriction(double factor) {
|
||||||
double frictionMin = 0.01;
|
double frictionMin = 0.01;
|
||||||
|
|
||||||
@@ -515,6 +526,7 @@ public class Bot extends ServerPlayer {
|
|||||||
velocity.setZ(Math.abs(z) < frictionMin ? 0 : z * factor);
|
velocity.setZ(Math.abs(z) < frictionMin ? 0 : z * factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void removeVisually() {
|
public void removeVisually() {
|
||||||
this.removeTab();
|
this.removeTab();
|
||||||
this.setDead();
|
this.setDead();
|
||||||
@@ -640,14 +652,17 @@ public class Bot extends ServerPlayer {
|
|||||||
velocity = vel;
|
velocity = vel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getKills() {
|
public int getKills() {
|
||||||
return kills;
|
return kills;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void incrementKills() {
|
public void incrementKills() {
|
||||||
kills++;
|
kills++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Location getLocation() {
|
public Location getLocation() {
|
||||||
return getBukkitEntity().getLocation();
|
return getBukkitEntity().getLocation();
|
||||||
}
|
}
|
||||||
@@ -656,6 +671,7 @@ public class Bot extends ServerPlayer {
|
|||||||
look(loc.toVector().subtract(getLocation().toVector()), false);
|
look(loc.toVector().subtract(getLocation().toVector()), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void look(BlockFace face) {
|
public void look(BlockFace face) {
|
||||||
look(face.getDirection(), face == BlockFace.DOWN || face == BlockFace.UP);
|
look(face.getDirection(), face == BlockFace.DOWN || face == BlockFace.UP);
|
||||||
}
|
}
|
||||||
@@ -677,6 +693,7 @@ public class Bot extends ServerPlayer {
|
|||||||
setRot(yaw, pitch);
|
setRot(yaw, pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void attemptBlockPlace(Location loc, Material type, boolean down) {
|
public void attemptBlockPlace(Location loc, Material type, boolean down) {
|
||||||
if (down) {
|
if (down) {
|
||||||
look(BlockFace.DOWN);
|
look(BlockFace.DOWN);
|
||||||
@@ -696,15 +713,23 @@ public class Bot extends ServerPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setItem(org.bukkit.inventory.ItemStack item) {
|
public void setItem(org.bukkit.inventory.ItemStack item) {
|
||||||
setItem(item, EquipmentSlot.MAINHAND);
|
setItem(item, EquipmentSlot.MAINHAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setItemOffhand(org.bukkit.inventory.ItemStack item) {
|
public void setItemOffhand(org.bukkit.inventory.ItemStack item) {
|
||||||
setItem(item, EquipmentSlot.OFFHAND);
|
setItem(item, EquipmentSlot.OFFHAND);
|
||||||
System.out.println("set offhand");
|
System.out.println("set offhand");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setItem(ItemStack item, org.bukkit.inventory.EquipmentSlot slot) {
|
||||||
|
EquipmentSlot nmsSlot = CraftEquipmentSlot.getNMS(slot);
|
||||||
|
setItem(item, nmsSlot);
|
||||||
|
}
|
||||||
|
|
||||||
public void setItem(org.bukkit.inventory.ItemStack item, EquipmentSlot slot) {
|
public void setItem(org.bukkit.inventory.ItemStack item, EquipmentSlot slot) {
|
||||||
if (item == null) item = defaultItem;
|
if (item == null) item = defaultItem;
|
||||||
|
|
||||||
@@ -718,20 +743,23 @@ public class Bot extends ServerPlayer {
|
|||||||
System.out.println("slot = " + slot);
|
System.out.println("slot = " + slot);
|
||||||
System.out.println("item = " + item);
|
System.out.println("item = " + item);
|
||||||
sendPacket(new ClientboundSetEquipmentPacket(getId(), new ArrayList<>(Collections.singletonList(
|
sendPacket(new ClientboundSetEquipmentPacket(getId(), new ArrayList<>(Collections.singletonList(
|
||||||
new Pair<>(slot, CraftItemStack.asNMSCopy(item))
|
new Pair<>(slot, CraftItemStack.asNMSCopy(item))
|
||||||
))));
|
))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void swim() {
|
public void swim() {
|
||||||
getBukkitEntity().setSwimming(true);
|
getBukkitEntity().setSwimming(true);
|
||||||
registerPose(Pose.SWIMMING);
|
registerPose(Pose.SWIMMING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void sneak() {
|
public void sneak() {
|
||||||
getBukkitEntity().setSneaking(true);
|
getBukkitEntity().setSneaking(true);
|
||||||
registerPose(Pose.CROUCHING);
|
registerPose(Pose.CROUCHING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void stand() {
|
public void stand() {
|
||||||
Player player = getBukkitEntity();
|
Player player = getBukkitEntity();
|
||||||
player.setSneaking(false);
|
player.setSneaking(false);
|
||||||
@@ -3,15 +3,17 @@ package net.nuggetmc.tplus.bot;
|
|||||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||||
import net.nuggetmc.tplus.bot.agent.Agent;
|
import net.nuggetmc.tplus.bot.agent.Agent;
|
||||||
import net.nuggetmc.tplus.bot.agent.legacyagent.LegacyAgent;
|
import net.nuggetmc.tplus.bot.agent.legacyagent.LegacyAgent;
|
||||||
import net.nuggetmc.tplus.bot.agent.legacyagent.ai.NeuralNetwork;
|
import net.nuggetmc.tplus.api.agent.legacyagent.ai.NeuralNetwork;
|
||||||
import net.nuggetmc.tplus.bot.event.BotDeathEvent;
|
import net.nuggetmc.tplus.bot.event.BotDeathEvent;
|
||||||
import net.nuggetmc.tplus.utils.MojangAPI;
|
import net.nuggetmc.tplus.utils.MojangAPI;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
@@ -149,19 +151,31 @@ public class BotManager implements Listener {
|
|||||||
agent.stopAllTasks();
|
agent.stopAllTasks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a bot from a Player object
|
||||||
|
* @param player
|
||||||
|
* @deprecated Use {@link #getBot(UUID)} instead as this may no longer work
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public Bot getBot(Player player) { // potentially memory intensive
|
public Bot getBot(Player player) { // potentially memory intensive
|
||||||
Bot bot = null;
|
|
||||||
|
|
||||||
int id = player.getEntityId();
|
int id = player.getEntityId();
|
||||||
|
return getBot(id);
|
||||||
|
}
|
||||||
|
|
||||||
for (Bot b : bots) {
|
public Bot getBot(UUID uuid) {
|
||||||
if (id == b.getId()) {
|
Entity entity = Bukkit.getEntity(uuid);
|
||||||
bot = b;
|
if (entity == null) return null;
|
||||||
break;
|
return getBot(entity.getEntityId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Bot getBot(int entityId) {
|
||||||
|
for (Bot bot : bots) {
|
||||||
|
if (bot.getId() == entityId) {
|
||||||
|
return bot;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
return bot;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@@ -171,10 +185,9 @@ public class BotManager implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onDeath(PlayerDeathEvent event) {
|
public void onDeath(EntityDeathEvent event) {
|
||||||
Player player = event.getEntity();
|
LivingEntity bukkitEntity = event.getEntity();
|
||||||
Bot bot = getBot(player);
|
Bot bot = getBot(bukkitEntity.getEntityId());
|
||||||
|
|
||||||
if (bot != null) {
|
if (bot != null) {
|
||||||
agent.onBotDeath(new BotDeathEvent(event, bot));
|
agent.onBotDeath(new BotDeathEvent(event, bot));
|
||||||
}
|
}
|
||||||
@@ -5,9 +5,9 @@ import net.minecraft.network.protocol.game.ClientboundBlockDestructionPacket;
|
|||||||
import net.nuggetmc.tplus.bot.Bot;
|
import net.nuggetmc.tplus.bot.Bot;
|
||||||
import net.nuggetmc.tplus.bot.BotManager;
|
import net.nuggetmc.tplus.bot.BotManager;
|
||||||
import net.nuggetmc.tplus.bot.agent.Agent;
|
import net.nuggetmc.tplus.bot.agent.Agent;
|
||||||
import net.nuggetmc.tplus.bot.agent.legacyagent.ai.BotData;
|
import net.nuggetmc.tplus.api.agent.legacyagent.ai.BotData;
|
||||||
import net.nuggetmc.tplus.bot.agent.legacyagent.ai.BotNode;
|
import net.nuggetmc.tplus.api.agent.legacyagent.ai.BotNode;
|
||||||
import net.nuggetmc.tplus.bot.agent.legacyagent.ai.NeuralNetwork;
|
import net.nuggetmc.tplus.api.agent.legacyagent.ai.NeuralNetwork;
|
||||||
import net.nuggetmc.tplus.bot.event.BotDamageByPlayerEvent;
|
import net.nuggetmc.tplus.bot.event.BotDamageByPlayerEvent;
|
||||||
import net.nuggetmc.tplus.bot.event.BotDeathEvent;
|
import net.nuggetmc.tplus.bot.event.BotDeathEvent;
|
||||||
import net.nuggetmc.tplus.bot.event.BotFallDamageEvent;
|
import net.nuggetmc.tplus.bot.event.BotFallDamageEvent;
|
||||||
@@ -10,8 +10,6 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.craftbukkit.v1_18_R1.CraftWorld;
|
import org.bukkit.craftbukkit.v1_18_R1.CraftWorld;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
public class LegacyUtils {
|
public class LegacyUtils {
|
||||||
|
|
||||||
public static boolean checkFreeSpace(Location a, Location b) {
|
public static boolean checkFreeSpace(Location a, Location b) {
|
||||||
@@ -2,6 +2,10 @@ package net.nuggetmc.tplus.bot.agent.legacyagent.ai;
|
|||||||
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.nuggetmc.tplus.TerminatorPlus;
|
import net.nuggetmc.tplus.TerminatorPlus;
|
||||||
|
import net.nuggetmc.tplus.api.Terminator;
|
||||||
|
import net.nuggetmc.tplus.api.agent.legacyagent.ai.BotDataType;
|
||||||
|
import net.nuggetmc.tplus.api.agent.legacyagent.ai.BotNode;
|
||||||
|
import net.nuggetmc.tplus.api.agent.legacyagent.ai.NeuralNetwork;
|
||||||
import net.nuggetmc.tplus.bot.Bot;
|
import net.nuggetmc.tplus.bot.Bot;
|
||||||
import net.nuggetmc.tplus.bot.BotManager;
|
import net.nuggetmc.tplus.bot.BotManager;
|
||||||
import net.nuggetmc.tplus.bot.agent.legacyagent.EnumTargetGoal;
|
import net.nuggetmc.tplus.bot.agent.legacyagent.EnumTargetGoal;
|
||||||
@@ -166,22 +170,22 @@ public class IntelligenceAgent {
|
|||||||
|
|
||||||
print("Generation " + ChatColor.RED + generation + ChatColor.RESET + " has ended.");
|
print("Generation " + ChatColor.RED + generation + ChatColor.RESET + " has ended.");
|
||||||
|
|
||||||
HashMap<Bot, Integer> values = new HashMap<>();
|
HashMap<Terminator, Integer> values = new HashMap<>();
|
||||||
|
|
||||||
for (Bot bot : bots.values()) {
|
for (Terminator bot : bots.values()) {
|
||||||
values.put(bot, bot.getAliveTicks());
|
values.put(bot, bot.getAliveTicks());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Map.Entry<Bot, Integer>> sorted = MathUtils.sortByValue(values);
|
List<Map.Entry<Terminator, Integer>> sorted = MathUtils.sortByValue(values);
|
||||||
Set<Bot> winners = new HashSet<>();
|
Set<Terminator> winners = new HashSet<>();
|
||||||
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
|
||||||
for (Map.Entry<Bot, Integer> entry : sorted) {
|
for (Map.Entry<Terminator, Integer> entry : sorted) {
|
||||||
Bot bot = entry.getKey();
|
Terminator bot = entry.getKey();
|
||||||
boolean check = i <= cutoff;
|
boolean check = i <= cutoff;
|
||||||
if (check) {
|
if (check) {
|
||||||
print(ChatColor.GRAY + "[" + ChatColor.YELLOW + "#" + i + ChatColor.GRAY + "] " + ChatColor.GREEN + bot.getName()
|
print(ChatColor.GRAY + "[" + ChatColor.YELLOW + "#" + i + ChatColor.GRAY + "] " + ChatColor.GREEN + bot.getBotName()
|
||||||
+ ChatUtils.BULLET_FORMATTED + ChatColor.RED + bot.getKills() + " kills");
|
+ ChatUtils.BULLET_FORMATTED + ChatColor.RED + bot.getKills() + " kills");
|
||||||
winners.add(bot);
|
winners.add(bot);
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
package net.nuggetmc.tplus.bot.event;
|
package net.nuggetmc.tplus.bot.event;
|
||||||
|
|
||||||
import net.nuggetmc.tplus.bot.Bot;
|
import net.nuggetmc.tplus.bot.Bot;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
|
|
||||||
public class BotDeathEvent extends PlayerDeathEvent {
|
public class BotDeathEvent extends EntityDeathEvent {
|
||||||
|
|
||||||
private final Bot bot;
|
private final Bot bot;
|
||||||
|
|
||||||
public BotDeathEvent(PlayerDeathEvent event, Bot bot) {
|
public BotDeathEvent(EntityDeathEvent event, Bot bot) {
|
||||||
super(event.getEntity(), event.getDrops(), event.getDroppedExp(), event.getDeathMessage());
|
super(event.getEntity(), event.getDrops(), event.getDroppedExp());
|
||||||
this.bot = bot;
|
this.bot = bot;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4,7 +4,7 @@ import net.nuggetmc.tplus.TerminatorPlus;
|
|||||||
import net.nuggetmc.tplus.bot.Bot;
|
import net.nuggetmc.tplus.bot.Bot;
|
||||||
import net.nuggetmc.tplus.bot.BotManager;
|
import net.nuggetmc.tplus.bot.BotManager;
|
||||||
import net.nuggetmc.tplus.bot.agent.legacyagent.ai.IntelligenceAgent;
|
import net.nuggetmc.tplus.bot.agent.legacyagent.ai.IntelligenceAgent;
|
||||||
import net.nuggetmc.tplus.bot.agent.legacyagent.ai.NeuralNetwork;
|
import net.nuggetmc.tplus.api.agent.legacyagent.ai.NeuralNetwork;
|
||||||
import net.nuggetmc.tplus.command.CommandHandler;
|
import net.nuggetmc.tplus.command.CommandHandler;
|
||||||
import net.nuggetmc.tplus.command.CommandInstance;
|
import net.nuggetmc.tplus.command.CommandInstance;
|
||||||
import net.nuggetmc.tplus.command.annotation.Arg;
|
import net.nuggetmc.tplus.command.annotation.Arg;
|
||||||
@@ -6,7 +6,7 @@ import net.nuggetmc.tplus.bot.Bot;
|
|||||||
import net.nuggetmc.tplus.bot.agent.Agent;
|
import net.nuggetmc.tplus.bot.agent.Agent;
|
||||||
import net.nuggetmc.tplus.bot.agent.legacyagent.LegacyAgent;
|
import net.nuggetmc.tplus.bot.agent.legacyagent.LegacyAgent;
|
||||||
import net.nuggetmc.tplus.bot.agent.legacyagent.ai.IntelligenceAgent;
|
import net.nuggetmc.tplus.bot.agent.legacyagent.ai.IntelligenceAgent;
|
||||||
import net.nuggetmc.tplus.bot.agent.legacyagent.ai.NeuralNetwork;
|
import net.nuggetmc.tplus.api.agent.legacyagent.ai.NeuralNetwork;
|
||||||
import net.nuggetmc.tplus.command.commands.AICommand;
|
import net.nuggetmc.tplus.command.commands.AICommand;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
18
build.gradle.kts
Normal file
18
build.gradle.kts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
plugins {
|
||||||
|
id("java")
|
||||||
|
}
|
||||||
|
|
||||||
|
group = "net.tplus"
|
||||||
|
version = "3.1-BETA"
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.getByName<Test>("test") {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
118
pom.xml
118
pom.xml
@@ -1,118 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<groupId>net.nuggetmc</groupId>
|
|
||||||
<artifactId>TerminatorPlus</artifactId>
|
|
||||||
<version>3.1-BETA</version>
|
|
||||||
<name>TerminatorPlus</name>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.8.1</version>
|
|
||||||
<configuration>
|
|
||||||
<source>8</source>
|
|
||||||
<target>8</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
|
||||||
<version>3.2.4</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>shade</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
<configuration>
|
|
||||||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
|
||||||
<shadedClassifierName>shaded</shadedClassifierName>
|
|
||||||
<!--
|
|
||||||
<transformers>
|
|
||||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
|
|
||||||
</transformers>
|
|
||||||
-->
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
|
||||||
<version>2.3.1</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>specialsource-maven-plugin</artifactId>
|
|
||||||
<version>1.2.2</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>remap</goal>
|
|
||||||
</goals>
|
|
||||||
<id>remap-obf</id>
|
|
||||||
<configuration>
|
|
||||||
<srgIn>org.spigotmc:minecraft-server:1.18.1-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
|
|
||||||
<reverse>true</reverse>
|
|
||||||
<remappedDependencies>org.spigotmc:spigot:1.18.1-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
|
|
||||||
<remappedArtifactAttached>true</remappedArtifactAttached>
|
|
||||||
<remappedClassifierName>remapped-obf</remappedClassifierName>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>remap</goal>
|
|
||||||
</goals>
|
|
||||||
<id>remap-spigot</id>
|
|
||||||
<configuration>
|
|
||||||
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
|
|
||||||
<srgIn>org.spigotmc:minecraft-server:1.18.1-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
|
|
||||||
<remappedDependencies>org.spigotmc:spigot:1.18.1-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
<resources>
|
|
||||||
<resource>
|
|
||||||
<directory>src/main/resources</directory>
|
|
||||||
<filtering>true</filtering>
|
|
||||||
</resource>
|
|
||||||
</resources>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<!-- Spigot Repo -->
|
|
||||||
<repository>
|
|
||||||
<id>spigot-repo</id>
|
|
||||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
|
||||||
</repository>
|
|
||||||
<!-- Advanced Spigot Repo -->
|
|
||||||
<repository>
|
|
||||||
<id>dre-repo</id>
|
|
||||||
<url>https://erethon.de/repo/</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<!--Spigot + Bukkit -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.spigotmc</groupId>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<version>1.18.1-R0.1-SNAPSHOT</version>
|
|
||||||
<classifier>remapped-mojang</classifier>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
||||||
10
settings.gradle.kts
Normal file
10
settings.gradle.kts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
gradlePluginPortal()
|
||||||
|
maven("https://repo.papermc.io/repository/maven-public/")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = "TerminatorPlus"
|
||||||
|
include("TerminatorPlus-Plugin")
|
||||||
|
include("TerminatorPlus-API")
|
||||||
Reference in New Issue
Block a user