Skip to content

Commit

Permalink
Cleaned up unncessary parent function calls
Browse files Browse the repository at this point in the history
  • Loading branch information
SmokeyStack committed Aug 12, 2024
1 parent dd6ff3e commit f269fba
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion adk/data/src/block/block_abstract_candle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace adk {
ComponentBlockTick tick;
tick.SetIntervalRange(20, 100);
permutation->AddComponent(std::make_unique<ComponentBlockTick>(tick));
Block::AddPermutation(std::move(permutation));
AddPermutation(std::move(permutation));

auto& custom_component = std::find_if(std::begin(components_), std::end(components_), [](const auto& component) { return component->GetType() == "minecraft:custom_components"; });
if (custom_component == std::end(components_)) {
Expand Down
10 changes: 5 additions & 5 deletions adk/data/src/block/block_candle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,31 @@ namespace adk {
ComponentBlockBoxSelection selection(Vector3(-1, 0, -1), Vector3(2, 6, 2));
permutation->AddComponent(std::make_unique<ComponentBlockBoxCollision>(collision));
permutation->AddComponent(std::make_unique<ComponentBlockBoxSelection>(selection));
Block::AddPermutation(std::move(permutation));
AddPermutation(std::move(permutation));
permutation = std::make_unique<Permutation>(fmt::format("q.block_state('{mod_id}:candles') == 2", fmt::arg("mod_id", mod_id)));
collision.SetCollision(Vector3(-3, 0, -1), Vector3(6, 6, 3));
selection.SetSelection(Vector3(-3, 0, -1), Vector3(6, 6, 3));
permutation->AddComponent(std::make_unique<ComponentBlockBoxCollision>(collision));
permutation->AddComponent(std::make_unique<ComponentBlockBoxSelection>(selection));
Block::AddPermutation(std::move(permutation));
AddPermutation(std::move(permutation));
permutation = std::make_unique<Permutation>(fmt::format("q.block_state('{mod_id}:candles') == 3", fmt::arg("mod_id", mod_id)));
collision.SetCollision(Vector3(-2, 0, -2), Vector3(5, 6, 5));
selection.SetSelection(Vector3(-2, 0, -2), Vector3(5, 6, 5));
permutation->AddComponent(std::make_unique<ComponentBlockBoxCollision>(collision));
permutation->AddComponent(std::make_unique<ComponentBlockBoxSelection>(selection));
Block::AddPermutation(std::move(permutation));
AddPermutation(std::move(permutation));
permutation = std::make_unique<Permutation>(fmt::format("q.block_state('{mod_id}:candles') == 4", fmt::arg("mod_id", mod_id)));
collision.SetCollision(Vector3(-3, 0, -3), Vector3(6, 6, 5));
selection.SetSelection(Vector3(-3, 0, -3), Vector3(6, 6, 5));
permutation->AddComponent(std::make_unique<ComponentBlockBoxCollision>(collision));
permutation->AddComponent(std::make_unique<ComponentBlockBoxSelection>(selection));
Block::AddPermutation(std::move(permutation));
AddPermutation(std::move(permutation));

for (int a = 1; a < 5; a++) {
permutation = std::make_unique<Permutation>(fmt::format("q.block_state('{mod_id}:lit') && q.block_state('{mod_id}:candles') == {a}", fmt::arg("mod_id", mod_id), fmt::arg("a", a)));
ComponentBlockLightEmission light_emission(3 * a);
permutation->AddComponent(std::make_unique<ComponentBlockLightEmission>(light_emission));
Block::AddPermutation(std::move(permutation));
AddPermutation(std::move(permutation));
}

const std::string condition = fmt::format("q.block_state('{mod_id}:lit')", fmt::arg("mod_id", mod_id));
Expand Down
8 changes: 4 additions & 4 deletions adk/data/src/block/block_ladder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ namespace adk {
ComponentBlockTransformation transformation;
transformation.SetRotation(Vector3(0, 0, 0));
permutation->AddComponent(std::make_unique<ComponentBlockTransformation>(transformation));
Block::AddPermutation(std::move(permutation));
AddPermutation(std::move(permutation));
permutation = std::make_unique<Permutation>("q.block_state('minecraft:block_face') == 'east'");
transformation.SetRotation(Vector3(0, 270, 0));
permutation->AddComponent(std::make_unique<ComponentBlockTransformation>(transformation));
Block::AddPermutation(std::move(permutation));
AddPermutation(std::move(permutation));
permutation = std::make_unique<Permutation>("q.block_state('minecraft:block_face') == 'south'");
transformation.SetRotation(Vector3(0, 180, 0));
permutation->AddComponent(std::make_unique<ComponentBlockTransformation>(transformation));
Block::AddPermutation(std::move(permutation));
AddPermutation(std::move(permutation));
permutation = std::make_unique<Permutation>("q.block_state('minecraft:block_face') == 'west'");
transformation.SetRotation(Vector3(0, 90, 0));
permutation->AddComponent(std::make_unique<ComponentBlockTransformation>(transformation));
Block::AddPermutation(std::move(permutation));
AddPermutation(std::move(permutation));

auto& box_collision = std::find_if(std::begin(components_), std::end(components_), [](const auto& component) { return component->GetType() == "minecraft:collision_box"; });
if (box_collision == std::end(components_)) {
Expand Down
2 changes: 1 addition & 1 deletion adk/data/src/block/block_lantern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace adk {
ComponentBlockTransformation transformation;
transformation.SetTranslation(Vector3(0, 0.5, 0));
permutation->AddComponent(std::make_unique<ComponentBlockTransformation>(transformation));
Block::AddPermutation(std::move(permutation));
AddPermutation(std::move(permutation));

auto& box_collision = std::find_if(std::begin(components_), std::end(components_), [](const auto& component) { return component->GetType() == "minecraft:collision_box"; });
if (box_collision == std::end(components_)) {
Expand Down
4 changes: 2 additions & 2 deletions adk/data/src/block/block_pillar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ namespace adk {
ComponentBlockTransformation transformation;
transformation.SetRotation(Vector3(90, 0, 0));
permutation->AddComponent(std::make_unique<ComponentBlockTransformation>(transformation));
Block::AddPermutation(std::move(permutation));
AddPermutation(std::move(permutation));
permutation = std::make_unique<Permutation>("q.block_state('minecraft:block_face') == 'east' || q.block_state('minecraft:block_face') == 'west'");
transformation.SetRotation(Vector3(0, 0, 270));
permutation->AddComponent(std::make_unique<ComponentBlockTransformation>(transformation));
Block::AddPermutation(std::move(permutation));
AddPermutation(std::move(permutation));

return Block::Generate(mod_id, id);
}
Expand Down
6 changes: 3 additions & 3 deletions adk/data/src/block/block_slab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ namespace adk {
permutation->AddComponent(std::make_unique<ComponentBlockBoxCollision>(Vector3(-8, 0, -8), Vector3(16, 8, 16)));
permutation->AddComponent(std::make_unique<ComponentBlockBoxSelection>(Vector3(-8, 0, -8), Vector3(16, 8, 16)));
permutation->AddComponent(std::make_unique<ComponentBlockCustom>(custom_component));
Block::AddPermutation(std::move(permutation));
AddPermutation(std::move(permutation));
permutation = std::make_unique<Permutation>("q.block_state('minecraft:vertical_half') == 'top' && !q.block_state('" + mod_id + ":is_double')");
permutation->AddComponent(std::make_unique<ComponentBlockBoxCollision>(Vector3(-8, 8, -8), Vector3(16, 8, 16)));
permutation->AddComponent(std::make_unique<ComponentBlockBoxSelection>(Vector3(-8, 8, -8), Vector3(16, 8, 16)));
permutation->AddComponent(std::make_unique<ComponentBlockCustom>(custom_component));
Block::AddPermutation(std::move(permutation));
AddPermutation(std::move(permutation));
permutation = std::make_unique<Permutation>("q.block_state('" + mod_id + ":is_double')");
permutation->AddComponent(std::make_unique<ComponentBlockLoot>(is_double_loot_));
Block::AddPermutation(std::move(permutation));
AddPermutation(std::move(permutation));

return Block::Generate(mod_id, id);
}
Expand Down
10 changes: 5 additions & 5 deletions adk/data/src/block/block_torch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,25 @@ namespace adk {
ComponentBlockTransformation transformation;
transformation.SetRotation(Vector3(0, 90, 0));
permutation->AddComponent(std::make_unique<ComponentBlockTransformation>(transformation));
Block::AddPermutation(std::move(permutation));
AddPermutation(std::move(permutation));
permutation = std::make_unique<Permutation>("q.block_state('minecraft:block_face') == 'east'");
transformation.SetRotation(Vector3(0, 0, 0));
permutation->AddComponent(std::make_unique<ComponentBlockTransformation>(transformation));
Block::AddPermutation(std::move(permutation));
AddPermutation(std::move(permutation));
permutation = std::make_unique<Permutation>("q.block_state('minecraft:block_face') == 'west'");
transformation.SetRotation(Vector3(0, 270, 0));
permutation->AddComponent(std::make_unique<ComponentBlockTransformation>(transformation));
Block::AddPermutation(std::move(permutation));
AddPermutation(std::move(permutation));
permutation = std::make_unique<Permutation>("q.block_state('minecraft:block_face') == 'south'");
transformation.SetRotation(Vector3(0, 180, 0));
permutation->AddComponent(std::make_unique<ComponentBlockTransformation>(transformation));
Block::AddPermutation(std::move(permutation));
AddPermutation(std::move(permutation));
permutation = std::make_unique<Permutation>(fmt::format(
"q.block_state('{state}') == 'north' || q.block_state('{state}') == 'east' || q.block_state('{state}') == 'south' || q.block_state('{state}') == 'west'",
fmt::arg("state", "minecraft:block_face")
));
permutation->AddComponent(std::make_unique<ComponentBlockBoxSelection>(Vector3(2, 3, -3), Vector3(6, 10, 6)));
Block::AddPermutation(std::move(permutation));
AddPermutation(std::move(permutation));

auto& box_collision = std::find_if(std::begin(components_), std::end(components_), [](const auto& component) { return component->GetType() == "minecraft:collision_box"; });
if (box_collision == std::end(components_)) {
Expand Down

0 comments on commit f269fba

Please sign in to comment.