Implemented custom commands.

This commit is contained in:
Luis C.M committed 2022-12-18 15:54:14 -06:00
1 parent a47af08d0f
commit 3d498814f9
3 files changed
+91 -1

No files matched your search

@@ -6,8 +6,10 @@
package noppes.npcs.scripted;
import cpw.mods.fml.common.eventhandler.EventBus;
import foxz.command.ScriptedCommand;
import jdk.nashorn.internal.ir.debug.ObjectSizeCalculator;
import net.minecraft.block.Block;
import net.minecraft.command.CommandHandler;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
@@ -69,6 +71,14 @@ public class NpcAPI extends AbstractNpcAPI {
worldCache.clear();
}
public void registerICommand(ICommand command) {
((CommandHandler)CustomNpcs.getServer().getCommandManager()).registerCommand((ScriptedCommand) command);
}
public ICommand getICommand(String commandName, int priorityLevel) {
return new ScriptedCommand(commandName,priorityLevel);
}
public void addGlobalObject(String key, Object obj) {
NpcAPI.engineObjects.put(key,obj);
}