Skip to content

Commit 29097e2

Browse files
committed
Get parent entity from ComplexEntityPart
Fixes core errors when interacting with EnderDragon parts.
1 parent ac51418 commit 29097e2

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

src/main/java/com/laytonsmith/abstraction/bukkit/BukkitConvertor.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCBreedable;
5353
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCChestBoat;
5454
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCCommandMinecart;
55-
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCComplexEntityPart;
5655
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCComplexLivingEntity;
5756
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCEntity;
5857
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCFireball;
@@ -452,6 +451,10 @@ public static MCEntity BukkitGetCorrectEntity(Entity be) {
452451
return null;
453452
}
454453

454+
if(be instanceof ComplexEntityPart part) {
455+
be = part.getParent();
456+
}
457+
455458
BukkitMCEntityType type = BukkitMCEntityType.valueOfConcrete(be.getType());
456459
if(type.getWrapperClass() != null) {
457460
return ReflectionUtils.newInstance(type.getWrapperClass(), new Class[]{Entity.class}, new Object[]{be});
@@ -536,11 +539,6 @@ public static MCEntity BukkitGetCorrectEntity(Entity be) {
536539
return new BukkitMCHumanEntity(be);
537540
}
538541

539-
if(be instanceof ComplexEntityPart) {
540-
type.setWrapperClass(BukkitMCComplexEntityPart.class);
541-
return new BukkitMCComplexEntityPart(be);
542-
}
543-
544542
if(be instanceof ComplexLivingEntity) {
545543
// Must come before LivingEntity
546544
type.setWrapperClass(BukkitMCComplexLivingEntity.class);

0 commit comments

Comments
 (0)