Switch ender dragon trait support to general multipart entities
@@ -5,7 +5,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.entity.ai.attributes.ModifiableAttributeInstance;
-import net.minecraft.entity.boss.dragon.EnderDragonPartEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack;
@@ -20,6 +19,7 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.ForgeHooks;
+import net.minecraftforge.entity.PartEntity;
import net.minecraftforge.event.entity.player.CriticalHitEvent;
import slimeknights.tconstruct.common.TinkerTags;
import slimeknights.tconstruct.library.modifiers.ModifierEntry;
@@ -120,8 +120,11 @@ public class ToolAttackUtil {
LivingEntity targetLiving = null;
if (targetEntity instanceof LivingEntity) {
targetLiving = (LivingEntity) targetEntity;
- } else if (targetEntity instanceof EnderDragonPartEntity) {
- targetLiving = ((EnderDragonPartEntity)targetEntity).dragon;
+ } else if (targetEntity instanceof PartEntity) {
+ Entity parent = ((PartEntity<?>) targetEntity).getParent();
+ if (parent instanceof LivingEntity) {
+ targetLiving = (LivingEntity)parent;
+ }
}
PlayerEntity attackerPlayer = null;
if (attackerLiving instanceof PlayerEntity) {
