|
@@ -78,6 +78,7 @@ import me.km.table.TableAPI;
|
|
import net.minecraft.block.BlockCrops;
|
|
import net.minecraft.block.BlockCrops;
|
|
import net.minecraft.entity.item.EntityItem;
|
|
import net.minecraft.entity.item.EntityItem;
|
|
import net.minecraft.item.Item;
|
|
import net.minecraft.item.Item;
|
|
|
|
+import net.minecraft.server.management.PlayerList;
|
|
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;
|
|
@@ -381,7 +382,7 @@ public class MinecraftFunctions
|
|
doForGroup(in[0].get(sc), sc, p -> ((EntityPlayerMP) p).sendStatusMessage(text, true));
|
|
doForGroup(in[0].get(sc), sc, p -> ((EntityPlayerMP) p).sendStatusMessage(text, true));
|
|
return Void.TYPE;
|
|
return Void.TYPE;
|
|
});
|
|
});
|
|
- parser.registerFunction("player.kick", (sc, in) -> KajetansMod.scripts.unregisterPlayer((EntityPlayer) in[0].get(sc)));
|
|
|
|
|
|
+ parser.registerFunction("player.kick", (sc, in) -> KajetansMod.scripts.unregisterPlayer(sc, (EntityPlayer) in[0].get(sc)));
|
|
parser.registerFunction("player.playsound", (sc, in) ->
|
|
parser.registerFunction("player.playsound", (sc, in) ->
|
|
{
|
|
{
|
|
EffectUtils.playSound((EntityPlayerMP) in[0].get(sc), SoundEvent.REGISTRY.getObject(new ResourceLocation(in[1].getString(sc))), SoundCategory.MASTER);
|
|
EffectUtils.playSound((EntityPlayerMP) in[0].get(sc), SoundEvent.REGISTRY.getObject(new ResourceLocation(in[1].getString(sc))), SoundCategory.MASTER);
|
|
@@ -661,11 +662,14 @@ public class MinecraftFunctions
|
|
((Location) in[0].get(sc)).setYaw(in[1].getFloat(sc));
|
|
((Location) in[0].get(sc)).setYaw(in[1].getFloat(sc));
|
|
return Void.TYPE;
|
|
return Void.TYPE;
|
|
});
|
|
});
|
|
|
|
+ parser.registerFunction("loc.getyaw", (sc, in) -> (double) ((Location) in[0].get(sc)).getYaw());
|
|
parser.registerFunction("loc.setpitch", (sc, in) ->
|
|
parser.registerFunction("loc.setpitch", (sc, in) ->
|
|
{
|
|
{
|
|
((Location) in[0].get(sc)).setPitch(in[1].getFloat(sc));
|
|
((Location) in[0].get(sc)).setPitch(in[1].getFloat(sc));
|
|
return Void.TYPE;
|
|
return Void.TYPE;
|
|
});
|
|
});
|
|
|
|
+ parser.registerFunction("loc.getpitch", (sc, in) -> (double) ((Location) in[0].get(sc)).getPitch());
|
|
|
|
+ parser.registerFunction("loc.getworld", (sc, in) -> ((Location) in[0].get(sc)).getWorld());
|
|
parser.registerFunction("loc.distance", (sc, in) -> ((Location) in[0].get(sc)).getPos().distanceTo(((Location) in[1].get(sc)).getPos()));
|
|
parser.registerFunction("loc.distance", (sc, in) -> ((Location) in[0].get(sc)).getPos().distanceTo(((Location) in[1].get(sc)).getPos()));
|
|
parser.registerFunction("loc.mod", (sc, in) -> ((Location) in[0].get(sc)).copyAdd(in[1].getDouble(sc), in[2].getDouble(sc), in[3].getDouble(sc)));
|
|
parser.registerFunction("loc.mod", (sc, in) -> ((Location) in[0].get(sc)).copyAdd(in[1].getDouble(sc), in[2].getDouble(sc), in[3].getDouble(sc)));
|
|
parser.registerFunction("loc.getcoord", (sc, in) ->
|
|
parser.registerFunction("loc.getcoord", (sc, in) ->
|
|
@@ -724,8 +728,9 @@ public class MinecraftFunctions
|
|
});
|
|
});
|
|
parser.registerFunction("block.clone", (sc, in) ->
|
|
parser.registerFunction("block.clone", (sc, in) ->
|
|
{
|
|
{
|
|
- Location l = (Location) in[1].get(sc);
|
|
|
|
- NBTUtils.cloneBlock(l.getWorld(), ((Location) in[0].get(sc)).getBlockPos(), l.getBlockPos());
|
|
|
|
|
|
+ Location l0 = (Location) in[0].get(sc);
|
|
|
|
+ Location l1 = (Location) in[1].get(sc);
|
|
|
|
+ NBTUtils.cloneBlock(l0.getWorld(), l0.getBlockPos(), l1.getWorld(), l1.getBlockPos());
|
|
return Void.TYPE;
|
|
return Void.TYPE;
|
|
});
|
|
});
|
|
parser.registerFunction("block.set", (sc, in) ->
|
|
parser.registerFunction("block.set", (sc, in) ->
|
|
@@ -801,6 +806,33 @@ public class MinecraftFunctions
|
|
}
|
|
}
|
|
return (double) InventoryUtils.searchInventoryFor((TileEntityChest) te, (ItemStack) in[2].get(sc), in[1].getBoolean(sc));
|
|
return (double) InventoryUtils.searchInventoryFor((TileEntityChest) te, (ItemStack) in[2].get(sc), in[1].getBoolean(sc));
|
|
});
|
|
});
|
|
|
|
+ parser.registerFunction("block.getsecchest", (sc, in) ->
|
|
|
|
+ {
|
|
|
|
+ Location l = (Location) in[0].get(sc);
|
|
|
|
+ TileEntity te = l.getWorld().getTileEntity(l.getBlockPos());
|
|
|
|
+ if(te == null || !(te instanceof TileEntityChest))
|
|
|
|
+ {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ TileEntityChest chest = (TileEntityChest) te;
|
|
|
|
+ if(chest.adjacentChestXNeg != null)
|
|
|
|
+ {
|
|
|
|
+ return chest.adjacentChestXNeg.getPos();
|
|
|
|
+ }
|
|
|
|
+ if(chest.adjacentChestXPos != null)
|
|
|
|
+ {
|
|
|
|
+ return chest.adjacentChestXPos.getPos();
|
|
|
|
+ }
|
|
|
|
+ if(chest.adjacentChestZNeg != null)
|
|
|
|
+ {
|
|
|
|
+ return chest.adjacentChestZNeg.getPos();
|
|
|
|
+ }
|
|
|
|
+ if(chest.adjacentChestZPos != null)
|
|
|
|
+ {
|
|
|
|
+ return chest.adjacentChestZPos.getPos();
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ });
|
|
parser.registerFunction("block.additem", (sc, in) ->
|
|
parser.registerFunction("block.additem", (sc, in) ->
|
|
{
|
|
{
|
|
Location l = (Location) in[0].get(sc);
|
|
Location l = (Location) in[0].get(sc);
|
|
@@ -869,7 +901,7 @@ public class MinecraftFunctions
|
|
// ---------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------
|
|
// Event-Bibliothek
|
|
// Event-Bibliothek
|
|
// ---------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------
|
|
- parser.registerFunction("event.addmovedata", (sc, in) -> CustomEventCaller.registerMoveData(new PlayerMoveData(
|
|
|
|
|
|
+ parser.registerFunction("event.addmovedata", (sc, in) -> (double) CustomEventCaller.registerMoveData(new PlayerMoveData(
|
|
sc, (Location) in[0].get(sc), (Location) in[1].get(sc), in[2].getInt(sc), in[3].getInt(sc))));
|
|
sc, (Location) in[0].get(sc), (Location) in[1].get(sc), in[2].getInt(sc), in[3].getInt(sc))));
|
|
parser.registerFunction("event.removemovedata", (sc, in) ->
|
|
parser.registerFunction("event.removemovedata", (sc, in) ->
|
|
{
|
|
{
|
|
@@ -1339,7 +1371,14 @@ public class MinecraftFunctions
|
|
// ---------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------
|
|
parser.registerFunction("gdmap.removeall", (sc, in) ->
|
|
parser.registerFunction("gdmap.removeall", (sc, in) ->
|
|
{
|
|
{
|
|
- KajetansMod.scripts.getDataBank(ScriptBank.class).removeDualMap(in[0].getString(sc));
|
|
|
|
|
|
+ if(in.length >= 2)
|
|
|
|
+ {
|
|
|
|
+ KajetansMod.scripts.getDataBank(ScriptBank.class).removeDualMapElement(in[0].getString(sc), in[1].getString(sc));
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ KajetansMod.scripts.getDataBank(ScriptBank.class).removeDualMap(in[0].getString(sc));
|
|
|
|
+ }
|
|
return Void.TYPE;
|
|
return Void.TYPE;
|
|
});
|
|
});
|
|
parser.registerFunction("gdmap.add", (sc, in) ->
|
|
parser.registerFunction("gdmap.add", (sc, in) ->
|
|
@@ -1528,15 +1567,15 @@ public class MinecraftFunctions
|
|
});
|
|
});
|
|
parser.registerFunction("script.get", (sc, in) -> KajetansMod.scripts.getScript(in[0].getString(sc)));
|
|
parser.registerFunction("script.get", (sc, in) -> KajetansMod.scripts.getScript(in[0].getString(sc)));
|
|
parser.registerFunction("script.join", (sc, in) -> KajetansMod.scripts.registerPlayer((Script) in[0].get(sc), (EntityPlayer) in[1].get(sc)));
|
|
parser.registerFunction("script.join", (sc, in) -> KajetansMod.scripts.registerPlayer((Script) in[0].get(sc), (EntityPlayer) in[1].get(sc)));
|
|
- parser.registerFunction("script.kick", (sc, in) -> KajetansMod.scripts.unregisterPlayer((EntityPlayer) in[0].get(sc)));
|
|
|
|
|
|
+ parser.registerFunction("script.kick", (sc, in) -> KajetansMod.scripts.unregisterPlayer(sc, (EntityPlayer) in[0].get(sc)));
|
|
parser.registerFunction("script.getleader", (sc, in) ->
|
|
parser.registerFunction("script.getleader", (sc, in) ->
|
|
{
|
|
{
|
|
- List<EntityPlayer> players = KajetansMod.scripts.getPlayerList(sc.getId());
|
|
|
|
|
|
+ List<UUID> players = KajetansMod.scripts.getPlayerList(sc.getId());
|
|
if(players.isEmpty())
|
|
if(players.isEmpty())
|
|
{
|
|
{
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
- return players.get(0);
|
|
|
|
|
|
+ return KajetansMod.server.getPlayerList().getPlayerByUUID(players.get(0));
|
|
});
|
|
});
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------
|
|
@@ -1913,7 +1952,15 @@ public class MinecraftFunctions
|
|
switch(group.toString())
|
|
switch(group.toString())
|
|
{
|
|
{
|
|
case "all":
|
|
case "all":
|
|
- KajetansMod.scripts.getPlayerList(sc.getId()).forEach(p -> c.accept(p));
|
|
|
|
|
|
+ PlayerList list = KajetansMod.server.getPlayerList();
|
|
|
|
+ KajetansMod.scripts.getPlayerList(sc.getId()).forEach(uuid ->
|
|
|
|
+ {
|
|
|
|
+ EntityPlayerMP p = list.getPlayerByUUID(uuid);
|
|
|
|
+ if(p != null)
|
|
|
|
+ {
|
|
|
|
+ c.accept(p);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
break;
|
|
break;
|
|
case "online":
|
|
case "online":
|
|
KajetansMod.server.getPlayerList().getPlayers().forEach(p -> c.accept(p));
|
|
KajetansMod.server.getPlayerList().getPlayers().forEach(p -> c.accept(p));
|