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 GitHub
parent 17b87f828c
commit 02576c0b02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,6 +54,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;
@ -372,9 +373,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();