mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 07:19:05 +00:00
Added global API.getActionManager()
This commit is contained in:
1 parent
6de09c1ee4
commit
e001beb6ba
3 files changed
+16
-2
No files matched your search
@@ -11,13 +11,22 @@ import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.client.AnalyticsTracking;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
public class ServerTickHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onServerTick(TickEvent.WorldTickEvent event) {
|
||||
public void onServerTick(TickEvent.ServerTickEvent event) {
|
||||
if (event.phase == Phase.END) {
|
||||
NpcAPI.actionManager.tick(MinecraftServer.getServer().getTickCounter());
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldTick(TickEvent.WorldTickEvent event) {
|
||||
if (event.phase == Phase.START) {
|
||||
NPCSpawning.findChunksForSpawning((WorldServer) event.world);
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ public class NpcAPI extends AbstractNpcAPI {
|
||||
private static final CacheHashMap<ItemStack, CacheHashMap.CachedObject<ScriptItemStack>> scriptItemCache = new CacheHashMap<>(60 * 1000);
|
||||
public static final HashMap<String, Object> engineObjects = new HashMap<>();
|
||||
public static final EventBus EVENT_BUS = new EventBus();
|
||||
public static final ScriptedActionManager actionManager = new ScriptedActionManager();
|
||||
private static AbstractNpcAPI instance = null;
|
||||
|
||||
private final static String API_USER_AGENT = "CNPC+API";
|
||||
@@ -559,6 +560,10 @@ public class NpcAPI extends AbstractNpcAPI {
|
||||
return container instanceof ContainerNpcInterface ? ContainerNpcInterface.getOrCreateIContainer((ContainerNpcInterface) container) : new ScriptContainer(container);
|
||||
}
|
||||
|
||||
public IActionManager getActionManager() {
|
||||
return actionManager;
|
||||
}
|
||||
|
||||
private void checkWorld() {
|
||||
if (CustomNpcs.getServer() == null || CustomNpcs.getServer().isServerStopped()) {
|
||||
throw new CustomNPCsException("No world is loaded right now");
|
||||
|
||||
Reference in new issue
Block a user