提取第三人称相机位置修改方法
This commit is contained in:
parent
51e7aa5fa0
commit
1001d7f2a7
12 changed files with 81 additions and 44 deletions
|
@ -7,6 +7,7 @@ import com.atsuishio.superbwarfare.entity.projectile.FlareDecoyEntity;
|
|||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.HelicopterEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ThirdPersonCameraPosition;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.HeliRocketWeapon;
|
||||
|
@ -111,6 +112,11 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
|||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThirdPersonCameraPosition getThirdPersonCameraPosition(int index) {
|
||||
return new ThirdPersonCameraPosition(7, 1, -2.7);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void defineSynchedData() {
|
||||
super.defineSynchedData();
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
|||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.EnergyVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ThirdPersonCameraPosition;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.LaserWeapon;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.VehicleWeapon;
|
||||
|
@ -95,6 +96,11 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
|
|||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThirdPersonCameraPosition getThirdPersonCameraPosition(int index) {
|
||||
return new ThirdPersonCameraPosition(16, 1.3, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void defineSynchedData() {
|
||||
super.defineSynchedData();
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
|||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.LandArmorEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ThirdPersonCameraPosition;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.ProjectileWeapon;
|
||||
|
@ -104,6 +105,11 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
|||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThirdPersonCameraPosition getThirdPersonCameraPosition(int index) {
|
||||
return new ThirdPersonCameraPosition(3, 1, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void defineSynchedData() {
|
||||
super.defineSynchedData();
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
|||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.LandArmorEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ThirdPersonCameraPosition;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.ProjectileWeapon;
|
||||
|
@ -64,6 +65,7 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
|||
public static final float MAX_HEALTH = VehicleConfig.LAV_150_HP.get();
|
||||
public static final int MAX_ENERGY = VehicleConfig.LAV_150_MAX_ENERGY.get();
|
||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||
|
||||
public Lav150Entity(PlayMessages.SpawnEntity packet, Level world) {
|
||||
this(ModEntities.LAV_150.get(), world);
|
||||
}
|
||||
|
@ -93,6 +95,11 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
|||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThirdPersonCameraPosition getThirdPersonCameraPosition(int index) {
|
||||
return new ThirdPersonCameraPosition(2.75, 1, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void defineSynchedData() {
|
||||
super.defineSynchedData();
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.atsuishio.superbwarfare.ModUtils;
|
|||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ThirdPersonCameraPosition;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.CannonShellWeapon;
|
||||
|
@ -102,6 +103,11 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity
|
|||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThirdPersonCameraPosition getThirdPersonCameraPosition(int index) {
|
||||
return new ThirdPersonCameraPosition(8, 1, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAdditionalSaveData(CompoundTag compound) {
|
||||
super.addAdditionalSaveData(compound);
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.atsuishio.superbwarfare.ModUtils;
|
|||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ThirdPersonCameraPosition;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.CannonShellWeapon;
|
||||
|
@ -95,6 +96,11 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
|
|||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThirdPersonCameraPosition getThirdPersonCameraPosition(int index) {
|
||||
return new ThirdPersonCameraPosition(10, 1.3, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void defineSynchedData() {
|
||||
super.defineSynchedData();
|
||||
|
|
|
@ -3,10 +3,7 @@ package com.atsuishio.superbwarfare.entity.vehicle;
|
|||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.LandArmorEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.*;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.ProjectileWeapon;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.VehicleWeapon;
|
||||
|
@ -81,6 +78,11 @@ public class SpeedboatEntity extends ContainerMobileVehicleEntity implements Geo
|
|||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThirdPersonCameraPosition getThirdPersonCameraPosition(int index) {
|
||||
return new ThirdPersonCameraPosition(3, 1, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void defineSynchedData() {
|
||||
super.defineSynchedData();
|
||||
|
@ -335,6 +337,7 @@ public class SpeedboatEntity extends ContainerMobileVehicleEntity implements Geo
|
|||
transform.rotate(Axis.ZP.rotationDegrees(Mth.lerp(ticks, prevRoll, getRoll())));
|
||||
return transform;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SoundEvent getEngineSound() {
|
||||
return ModSounds.BOAT_ENGINE.get();
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
|||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.MelonBombEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ThirdPersonCameraPosition;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||
|
@ -61,6 +62,11 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
|||
this.setMaxUpStep(0.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThirdPersonCameraPosition getThirdPersonCameraPosition(int index) {
|
||||
return new ThirdPersonCameraPosition(4, 1, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void defineSynchedData() {
|
||||
super.defineSynchedData();
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
|||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.LandArmorEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ThirdPersonCameraPosition;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.CannonShellWeapon;
|
||||
|
@ -126,6 +127,15 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
|||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThirdPersonCameraPosition getThirdPersonCameraPosition(int index) {
|
||||
return switch (index) {
|
||||
case 0 -> new ThirdPersonCameraPosition(5, 1.5, -0.8669625);
|
||||
case 1 -> new ThirdPersonCameraPosition(-0.5, 2, 0);
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void defineSynchedData() {
|
||||
super.defineSynchedData();
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
package com.atsuishio.superbwarfare.entity.vehicle.base;
|
||||
|
||||
public record ThirdPersonCameraPosition(double distance, double y, double z) {
|
||||
}
|
|
@ -208,6 +208,17 @@ public abstract class VehicleEntity extends Entity {
|
|||
return orderedPassengers.indexOf(entity);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 第三人称视角相机位置重载,返回null表示不进行修改
|
||||
*
|
||||
* @param seatIndex 座位索引
|
||||
*/
|
||||
@Nullable
|
||||
public ThirdPersonCameraPosition getThirdPersonCameraPosition(int seatIndex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public float getRoll() {
|
||||
return roll;
|
||||
}
|
||||
|
@ -885,4 +896,5 @@ public abstract class VehicleEntity extends Entity {
|
|||
public void setGunXRot(float pGunXRot) {
|
||||
this.gunXRot = pGunXRot;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.atsuishio.superbwarfare.mixins;
|
|||
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.*;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.atsuishio.superbwarfare.init.ModItems;
|
||||
import com.atsuishio.superbwarfare.init.ModTags;
|
||||
|
@ -154,47 +155,11 @@ public abstract class CameraMixin {
|
|||
return;
|
||||
}
|
||||
|
||||
if (thirdPerson && entity.getVehicle() instanceof Mk42Entity) {
|
||||
move(-getMaxZoom(8), 1, 0.0);
|
||||
return;
|
||||
}
|
||||
if (thirdPerson && entity.getVehicle() instanceof Mle1934Entity) {
|
||||
move(-getMaxZoom(10), 1.3, 0.0);
|
||||
return;
|
||||
}
|
||||
if (thirdPerson && entity.getVehicle() instanceof AnnihilatorEntity) {
|
||||
move(-getMaxZoom(16), 1.3, 0.0);
|
||||
return;
|
||||
}
|
||||
if (thirdPerson && entity.getVehicle() instanceof SpeedboatEntity && !ClientEventHandler.zoomVehicle) {
|
||||
move(-getMaxZoom(3), 1, 0.0);
|
||||
return;
|
||||
}
|
||||
if (thirdPerson && entity.getVehicle() instanceof Ah6Entity) {
|
||||
move(-getMaxZoom(7), 1, -2.7);
|
||||
return;
|
||||
}
|
||||
if (!thirdPerson || !(entity.getVehicle() instanceof VehicleEntity vehicle)) return;
|
||||
|
||||
if (thirdPerson && entity.getVehicle() instanceof Tom6Entity) {
|
||||
move(-getMaxZoom(4), 1, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (thirdPerson && entity.getVehicle() instanceof Lav150Entity && !ClientEventHandler.zoomVehicle) {
|
||||
move(-getMaxZoom(2.75), 1, 0.0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (thirdPerson && entity.getVehicle() instanceof Bmp2Entity && !ClientEventHandler.zoomVehicle) {
|
||||
move(-getMaxZoom(3), 1, 0.0);
|
||||
}
|
||||
|
||||
if (thirdPerson && entity.getVehicle() instanceof Yx100Entity yx100 && !ClientEventHandler.zoomVehicle) {
|
||||
if (yx100.getFirstPassenger() == entity) {
|
||||
move(-getMaxZoom(5), 1.5, -0.8669625f);
|
||||
} else if (yx100.getNthEntity(1) == entity) {
|
||||
move(-getMaxZoom(-0.5), 2, 0);
|
||||
}
|
||||
var cameraPosition = vehicle.getThirdPersonCameraPosition(vehicle.getSeatIndex(entity));
|
||||
if (cameraPosition != null) {
|
||||
move(-getMaxZoom(cameraPosition.distance()), cameraPosition.y(), cameraPosition.z());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue