修复子弹移动问题

This commit is contained in:
17146 2024-05-06 16:16:45 +08:00
parent 2e5d9b75f6
commit 26f63be31f
3 changed files with 12 additions and 4 deletions

View file

@ -35,8 +35,7 @@ import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.util.GeckoLibUtil;
import java.util.List;
// TODO 重写阔剑地雷
public class ClaymoreEntity extends TamableAnimal implements GeoEntity {
public static final EntityDataAccessor<Boolean> SHOOT = SynchedEntityData.defineId(ClaymoreEntity.class, EntityDataSerializers.BOOLEAN);
public static final EntityDataAccessor<String> ANIMATION = SynchedEntityData.defineId(ClaymoreEntity.class, EntityDataSerializers.STRING);
@ -87,7 +86,7 @@ public class ClaymoreEntity extends TamableAnimal implements GeoEntity {
@Override
public MobType getMobType() {
return MobType.UNDEFINED;
return super.getMobType();
}
@Override
@ -200,7 +199,9 @@ public class ClaymoreEntity extends TamableAnimal implements GeoEntity {
@Override
public AgeableMob getBreedOffspring(ServerLevel serverWorld, AgeableMob ageable) {
ClaymoreEntity retval = TargetModEntities.CLAYMORE.get().create(serverWorld);
if (retval != null) {
retval.finalizeSpawn(serverWorld, serverWorld.getCurrentDifficultyAt(retval.blockPosition()), MobSpawnType.BREEDING, null, null);
}
return retval;
}

View file

@ -176,6 +176,8 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
this.updateHeading();
this.onProjectileTick();
Vec3 vec = this.getDeltaMovement();
if (!this.level().isClientSide()) {
Vec3 startVec = this.position();
Vec3 endVec = startVec.add(this.getDeltaMovement());
@ -199,6 +201,10 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
} else {
this.onHit(result);
}
this.setPos(this.getX() + vec.x, this.getY() + vec.y, this.getZ() + vec.z);
} else {
this.setPosRaw(this.getX() + vec.x, this.getY() + vec.y, this.getZ() + vec.z);
}
if (this.tickCount > 200) {

View file

@ -15,6 +15,7 @@ import net.minecraftforge.fml.common.Mod;
import javax.annotation.Nullable;
// TODO 把伤害逻辑移植到箭类中
@Mod.EventBusSubscriber
public class ArrowdamageProcedure {
@SubscribeEvent