Commit fa1841d6 by Jonathan Thomas

Adding lots more log statements to find behavior crash

parent f989ee44
Pipeline #11930 passed with stage
in 22 seconds
......@@ -215,7 +215,15 @@ public class ChatDataManager {
", Argument: " + behavior.getArgument() : ""));
// Apply behaviors to entity
LOGGER.info("About to check behavior name - 1");
if (behavior.getName().equals("FOLLOW")) {
LOGGER.info("FOLLOW behavior detected - 2");
if (entity != null) {
LOGGER.info("Entity is not null - 3");
}
if (player != null) {
LOGGER.info("Player is not null - 4");
}
EntityBehaviorManager.addFollowPlayerGoal(player, entity, 1.0);
} else if (behavior.getName().equals("UNFOLLOW")) {
EntityBehaviorManager.removeFollowPlayerGoal(entity);
......
......@@ -21,16 +21,22 @@ public class EntityBehaviorManager {
private static final Map<UUID, FollowPlayerGoal> followGoals = new HashMap<>();
public static void addFollowPlayerGoal(ServerPlayerEntity player, MobEntity entity, double speed) {
LOGGER.info("Start of addFollowPlayerGoal function - 5");
if (!(entity.getWorld() instanceof ServerWorld)) {
LOGGER.debug("Attempted to add FollowPlayerGoal in a non-server world. Aborting.");
return;
}
UUID entityId = entity.getUuid();
LOGGER.info("entity.getUuid(): " + entity.getUuid() + " - 6");
if (!followGoals.containsKey(entityId)) {
LOGGER.info("followGoals does not contain the key yet - 7");
FollowPlayerGoal goal = new FollowPlayerGoal(player, entity, speed);
LOGGER.info("Created FollowPlayerGoal instance - 8");
GoalSelector goalSelector = GoalUtils.getGoalSelector(entity);
goalSelector.add(1, goal); // Priority 1
LOGGER.info("Created goalSelector instance - 9");
goalSelector.add(1, goal);
LOGGER.info("Added goal to goalSelector - 10");
followGoals.put(entityId, goal);
LOGGER.info("FollowPlayerGoal added for entity UUID: {} with speed: {}", entityId, speed);
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment