Freelook Mod
Allows you to rotate your camera freely around your character!
Features
- Multiple Camera Perspectives
- Customizable Activation Style
- Camera Cycle Integration
- Smooth Transitions
Server Opt-Opt
Some servers may consider freelook a competitive advantage. As of 2.0.0, Freelook includes a simple opt‑out protocol.
How it works
- When a player joins, the client sends a
freelook:handshake packet.
- If the server wants to disable freelook, it responds with a
freelook:disable packet.
- Then the player cannot use freelook for that session.
Click to expand code example
```java
public class Example implements ModInitializer {
@Override
public void onInitialize() {
PayloadTypeRegistry.clientboundPlay().register(DisableModPayload.TYPE, DisableModPayload.CODEC);
PayloadTypeRegistry.serverboundPlay().register(HandshakePayload.TYPE, HandshakePayload.CODEC);
ServerPlayNetworking.registerGlobalReceiver(HandshakePayload.TYPE,
(payload, ctx) -> ServerPlayNetworking.send(ctx.player(), new DisableModPayload())
);
}
public record DisableModPayload() implements CustomPacketPayload {
public static final Type TYPE = new Type(Identifier.parse("freelook:disable"));
public static final StreamCodec CODEC = StreamCodec.unit(new DisableModPayload());
@Override
public Type extends CustomPacketPayload> type() {
return TYPE;
}
}
public record HandshakePayload() implements CustomPacketPayload {
public static final Type TYPE = new Type(Identifier.parse("freelook:handshake"));
public static final StreamCodec CODEC = StreamCodec.unit(new HandshakePayload());
@Override
public Type extends CustomPacketPayload> type() {
return TYPE;
}
}
}
```
Code licensed under LGPL 3.0.
暂无评论,抢个沙发吧~