Add vectored afterburner nozzle with afterburner key and exhaust style
- Add vectored afterburner nozzle block with AzureLib model, deflection, throttle and afterburner state - Drive nozzles from the vehicle control node and map pitch, roll and yaw to differential deflection - Add afterburner toggle key and packet, linked to the control node - Replace Warium exhaust effect entities with improved flames, particles and sounds when exhaustStyle is improved - Add /aero seedgen to measure the air ceiling for the air placeholder - Upgrade Warium VS to 1.1.7 and make the lift use horizontal speed
This commit is contained in:
1 parent
1e659816b8
commit
70eb237d70
56 files changed
+2197
-12
No files matched your search
@@ -0,0 +1,46 @@
|
||||
package dev.lumareth.improvedAerodynamics.exhaust;
|
||||
|
||||
import net.mcreator.valkyrienwarium.ships.ForceData;
|
||||
import net.mcreator.valkyrienwarium.ships.ForceDirectionMode;
|
||||
import net.mcreator.valkyrienwarium.ships.ForceInducedShips;
|
||||
import net.mcreator.valkyrienwarium.ships.ForceMode;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.joml.Vector3d;
|
||||
import org.valkyrienskies.core.api.ships.LoadedServerShip;
|
||||
import org.valkyrienskies.core.api.ships.ServerShip;
|
||||
import org.valkyrienskies.mod.common.VSGameUtilsKt;
|
||||
|
||||
/**
|
||||
* Thrust of a nozzle, the way Futurism's vectored afterburner makes it: the power comes from the Warium jet exhaust
|
||||
* directly behind the nozzle, which hands it over through its {@code ExhaustPower} value instead of pushing the ship
|
||||
* itself because the nozzle is in the {@code warium_vs:blocksjet} tag. The push goes opposite to the way the exhaust
|
||||
* leaves, so a nozzle deflected upwards pushes the tail down. Only used where Warium VS is installed.
|
||||
*/
|
||||
final class ExhaustThrust {
|
||||
private ExhaustThrust() {
|
||||
}
|
||||
|
||||
/** The power the jet exhaust directly behind the nozzle hands over, 0 if there is none or it is off. */
|
||||
static double power(Level level, BlockPos pos, Direction facing) {
|
||||
BlockEntity exhaust = level.getBlockEntity(pos.relative(facing.getOpposite()));
|
||||
return exhaust != null ? exhaust.getPersistentData().getDouble("ExhaustPower") : 0.0;
|
||||
}
|
||||
|
||||
static void apply(ServerLevel level, BlockPos pos, Direction facing, Vec3 exhaustDirection) {
|
||||
double power = power(level, pos, facing);
|
||||
if (power <= 0.0) {
|
||||
return;
|
||||
}
|
||||
LoadedServerShip ship = VSGameUtilsKt.getLoadedShipManagingPos(level, pos);
|
||||
if (ship == null || ((ServerShip) ship).isStatic()) {
|
||||
return;
|
||||
}
|
||||
Vector3d push = new Vector3d(-exhaustDirection.x, -exhaustDirection.y, -exhaustDirection.z);
|
||||
ForceInducedShips.getOrCreate(ship).addForce(pos, new ForceData(push, power, ForceMode.POSITION, ForceDirectionMode.SHIP));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user