-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
47 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,46 @@ | ||
import 'package:objd/core.dart'; | ||
|
||
import '../chickens/ChickenBase.dart'; | ||
|
||
class ModelManager extends Widget{ | ||
|
||
Entity select_chicken = Entity.Select(Selector(type: Entities.chicken,tags: ["better_chicken"],limit: 1,sorting: Sort.nearest,distance: Range(to: 1))); | ||
Entity chicken = Entity(type: Entities.chicken,tags: ["better_chicken"]); | ||
Entity select_stand = Entity.Select(Selector(type: Entities.armor_stand,tags: ["bc_stand"],limit: 1,sorting: Sort.nearest,distance: Range(to: 1))); | ||
Entity ground_stand = Entity(type: Entities.armor_stand,tags: ["bc_stand"],nbt: {"OnGround":1}); | ||
Entity stand = Entity(type: Entities.armor_stand,tags: ["bc_stand"]); | ||
static Entity chicken = Entity(type: Entities.chicken,tags: ["better_chicken"]); | ||
static Entity select_chicken = chicken.copyWith(scores: [Score(Entity.Selected(), "bc_id").matches(0)],limit: 1); | ||
static Entity check_chicken = chicken.copyWith(scores: [Score(Entity.Selected(), "bc_id").matches(0)]); | ||
static Entity select_stand = Entity.Select(Selector(type: Entities.armor_stand,tags: ["bc_stand","bc_init"],limit: 1,sorting: Sort.nearest,distance: Range(to: 1))); | ||
static Entity ground_stand = Entity(type: Entities.armor_stand,tags: ["bc_stand"],nbt: {"OnGround":1}); | ||
static Entity stand = Entity(type: Entities.armor_stand,tags: ["bc_stand","!bc_init"]); | ||
|
||
@override | ||
generate(Context context) { | ||
//data modify entity @e[type=minecraft:armor_stand,limit=1] Rotation set from entity @e[type=minecraft:chicken,limit=1,sort=nearest] Rotation | ||
List<Widget> models = []; | ||
|
||
for (var chicken in ChickenBase.chickens) { | ||
models.add(chicken.getModel()); | ||
} | ||
return File.execute("model_manager",child: For.of([ | ||
Execute.asat(chicken.copyWith(nbt: {"Age":0}),children: [ | ||
If(Condition.not(Condition.score(Score(Entity.Selected(),"bc_id").matchesRange(Range(from: 1)))),then: [ | ||
Score(Entity.PlayerName("#max"),"bc_id").add(1), | ||
Score(Entity.Selected(),"bc_id").addScore( Score(Entity.PlayerName("#max"),"bc_id")), | ||
For.of(models), | ||
Execute.asat(select_stand,children: [ | ||
Score(Entity.Selected(),"bc_id").addScore( Score(Entity.PlayerName("#max"),"bc_id")), | ||
Tag("bc_init",entity: Entity.Selected(),value: false) | ||
]) | ||
]), | ||
]), | ||
Execute.asat(stand,children: [ | ||
Data.modify(Entity.Selected(),path: "Rotation",modify: DataModify.set(select_chicken,fromPath: "Rotation")) | ||
Score(chicken,"bc_id").subtractScore(Score(Entity.Selected(),"bc_id")), | ||
Tp.entity(Entity.Selected(),to: select_chicken), | ||
If(Condition.not(Condition.entity(check_chicken)),assignTag: Entity.Selected(), then: [ | ||
Score(chicken,"bc_id").addScore(Score(Entity.Selected(),"bc_id")), | ||
Kill(Entity.Selected()) | ||
],orElse: [ | ||
Data.modify(Entity.Selected(),path: "Rotation",modify: DataModify.set(select_chicken,fromPath: "Rotation")), | ||
Score(chicken,"bc_id").addScore(Score(Entity.Selected(),"bc_id")), | ||
]), | ||
]), | ||
/*Execute.asat(chicken,children: [ | ||
//Teleport(select_stand,rot: Rotation.rel(),to: Location.here()), | ||
Tp(select_stand,to: Location.here(), rot: Rotation.rel()) | ||
])*/ | ||
Command("/kill @e[type=armor_stand,nbt=!{FallDistance:0.0f},tag=bc_stand]"), | ||
Command("kill @e[type=armor_stand,nbt={OnGround:1b},tag=bc_stand]") | ||
])); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters