Merge branch 'master' into 1.17
This commit is contained in:
commit
b8082ba5b8
4 files changed
+22
-4
No files matched your search
@@ -0,0 +1,13 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import net.minecraft.scoreboard.Team;
|
||||
import net.minecraft.util.Formatting;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(Team.class)
|
||||
public interface Team_scarpetMixin
|
||||
{
|
||||
@Accessor("color")
|
||||
Formatting getColor();
|
||||
}
|
||||
@@ -1074,7 +1074,8 @@ public class Expression
|
||||
return root.op;
|
||||
|
||||
Context optimizeOnlyContext = new Context.ContextForErrorReporting(context);
|
||||
CarpetScriptServer.LOG.info("Input code size for "+getModuleName()+": " + treeSize(root) + " nodes, " + treeDepth(root) + " deep");
|
||||
if (CarpetSettings.scriptsDebugging)
|
||||
CarpetScriptServer.LOG.info("Input code size for "+getModuleName()+": " + treeSize(root) + " nodes, " + treeDepth(root) + " deep");
|
||||
|
||||
boolean changed = true;
|
||||
while(changed) {
|
||||
@@ -1085,7 +1086,8 @@ public class Expression
|
||||
boolean optimized = compactTree(root, Context.Type.NONE, 0);
|
||||
if (!optimized) break;
|
||||
changed = true;
|
||||
CarpetScriptServer.LOG.info("Compacted from " + tree_size + " nodes, " + tree_depth + " code depth to " + treeSize(root) + " nodes, " + treeDepth(root) + " code depth");
|
||||
if (CarpetSettings.scriptsDebugging)
|
||||
CarpetScriptServer.LOG.info("Compacted from " + tree_size + " nodes, " + tree_depth + " code depth to " + treeSize(root) + " nodes, " + treeDepth(root) + " code depth");
|
||||
}
|
||||
while (true) {
|
||||
int tree_size = treeSize(root);
|
||||
@@ -1093,7 +1095,8 @@ public class Expression
|
||||
boolean optimized = optimizeTree(optimizeOnlyContext, root, Context.Type.NONE, 0);
|
||||
if (!optimized) break;
|
||||
changed = true;
|
||||
CarpetScriptServer.LOG.info("Optimized from " + tree_size + " nodes, " + tree_depth + " code depth to " + treeSize(root) + " nodes, " + treeDepth(root) + " code depth");
|
||||
if (CarpetSettings.scriptsDebugging)
|
||||
CarpetScriptServer.LOG.info("Optimized from " + tree_size + " nodes, " + tree_depth + " code depth to " + treeSize(root) + " nodes, " + treeDepth(root) + " code depth");
|
||||
}
|
||||
}
|
||||
return extractOp(optimizeOnlyContext, root, Context.Type.NONE);
|
||||
|
||||
@@ -2,6 +2,7 @@ package carpet.script.api;
|
||||
|
||||
import carpet.mixins.ScoreboardObjective_scarpetMixin;
|
||||
import carpet.mixins.Scoreboard_scarpetMixin;
|
||||
import carpet.mixins.Team_scarpetMixin;
|
||||
import carpet.script.CarpetContext;
|
||||
import carpet.script.Expression;
|
||||
import carpet.script.LazyValue;
|
||||
@@ -337,7 +338,7 @@ public class Scoreboards {
|
||||
team.setCollisionRule(collisionRule);
|
||||
break;
|
||||
case "color":
|
||||
if(!modifying) return new StringValue(team.getColor().getName());
|
||||
if(!modifying) return new StringValue(((Team_scarpetMixin) team).getColor().getName());
|
||||
if(!(settingVal instanceof StringValue)) throw new InternalExpressionException("'team_property' requires a string as the third argument for the property " + propertyVal.getString());
|
||||
Formatting color = Formatting.byName(settingVal.getString().toUpperCase());
|
||||
if(color == null || !color.isColor()) throw new InternalExpressionException("Unknown value for property " + propertyVal.getString() + ": " + settingVal.getString());
|
||||
|
||||
@@ -181,6 +181,7 @@
|
||||
"PlayerInventory_scarpetEventMixin",
|
||||
"ScoreboardObjective_scarpetMixin",
|
||||
"Scoreboard_scarpetMixin",
|
||||
"Team_scarpetMixin",
|
||||
"TradeOutputSlot_scarpetEventMixin",
|
||||
|
||||
"BiomeEffects_scarpetMixin",
|
||||
|
||||
Reference in new issue
Block a user