Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Yardstick library #5

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions yardstick/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>nl.tudelft</groupId>
<artifactId>yardstick</artifactId>
<version>1.0.3-SNAPSHOT</version>
<version>1.0.3-library-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -76,16 +76,16 @@

<!-- PacketLib -->
<dependency>
<groupId>science.atlarge.opencraft</groupId>
<artifactId>packetlib</artifactId>
<version>1.2.1-SNAPSHOT</version>
<groupId>com.github.Steveice10</groupId>
<artifactId>PacketLib</artifactId>
<version>1.2</version>
</dependency>

<!-- MCProtocolLib -->
<dependency>
<groupId>science.atlarge.opencraft</groupId>
<artifactId>mcprotocollib</artifactId>
<version>1.12.2-3-SNAPSHOT</version>
<groupId>com.github.Steveice10</groupId>
<artifactId>MCProtocolLib</artifactId>
<version>1.12.2-2</version>
</dependency>

<!-- Prometheus -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
*/
public class Yardstick {

public static final GlobalLogger LOGGER = GlobalLogger.setupGlobalLogger("Yardstick");
public static final GlobalLogger LOGGER = GlobalLogger.getLogger();
public static final Options OPTIONS = new Options();
public static final StatisticsPusher PROMETHEUS = new StatisticsPusher();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
package nl.tudelft.opencraft.yardstick.bot;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.github.steveice10.mc.protocol.MinecraftProtocol;
import com.github.steveice10.packetlib.Client;
import com.github.steveice10.packetlib.event.session.DisconnectedEvent;
import com.github.steveice10.packetlib.event.session.SessionAdapter;
import com.github.steveice10.packetlib.event.session.SessionListener;
import com.github.steveice10.packetlib.tcp.TcpSessionFactory;
import nl.tudelft.opencraft.yardstick.bot.ai.pathfinding.astar.SimpleAStar;
import nl.tudelft.opencraft.yardstick.bot.ai.pathfinding.astar.heuristic.EuclideanHeuristic;
import nl.tudelft.opencraft.yardstick.bot.ai.task.TaskExecutor;
Expand All @@ -27,12 +33,6 @@
import nl.tudelft.opencraft.yardstick.bot.world.World;
import nl.tudelft.opencraft.yardstick.logging.GlobalLogger;
import nl.tudelft.opencraft.yardstick.logging.SubLogger;
import science.atlarge.opencraft.mcprotocollib.MinecraftProtocol;
import science.atlarge.opencraft.packetlib.Client;
import science.atlarge.opencraft.packetlib.event.session.DisconnectedEvent;
import science.atlarge.opencraft.packetlib.event.session.SessionAdapter;
import science.atlarge.opencraft.packetlib.event.session.SessionListener;
import science.atlarge.opencraft.packetlib.tcp.TcpSessionFactory;

/**
* Represents a Minecraft simulated bot.
Expand Down Expand Up @@ -69,7 +69,7 @@ public class Bot {
* @param port the port of the Minecraft server.
*/
public Bot(MinecraftProtocol protocol, String host, int port) {
this(protocol, new Client(host, port, protocol, new TcpSessionFactory(true)));
this(protocol, new Client(host, port, protocol, new TcpSessionFactory()));
}

/**
Expand All @@ -94,6 +94,11 @@ public void disconnected(DisconnectedEvent event) {
disconnected = true;
}
});

// If the provided client is already connected, start the ticker right away.
if (client.getSession().isConnected()) {
ticker.start();
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@

package nl.tudelft.opencraft.yardstick.bot;

import science.atlarge.opencraft.mcprotocollib.data.game.entity.metadata.ItemStack;
import science.atlarge.opencraft.mcprotocollib.data.game.entity.metadata.Position;
import science.atlarge.opencraft.mcprotocollib.data.game.entity.player.Hand;
import science.atlarge.opencraft.mcprotocollib.data.game.entity.player.PlayerAction;
import science.atlarge.opencraft.mcprotocollib.packet.ingame.client.player.ClientPlayerActionPacket;
import science.atlarge.opencraft.mcprotocollib.packet.ingame.client.player.ClientPlayerPlaceBlockPacket;
import science.atlarge.opencraft.mcprotocollib.packet.ingame.client.player.ClientPlayerPositionPacket;
import science.atlarge.opencraft.mcprotocollib.packet.ingame.client.player.ClientPlayerRotationPacket;
import science.atlarge.opencraft.mcprotocollib.packet.ingame.client.player.ClientPlayerSwingArmPacket;
import science.atlarge.opencraft.mcprotocollib.packet.ingame.client.window.ClientCreativeInventoryActionPacket;
import science.atlarge.opencraft.packetlib.Session;
import science.atlarge.opencraft.packetlib.packet.Packet;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerActionPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPlaceBlockPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerRotationPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerSwingArmPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCreativeInventoryActionPacket;
import com.github.steveice10.packetlib.Session;
import com.github.steveice10.packetlib.packet.Packet;
import nl.tudelft.opencraft.yardstick.bot.entity.BotPlayer;
import nl.tudelft.opencraft.yardstick.bot.world.Block;
import nl.tudelft.opencraft.yardstick.bot.world.BlockFace;
Expand Down
Loading