|
@@ -82,7 +82,6 @@ import me.km.pathfinder.PathfinderUtils;
|
|
import me.km.skills.LeveledSkill;
|
|
import me.km.skills.LeveledSkill;
|
|
import me.km.skills.Skill;
|
|
import me.km.skills.Skill;
|
|
import net.minecraft.entity.item.EntityItem;
|
|
import net.minecraft.entity.item.EntityItem;
|
|
-import net.minecraft.inventory.Slot;
|
|
|
|
import net.minecraft.util.NonNullList;
|
|
import net.minecraft.util.NonNullList;
|
|
import net.minecraft.util.math.MathHelper;
|
|
import net.minecraft.util.math.MathHelper;
|
|
import net.minecraft.util.text.ITextComponent;
|
|
import net.minecraft.util.text.ITextComponent;
|
|
@@ -310,12 +309,46 @@ public class MinecraftFunctions implements ISnuviLogger
|
|
// -------------------------------------------------------------
|
|
// -------------------------------------------------------------
|
|
// Location-Bibliothek
|
|
// Location-Bibliothek
|
|
// -------------------------------------------------------------
|
|
// -------------------------------------------------------------
|
|
- parser.registerFunction("loc.distance", (args, qd) ->
|
|
|
|
- Fraction.fromDouble(((Location) args[0]).getPos().distanceTo(((Location) args[1]).getPos())));
|
|
|
|
|
|
+ parser.registerFunction("loc.new", (args, qd) ->
|
|
|
|
+ {
|
|
|
|
+ if(args.length >= 6)
|
|
|
|
+ {
|
|
|
|
+ return new Location(ModDimensions.getWorldFromName(args[0].toString()),
|
|
|
|
+ ScriptUtils.getDouble(args[0]), ScriptUtils.getDouble(args[1]), ScriptUtils.getDouble(args[2]),
|
|
|
|
+ ScriptUtils.getFloat(args[3]), ScriptUtils.getFloat(args[4]));
|
|
|
|
+ }
|
|
|
|
+ return new Location(ModDimensions.getWorldFromName(args[0].toString()),
|
|
|
|
+ ScriptUtils.getDouble(args[0]), ScriptUtils.getDouble(args[1]), ScriptUtils.getDouble(args[2]), 0, 0);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ parser.registerFunction("loc.getx", (args, qd) ->
|
|
|
|
+ ((Location) args[0]).getX());
|
|
|
|
+ parser.registerFunction("loc.gety", (args, qd) ->
|
|
|
|
+ ((Location) args[0]).getY());
|
|
|
|
+ parser.registerFunction("loc.getz", (args, qd) ->
|
|
|
|
+ ((Location) args[0]).getZ());
|
|
|
|
+
|
|
|
|
+ parser.registerConsumer("loc.setx", (args, qd) ->
|
|
|
|
+ ((Location) args[0]).setX(ScriptUtils.getDouble(args[1])));
|
|
|
|
+ parser.registerConsumer("loc.sety", (args, qd) ->
|
|
|
|
+ ((Location) args[0]).setY(ScriptUtils.getDouble(args[1])));
|
|
|
|
+ parser.registerConsumer("loc.setz", (args, qd) ->
|
|
|
|
+ ((Location) args[0]).setZ(ScriptUtils.getDouble(args[1])));
|
|
|
|
+
|
|
|
|
+ parser.registerConsumer("loc.addx", (args, qd) ->
|
|
|
|
+ ((Location) args[0]).addX(ScriptUtils.getDouble(args[1])));
|
|
|
|
+ parser.registerConsumer("loc.addy", (args, qd) ->
|
|
|
|
+ ((Location) args[0]).addY(ScriptUtils.getDouble(args[1])));
|
|
|
|
+ parser.registerConsumer("loc.addz", (args, qd) ->
|
|
|
|
+ ((Location) args[0]).addZ(ScriptUtils.getDouble(args[1])));
|
|
|
|
+
|
|
parser.registerConsumer("loc.setyaw", (args, qd) ->
|
|
parser.registerConsumer("loc.setyaw", (args, qd) ->
|
|
((Location) args[0]).setYaw(ScriptUtils.getFloat(args[1])));
|
|
((Location) args[0]).setYaw(ScriptUtils.getFloat(args[1])));
|
|
parser.registerConsumer("loc.setpitch", (args, qd) ->
|
|
parser.registerConsumer("loc.setpitch", (args, qd) ->
|
|
((Location) args[0]).setPitch(ScriptUtils.getFloat(args[1])));
|
|
((Location) args[0]).setPitch(ScriptUtils.getFloat(args[1])));
|
|
|
|
+
|
|
|
|
+ parser.registerFunction("loc.distance", (args, qd) ->
|
|
|
|
+ Fraction.fromDouble(((Location) args[0]).getPos().distanceTo(((Location) args[1]).getPos())));
|
|
parser.registerFunction("loc.mod", (args, qd) ->
|
|
parser.registerFunction("loc.mod", (args, qd) ->
|
|
((Location) args[0]).copyAdd(ScriptUtils.getDouble(args[1]), ScriptUtils.getDouble(args[2]), ScriptUtils.getDouble(args[3])));
|
|
((Location) args[0]).copyAdd(ScriptUtils.getDouble(args[1]), ScriptUtils.getDouble(args[2]), ScriptUtils.getDouble(args[3])));
|
|
parser.registerFunction("loc.getcoord", (args, qd) ->
|
|
parser.registerFunction("loc.getcoord", (args, qd) ->
|
|
@@ -538,6 +571,15 @@ public class MinecraftFunctions implements ISnuviLogger
|
|
qd.setVar(args[0].toString(), KajetansMod.scripts.getDataBank(ScriptBank.class).getGlobalMapAsTable(args[1].toString())));
|
|
qd.setVar(args[0].toString(), KajetansMod.scripts.getDataBank(ScriptBank.class).getGlobalMapAsTable(args[1].toString())));
|
|
parser.registerFunction("gmap.get", (args, qd) ->
|
|
parser.registerFunction("gmap.get", (args, qd) ->
|
|
KajetansMod.scripts.getDataBank(ScriptBank.class).getMapValue(args[0].toString(), args[1].toString()));
|
|
KajetansMod.scripts.getDataBank(ScriptBank.class).getMapValue(args[0].toString(), args[1].toString()));
|
|
|
|
+ parser.registerFunction("gmap.getordefault", (args, qd) ->
|
|
|
|
+ {
|
|
|
|
+ Object o = KajetansMod.scripts.getDataBank(ScriptBank.class).getMapValue(args[0].toString(), args[1].toString());
|
|
|
|
+ if(o == null)
|
|
|
|
+ {
|
|
|
|
+ return args[2];
|
|
|
|
+ }
|
|
|
|
+ return o;
|
|
|
|
+ });
|
|
|
|
|
|
// -------------------------------------------------------------
|
|
// -------------------------------------------------------------
|
|
// GDMap-Bibliothek
|
|
// GDMap-Bibliothek
|
|
@@ -552,6 +594,15 @@ public class MinecraftFunctions implements ISnuviLogger
|
|
qd.setVar(args[0].toString(), KajetansMod.scripts.getDataBank(ScriptBank.class).getGlobalDualMapAsTable(args[1].toString(), args[2].toString())));
|
|
qd.setVar(args[0].toString(), KajetansMod.scripts.getDataBank(ScriptBank.class).getGlobalDualMapAsTable(args[1].toString(), args[2].toString())));
|
|
parser.registerFunction("gdmap.get", (args, qd) ->
|
|
parser.registerFunction("gdmap.get", (args, qd) ->
|
|
KajetansMod.scripts.getDataBank(ScriptBank.class).getDualMapValue(args[0].toString(), args[1].toString(), args[2].toString()));
|
|
KajetansMod.scripts.getDataBank(ScriptBank.class).getDualMapValue(args[0].toString(), args[1].toString(), args[2].toString()));
|
|
|
|
+ parser.registerFunction("gdmap.getordefault", (args, qd) ->
|
|
|
|
+ {
|
|
|
|
+ Object o = KajetansMod.scripts.getDataBank(ScriptBank.class).getDualMapValue(args[0].toString(), args[1].toString(), args[2].toString());
|
|
|
|
+ if(o == null)
|
|
|
|
+ {
|
|
|
|
+ return args[3];
|
|
|
|
+ }
|
|
|
|
+ return o;
|
|
|
|
+ });
|
|
|
|
|
|
// -------------------------------------------------------------
|
|
// -------------------------------------------------------------
|
|
// Table-Bibliothek
|
|
// Table-Bibliothek
|
|
@@ -576,6 +627,8 @@ public class MinecraftFunctions implements ISnuviLogger
|
|
((Table) args[0]).removeRow(ScriptUtils.getInt(args[1])));
|
|
((Table) args[0]).removeRow(ScriptUtils.getInt(args[1])));
|
|
parser.registerFunction("table.get", (args, qd) ->
|
|
parser.registerFunction("table.get", (args, qd) ->
|
|
((Table) args[0]).getElement(ScriptUtils.getInt(args[1]), ScriptUtils.getInt(args[2])));
|
|
((Table) args[0]).getElement(ScriptUtils.getInt(args[1]), ScriptUtils.getInt(args[2])));
|
|
|
|
+ parser.registerConsumer("table.set", (args, qd) ->
|
|
|
|
+ ((Table) args[0]).setElement(ScriptUtils.getInt(args[1]), ScriptUtils.getInt(args[2]), args[3]));
|
|
parser.registerFunction("table.getindexof", (args, qd) ->
|
|
parser.registerFunction("table.getindexof", (args, qd) ->
|
|
new Fraction(((Table) args[0]).getIndexOf(args[1])));
|
|
new Fraction(((Table) args[0]).getIndexOf(args[1])));
|
|
parser.registerConsumer("table.setsortcolumn", (args, qd) ->
|
|
parser.registerConsumer("table.setsortcolumn", (args, qd) ->
|