This repository has been archived by the owner on Jun 1, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 9
Entity Brain | Memories
GamerCoder edited this page Jan 20, 2023
·
1 revision
Memories are small bits of information stored in the Entity's Brain. They are used to store things like angry at, nearest items, and more.
Here's an example on how to get and set memories:
import me.gamercoder215.mobchip.bukkit.BukkitBrain;
import me.gamercoder215.mobchip.EntityBrain;
import me.gamercoder215.mobchip.ai.memories.EntityMemory;
// Bukkit imports...
public class MyPlugin extends JavaPlugin {
public void setMemories(Mob m) {
EntityBrain brain = BukkitBrain.getBrain(m);
// Fetch Memory Value of "HOME"
Location home = brain.getMemory(EntityMemory.HOME); // EntityMemory types are paramaterized
// Set Memory value of "HOME"
brain.setMemory(EntityMemory.HOME, m.getLocation());
// Set temporary memory value of "HOME" with expiration in ticks
brain.setMemory(EntityMemory.HOME, m.getLocation(), 20 * 60 * 20); // Will expire in 20 minutes
}
}
Copyright © 2022-Present gmitch215. All Rights Reserved.
Licensed under GNU General Public License v3.0.