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;
|
return root.op;
|
||||||
|
|
||||||
Context optimizeOnlyContext = new Context.ContextForErrorReporting(context);
|
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;
|
boolean changed = true;
|
||||||
while(changed) {
|
while(changed) {
|
||||||
@@ -1085,7 +1086,8 @@ public class Expression
|
|||||||
boolean optimized = compactTree(root, Context.Type.NONE, 0);
|
boolean optimized = compactTree(root, Context.Type.NONE, 0);
|
||||||
if (!optimized) break;
|
if (!optimized) break;
|
||||||
changed = true;
|
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) {
|
while (true) {
|
||||||
int tree_size = treeSize(root);
|
int tree_size = treeSize(root);
|
||||||
@@ -1093,7 +1095,8 @@ public class Expression
|
|||||||
boolean optimized = optimizeTree(optimizeOnlyContext, root, Context.Type.NONE, 0);
|
boolean optimized = optimizeTree(optimizeOnlyContext, root, Context.Type.NONE, 0);
|
||||||
if (!optimized) break;
|
if (!optimized) break;
|
||||||
changed = true;
|
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);
|
return extractOp(optimizeOnlyContext, root, Context.Type.NONE);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package carpet.script.api;
|
|||||||
|
|
||||||
import carpet.mixins.ScoreboardObjective_scarpetMixin;
|
import carpet.mixins.ScoreboardObjective_scarpetMixin;
|
||||||
import carpet.mixins.Scoreboard_scarpetMixin;
|
import carpet.mixins.Scoreboard_scarpetMixin;
|
||||||
|
import carpet.mixins.Team_scarpetMixin;
|
||||||
import carpet.script.CarpetContext;
|
import carpet.script.CarpetContext;
|
||||||
import carpet.script.Expression;
|
import carpet.script.Expression;
|
||||||
import carpet.script.LazyValue;
|
import carpet.script.LazyValue;
|
||||||
@@ -337,7 +338,7 @@ public class Scoreboards {
|
|||||||
team.setCollisionRule(collisionRule);
|
team.setCollisionRule(collisionRule);
|
||||||
break;
|
break;
|
||||||
case "color":
|
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());
|
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());
|
Formatting color = Formatting.byName(settingVal.getString().toUpperCase());
|
||||||
if(color == null || !color.isColor()) throw new InternalExpressionException("Unknown value for property " + propertyVal.getString() + ": " + settingVal.getString());
|
if(color == null || !color.isColor()) throw new InternalExpressionException("Unknown value for property " + propertyVal.getString() + ": " + settingVal.getString());
|
||||||
|
|||||||
@@ -181,6 +181,7 @@
|
|||||||
"PlayerInventory_scarpetEventMixin",
|
"PlayerInventory_scarpetEventMixin",
|
||||||
"ScoreboardObjective_scarpetMixin",
|
"ScoreboardObjective_scarpetMixin",
|
||||||
"Scoreboard_scarpetMixin",
|
"Scoreboard_scarpetMixin",
|
||||||
|
"Team_scarpetMixin",
|
||||||
"TradeOutputSlot_scarpetEventMixin",
|
"TradeOutputSlot_scarpetEventMixin",
|
||||||
|
|
||||||
"BiomeEffects_scarpetMixin",
|
"BiomeEffects_scarpetMixin",
|
||||||
|
|||||||
Reference in new issue
Block a user