Simplify and slightly optimize EntityClassDescriptor
Could probably also be a record, though I'll look into that at another time
This commit is contained in:
2 files changed
+13
-23
No files matched your search
@@ -244,7 +244,7 @@ public class Entities {
|
||||
{
|
||||
if (lv.size() > 1) throw new InternalExpressionException("'entity_types' requires one or no arguments");
|
||||
String desc = (lv.size() == 1)?lv.get(0).getString():"*";
|
||||
return EntityValue.getEntityDescriptor(desc, ((CarpetContext) c).s.getServer()).listValue;
|
||||
return EntityValue.getEntityDescriptor(desc, ((CarpetContext) c).s.getServer()).listValue();
|
||||
});
|
||||
|
||||
expression.addContextFunction("entity_load_handler", -1, (c, t, lv) ->
|
||||
@@ -255,7 +255,7 @@ public class Entities {
|
||||
? ((ListValue) entityValue).getItems().stream().map(Value::getString).collect(Collectors.toList())
|
||||
: Collections.singletonList(entityValue.getString());
|
||||
Set<EntityType<? extends Entity>> types = new HashSet<>();
|
||||
descriptors.forEach(s -> types.addAll(EntityValue.getEntityDescriptor(s, ((CarpetContext) c).s.getServer()).typeList));
|
||||
descriptors.forEach(s -> types.addAll(EntityValue.getEntityDescriptor(s, ((CarpetContext) c).s.getServer()).types));
|
||||
FunctionArgument funArg = FunctionArgument.findIn(c, expression.module, lv, 1, true, false);
|
||||
CarpetEventServer events = ((CarpetScriptHost)c.host).scriptServer().events;
|
||||
if (funArg.function == null)
|
||||
|
||||
Reference in new issue
Block a user