Skip to content

Commit 04802dc

Browse files
committed
Update CameraMixin documentation
1 parent d971277 commit 04802dc

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

common/src/main/java/com/lambda/mixin/render/CameraMixin.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,39 @@ private float onDistanceUpdate(float desiredCameraDistance) {
105105
return desiredCameraDistance;
106106
}
107107

108+
/**
109+
* Modifies the arguments for setting the camera rotation.
110+
* Mixes into 4 arguments:
111+
* <p>Experimental Minecart Controller:</p>
112+
* <pre>
113+
* if (experimentalMinecartController.hasCurrentLerpSteps()) {
114+
* Vec3d vec3d = minecartEntity.getPassengerRidingPos(focusedEntity).subtract(minecartEntity.getPos()).subtract(focusedEntity.getVehicleAttachmentPos(minecartEntity)).add(new Vec3d(0.0, (double)MathHelper.lerp(tickProgress, this.lastCameraY, this.cameraY), 0.0));
115+
* this.setRotation(focusedEntity.getYaw(tickProgress), focusedEntity.getPitch(tickProgress));
116+
* this.setPos(experimentalMinecartController.getLerpedPosition(tickProgress).add(vec3d));
117+
* break label39;
118+
* }
119+
* </pre>
120+
* <p>Default Camera:</p>
121+
* <pre>
122+
* this.setRotation(focusedEntity.getYaw(tickProgress), focusedEntity.getPitch(tickProgress));
123+
* this.setPos(MathHelper.lerp((double)tickProgress, focusedEntity.lastX, focusedEntity.getX()), MathHelper.lerp((double)tickProgress, focusedEntity.lastY, focusedEntity.getY()) + (double)MathHelper.lerp(tickProgress, this.lastCameraY, this.cameraY), MathHelper.lerp((double)tickProgress, focusedEntity.lastZ, focusedEntity.getZ()));
124+
* </pre>
125+
* <p>Third person camera:</p>
126+
* <pre>
127+
* if (thirdPerson) {
128+
* if (inverseView) {
129+
* this.setRotation(this.yaw + 180.0F, -this.pitch);
130+
* }
131+
* // ...
132+
* }
133+
* </pre>
134+
* <p>When the player is focused on another Living Entity:</p>
135+
* <pre>
136+
* Direction direction = ((LivingEntity)focusedEntity).getSleepingDirection();
137+
* this.setRotation(direction != null ? direction.getPositiveHorizontalDegrees() - 180.0F : 0.0F, 0.0F);
138+
* this.moveBy(0.0F, 0.3F, 0.0F);
139+
* </pre>
140+
*/
108141
@ModifyArgs(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;setRotation(FF)V"))
109142
private void onUpdateSetRotationArgs(Args args) {
110143
if (FreeLook.INSTANCE.isEnabled()) {

0 commit comments

Comments
 (0)