Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/muqsit/libcamera/CameraInstruction.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static function set(
?Vector3 $facing_pos = null
) : self{
$preset_id = libcamera::getPresetRegistry()->network_ids[spl_object_id($preset)];
$instruction = new CameraSetInstruction($preset_id, $ease, $camera_pos, $rot, $facing_pos, null, null, null);
$instruction = new CameraSetInstruction($preset_id, $ease, $camera_pos, $rot, $facing_pos, null, null, null, false);
return new self([[$instruction, null, null, null]]);
}

Expand Down
14 changes: 6 additions & 8 deletions src/muqsit/libcamera/libcamera.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ public static function isRegistered(): bool{
public static function register(Plugin $plugin) : void{
!self::$registered || throw new BadMethodCallException("Tried to registered an already existing libcamera instance");
$preset_registry = new CameraPresetRegistry([
"free" => new CameraPreset("minecraft:free", "", null, null, null, null, null, null, null, null, null, null, null, null, null, null, CameraPreset::AUDIO_LISTENER_TYPE_CAMERA, false, false, null),
"first_person" => new CameraPreset("minecraft:first_person", "", null, null, null, null, null, null, null, null, null, null, null, null, null, null, CameraPreset::AUDIO_LISTENER_TYPE_PLAYER, false, false, null),
"third_person" => new CameraPreset("minecraft:third_person", "", null, null, null, null, null, null, null, null, null, null, null, null, null, null, CameraPreset::AUDIO_LISTENER_TYPE_PLAYER, false, false, null),
"third_person_front" => new CameraPreset("minecraft:third_person_front", "", null, null, null, null, null, null, null, null, null, null, null, null, null, null, CameraPreset::AUDIO_LISTENER_TYPE_PLAYER, false, false, null),
"target" => new CameraPreset("minecraft:target", "minecraft:free", null, null, null, null, null, 0.0, true, new Vector2(0.0, 360.0), new Vector2(0.0, 180.0), true, 50.0, null, null, null, CameraPreset::AUDIO_LISTENER_TYPE_CAMERA, false, false, null)
"free" => new CameraPreset("minecraft:free", "", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, CameraPreset::AUDIO_LISTENER_TYPE_CAMERA, false, null, null),
"first_person" => new CameraPreset("minecraft:first_person", "", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, CameraPreset::AUDIO_LISTENER_TYPE_PLAYER, false, null, null),
"third_person" => new CameraPreset("minecraft:third_person", "", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, CameraPreset::AUDIO_LISTENER_TYPE_PLAYER, false, null, null),
"third_person_front" => new CameraPreset("minecraft:third_person_front", "", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, CameraPreset::AUDIO_LISTENER_TYPE_PLAYER, false, null, null),
"target" => new CameraPreset("minecraft:target", "minecraft:free", null, null, null, null, null, 0.0, true, new Vector2(0.0, 360.0), new Vector2(0.0, 180.0), true, 50.0, null, null, null, null, null, CameraPreset::AUDIO_LISTENER_TYPE_CAMERA, false, null, null)
]);
$packet = CameraPresetsPacket::create(array_values($preset_registry->registered));
Server::getInstance()->getPluginManager()->registerEvent(DataPacketReceiveEvent::class, function(DataPacketReceiveEvent $event) use($packet) : void{
Expand All @@ -48,9 +48,7 @@ public static function register(Plugin $plugin) : void{
foreach($event->getPackets() as $packet){
if($packet instanceof StartGamePacket){
$experiments = $packet->levelSettings->experiments->getExperiments();
$experiments["focus_target_camera"] = true;
$experiments["third_person_cameras"] = true;
$experiments["cameras"] = true;
$experiments["experimental_creator_camera"] = true;//It seems to work without it.
$packet->levelSettings->experiments = new Experiments($experiments, true);
}
}
Expand Down