傻逼NPE

This commit is contained in:
Light_Quanta 2025-07-16 03:35:28 +08:00
parent 9edf8784df
commit d57bd9016a
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959

View file

@ -1,12 +1,12 @@
package com.atsuishio.superbwarfare.tools; package com.atsuishio.superbwarfare.tools;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.ClipContext;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext;
import java.util.Optional; import java.util.Optional;
@ -18,8 +18,8 @@ public class ProjectileCalculator {
/** /**
* 计算炮弹精确落点位置Vec3 * 计算炮弹精确落点位置Vec3
* *
* @param level 世界对象 * @param level 世界对象
* @param startPos 发射点位置Vec3 * @param startPos 发射点位置Vec3
* @param launchVector 发射向量Vec3 * @param launchVector 发射向量Vec3
* @return 精确的落点位置Vec3如果没有碰撞则返回最后位置 * @return 精确的落点位置Vec3如果没有碰撞则返回最后位置
*/ */
@ -71,7 +71,7 @@ public class ProjectileCalculator {
end, end,
ClipContext.Block.COLLIDER, // 只检测碰撞方块 ClipContext.Block.COLLIDER, // 只检测碰撞方块
ClipContext.Fluid.NONE, // 忽略流体 ClipContext.Fluid.NONE, // 忽略流体
(Entity) null // 无实体 CollisionContext.empty() // 无实体
)); ));
// 如果检测到碰撞返回碰撞点 // 如果检测到碰撞返回碰撞点