-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
how fun
- Loading branch information
Showing
88 changed files
with
956 additions
and
597 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
- added support for NeoForge 20.5+ | ||
- made missing dependencies error on Fabric more user-friendly | ||
- improved mod compatibility by using events on LexForge for mc17-mc18.2 | ||
- added explicit incompatibility with outdated versions of Embeddium++ which were causing obscure crashes | ||
- fixed crash on NeoForge 20.5+ | ||
- many internal refactors | ||
- further improvements to overall system stability and other minor adjustments have been made to enhance the user experience |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
api/src/main/java/dev/nolij/zume/api/config/v0/ZumeConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package dev.nolij.zume.api.config.v0; | ||
|
||
public class ZumeConfig { | ||
|
||
public boolean isCinematicZoomEnabled; | ||
public double mouseSensitivityFloor; | ||
public short zoomSpeed; | ||
public boolean isZoomScrollingEnabled; | ||
public short zoomSmoothnessMilliseconds; | ||
public double animationEasingExponent; | ||
public double zoomEasingExponent; | ||
public double defaultZoom; | ||
public boolean isFirstPersonToggleModeEnabled; | ||
public boolean isThirdPersonToggleModeEnabled; | ||
public double minimumFOV; | ||
public double maximumThirdPersonZoomBlocks; | ||
public double minimumThirdPersonZoomBlocks; | ||
public boolean isDisabled; | ||
|
||
} |
106 changes: 106 additions & 0 deletions
106
api/src/main/java/dev/nolij/zume/api/config/v0/ZumeConfigAPI.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
package dev.nolij.zume.api.config.v0; | ||
|
||
import dev.nolij.zume.impl.Zume; | ||
import dev.nolij.zume.impl.config.ZumeConfigImpl; | ||
|
||
public final class ZumeConfigAPI { | ||
|
||
public static boolean isCinematicZoomEnabled() { | ||
return Zume.config.enableCinematicZoom; | ||
} | ||
|
||
public static double getMouseSensitivityFloor() { | ||
return Zume.config.mouseSensitivityFloor; | ||
} | ||
|
||
public static short getZoomSpeed() { | ||
return Zume.config.zoomSpeed; | ||
} | ||
|
||
public static boolean isZoomScrollingEnabled() { | ||
return Zume.config.enableZoomScrolling; | ||
} | ||
|
||
public static short getZoomSmoothnessMilliseconds() { | ||
return Zume.config.zoomSmoothnessMs; | ||
} | ||
|
||
public static double getAnimationEasingExponent() { | ||
return Zume.config.animationEasingExponent; | ||
} | ||
|
||
public static double getZoomEasingExponent() { | ||
return Zume.config.zoomEasingExponent; | ||
} | ||
|
||
public static double getDefaultZoom() { | ||
return Zume.config.defaultZoom; | ||
} | ||
|
||
public static boolean isFirstPersonToggleModeEnabled() { | ||
return Zume.config.toggleMode; | ||
} | ||
|
||
public static boolean isThirdPersonToggleModeEnabled() { | ||
return Zume.config.thirdPersonToggleMode; | ||
} | ||
|
||
public static double getMinimumFOV() { | ||
return Zume.config.minFOV; | ||
} | ||
|
||
public static double getMaximumThirdPersonZoomBlocks() { | ||
return Zume.config.maxThirdPersonZoomDistance; | ||
} | ||
|
||
public static double getMinimumThirdPersonZoomBlocks() { | ||
return Zume.config.minThirdPersonZoomDistance; | ||
} | ||
|
||
public static boolean isDisabled() { | ||
return Zume.config.disable; | ||
} | ||
|
||
public static ZumeConfig getSnapshot() { | ||
final ZumeConfig snapshot = new ZumeConfig(); | ||
|
||
snapshot.isCinematicZoomEnabled = isCinematicZoomEnabled(); | ||
snapshot.mouseSensitivityFloor = getMouseSensitivityFloor(); | ||
snapshot.zoomSpeed = getZoomSpeed(); | ||
snapshot.isZoomScrollingEnabled = isZoomScrollingEnabled(); | ||
snapshot.zoomSmoothnessMilliseconds = getZoomSmoothnessMilliseconds(); | ||
snapshot.animationEasingExponent = getAnimationEasingExponent(); | ||
snapshot.zoomEasingExponent = getZoomEasingExponent(); | ||
snapshot.defaultZoom = getDefaultZoom(); | ||
snapshot.isFirstPersonToggleModeEnabled = isFirstPersonToggleModeEnabled(); | ||
snapshot.isThirdPersonToggleModeEnabled = isThirdPersonToggleModeEnabled(); | ||
snapshot.minimumFOV = getMinimumFOV(); | ||
snapshot.maximumThirdPersonZoomBlocks = getMaximumThirdPersonZoomBlocks(); | ||
snapshot.minimumThirdPersonZoomBlocks = getMinimumThirdPersonZoomBlocks(); | ||
snapshot.isDisabled = isDisabled(); | ||
|
||
return snapshot; | ||
} | ||
|
||
public static void replaceConfig(ZumeConfig replacement) throws InterruptedException { | ||
final ZumeConfigImpl config = new ZumeConfigImpl(); | ||
|
||
config.enableCinematicZoom = replacement.isCinematicZoomEnabled; | ||
config.mouseSensitivityFloor = replacement.mouseSensitivityFloor; | ||
config.zoomSpeed = replacement.zoomSpeed; | ||
config.enableZoomScrolling = replacement.isZoomScrollingEnabled; | ||
config.zoomSmoothnessMs = replacement.zoomSmoothnessMilliseconds; | ||
config.animationEasingExponent = replacement.animationEasingExponent; | ||
config.zoomEasingExponent = replacement.zoomEasingExponent; | ||
config.defaultZoom = replacement.defaultZoom; | ||
config.toggleMode = replacement.isFirstPersonToggleModeEnabled; | ||
config.thirdPersonToggleMode = replacement.isThirdPersonToggleModeEnabled; | ||
config.minFOV = replacement.minimumFOV; | ||
config.maxThirdPersonZoomDistance = replacement.maximumThirdPersonZoomBlocks; | ||
config.minThirdPersonZoomDistance = replacement.minimumThirdPersonZoomBlocks; | ||
config.disable = replacement.isDisabled; | ||
|
||
ZumeConfigImpl.replace(config); | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
api/src/main/java/dev/nolij/zume/api/platform/v0/CameraPerspective.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package dev.nolij.zume.api.platform.v0; | ||
|
||
public enum CameraPerspective { | ||
|
||
FIRST_PERSON, | ||
THIRD_PERSON, | ||
THIRD_PERSON_FLIPPED, | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...olij/zume/common/IZumeImplementation.java → .../api/platform/v0/IZumeImplementation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package dev.nolij.zume.common; | ||
package dev.nolij.zume.api.platform.v0; | ||
|
||
public interface IZumeImplementation { | ||
|
||
|
143 changes: 143 additions & 0 deletions
143
api/src/main/java/dev/nolij/zume/api/platform/v0/ZumeAPI.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
package dev.nolij.zume.api.platform.v0; | ||
|
||
import dev.nolij.zume.impl.CameraPerspective; | ||
import dev.nolij.zume.impl.Zume; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
import java.nio.file.Path; | ||
|
||
public final class ZumeAPI { | ||
|
||
public static Logger getLogger() { | ||
return Zume.LOGGER; | ||
} | ||
|
||
/** | ||
* Attempts to open Zume's config file in the system's text editor. | ||
*/ | ||
public static void openConfigFile() { | ||
Zume.openConfigFile(); | ||
} | ||
|
||
/** | ||
* Invoke this in the initializer of your Zume implementation. | ||
* | ||
* @param implementation The {@linkplain IZumeImplementation} Zume should use. | ||
* @param instanceConfigPath The {@linkplain Path} Zume should use for storing the instance-specific config. | ||
*/ | ||
public static void registerImplementation(IZumeImplementation implementation, Path instanceConfigPath) { | ||
Zume.init(new dev.nolij.zume.impl.IZumeImplementation() { | ||
@Override | ||
public boolean isZoomPressed() { | ||
return implementation.isZoomPressed(); | ||
} | ||
|
||
@Override | ||
public boolean isZoomInPressed() { | ||
return implementation.isZoomInPressed(); | ||
} | ||
|
||
@Override | ||
public boolean isZoomOutPressed() { | ||
return implementation.isZoomOutPressed(); | ||
} | ||
|
||
@Override | ||
public CameraPerspective getCameraPerspective() { | ||
return CameraPerspective.values()[implementation.getCameraPerspective().ordinal()]; | ||
} | ||
|
||
@Override | ||
public void onZoomActivate() { | ||
implementation.onZoomActivate(); | ||
} | ||
}, instanceConfigPath); | ||
} | ||
|
||
//region Query Methods | ||
/** | ||
* Returns `true` if Zoom is activated. | ||
*/ | ||
public static boolean isActive() { | ||
return Zume.isEnabled(); | ||
} | ||
|
||
/** | ||
* Returns `true` if FOV should be hooked. | ||
*/ | ||
public static boolean isFOVHookActive() { | ||
return Zume.shouldHookFOV(); | ||
} | ||
|
||
/** | ||
* Returns `true` if mouse scrolling should be hooked. | ||
*/ | ||
public static boolean isMouseScrollHookActive() { | ||
return Zume.shouldCancelScroll(); | ||
} | ||
//endregion | ||
|
||
//region Hooks | ||
/** | ||
* This should be invoked once at the beginning of every frame. | ||
* It will handle Keybindings and Zoom Scrolling if the other hooks in this API are used correctly. | ||
*/ | ||
public static void renderHook() { | ||
Zume.render(); | ||
} | ||
|
||
/** | ||
* ONLY INVOKE THIS METHOD WHEN {@linkplain ZumeAPI#isFOVHookActive()} RETURNS `true`. | ||
* That check was explicitly excluded from this method for efficiency and for mixin compatibility. | ||
* The {@linkplain IZumeImplementation} is responsible for this check. | ||
* | ||
* @param fov The unmodified FOV value | ||
* {@return The new FOV transformed by Zume} | ||
*/ | ||
public static double fovHook(double fov) { | ||
return Zume.transformFOV(fov); | ||
} | ||
|
||
/** | ||
* This method assumes Zume is active and the camera perspective is third-person. | ||
* If it is not, using this value will cause bugs. | ||
* | ||
* @param distance The vanilla third-person camera distance | ||
* @return The new third-person camera distance | ||
*/ | ||
public static double thirdPersonCameraHook(double distance) { | ||
return Zume.transformThirdPersonDistance(distance); | ||
} | ||
|
||
/** | ||
* The return value of this method can be safely used without checking whether Zume is active. | ||
* | ||
* @param mouseSensitivity The unmodified mouse sensitivity | ||
* {@return The new mouse sensitivity, transformed by Zume} | ||
*/ | ||
public static double mouseSensitivityHook(double mouseSensitivity) { | ||
return Zume.transformMouseSensitivity(mouseSensitivity); | ||
} | ||
|
||
/** | ||
* The return value of this method can be safely used without checking whether Zume is active. | ||
* | ||
* @param cinematicCameraEnabled The unmodified cinematic camera state | ||
* {@return The new cinematic camera state, transformed by Zume} | ||
*/ | ||
public static boolean cinematicCameraEnabledHook(boolean cinematicCameraEnabled) { | ||
return Zume.transformCinematicCamera(cinematicCameraEnabled); | ||
} | ||
|
||
/** | ||
* The return value of this method can be safely used without checking whether Zume is active. | ||
* | ||
* @param scrollDelta The scroll delta (magnitude will be ignored, only the sign is used) | ||
* {@return `true` if the invoker should prevent further handling of this scroll event} | ||
*/ | ||
public static boolean mouseScrollHook(int scrollDelta) { | ||
return Zume.interceptScroll(scrollDelta); | ||
} | ||
//endregion | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...olij/zume/common/easing/EasingHelper.java → .../nolij/zume/api/util/v0/EasingHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package dev.nolij.zume.common.easing; | ||
package dev.nolij.zume.api.util.v0; | ||
|
||
public final class EasingHelper { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../nolij/zume/common/CameraPerspective.java → ...ev/nolij/zume/impl/CameraPerspective.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package dev.nolij.zume.common; | ||
package dev.nolij.zume.impl; | ||
|
||
public enum CameraPerspective { | ||
|
||
|
4 changes: 3 additions & 1 deletion
4
...nolij/zume/common/easing/EasedDouble.java → ...java/dev/nolij/zume/impl/EasedDouble.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...a/dev/nolij/zume/common/HostPlatform.java → ...ava/dev/nolij/zume/impl/HostPlatform.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package dev.nolij.zume.common; | ||
package dev.nolij.zume.impl; | ||
|
||
public enum HostPlatform { | ||
|
||
|
13 changes: 13 additions & 0 deletions
13
api/src/main/java/dev/nolij/zume/impl/IZumeImplementation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package dev.nolij.zume.impl; | ||
|
||
public interface IZumeImplementation { | ||
|
||
boolean isZoomPressed(); | ||
boolean isZoomInPressed(); | ||
boolean isZoomOutPressed(); | ||
|
||
CameraPerspective getCameraPerspective(); | ||
|
||
void onZoomActivate(); | ||
|
||
} |
Oops, something went wrong.