添加子弹对于PartEntity判定的处理
This commit is contained in:
parent
b0452ecce7
commit
90ac4c88fa
1 changed files with 5 additions and 0 deletions
|
@ -33,6 +33,7 @@ import net.minecraft.world.level.material.FluidState;
|
|||
import net.minecraft.world.phys.*;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.entity.IEntityAdditionalSpawnData;
|
||||
import net.minecraftforge.entity.PartEntity;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
|
@ -301,6 +302,10 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
|
|||
protected void onHitEntity(Entity entity, boolean headshot) {
|
||||
if (entity == null) return;
|
||||
|
||||
if (entity instanceof PartEntity<?> part) {
|
||||
entity = part.getParent();
|
||||
}
|
||||
|
||||
if (beast && entity instanceof LivingEntity living) {
|
||||
if (living.isDeadOrDying()) return;
|
||||
if (living instanceof ServerPlayer victim) {
|
||||
|
|
Loading…
Add table
Reference in a new issue