Package io.github.ennuil.libzoomer.api
Class ZoomInstance
java.lang.Object
io.github.ennuil.libzoomer.api.ZoomInstance
The zoom instance is essentially the zoom. It contains all the values and sub-instances required to zoom.
-
Constructor Summary
ConstructorsConstructorDescriptionZoomInstance(net.minecraft.util.Identifier instanceId, float defaultZoomDivisor, TransitionMode transition, @Nullable MouseModifier modifier, @Nullable ZoomOverlay overlay) Initializes a zoom instance. -
Method Summary
Modifier and TypeMethodDescriptiondoubleGets the instance's default zoom divisor.net.minecraft.util.IdentifierObtains the identifier of this zoom instance.@Nullable MouseModifierGets the instance's mouse modifier.Gets the instance's transition mode.booleangetZoom()Gets the zoom instance's zoom state.doubleGets the zoom instance's current zoom divisor.@Nullable ZoomOverlayGets the instance's zoom overlay.booleanGets the mouse modifier's active state.booleanGets the zoom overlay's active state.booleanGets the active state from the instance's transition mode.doubleSets the instance's zoom divisor to the default zoom divisor.doublesetDefaultZoomDivisor(double newDivisor) Sets the instance's default zoom divisor.setMouseModifier(MouseModifier modifier) Sets the mouse modifier.setTransitionMode(TransitionMode transition) Sets the instance's transition mode.booleansetZoom(boolean newZoom) Sets the zoom instance's zoom state.doublesetZoomDivisor(double newDivisor) Sets the zoom instance's current zoom divisor.setZoomOverlay(ZoomOverlay overlay) Sets the zoom overlay.
-
Constructor Details
-
ZoomInstance
public ZoomInstance(net.minecraft.util.Identifier instanceId, float defaultZoomDivisor, TransitionMode transition, @Nullable @Nullable MouseModifier modifier, @Nullable @Nullable ZoomOverlay overlay) Initializes a zoom instance. It must be registered by the instance registry before being functional- Parameters:
instanceId- the identifier for this zoom instancedefaultZoomDivisor- the default zoom divisor, it will be this instance's initial zoom divisor valuetransition- the zoom instance's transition mode, if null,InstantTransitionModewill be usedmodifier- the zoom instance's mouse modifier, if null, no mouse modifier will be appliedoverlay- the zoom instance's zoom overlay, if null, no zoom overlay will be applied
-
-
Method Details
-
getInstanceId
public net.minecraft.util.Identifier getInstanceId()Obtains the identifier of this zoom instance.- Returns:
- this zoom instance's identifier
-
getZoom
public boolean getZoom()Gets the zoom instance's zoom state. This is used to check if this instance's sub-instances should be active or not.- Returns:
- the current zoom state
-
setZoom
public boolean setZoom(boolean newZoom) Sets the zoom instance's zoom state.- Parameters:
newZoom- The new zoom state.- Returns:
- the zoom state with the new value
-
getZoomDivisor
public double getZoomDivisor()Gets the zoom instance's current zoom divisor. Do note that this isn't the same as the transition mode's internal multiplier.- Returns:
- the current zoom divisor
-
setZoomDivisor
public double setZoomDivisor(double newDivisor) Sets the zoom instance's current zoom divisor.- Parameters:
newDivisor- the new zoom divisor- Returns:
- the zoom divisor with the new value
-
resetZoomDivisor
public double resetZoomDivisor()Sets the instance's zoom divisor to the default zoom divisor.- Returns:
- the zoom divisor with the new value
-
getDefaultZoomDivisor
public double getDefaultZoomDivisor()Gets the instance's default zoom divisor. This is used as the initial zoom divisor and as the value used onresetZoomDivisor().- Returns:
- the default zoom divisor
-
setDefaultZoomDivisor
public double setDefaultZoomDivisor(double newDivisor) Sets the instance's default zoom divisor.- Parameters:
newDivisor- the new default zoom divisor- Returns:
- the default zoom divisor with the new value
-
getTransitionMode
Gets the instance's transition mode.- Returns:
- the transition mode
-
setTransitionMode
Sets the instance's transition mode.- Parameters:
transition- the new transition mode- Returns:
- the transition mode with the new mode
-
isTransitionActive
public boolean isTransitionActive()Gets the active state from the instance's transition mode.- Returns:
- the transition mode's active state
-
getMouseModifier
Gets the instance's mouse modifier.- Returns:
- the mouse modifier
-
setMouseModifier
Sets the mouse modifier.- Parameters:
modifier- the new mouse modifier- Returns:
- the mouse modifier with the new modifier
-
isModifierActive
public boolean isModifierActive()Gets the mouse modifier's active state.- Returns:
- the mouse modifier's active state if the modifier isn't null, or
falseotherwise
-
getZoomOverlay
Gets the instance's zoom overlay.- Returns:
- the zoom overlay
-
setZoomOverlay
Sets the zoom overlay.- Parameters:
overlay- the new zoom overlay- Returns:
- the zoom overlay with the new overlay
-
isOverlayActive
public boolean isOverlayActive()Gets the zoom overlay's active state.- Returns:
- the zoom overlay's active state if the overlay isn't null, or
falseotherwise
-