Class CalculateDetachedCameraDistanceEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.client.event.CalculateDetachedCameraDistanceEvent
public class CalculateDetachedCameraDistanceEvent
extends net.neoforged.bus.api.Event
Fired for hooking the maximum distance from the player to the camera in third-person view.
The ray-cast that reduces this distance based on the blocks around the player is invoked after this event is fired.
This event is not cancellable.
This event is fired on the main Forge event bus, only on the logical client.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Cameraprivate final booleanprivate floatprivate final floatprivate final floatprivate final floatprivate final float -
Constructor Summary
ConstructorsConstructorDescriptionCalculateDetachedCameraDistanceEvent(Camera camera, boolean cameraFlipped, float entityScale, float entityDistance, float vehicleEntityScale, float vehicleDistance) -
Method Summary
Modifier and TypeMethodDescriptionReturns the camera instance.floatReturns the final distance from the camera to the.invalid reference
camera entity
floatReturns the unscaled camera distance provided by the.invalid reference
camera entityfloatReturns the scaling factor that will be applied to theentityDistanceto compute the final distance, based on the size of the.invalid reference
camera entityfloatReturns the unscaled camera distance provided by the vehicle ridden by the, if any.invalid reference
camera entityfloatReturns the scaling factor that will be applied to thevehicleEntityDistanceto compute the final distance, based on the size of the vehicle ridden by the, if any.invalid reference
camera entitybooleanReturns `true` if the camera is flipped (ie facing backward instead of forward).voidsetDistance(float distance) Sets final distance from the camera to the.invalid reference
camera entity
-
Field Details
-
camera
-
cameraFlipped
private final boolean cameraFlipped -
entityScale
private final float entityScale -
entityDistance
private final float entityDistance -
vehicleEntityScale
private final float vehicleEntityScale -
vehicleEntityDistance
private final float vehicleEntityDistance -
distance
private float distance
-
-
Constructor Details
-
CalculateDetachedCameraDistanceEvent
@Internal public CalculateDetachedCameraDistanceEvent(Camera camera, boolean cameraFlipped, float entityScale, float entityDistance, float vehicleEntityScale, float vehicleDistance)
-
-
Method Details
-
getCamera
-
isCameraFlipped
public boolean isCameraFlipped()Returns `true` if the camera is flipped (ie facing backward instead of forward). -
getEntityScalingFactor
public float getEntityScalingFactor()Returns the scaling factor that will be applied to theentityDistanceto compute the final distance, based on the size of the.invalid reference
camera entity -
getEntityDistance
public float getEntityDistance()Returns the unscaled camera distance provided by the.invalid reference
camera entity -
getVehicleEntityScalingFactor
public float getVehicleEntityScalingFactor()Returns the scaling factor that will be applied to thevehicleEntityDistanceto compute the final distance, based on the size of the vehicle ridden by the, if any.invalid reference
camera entity -
getVehicleEntityDistance
public float getVehicleEntityDistance()Returns the unscaled camera distance provided by the vehicle ridden by the, if any.invalid reference
camera entity -
getDistance
public float getDistance()Returns the final distance from the camera to the.invalid reference
camera entity
-
setDistance
public void setDistance(float distance) Sets final distance from the camera to the.invalid reference
camera entity
- Parameters:
distance- The new distance from the camera to theinvalid reference
camera entity
-