Merge branch 'master' into 1.17
This commit is contained in:
commit
820c9b6489
31 files changed
+1188
-211
No files matched your search
@@ -15,4 +15,9 @@ public abstract class AbstractListValue extends Value implements Iterable<Value>
|
||||
{
|
||||
throw new InternalExpressionException("Cannot append a value to an abstract list");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Value fromConstant() {
|
||||
return this.deepcopy();
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public class FormattedTextValue extends StringValue
|
||||
|
||||
@Override
|
||||
public boolean getBoolean() {
|
||||
return !text.asString().isEmpty();
|
||||
return !text.getString().isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -150,7 +150,7 @@ public class FunctionValue extends Value implements Fluff.ILazyFunction
|
||||
return varArgs != null;
|
||||
}
|
||||
|
||||
public LazyValue callInContext(Context c, Integer type, List<Value> params)
|
||||
public LazyValue callInContext(Context c, Context.Type type, List<Value> params)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -204,12 +204,12 @@ public class FunctionValue extends Value implements Fluff.ILazyFunction
|
||||
}
|
||||
|
||||
@Override
|
||||
public LazyValue lazyEval(Context c, Integer type, Expression e, Tokenizer.Token t, List<LazyValue> lazyParams) {
|
||||
public LazyValue lazyEval(Context c, Context.Type type, Expression e, Tokenizer.Token t, List<LazyValue> lazyParams) {
|
||||
List<Value> resolvedParams = unpackArgs(lazyParams, c);
|
||||
return execute(c, type, e, t, resolvedParams);
|
||||
}
|
||||
|
||||
public LazyValue execute(Context c, Integer type, Expression e, Tokenizer.Token t, List<Value> params)
|
||||
public LazyValue execute(Context c, Context.Type type, Expression e, Tokenizer.Token t, List<Value> params)
|
||||
{
|
||||
assertArgsOk(params, (fixedArgs) ->{
|
||||
if (fixedArgs) // wrong number of args for fixed args
|
||||
@@ -301,10 +301,13 @@ public class FunctionValue extends Value implements Fluff.ILazyFunction
|
||||
}
|
||||
}
|
||||
|
||||
public static List<LazyValue> lazify(List<Value> args)
|
||||
{
|
||||
List<LazyValue> lzargs = new ArrayList<>(args.size());
|
||||
args.forEach( v -> lzargs.add( (c, t) -> v));
|
||||
return lzargs;
|
||||
@Override
|
||||
public boolean pure() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean transitive() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -192,6 +192,11 @@ public abstract class LazyListValue extends AbstractListValue implements Iterato
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Value fromConstant() {
|
||||
return (Value)clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
|
||||
@@ -152,6 +152,11 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Value fromConstant() {
|
||||
return deepcopy();
|
||||
}
|
||||
|
||||
// stolen from HopperBlockEntity, adjusted for threaded operation
|
||||
public static Inventory getInventoryAt(ServerWorld world, BlockPos blockPos)
|
||||
{
|
||||
|
||||
@@ -244,4 +244,11 @@ public abstract class Value implements Comparable<Value>, Cloneable
|
||||
}
|
||||
|
||||
public boolean isNull() { return false; }
|
||||
|
||||
/**
|
||||
* @return retrieves useful in-run value of an optimized code-base value.
|
||||
* For immutable values (most of them) it can return itself,
|
||||
* but for mutables, it needs to be its copy or deep copy.
|
||||
*/
|
||||
public Value fromConstant() { return this; }
|
||||
}
|
||||
Reference in new issue
Block a user