v1.6.0
This commit is contained in:
1 parent
e9d4665059
commit
3dbe97dd60
83 files changed
+1425
-283
No files matched your search
@@ -71,12 +71,16 @@ public class TungstenBullet extends BulletAmmo {
|
||||
public void tick(StaticSummon summon) {
|
||||
this.checkBeforeTick(summon);
|
||||
Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed());
|
||||
summon.setDeltaMovement(motion);
|
||||
Vec3 start = summon.position();
|
||||
Vec3 end = start.add(motion);
|
||||
|
||||
if(summon.level().isClientSide()) return;
|
||||
if(summon.level().isClientSide()) {
|
||||
summon.setPos(end);
|
||||
return;
|
||||
}
|
||||
|
||||
//碰撞检测
|
||||
AABB hitBox = new AABB(summon.position(), summon.position().add(motion)).inflate(0.25);
|
||||
AABB hitBox = new AABB(start, end).inflate(0.25);
|
||||
List<Entity> targets = summon.level().getEntitiesOfClass(
|
||||
Entity.class,
|
||||
hitBox,
|
||||
@@ -93,14 +97,18 @@ public class TungstenBullet extends BulletAmmo {
|
||||
if(DamageUtil.rangedAttack(summon, target, sourceStack, getBaseDamage() + damage, knockbackScale)) {
|
||||
target.invulnerableTime = invulnerableTime;
|
||||
this.onDied(summon);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//方块检测
|
||||
BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, summon.position().add(motion));
|
||||
BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, end);
|
||||
if(blockHitResult.getType() != HitResult.Type.MISS) {
|
||||
this.onDied(summon);
|
||||
return;
|
||||
}
|
||||
|
||||
summon.setPos(end);
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user