Fix PartEntity not recognized by updating PlayerMixin#attack (#662) (#678)

This commit is contained in:
Yanang Pearce 2022-08-04 22:22:04 +08:00 committed by IzzelAliz
parent 033cc9973f
commit 3623739e84

View File

@ -56,6 +56,7 @@ import net.minecraft.world.phys.Vec3;
import net.minecraft.world.scores.Scoreboard;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.extensions.IForgePlayer;
import net.minecraftforge.entity.PartEntity;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.block.Block;
@ -377,9 +378,9 @@ public abstract class PlayerMixin extends LivingEntityMixin implements PlayerEnt
}
EnchantmentHelper.doPostDamageEffects((net.minecraft.world.entity.player.Player) (Object) this, entity);
final ItemStack itemstack2 = this.getMainHandItem();
Object object = entity;
if (entity instanceof EnderDragonPart) {
object = ((EnderDragonPart) entity).parentMob;
Entity object = entity;
if (entity instanceof PartEntity) {
object = ((PartEntity<?>) entity).getParent();
}
if (!this.level.isClientSide && !itemstack2.isEmpty() && object instanceof LivingEntity) {
ItemStack copy = itemstack2.copy();