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
34 lines
1.0 KiB
Java
34 lines
1.0 KiB
Java
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);
|
|
}
|
|
}
|
|
}
|