@@ -631,7 +631,7 @@ class Entity::Impl {
631631 E (sheep, C (Animal, AgeableA (u8" minecraft:sheep" ), Colorable (u8" sheep" ), Definitions ({u8" +minecraft:sheep_dyeable" , u8" +minecraft:rideable_wooly" , u8" +minecraft:loot_wooly" }), Sheep));
632632 E (shulker, C (Monster, Shulker));
633633 M (silverfish);
634- M (skeleton); // lefty skeleton does not exist in Bedrock?
634+ E (skeleton, C (Monster, RangedAttack) ); // lefty skeleton does not exist in Bedrock?
635635
636636 E (skeleton_horse, C (Animal, Definitions ({u8" +minecraft:skeleton_horse_adult" }), SkeletonHorse));
637637 E (slime, C (Monster, Slime));
@@ -693,7 +693,7 @@ class Entity::Impl {
693693 E (interaction, Null);
694694
695695 E (armadillo, C (Animal, Definitions ({u8" +minecraft:armadillo" }), AgeableG, Armadillo));
696- E (bogged, C (Monster, Definitions ({u8" +minecraft:bogged" , u8" +minecraft:ranged_attack " }) , Bogged));
696+ E (bogged, C (Monster, Definitions ({u8" +minecraft:bogged" }), RangedAttack , Bogged));
697697 E (breeze, C (Monster, Definitions ({u8" +minecraft:breeze" })));
698698
699699 E (creaking, C (Monster, Definitions ({u8" +minecraft:creaking" }), Creaking));
@@ -1013,7 +1013,7 @@ class Entity::Impl {
10131013 bool melee = true ;
10141014 if (auto handItems = tag.listTag (u8" HandItems" ); handItems && !handItems->fValue .empty ()) {
10151015 if (auto item = handItems->fValue [0 ]->asCompound (); item) {
1016- if (Item::Count (*item, 0 ) > 0 && item->string (u8" id" ) == u8" minecraft:trident " ) {
1016+ if (Item::Count (*item, 0 ) > 0 && Item::IsMeleeWeapon ( item->string (u8" id" , u8" " )) ) {
10171017 melee = false ;
10181018 }
10191019 }
@@ -1444,10 +1444,10 @@ class Entity::Impl {
14441444 }
14451445 if (itemInHand) {
14461446 b.set (u8" ItemInHand" , itemInHand);
1447- auto name = itemInHand->string (u8" Name" );
1448- if (name == u8" minecraft:crossbow " ) {
1447+ auto name = itemInHand->string (u8" Name" , u8" " );
1448+ if (Item::IsRangedWeapon (name) ) {
14491449 AddDefinition (b, u8" +ranged_unit" );
1450- } else if (name == u8" minecraft:golden_sword " ) {
1450+ } else if (Item::IsMeleeWeapon (name) ) {
14511451 AddDefinition (b, u8" +melee_unit" );
14521452 }
14531453 }
@@ -2021,6 +2021,24 @@ class Entity::Impl {
20212021 }
20222022 }
20232023
2024+ static void RangedAttack (CompoundTag &b, CompoundTag const &j, ConverterContext &) {
2025+ auto mainHandB = b.listTag (u8" Mainhand" );
2026+ if (!mainHandB) {
2027+ return ;
2028+ }
2029+ if (mainHandB->size () < 1 ) {
2030+ return ;
2031+ }
2032+ auto itemB = mainHandB->fValue [0 ]->asCompound ();
2033+ if (!itemB) {
2034+ return ;
2035+ }
2036+ auto name = itemB->string (u8" Name" , u8" " );
2037+ if (Item::IsRangedWeapon (name)) {
2038+ AddDefinition (b, u8" +minecraft:ranged_attack" );
2039+ }
2040+ }
2041+
20242042 static void Sittable (CompoundTag &c, CompoundTag const &tag, ConverterContext &) {
20252043 CopyBoolValues (tag, c, {{u8" Sitting" }});
20262044 }
0 commit comments