Skip to content

Commit

Permalink
fixed models
Browse files Browse the repository at this point in the history
  • Loading branch information
d0mmi committed Jan 26, 2020
1 parent 25fe34d commit 7af0f96
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"condition": "minecraft:entity_scores",
"entity": "this",
"scores": {
"chickendrop": {
"bc_drop": {
"min": 10,
"max": 20
}
Expand Down
Binary file modified models/block.cubik
Binary file not shown.
Binary file modified models/tool.cubik
Binary file not shown.
10 changes: 6 additions & 4 deletions src/chickens/ChickenBase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class ChickenBase extends Widget{
}
this.texture = name.replaceAll(" Chicken", "").replaceAll(" ", "_").toLowerCase();
this.drops.add(Item(Items.feather,count: 1));
this.drops.add(Item(Items.egg,count: 1));
_tags = [name.toLowerCase().replaceAll(" ", "_"),"better_chicken"];
_entity = Entity(type: Entities.chicken, tags: _tags);
model = chickensModelCounter;
Expand All @@ -54,12 +55,13 @@ class ChickenBase extends Widget{
}

Summon getSummon({bool baby = false}){
List<Summon> passengers = [
//Summon(Entities.armor_stand,invulnerable: true,tags: ["bc_stand"], nbt: {"Invisible":1,"NoBasePlate":1,"Small":1,"ArmorItems":[{},{},{},Item(Items.cookie,count: 1,model: model).getMap()]})
];
return (baby)? Summon(Entities.chicken,tags: _tags,name: TextComponent(name),nbt: {"Age":-6000},passengers: passengers) : Summon(Entities.chicken,tags: _tags,name: TextComponent(name),passengers: passengers);
return (baby)? Summon(Entities.chicken,tags: _tags,nbt: {"Age":-6000}) : Summon(Entities.chicken,tags: _tags);
}

Widget getModel(){
return If(Condition.entity(Entity(type: Entities.chicken, tags: [name.toLowerCase().replaceAll(" ", "_"),"better_chicken"],selector: "s")),then: [Summon(Entities.armor_stand,invulnerable: true,tags: ["bc_stand","bc_init"], nbt: {"Invisible":1,"Invulnerable":1,"NoBasePlate":1,"NoGravity":1,"Small":1,"Marker":1,"ArmorItems":[{},{},{},Item(Items.cookie,count: 1,model: model).getMap()]})]);
}

Widget getDrops(){
List<Widget> summondrops = [RandomScore(Entity.Selected(),to: drops.length-1,objective: drop_score)];
var i = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/chickens/example.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{
"__comment": "Box1",
"from": [ 0, 0, 0 ],
"to": [ 16, 16, 19 ],
"to": [ 16, 16, 20 ],
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture" },
Expand All @@ -21,7 +21,7 @@
],
"display": {
"head": {
"translation": [ 0, -30, -5 ]
"translation": [ 0, -15, -2 ]
}
}
}
2 changes: 1 addition & 1 deletion src/manager/BreedingManager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class BreedingManager extends Widget{
Execute.asat(chicken,children: [
If(Condition.tag(Tag(lovescore,entity: Entity.Selected(),value: true)),then: onLove),
Command("execute as @s store result score @s "+ lovescore + " run data get entity @s " + property),
If(Condition.predicate(Predicate("inlove",contents: Scores({"inlove":Range(from: 100, to: 600)}))),then: [
If(Condition.predicate(Predicate("better_chicken:inlove",contents: Scores({"inlove":Range(from: 100, to: 600)}))),then: [
Tag(lovescore,entity: Entity.Selected(),value: true)
])
])
Expand Down
7 changes: 3 additions & 4 deletions src/manager/DropManager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import '../chickens/ChickenBase.dart';
class DropManager extends Widget{

static Entity chicken = Entity(type: Entities.chicken,tags: ["better_chicken"]);
static String dropscore = "chickendrop";
static String property = "EggLayTime";

@override
Expand All @@ -19,10 +18,10 @@ class DropManager extends Widget{
}

return File.execute("drop_manager",child: For.of([
Scoreboard(dropscore),
Scoreboard(ChickenBase.drop_score),
Execute.asat(chicken,children: [
Command("execute as @s store result score @s "+ dropscore + " run data get entity @s " + property),
If(Condition.predicate(Predicate("chickendrop",contents: Scores({"chickendrop":Range(from: 100, to: 600)}))),then: [
Command("execute as @s store result score @s "+ ChickenBase.drop_score + " run data get entity @s " + property),
If(Condition.predicate(Predicate("better_chicken:chickendrop",contents: Scores({ChickenBase.drop_score:Range(from: 10, to: 30)}))),then: [
For.of(drops)
])
])
Expand Down
46 changes: 33 additions & 13 deletions src/manager/ModelManager.dart
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]")
]));
}
}
2 changes: 1 addition & 1 deletion src/tools/analyse_tool.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class AnalyseTool extends Tool {
If(Condition.entity(Tool.chicken),then: [
Tellraw(Entity.Selected(),show: [TextComponent("[--------------------------------]")]),
For.of(getChickenInfo()),
Tellraw(Entity.Selected(),show: [TextComponent(" Chickendrop Timer: "),TextComponent.score(Score(Tool.chicken,"chickendrop"))]),
Tellraw(Entity.Selected(),show: [TextComponent(" Chickendrop Timer: "),TextComponent.score(Score(Tool.chicken,ChickenBase.drop_score))]),
Tellraw(Entity.Selected(),show: [TextComponent("[--------------------------------]")]),
]),

Expand Down

0 comments on commit 7af0f96

Please sign in to comment.