优化音效
This commit is contained in:
parent
c2f066e4ea
commit
d0e44ff9c3
6 changed files with 19 additions and 6 deletions
|
@ -208,8 +208,7 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
||||||
this.entityData.set(POWER, this.entityData.get(POWER) * 0.995f);
|
this.entityData.set(POWER, this.entityData.get(POWER) * 0.995f);
|
||||||
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) * 0.95f);
|
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) * 0.95f);
|
||||||
|
|
||||||
|
this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale(0.04 * this.entityData.get(POWER))));
|
||||||
this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale(0.03 * this.entityData.get(POWER))));
|
|
||||||
|
|
||||||
setDeltaMovement(getDeltaMovement().add(0.0f, Mth.clamp(Math.sin((onGround() ? 45 : -(getXRot() - 20)) * Mth.DEG_TO_RAD) * Math.sin((90 - this.getXRot()) * Mth.DEG_TO_RAD) * getDeltaMovement().dot(getViewVector(1)) * 0.04, -0.04, 0.09), 0.0f));
|
setDeltaMovement(getDeltaMovement().add(0.0f, Mth.clamp(Math.sin((onGround() ? 45 : -(getXRot() - 20)) * Mth.DEG_TO_RAD) * Math.sin((90 - this.getXRot()) * Mth.DEG_TO_RAD) * getDeltaMovement().dot(getViewVector(1)) * 0.04, -0.04, 0.09), 0.0f));
|
||||||
|
|
||||||
|
@ -223,14 +222,19 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
||||||
// ));
|
// ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean engineRunning() {
|
||||||
|
return (getFirstPassenger() != null && Math.abs(getDeltaMovement().length()) > 0);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SoundEvent getEngineSound() {
|
public SoundEvent getEngineSound() {
|
||||||
return super.getEngineSound();
|
return ModSounds.FLY_LOOP.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getEngineSoundVolume() {
|
public float getEngineSoundVolume() {
|
||||||
return entityData.get(POWER);
|
return (float) getDeltaMovement().length();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void clampRotation(Entity entity) {
|
protected void clampRotation(Entity entity) {
|
||||||
|
|
|
@ -162,7 +162,7 @@ public class WheelChairEntity extends MobileVehicleEntity implements GeoEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.forwardInputDown) {
|
if (this.forwardInputDown) {
|
||||||
this.entityData.set(POWER, this.entityData.get(POWER) + 0.01f);
|
this.entityData.set(POWER, this.entityData.get(POWER) + (sprintInputDown ? 0.02f : 0.01f));
|
||||||
if (this.getEnergy() <= 0 && passenger instanceof Player player) {
|
if (this.getEnergy() <= 0 && passenger instanceof Player player) {
|
||||||
moveWithOutPower(player, true);
|
moveWithOutPower(player, true);
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ public class WheelChairEntity extends MobileVehicleEntity implements GeoEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getEngineSoundVolume() {
|
public float getEngineSoundVolume() {
|
||||||
return entityData.get(POWER);
|
return getEnergy() > 0 ? entityData.get(POWER) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void clampRotation(Entity entity) {
|
protected void clampRotation(Entity entity) {
|
||||||
|
|
|
@ -464,6 +464,7 @@ public class ModSounds {
|
||||||
public static final DeferredHolder<SoundEvent, SoundEvent> MISSILE_START = REGISTRY.register("missile_start", () -> SoundEvent.createVariableRangeEvent(Mod.loc("missile_start")));
|
public static final DeferredHolder<SoundEvent, SoundEvent> MISSILE_START = REGISTRY.register("missile_start", () -> SoundEvent.createVariableRangeEvent(Mod.loc("missile_start")));
|
||||||
public static final DeferredHolder<SoundEvent, SoundEvent> JET_LOCK = REGISTRY.register("jet_lock", () -> SoundEvent.createVariableRangeEvent(Mod.loc("jet_lock")));
|
public static final DeferredHolder<SoundEvent, SoundEvent> JET_LOCK = REGISTRY.register("jet_lock", () -> SoundEvent.createVariableRangeEvent(Mod.loc("jet_lock")));
|
||||||
public static final DeferredHolder<SoundEvent, SoundEvent> JET_LOCKON = REGISTRY.register("jet_lockon", () -> SoundEvent.createVariableRangeEvent(Mod.loc("jet_lockon")));
|
public static final DeferredHolder<SoundEvent, SoundEvent> JET_LOCKON = REGISTRY.register("jet_lockon", () -> SoundEvent.createVariableRangeEvent(Mod.loc("jet_lockon")));
|
||||||
|
public static final DeferredHolder<SoundEvent, SoundEvent> FLY_LOOP = REGISTRY.register("fly_loop", () -> SoundEvent.createVariableRangeEvent(Mod.loc("fly_loop")));
|
||||||
|
|
||||||
public static final DeferredHolder<SoundEvent, SoundEvent> AURELIA_SCEPTRE_FIRE_1P = REGISTRY.register("aurelia_sceptre_fire_1p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("aurelia_sceptre_fire_1p")));
|
public static final DeferredHolder<SoundEvent, SoundEvent> AURELIA_SCEPTRE_FIRE_1P = REGISTRY.register("aurelia_sceptre_fire_1p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("aurelia_sceptre_fire_1p")));
|
||||||
public static final DeferredHolder<SoundEvent, SoundEvent> AURELIA_SCEPTRE_FIRE_3P = REGISTRY.register("aurelia_sceptre_fire_3p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("aurelia_sceptre_fire_3p")));
|
public static final DeferredHolder<SoundEvent, SoundEvent> AURELIA_SCEPTRE_FIRE_3P = REGISTRY.register("aurelia_sceptre_fire_3p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("aurelia_sceptre_fire_3p")));
|
||||||
|
|
|
@ -3218,5 +3218,13 @@
|
||||||
"stream": false
|
"stream": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"fly_loop": {
|
||||||
|
"sounds": [
|
||||||
|
{
|
||||||
|
"name": "superbwarfare:fly_loop",
|
||||||
|
"stream": false
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
BIN
src/main/resources/assets/superbwarfare/sounds/fly_loop.ogg
Normal file
BIN
src/main/resources/assets/superbwarfare/sounds/fly_loop.ogg
Normal file
Binary file not shown.
Binary file not shown.
Loading…
Add table
Reference in a new issue