Add flaps: flappable tag, flap lever on the control node, flap physics (0.4.0)
Shift-right-click a block in improved_aerodynamics:flappable to make it a flap. G/H step the node's flap lever UP/TAKEOFF/LANDING; flaps slew to the configured angle, add lift and drag and raise the stall angle, and retract above a max speed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YVREx3uo7nz1FEhzveWTUh
This commit is contained in:
18 files changed
+525
-13
No files matched your search
@@ -0,0 +1,33 @@
|
||||
package dev.lumareth.improvedAerodynamics.network;
|
||||
|
||||
import dev.lumareth.improvedAerodynamics.flight.FlapControl;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.network.NetworkEvent;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/** Sent when a pilot moves the flap lever: more flaps (true) or fewer. */
|
||||
public final class FlapPacket {
|
||||
private final boolean extend;
|
||||
|
||||
public FlapPacket(boolean extend) {
|
||||
this.extend = extend;
|
||||
}
|
||||
|
||||
public void encode(FriendlyByteBuf buffer) {
|
||||
buffer.writeBoolean(extend);
|
||||
}
|
||||
|
||||
public static FlapPacket decode(FriendlyByteBuf buffer) {
|
||||
return new FlapPacket(buffer.readBoolean());
|
||||
}
|
||||
|
||||
public void handle(Supplier<NetworkEvent.Context> context) {
|
||||
ServerPlayer player = context.get().getSender();
|
||||
if (player != null && ModList.get().isLoaded("valkyrien_warium")) {
|
||||
FlapControl.step(player, extend ? 1 : -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user