|
@@ -80,6 +80,7 @@ import me.km.inventory.CustomContainer;
|
|
|
import me.km.networking.ModPacketHandler;
|
|
|
import me.km.pathfinder.PathfinderUtils;
|
|
|
import me.km.skills.LeveledSkill;
|
|
|
+import me.km.skills.Skill;
|
|
|
import net.minecraft.entity.item.EntityItem;
|
|
|
import net.minecraft.util.math.MathHelper;
|
|
|
import net.minecraft.util.text.ITextComponent;
|
|
@@ -376,9 +377,11 @@ public class MinecraftFunctions implements ISnuviLogger
|
|
|
parser.registerConsumer("skill.clear", (args, qd) ->
|
|
|
KajetansMod.skills.clearSkills());
|
|
|
parser.registerConsumer("skill.getactive", (args, qd) ->
|
|
|
- qd.setVar(args[0].toString(), KajetansMod.jobs.getActiveSkillMap((EntityPlayer) args[1])));
|
|
|
+ qd.setVar(args[0].toString(), KajetansMod.jobs.getActiveSkills((EntityPlayer) args[1])));
|
|
|
parser.registerFunction("skill.getid", (args, qd) ->
|
|
|
((LeveledSkill) args[0]).getId());
|
|
|
+ parser.registerFunction("skill.fromid", (args, qd) ->
|
|
|
+ getSkillFromId(args));
|
|
|
parser.registerFunction("skill.getstack", (args, qd) ->
|
|
|
((LeveledSkill) args[0]).getItemStack());
|
|
|
parser.registerFunction("skill.use", (args, qd) ->
|
|
@@ -642,7 +645,9 @@ public class MinecraftFunctions implements ISnuviLogger
|
|
|
// Inventory-Bibliothek
|
|
|
// -------------------------------------------------------------
|
|
|
parser.registerConsumer("inv.new", (args, qd) ->
|
|
|
- qd.setVar(args[0].toString(), new SnuviInventory(args[2].toString(), ScriptUtils.getInt(args[1]), ((MinecraftScript) qd).getNewId())));
|
|
|
+ qd.setVar(args[0].toString(), new SnuviInventory(args[2].toString(), ScriptUtils.getInt(args[1]), ((MinecraftScript) qd).getNewId())));
|
|
|
+ parser.registerConsumer("inv.newdynamic", (args, qd) ->
|
|
|
+ qd.setVar(args[0].toString(), new SnuviInventory(args[2].toString(), args[1].toString(), ((MinecraftScript) qd).getNewId())));
|
|
|
parser.registerConsumer("inv.loadblock", (args, qd) ->
|
|
|
qd.setVar(args[0].toString(), newInventory((Location) args[1], (MinecraftScript) qd, args[2].toString())));
|
|
|
parser.registerConsumer("inv.setitem", (args, qd) ->
|
|
@@ -704,7 +709,7 @@ public class MinecraftFunctions implements ISnuviLogger
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void printException(Exception ex, String s, int line)
|
|
|
+ public void printException(Exception ex, String function, String s, int line)
|
|
|
{
|
|
|
if(KajetansMod.debugMode || KajetansMod.scripts.getSnuviParser().printStack)
|
|
|
{
|
|
@@ -715,6 +720,10 @@ public class MinecraftFunctions implements ISnuviLogger
|
|
|
m.sendWarningToConsole("Zeile: " + line);
|
|
|
}
|
|
|
m.sendWarningToConsole("Fehler: " + ex.getClass().getSimpleName() + " - " + ex.getLocalizedMessage());
|
|
|
+ if(function != null)
|
|
|
+ {
|
|
|
+ m.sendWarningToConsole("Funktion: " + function);
|
|
|
+ }
|
|
|
}
|
|
|
sendToDevsWithSuffix("§cError in '" + s + "'");
|
|
|
if(line != -1)
|
|
@@ -722,12 +731,16 @@ public class MinecraftFunctions implements ISnuviLogger
|
|
|
sendToDevsWithHelpList("§cZeile:", String.valueOf(line));
|
|
|
}
|
|
|
sendToDevsWithHelpList("§cFehler:", ex.getClass().getSimpleName() + " - " + ex.getLocalizedMessage());
|
|
|
+ if(function != null)
|
|
|
+ {
|
|
|
+ sendToDevsWithHelpList("§cFunktion: ", function);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void printException(Exception ex, Script sc, int line)
|
|
|
+ public void printException(Exception ex, String function, Script sc, int line)
|
|
|
{
|
|
|
- printException(ex, sc == null ? "null" : sc.getName(), line);
|
|
|
+ printException(ex, function, sc == null ? "null" : sc.getName(), line);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -788,6 +801,21 @@ public class MinecraftFunctions implements ISnuviLogger
|
|
|
ScriptUtils.getInt(args[7]), ScriptUtils.getInt(args[8]));
|
|
|
}
|
|
|
|
|
|
+ private static LeveledSkill getSkillFromId(Object[] args)
|
|
|
+ {
|
|
|
+ Skill skill = KajetansMod.skills.getSkill(ScriptUtils.getInt(args[0]));
|
|
|
+ if(skill == null)
|
|
|
+ {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ byte level = (byte) EffectUtils.getEffectLevel((EntityPlayer) args[1], skill.getEffect());
|
|
|
+ if(level <= 0)
|
|
|
+ {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return new LeveledSkill(skill, level);
|
|
|
+ }
|
|
|
+
|
|
|
private static void walkTo(Object[] args)
|
|
|
{
|
|
|
Location l = (Location) args[1];
|