Fixed team color using client method (#965)
This commit is contained in:
1 parent
cd50919a90
commit
83afa95d98
3 files changed
+16
-1
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();
|
||||||
|
}
|
||||||
@@ -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());
|
||||||
|
|||||||
@@ -175,6 +175,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