added more types, entities
This commit is contained in:
1 parent
faf4d7b7db
commit
ce8529d084
5 files changed
+108
-48
No files matched your search
@@ -591,7 +591,7 @@ public class Auxiliary {
|
|||||||
|
|
||||||
expression.addLazyFunction("current_dimension", 0, (c, t, lv) -> {
|
expression.addLazyFunction("current_dimension", 0, (c, t, lv) -> {
|
||||||
ServerCommandSource s = ((CarpetContext)c).s;
|
ServerCommandSource s = ((CarpetContext)c).s;
|
||||||
Value retval = ValueConversions.dimName(s.getWorld());
|
Value retval = ValueConversions.of(s.getWorld());
|
||||||
return (cc, tt) -> retval;
|
return (cc, tt) -> retval;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1088,7 +1088,7 @@ public class WorldAccess {
|
|||||||
StructureStart<?> start = FeatureGenerator.shouldStructureStartAt(world, pos, structure, needSize);
|
StructureStart<?> start = FeatureGenerator.shouldStructureStartAt(world, pos, structure, needSize);
|
||||||
if (start == null) return LazyValue.NULL;
|
if (start == null) return LazyValue.NULL;
|
||||||
if (!needSize) return LazyValue.TRUE;
|
if (!needSize) return LazyValue.TRUE;
|
||||||
Value ret = ValueConversions.fromStructure(start);
|
Value ret = ValueConversions.of(start);
|
||||||
return (_c, _t) -> ret;
|
return (_c, _t) -> ret;
|
||||||
}
|
}
|
||||||
Map<Value, Value> ret = new HashMap<>();
|
Map<Value, Value> ret = new HashMap<>();
|
||||||
@@ -1098,7 +1098,7 @@ public class WorldAccess {
|
|||||||
if (start == null) continue;
|
if (start == null) continue;
|
||||||
|
|
||||||
Value key = new StringValue(NBTSerializableValue.nameFromRegistryId(Registry.STRUCTURE_FEATURE.getId(str)));
|
Value key = new StringValue(NBTSerializableValue.nameFromRegistryId(Registry.STRUCTURE_FEATURE.getId(str)));
|
||||||
ret.put(key, (!needSize)?Value.NULL: ValueConversions.fromStructure(start));
|
ret.put(key, (!needSize)?Value.NULL: ValueConversions.of(start));
|
||||||
}
|
}
|
||||||
Value retMap = MapValue.wrap(ret);
|
Value retMap = MapValue.wrap(ret);
|
||||||
return (_c, _t) -> retMap;
|
return (_c, _t) -> retMap;
|
||||||
@@ -1130,7 +1130,7 @@ public class WorldAccess {
|
|||||||
}
|
}
|
||||||
String structureName = lv.get(locator.offset).evalValue(c).getString().toLowerCase(Locale.ROOT);
|
String structureName = lv.get(locator.offset).evalValue(c).getString().toLowerCase(Locale.ROOT);
|
||||||
StructureStart start = structures.get(Registry.STRUCTURE_FEATURE.get(new Identifier(structureName)));
|
StructureStart start = structures.get(Registry.STRUCTURE_FEATURE.get(new Identifier(structureName)));
|
||||||
Value ret = ValueConversions.fromStructure(start);
|
Value ret = ValueConversions.of(start);
|
||||||
return (_c, _t) -> ret;
|
return (_c, _t) -> ret;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import carpet.fakes.BlockStateArgumentInterface;
|
|||||||
import carpet.script.CarpetScriptHost;
|
import carpet.script.CarpetScriptHost;
|
||||||
import carpet.script.exception.InternalExpressionException;
|
import carpet.script.exception.InternalExpressionException;
|
||||||
import carpet.script.value.BlockValue;
|
import carpet.script.value.BlockValue;
|
||||||
|
import carpet.script.value.EntityValue;
|
||||||
import carpet.script.value.ListValue;
|
import carpet.script.value.ListValue;
|
||||||
import carpet.script.value.NumericValue;
|
import carpet.script.value.NumericValue;
|
||||||
import carpet.script.value.StringValue;
|
import carpet.script.value.StringValue;
|
||||||
@@ -27,10 +28,14 @@ import net.minecraft.command.argument.BlockPosArgumentType;
|
|||||||
import net.minecraft.command.argument.BlockStateArgument;
|
import net.minecraft.command.argument.BlockStateArgument;
|
||||||
import net.minecraft.command.argument.BlockStateArgumentType;
|
import net.minecraft.command.argument.BlockStateArgumentType;
|
||||||
import net.minecraft.command.argument.ColorArgumentType;
|
import net.minecraft.command.argument.ColorArgumentType;
|
||||||
|
import net.minecraft.command.argument.ColumnPosArgumentType;
|
||||||
|
import net.minecraft.command.argument.DimensionArgumentType;
|
||||||
|
import net.minecraft.command.argument.EntityArgumentType;
|
||||||
import net.minecraft.command.argument.RotationArgumentType;
|
import net.minecraft.command.argument.RotationArgumentType;
|
||||||
import net.minecraft.command.argument.SwizzleArgumentType;
|
import net.minecraft.command.argument.SwizzleArgumentType;
|
||||||
import net.minecraft.command.argument.TimeArgumentType;
|
import net.minecraft.command.argument.TimeArgumentType;
|
||||||
import net.minecraft.command.argument.Vec3ArgumentType;
|
import net.minecraft.command.argument.Vec3ArgumentType;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.LiteralText;
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
@@ -45,7 +50,6 @@ import java.util.Locale;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.function.BiFunction;
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -57,21 +61,17 @@ public abstract class CommandArgument
|
|||||||
private static final List<? extends CommandArgument> baseTypes = Lists.newArrayList(
|
private static final List<? extends CommandArgument> baseTypes = Lists.newArrayList(
|
||||||
// default
|
// default
|
||||||
new StringArgument(),
|
new StringArgument(),
|
||||||
// other customizable string arguments
|
// vanilla arguments as per https://minecraft.gamepedia.com/Argument_types
|
||||||
new WordArgument(), new GreedyStringArgument(),
|
|
||||||
new BlockPosArgument(), new FloatArgument(), new IntArgument(),
|
|
||||||
// etc...
|
|
||||||
// vanilla arguments
|
|
||||||
new VanillaUnconfigurableArgument( "bool",
|
new VanillaUnconfigurableArgument( "bool",
|
||||||
BoolArgumentType::bool,
|
BoolArgumentType::bool, (c, p) -> new NumericValue(BoolArgumentType.getBool(c, p)), false
|
||||||
(c, p) -> new NumericValue(BoolArgumentType.getBool(c, p)),
|
|
||||||
false
|
|
||||||
),
|
),
|
||||||
|
new FloatArgument(),
|
||||||
|
new IntArgument(),
|
||||||
|
new WordArgument(), new GreedyStringArgument(),
|
||||||
new VanillaUnconfigurableArgument( "yaw", // angle
|
new VanillaUnconfigurableArgument( "yaw", // angle
|
||||||
AngleArgumentType::angle,
|
AngleArgumentType::angle, (c, p) -> new NumericValue(AngleArgumentType.getAngle(c, p)), true
|
||||||
(c, p) -> new NumericValue(AngleArgumentType.getAngle(c, p)),
|
|
||||||
true
|
|
||||||
),
|
),
|
||||||
|
new BlockPosArgument(),
|
||||||
new VanillaUnconfigurableArgument( "block",
|
new VanillaUnconfigurableArgument( "block",
|
||||||
BlockStateArgumentType::blockState,
|
BlockStateArgumentType::blockState,
|
||||||
(c, p) -> {
|
(c, p) -> {
|
||||||
@@ -89,9 +89,14 @@ public abstract class CommandArgument
|
|||||||
},
|
},
|
||||||
false
|
false
|
||||||
),
|
),
|
||||||
// columnpos
|
new VanillaUnconfigurableArgument("columnpos",
|
||||||
|
ColumnPosArgumentType::columnPos, (c, p) -> ValueConversions.of(ColumnPosArgumentType.getColumnPos(c, p)), false
|
||||||
|
),
|
||||||
// component // raw json
|
// component // raw json
|
||||||
// dimension
|
new VanillaUnconfigurableArgument("dimension",
|
||||||
|
DimensionArgumentType::dimension, (c, p) -> ValueConversions.of(DimensionArgumentType.getDimensionArgument(c, p)), false
|
||||||
|
),
|
||||||
|
new EntityArgument(),
|
||||||
// entity
|
// entity
|
||||||
// anchor // entity_anchor
|
// anchor // entity_anchor
|
||||||
// entitytype // entity_summon
|
// entitytype // entity_summon
|
||||||
@@ -123,15 +128,11 @@ public abstract class CommandArgument
|
|||||||
// scoreholder
|
// scoreholder
|
||||||
// scoreboardslot
|
// scoreboardslot
|
||||||
new VanillaUnconfigurableArgument("swizzle",
|
new VanillaUnconfigurableArgument("swizzle",
|
||||||
SwizzleArgumentType::swizzle,
|
SwizzleArgumentType::swizzle, (c, p) -> StringValue.of(SwizzleArgumentType.getSwizzle(c, p).stream().map(Direction.Axis::asString).collect(Collectors.joining())), true
|
||||||
(c, p) -> StringValue.of(SwizzleArgumentType.getSwizzle(c, p).stream().map(Direction.Axis::asString).collect(Collectors.joining())),
|
|
||||||
true
|
|
||||||
),
|
),
|
||||||
// team
|
// team
|
||||||
new VanillaUnconfigurableArgument("time",
|
new VanillaUnconfigurableArgument("time",
|
||||||
TimeArgumentType::time,
|
TimeArgumentType::time, (c, p) -> new NumericValue(IntegerArgumentType.getInteger(c, p)), false
|
||||||
(c, p) -> new NumericValue(IntegerArgumentType.getInteger(c, p)),
|
|
||||||
false
|
|
||||||
),
|
),
|
||||||
// uuid
|
// uuid
|
||||||
// columnlocation // vec2
|
// columnlocation // vec2
|
||||||
@@ -342,7 +343,7 @@ public abstract class CommandArgument
|
|||||||
BlockPos pos = mustBeLoaded
|
BlockPos pos = mustBeLoaded
|
||||||
? BlockPosArgumentType.getLoadedBlockPos(context, param)
|
? BlockPosArgumentType.getLoadedBlockPos(context, param)
|
||||||
: BlockPosArgumentType.getBlockPos(context, param);
|
: BlockPosArgumentType.getBlockPos(context, param);
|
||||||
return ValueConversions.fromPos(pos);
|
return ValueConversions.of(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -377,7 +378,7 @@ public abstract class CommandArgument
|
|||||||
@Override
|
@Override
|
||||||
protected Value getValueFromContext(CommandContext<ServerCommandSource> context, String param) throws CommandSyntaxException
|
protected Value getValueFromContext(CommandContext<ServerCommandSource> context, String param) throws CommandSyntaxException
|
||||||
{
|
{
|
||||||
return ValueConversions.fromVec(Vec3ArgumentType.getVec3(context, param));
|
return ValueConversions.of(Vec3ArgumentType.getVec3(context, param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -394,6 +395,59 @@ public abstract class CommandArgument
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class EntityArgument extends CommandArgument
|
||||||
|
{
|
||||||
|
boolean onlyFans;
|
||||||
|
boolean single;
|
||||||
|
|
||||||
|
private EntityArgument()
|
||||||
|
{
|
||||||
|
super("entity", EntityArgumentType.entities().getExamples(), false);
|
||||||
|
onlyFans = false;
|
||||||
|
single = false;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected ArgumentType<?> getArgumentType()
|
||||||
|
{
|
||||||
|
if (onlyFans)
|
||||||
|
{
|
||||||
|
return single?EntityArgumentType.player():EntityArgumentType.players();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return single?EntityArgumentType.entity():EntityArgumentType.entities();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Value getValueFromContext(CommandContext<ServerCommandSource> context, String param) throws CommandSyntaxException
|
||||||
|
{
|
||||||
|
List<? extends Entity> founds = (List)EntityArgumentType.getOptionalEntities(context, param);
|
||||||
|
if (single)
|
||||||
|
{
|
||||||
|
return founds.isEmpty()?Value.NULL:new EntityValue(founds.get(0));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ListValue.wrap(founds.stream().map(EntityValue::new).collect(Collectors.toList()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure(Map<String, Value> config)
|
||||||
|
{
|
||||||
|
super.configure(config);
|
||||||
|
onlyFans = config.getOrDefault("players", Value.FALSE).getBoolean();
|
||||||
|
single = config.getOrDefault("single", Value.FALSE).getBoolean();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Supplier<CommandArgument> builder()
|
||||||
|
{
|
||||||
|
return EntityArgument::new;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static class FloatArgument extends CommandArgument
|
private static class FloatArgument extends CommandArgument
|
||||||
{
|
{
|
||||||
private Double min = null;
|
private Double min = null;
|
||||||
@@ -496,15 +550,21 @@ public abstract class CommandArgument
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
private interface ValueExtractor
|
||||||
|
{
|
||||||
|
Value apply(CommandContext<ServerCommandSource> ctx, String param) throws CommandSyntaxException;
|
||||||
|
}
|
||||||
|
|
||||||
public static class VanillaUnconfigurableArgument extends CommandArgument
|
public static class VanillaUnconfigurableArgument extends CommandArgument
|
||||||
{
|
{
|
||||||
private Supplier<ArgumentType<?>> argumentTypeSupplier;
|
private Supplier<ArgumentType<?>> argumentTypeSupplier;
|
||||||
private BiFunction<CommandContext<ServerCommandSource>, String, Value> valueExtractor;
|
private ValueExtractor valueExtractor;
|
||||||
private boolean providesExamples;
|
private boolean providesExamples;
|
||||||
public VanillaUnconfigurableArgument(
|
public VanillaUnconfigurableArgument(
|
||||||
String suffix,
|
String suffix,
|
||||||
Supplier<ArgumentType<?>> argumentTypeSupplier,
|
Supplier<ArgumentType<?>> argumentTypeSupplier,
|
||||||
BiFunction<CommandContext<ServerCommandSource>, String, Value> valueExtractor,
|
ValueExtractor valueExtractor,
|
||||||
boolean providesExamples
|
boolean providesExamples
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import carpet.script.CarpetContext;
|
|||||||
import carpet.script.EntityEventsGroup;
|
import carpet.script.EntityEventsGroup;
|
||||||
import carpet.script.argument.Vector3Argument;
|
import carpet.script.argument.Vector3Argument;
|
||||||
import carpet.script.exception.InternalExpressionException;
|
import carpet.script.exception.InternalExpressionException;
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.mojang.brigadier.StringReader;
|
import com.mojang.brigadier.StringReader;
|
||||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
@@ -66,13 +65,11 @@ import net.minecraft.util.registry.Registry;
|
|||||||
import net.minecraft.util.registry.RegistryKey;
|
import net.minecraft.util.registry.RegistryKey;
|
||||||
import net.minecraft.world.GameMode;
|
import net.minecraft.world.GameMode;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -444,8 +441,8 @@ public class EntityValue extends Value
|
|||||||
ServerPlayerEntity spe = (ServerPlayerEntity)e;
|
ServerPlayerEntity spe = (ServerPlayerEntity)e;
|
||||||
if (spe.getSpawnPointPosition() == null) return Value.FALSE;
|
if (spe.getSpawnPointPosition() == null) return Value.FALSE;
|
||||||
return ListValue.of(
|
return ListValue.of(
|
||||||
ValueConversions.fromPos(spe.getSpawnPointPosition()),
|
ValueConversions.of(spe.getSpawnPointPosition()),
|
||||||
ValueConversions.dimName(spe.getSpawnPointDimension()),
|
ValueConversions.of(spe.getSpawnPointDimension()),
|
||||||
new NumericValue(spe.getSpawnAngle()),
|
new NumericValue(spe.getSpawnAngle()),
|
||||||
new NumericValue(spe.isSpawnPointSet()) // true if forced spawn point
|
new NumericValue(spe.isSpawnPointSet()) // true if forced spawn point
|
||||||
);
|
);
|
||||||
@@ -715,7 +712,7 @@ public class EntityValue extends Value
|
|||||||
hitres = Tracer.rayTraceBlocks(e, 1, reach, liquids);
|
hitres = Tracer.rayTraceBlocks(e, 1, reach, liquids);
|
||||||
|
|
||||||
if (hitres == null) return Value.NULL;
|
if (hitres == null) return Value.NULL;
|
||||||
if (exact && hitres.getType() != HitResult.Type.MISS) return ValueConversions.fromVec(hitres.getPos());
|
if (exact && hitres.getType() != HitResult.Type.MISS) return ValueConversions.of(hitres.getPos());
|
||||||
switch (hitres.getType())
|
switch (hitres.getType())
|
||||||
{
|
{
|
||||||
case MISS: return Value.NULL;
|
case MISS: return Value.NULL;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import net.minecraft.util.Identifier;
|
|||||||
import net.minecraft.util.dynamic.GlobalPos;
|
import net.minecraft.util.dynamic.GlobalPos;
|
||||||
import net.minecraft.util.math.BlockBox;
|
import net.minecraft.util.math.BlockBox;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.ColumnPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraft.util.registry.RegistryKey;
|
import net.minecraft.util.registry.RegistryKey;
|
||||||
@@ -33,25 +34,27 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
public class ValueConversions
|
public class ValueConversions
|
||||||
{
|
{
|
||||||
public static Value fromPos(BlockPos pos)
|
public static Value of(BlockPos pos)
|
||||||
{
|
{
|
||||||
return ListValue.of(new NumericValue(pos.getX()), new NumericValue(pos.getY()), new NumericValue(pos.getZ()));
|
return ListValue.of(new NumericValue(pos.getX()), new NumericValue(pos.getY()), new NumericValue(pos.getZ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Value fromPosOptional(BlockPos pos)
|
public static Value ofOptional(BlockPos pos)
|
||||||
{
|
{
|
||||||
if (pos == null) return Value.NULL;
|
if (pos == null) return Value.NULL;
|
||||||
return ListValue.of(new NumericValue(pos.getX()), new NumericValue(pos.getY()), new NumericValue(pos.getZ()));
|
return ListValue.of(new NumericValue(pos.getX()), new NumericValue(pos.getY()), new NumericValue(pos.getZ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Value fromVec(Vec3d vec)
|
public static Value of(Vec3d vec)
|
||||||
{
|
{
|
||||||
return ListValue.of(new NumericValue(vec.x), new NumericValue(vec.y), new NumericValue(vec.z));
|
return ListValue.of(new NumericValue(vec.x), new NumericValue(vec.y), new NumericValue(vec.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Value dimName(ServerWorld world)
|
public static Value of(ColumnPos cpos) { return ListValue.of(new NumericValue(cpos.x), new NumericValue(cpos.z));}
|
||||||
|
|
||||||
|
public static Value of(ServerWorld world)
|
||||||
{
|
{
|
||||||
return ofId(world.getRegistryKey().getValue());
|
return of(world.getRegistryKey().getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static World dimFromValue(Value dimensionValue, MinecraftServer server)
|
public static World dimFromValue(Value dimensionValue, MinecraftServer server)
|
||||||
@@ -105,12 +108,12 @@ public class ValueConversions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Value dimName(RegistryKey<World> dim)
|
public static Value of(RegistryKey<World> dim)
|
||||||
{
|
{
|
||||||
return ofId(dim.getValue());
|
return of(dim.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Value ofId(Identifier id)
|
public static Value of(Identifier id)
|
||||||
{
|
{
|
||||||
if (id == null) // should be Value.NULL
|
if (id == null) // should be Value.NULL
|
||||||
return Value.NULL;
|
return Value.NULL;
|
||||||
@@ -128,11 +131,11 @@ public class ValueConversions
|
|||||||
return id.toString();
|
return id.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Value ofGlobalPos(GlobalPos pos)
|
public static Value of(GlobalPos pos)
|
||||||
{
|
{
|
||||||
return ListValue.of(
|
return ListValue.of(
|
||||||
ValueConversions.dimName(pos.getDimension()),
|
ValueConversions.of(pos.getDimension()),
|
||||||
ValueConversions.fromPos(pos.getPos())
|
ValueConversions.of(pos.getPos())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,7 +168,7 @@ public class ValueConversions
|
|||||||
if (v instanceof GlobalPos)
|
if (v instanceof GlobalPos)
|
||||||
{
|
{
|
||||||
GlobalPos pos = (GlobalPos)v;
|
GlobalPos pos = (GlobalPos)v;
|
||||||
return ofGlobalPos(pos);
|
return of(pos);
|
||||||
}
|
}
|
||||||
if (v instanceof Entity)
|
if (v instanceof Entity)
|
||||||
{
|
{
|
||||||
@@ -226,7 +229,7 @@ public class ValueConversions
|
|||||||
}
|
}
|
||||||
if (el instanceof GlobalPos)
|
if (el instanceof GlobalPos)
|
||||||
{
|
{
|
||||||
return ListValue.wrap((List<Value>) l.stream().map(o -> ofGlobalPos((GlobalPos) o)).collect(Collectors.toList()));
|
return ListValue.wrap((List<Value>) l.stream().map(o -> of((GlobalPos) o)).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Value.NULL;
|
return Value.NULL;
|
||||||
@@ -241,7 +244,7 @@ public class ValueConversions
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Value fromStructure(StructureStart<?> structure)
|
public static Value of(StructureStart<?> structure)
|
||||||
{
|
{
|
||||||
if (structure == null || structure == StructureStart.DEFAULT) return Value.NULL;
|
if (structure == null || structure == StructureStart.DEFAULT) return Value.NULL;
|
||||||
List<Value> pieces = new ArrayList<>();
|
List<Value> pieces = new ArrayList<>();
|
||||||
|
|||||||
Reference in new issue
Block a user