Merge branch 'master' into 1.15

This commit is contained in:
gnembon committed 2019-10-28 21:55:49 -03:00
commit b1e2b4367d
5 files changed
+75 -29

No files matched your search

@@ -36,11 +36,15 @@ public class InventoryHelper
}
if (bet.isEmpty())
{
tag.remove("BlockEntityTag");
changed = true;
}
if (tag.isEmpty())
{
stack.setTag(null);
changed = true;
}
return changed;
}
+3 -2
View File
@@ -24,6 +24,7 @@ import carpet.script.value.MapValue;
import carpet.script.value.NumericValue;
import carpet.script.value.StringValue;
import carpet.script.value.Value;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import org.apache.commons.lang3.text.WordUtils;
import java.math.BigInteger;
@@ -388,10 +389,10 @@ public class Expression implements Cloneable
private LazyValue ast = null;
/** script specific operatos and built-in functions */
private Map<String, ILazyOperator> operators = new HashMap<>();
private Map<String, ILazyOperator> operators = new Object2ObjectOpenHashMap<>();
boolean isAnOperator(String opname) { return operators.containsKey(opname) || operators.containsKey(opname+"u");}
private Map<String, ILazyFunction> functions = new HashMap<>();
private Map<String, ILazyFunction> functions = new Object2ObjectOpenHashMap<>();
Set<String> getFunctionNames() {return functions.keySet();}
@Override
+4 -3
View File
@@ -9,6 +9,7 @@ import carpet.script.value.NumericValue;
import carpet.script.value.StringValue;
import carpet.script.value.Value;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.nbt.Tag;
@@ -29,9 +30,9 @@ import static java.lang.Math.max;
public class ScriptHost
{
private final Map<String, ScriptHost> userHosts = new HashMap<>();
public Map<String, UserDefinedFunction> globalFunctions = new HashMap<>();
public Map<String, LazyValue> globalVariables = new HashMap<>();
private final Map<String, ScriptHost> userHosts = new Object2ObjectOpenHashMap<>();
public Map<String, UserDefinedFunction> globalFunctions = new Object2ObjectOpenHashMap<>();
public Map<String, LazyValue> globalVariables = new Object2ObjectOpenHashMap<>();
private Tag globalState;
private int saveTimeout;
+9 -14
View File
@@ -121,12 +121,9 @@ public class Tokenizer implements Iterator<Tokenizer.Token>
{
pos++;
linepos++;
if (pos == input.length())
{
token.type = Token.TokenType.STRINGPARAM;
if (expression != null)
throw new ExpressionException(this.expression, token, "Program truncated");
}
token.type = Token.TokenType.STRINGPARAM;
if (pos == input.length() && expression != null)
throw new ExpressionException(this.expression, token, "Program truncated");
ch = input.charAt(pos);
while (ch != '\'')
{
@@ -134,20 +131,18 @@ public class Tokenizer implements Iterator<Tokenizer.Token>
{
pos++;
linepos++;
if (pos == input.length())
{
token.type = Token.TokenType.STRINGPARAM;
if (expression != null)
throw new ExpressionException(this.expression, token, "Program truncated");
}
if (pos == input.length() && expression != null)
throw new ExpressionException(this.expression, token, "Program truncated");
}
token.append(input.charAt(pos++));
linepos++;
ch = pos == input.length() ? 0 : input.charAt(pos);
if (pos == input.length() && expression != null)
throw new ExpressionException(this.expression, token, "Program truncated");
ch = input.charAt(pos);
}
pos++;
linepos++;
token.type = Token.TokenType.STRINGPARAM;
}
else if (Character.isLetter(ch) || "_".indexOf(ch) >= 0)
{