Refactored all the common/module to feature
This commit is contained in:
+4
-2
@@ -1,4 +1,4 @@
|
|||||||
package org.saturnclient.common.module;
|
package org.saturnclient.common.feature;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EntityModule provides queries about entities in the current world.
|
* EntityModule provides queries about entities in the current world.
|
||||||
@@ -6,7 +6,7 @@ package org.saturnclient.common.module;
|
|||||||
* Designed to be thin so that feature logic is not polluted with
|
* Designed to be thin so that feature logic is not polluted with
|
||||||
* engine-specific entity types.
|
* engine-specific entity types.
|
||||||
*/
|
*/
|
||||||
public interface EntityModule {
|
public interface EntityFeature {
|
||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
// Crosshair / targeting
|
// Crosshair / targeting
|
||||||
@@ -30,7 +30,9 @@ public interface EntityModule {
|
|||||||
String getCustomName();
|
String getCustomName();
|
||||||
|
|
||||||
float getHealth();
|
float getHealth();
|
||||||
|
|
||||||
float getMaxHealth();
|
float getMaxHealth();
|
||||||
|
|
||||||
EntityType getEntityType();
|
EntityType getEntityType();
|
||||||
}
|
}
|
||||||
|
|
||||||
+2
-2
@@ -1,11 +1,11 @@
|
|||||||
package org.saturnclient.common.module;
|
package org.saturnclient.common.feature;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NetworkModule provides access to the current server connection.
|
* NetworkModule provides access to the current server connection.
|
||||||
*
|
*
|
||||||
* Methods return safe defaults (false / -1) when not connected.
|
* Methods return safe defaults (false / -1) when not connected.
|
||||||
*/
|
*/
|
||||||
public interface NetworkModule {
|
public interface NetworkFeature {
|
||||||
|
|
||||||
/** Returns true when a server connection is active. */
|
/** Returns true when a server connection is active. */
|
||||||
boolean hasNetwork();
|
boolean hasNetwork();
|
||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
package org.saturnclient.common.module;
|
package org.saturnclient.common.feature;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ import org.saturnclient.common.ref.game.ItemStackRef;
|
|||||||
* All methods return safe defaults (false / 0 / empty) when no player
|
* All methods return safe defaults (false / 0 / empty) when no player
|
||||||
* is present so that features do not need to null-check everywhere.
|
* is present so that features do not need to null-check everywhere.
|
||||||
*/
|
*/
|
||||||
public interface PlayerModule {
|
public interface PlayerFeature {
|
||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
// Presence
|
// Presence
|
||||||
+4
-2
@@ -1,17 +1,18 @@
|
|||||||
package org.saturnclient.common.module;
|
package org.saturnclient.common.feature;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RenderModule provides access to render-time information that does
|
* RenderModule provides access to render-time information that does
|
||||||
* not belong to the player or world, such as the current window
|
* not belong to the player or world, such as the current window
|
||||||
* dimensions, camera perspective, and the frame's FPS counter.
|
* dimensions, camera perspective, and the frame's FPS counter.
|
||||||
*/
|
*/
|
||||||
public interface RenderModule {
|
public interface RenderFeature {
|
||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
// Window
|
// Window
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
|
|
||||||
int getScaledWindowWidth();
|
int getScaledWindowWidth();
|
||||||
|
|
||||||
int getScaledWindowHeight();
|
int getScaledWindowHeight();
|
||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
@@ -27,5 +28,6 @@ public interface RenderModule {
|
|||||||
boolean isFirstPerson();
|
boolean isFirstPerson();
|
||||||
|
|
||||||
void setFirstPerson();
|
void setFirstPerson();
|
||||||
|
|
||||||
void setThirdPersonBack();
|
void setThirdPersonBack();
|
||||||
}
|
}
|
||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
package org.saturnclient.common.module;
|
package org.saturnclient.common.feature;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WorldModule provides access to world-level information that is not
|
* WorldModule provides access to world-level information that is not
|
||||||
@@ -6,7 +6,7 @@ package org.saturnclient.common.module;
|
|||||||
*
|
*
|
||||||
* All methods return safe defaults when no world is loaded.
|
* All methods return safe defaults when no world is loaded.
|
||||||
*/
|
*/
|
||||||
public interface WorldModule {
|
public interface WorldFeature {
|
||||||
|
|
||||||
/** Returns true when a world is currently loaded. */
|
/** Returns true when a world is currently loaded. */
|
||||||
boolean hasWorld();
|
boolean hasWorld();
|
||||||
+11
-11
@@ -1,10 +1,10 @@
|
|||||||
package org.saturnclient.common.provider;
|
package org.saturnclient.common.provider;
|
||||||
|
|
||||||
import org.saturnclient.common.module.EntityModule;
|
import org.saturnclient.common.feature.EntityFeature;
|
||||||
import org.saturnclient.common.module.NetworkModule;
|
import org.saturnclient.common.feature.NetworkFeature;
|
||||||
import org.saturnclient.common.module.PlayerModule;
|
import org.saturnclient.common.feature.PlayerFeature;
|
||||||
import org.saturnclient.common.module.RenderModule;
|
import org.saturnclient.common.feature.RenderFeature;
|
||||||
import org.saturnclient.common.module.WorldModule;
|
import org.saturnclient.common.feature.WorldFeature;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ModuleProvider is the single entry point for features to access
|
* ModuleProvider is the single entry point for features to access
|
||||||
@@ -16,20 +16,20 @@ import org.saturnclient.common.module.WorldModule;
|
|||||||
* because the provider may swap implementations at runtime (e.g. on
|
* because the provider may swap implementations at runtime (e.g. on
|
||||||
* world change).
|
* world change).
|
||||||
*/
|
*/
|
||||||
public interface ModuleProvider {
|
public interface FeatureProvider {
|
||||||
|
|
||||||
/** Access to the local player and movement state. */
|
/** Access to the local player and movement state. */
|
||||||
PlayerModule player();
|
PlayerFeature player();
|
||||||
|
|
||||||
/** Access to the game world (time, TPS packets, etc.). */
|
/** Access to the game world (time, TPS packets, etc.). */
|
||||||
WorldModule world();
|
WorldFeature world();
|
||||||
|
|
||||||
/** Access to entity / nametag queries. */
|
/** Access to entity / nametag queries. */
|
||||||
EntityModule entity();
|
EntityFeature entity();
|
||||||
|
|
||||||
/** Access to rendering utilities (window size, textures, etc.). */
|
/** Access to rendering utilities (window size, textures, etc.). */
|
||||||
RenderModule render();
|
RenderFeature render();
|
||||||
|
|
||||||
/** Access to the network / server connection. */
|
/** Access to the network / server connection. */
|
||||||
NetworkModule network();
|
NetworkFeature network();
|
||||||
}
|
}
|
||||||
@@ -4,5 +4,5 @@ public class Providers {
|
|||||||
public static RefConstructorProvider refConstructor;
|
public static RefConstructorProvider refConstructor;
|
||||||
public static SaturnProvider saturn;
|
public static SaturnProvider saturn;
|
||||||
public static GLFWProvider GLFW;
|
public static GLFWProvider GLFW;
|
||||||
public static ModuleProvider module;
|
public static FeatureProvider module;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package org.saturnclient.mod.mods;
|
package org.saturnclient.mod.mods;
|
||||||
|
|
||||||
|
import org.saturnclient.common.feature.PlayerFeature;
|
||||||
import org.saturnclient.common.provider.Providers;
|
import org.saturnclient.common.provider.Providers;
|
||||||
import org.saturnclient.common.module.PlayerModule;
|
|
||||||
import org.saturnclient.common.ref.game.ItemStackRef;
|
import org.saturnclient.common.ref.game.ItemStackRef;
|
||||||
import org.saturnclient.config.property.BoolProperty;
|
import org.saturnclient.config.property.BoolProperty;
|
||||||
import org.saturnclient.config.property.Property;
|
import org.saturnclient.config.property.Property;
|
||||||
@@ -15,7 +15,7 @@ import org.saturnclient.ui.RenderScope;
|
|||||||
* ArmorDisplayMod renders the durability of the player's equipped
|
* ArmorDisplayMod renders the durability of the player's equipped
|
||||||
* armor pieces (and optionally the main-hand item) as a HUD overlay.
|
* armor pieces (and optionally the main-hand item) as a HUD overlay.
|
||||||
*
|
*
|
||||||
* Engine access is provided exclusively through {@link ModuleProvider}.
|
* Engine access is provided exclusively through {@link FeatureProvider}.
|
||||||
*/
|
*/
|
||||||
public class ArmorDisplayMod extends Mod implements HudMod {
|
public class ArmorDisplayMod extends Mod implements HudMod {
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ public class ArmorDisplayMod extends Mod implements HudMod {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderHud(RenderScope scope) {
|
public void renderHud(RenderScope scope) {
|
||||||
PlayerModule player = Providers.module.player();
|
PlayerFeature player = Providers.module.player();
|
||||||
renderArmor(scope,
|
renderArmor(scope,
|
||||||
player.getMainHand(),
|
player.getMainHand(),
|
||||||
player.getHelmet(),
|
player.getHelmet(),
|
||||||
@@ -51,7 +51,7 @@ public class ArmorDisplayMod extends Mod implements HudMod {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderDummy(RenderScope scope) {
|
public void renderDummy(RenderScope scope) {
|
||||||
PlayerModule player = Providers.module.player();
|
PlayerFeature player = Providers.module.player();
|
||||||
renderArmor(scope,
|
renderArmor(scope,
|
||||||
player.getDummyMainHand(),
|
player.getDummyMainHand(),
|
||||||
player.getDummyHelmet(),
|
player.getDummyHelmet(),
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package org.saturnclient.mod.mods;
|
package org.saturnclient.mod.mods;
|
||||||
|
|
||||||
|
import org.saturnclient.common.feature.NetworkFeature;
|
||||||
|
import org.saturnclient.common.feature.PlayerFeature;
|
||||||
import org.saturnclient.common.provider.Providers;
|
import org.saturnclient.common.provider.Providers;
|
||||||
import org.saturnclient.config.property.BoolProperty;
|
import org.saturnclient.config.property.BoolProperty;
|
||||||
import org.saturnclient.config.property.Property;
|
import org.saturnclient.config.property.Property;
|
||||||
import org.saturnclient.mod.Mod;
|
import org.saturnclient.mod.Mod;
|
||||||
import org.saturnclient.mod.ModSpec;
|
import org.saturnclient.mod.ModSpec;
|
||||||
import org.saturnclient.common.module.NetworkModule;
|
|
||||||
import org.saturnclient.common.module.PlayerModule;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AutoSprintMod automatically enables sprinting whenever the
|
* AutoSprintMod automatically enables sprinting whenever the
|
||||||
@@ -31,8 +31,8 @@ public class AutoSprintMod extends Mod {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
PlayerModule player = Providers.module.player();
|
PlayerFeature player = Providers.module.player();
|
||||||
NetworkModule network = Providers.module.network();
|
NetworkFeature network = Providers.module.network();
|
||||||
|
|
||||||
if (!player.hasPlayer() || !network.hasNetwork()) {
|
if (!player.hasPlayer() || !network.hasNetwork()) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package org.saturnclient.mod.mods;
|
package org.saturnclient.mod.mods;
|
||||||
|
|
||||||
|
import org.saturnclient.common.feature.RenderFeature;
|
||||||
import org.saturnclient.common.provider.Providers;
|
import org.saturnclient.common.provider.Providers;
|
||||||
import org.saturnclient.config.property.BoolProperty;
|
import org.saturnclient.config.property.BoolProperty;
|
||||||
import org.saturnclient.config.property.Property;
|
import org.saturnclient.config.property.Property;
|
||||||
import org.saturnclient.mod.Mod;
|
import org.saturnclient.mod.Mod;
|
||||||
import org.saturnclient.mod.ModSpec;
|
import org.saturnclient.mod.ModSpec;
|
||||||
import org.saturnclient.common.module.RenderModule;
|
|
||||||
import org.saturnclient.ui.RenderScope;
|
import org.saturnclient.ui.RenderScope;
|
||||||
import org.saturnclient.ui.resources.Textures;
|
import org.saturnclient.ui.resources.Textures;
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ public class CrosshairMod extends Mod {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderModule render = Providers.module.render();
|
RenderFeature render = Providers.module.render();
|
||||||
int x = (render.getScaledWindowWidth() - CROSSHAIR_SIZE) / 2;
|
int x = (render.getScaledWindowWidth() - CROSSHAIR_SIZE) / 2;
|
||||||
int y = (render.getScaledWindowHeight() - CROSSHAIR_SIZE) / 2;
|
int y = (render.getScaledWindowHeight() - CROSSHAIR_SIZE) / 2;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package org.saturnclient.mod.mods;
|
package org.saturnclient.mod.mods;
|
||||||
|
|
||||||
import org.saturnclient.common.module.WorldModule;
|
import org.saturnclient.common.feature.WorldFeature;
|
||||||
import org.saturnclient.common.provider.Providers;
|
import org.saturnclient.common.provider.Providers;
|
||||||
import org.saturnclient.config.property.BoolProperty;
|
import org.saturnclient.config.property.BoolProperty;
|
||||||
import org.saturnclient.config.property.Property;
|
import org.saturnclient.config.property.Property;
|
||||||
@@ -13,7 +13,7 @@ import org.saturnclient.ui.resources.Fonts;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* DayCounterMod shows how many in-game days have elapsed.
|
* DayCounterMod shows how many in-game days have elapsed.
|
||||||
* Day count is derived from the world age via {@link WorldModule}.
|
* Day count is derived from the world age via {@link WorldFeature}.
|
||||||
*/
|
*/
|
||||||
public class DayCounterMod extends Mod implements HudMod {
|
public class DayCounterMod extends Mod implements HudMod {
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package org.saturnclient.mod.mods;
|
package org.saturnclient.mod.mods;
|
||||||
|
|
||||||
import org.saturnclient.common.module.RenderModule;
|
import org.saturnclient.common.feature.RenderFeature;
|
||||||
import org.saturnclient.common.provider.Providers;
|
import org.saturnclient.common.provider.Providers;
|
||||||
import org.saturnclient.config.property.BoolProperty;
|
import org.saturnclient.config.property.BoolProperty;
|
||||||
import org.saturnclient.config.property.Property;
|
import org.saturnclient.config.property.Property;
|
||||||
@@ -13,7 +13,7 @@ import org.saturnclient.ui.resources.Fonts;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* FpsMod displays the current frames-per-second as a HUD element.
|
* FpsMod displays the current frames-per-second as a HUD element.
|
||||||
* FPS is obtained from {@link RenderModule} rather than cached in the feature.
|
* FPS is obtained from {@link RenderFeature} rather than cached in the feature.
|
||||||
*/
|
*/
|
||||||
public class FpsMod extends Mod implements HudMod {
|
public class FpsMod extends Mod implements HudMod {
|
||||||
|
|
||||||
|
|||||||
@@ -6,14 +6,14 @@ import org.saturnclient.config.property.KeybindingProperty;
|
|||||||
import org.saturnclient.config.property.Property;
|
import org.saturnclient.config.property.Property;
|
||||||
import org.saturnclient.mod.Mod;
|
import org.saturnclient.mod.Mod;
|
||||||
import org.saturnclient.mod.ModSpec;
|
import org.saturnclient.mod.ModSpec;
|
||||||
import org.saturnclient.common.module.RenderModule;
|
import org.saturnclient.common.feature.RenderFeature;
|
||||||
import org.saturnclient.common.provider.GLFWProvider;
|
import org.saturnclient.common.provider.GLFWProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FreelookMod lets the player look around freely (in third-person)
|
* FreelookMod lets the player look around freely (in third-person)
|
||||||
* without changing the direction their character walks.
|
* without changing the direction their character walks.
|
||||||
*
|
*
|
||||||
* Camera perspective is controlled through {@link RenderModule} so
|
* Camera perspective is controlled through {@link RenderFeature} so
|
||||||
* that the feature itself contains no direct Minecraft API calls.
|
* that the feature itself contains no direct Minecraft API calls.
|
||||||
*/
|
*/
|
||||||
public class FreelookMod extends Mod {
|
public class FreelookMod extends Mod {
|
||||||
@@ -75,7 +75,7 @@ public class FreelookMod extends Mod {
|
|||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
|
|
||||||
private void startFreelook() {
|
private void startFreelook() {
|
||||||
RenderModule render = Providers.module.render();
|
RenderFeature render = Providers.module.render();
|
||||||
wasFirstPerson = render.isFirstPerson();
|
wasFirstPerson = render.isFirstPerson();
|
||||||
render.setThirdPersonBack();
|
render.setThirdPersonBack();
|
||||||
isFreeLooking = true;
|
isFreeLooking = true;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.saturnclient.mod.mods;
|
package org.saturnclient.mod.mods;
|
||||||
|
|
||||||
|
import org.saturnclient.common.feature.PlayerFeature;
|
||||||
import org.saturnclient.common.provider.Providers;
|
import org.saturnclient.common.provider.Providers;
|
||||||
import org.saturnclient.config.property.BoolProperty;
|
import org.saturnclient.config.property.BoolProperty;
|
||||||
import org.saturnclient.config.property.ColorProperty;
|
import org.saturnclient.config.property.ColorProperty;
|
||||||
@@ -8,7 +9,6 @@ import org.saturnclient.mod.HudMod;
|
|||||||
import org.saturnclient.mod.Mod;
|
import org.saturnclient.mod.Mod;
|
||||||
import org.saturnclient.mod.ModLayout;
|
import org.saturnclient.mod.ModLayout;
|
||||||
import org.saturnclient.mod.ModSpec;
|
import org.saturnclient.mod.ModSpec;
|
||||||
import org.saturnclient.common.module.PlayerModule;
|
|
||||||
import org.saturnclient.ui.RenderScope;
|
import org.saturnclient.ui.RenderScope;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,7 +67,7 @@ public class KeystrokesMod extends Mod implements HudMod {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
PlayerModule player = Providers.module.player();
|
PlayerFeature player = Providers.module.player();
|
||||||
w = player.isForwardPressed();
|
w = player.isForwardPressed();
|
||||||
a = player.isLeftPressed();
|
a = player.isLeftPressed();
|
||||||
s = player.isBackPressed();
|
s = player.isBackPressed();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package org.saturnclient.mod.mods;
|
package org.saturnclient.mod.mods;
|
||||||
|
|
||||||
import org.saturnclient.common.module.EntityModule;
|
import org.saturnclient.common.feature.EntityFeature;
|
||||||
import org.saturnclient.config.property.BoolProperty;
|
import org.saturnclient.config.property.BoolProperty;
|
||||||
import org.saturnclient.config.property.Property;
|
import org.saturnclient.config.property.Property;
|
||||||
import org.saturnclient.config.property.SelectProperty;
|
import org.saturnclient.config.property.SelectProperty;
|
||||||
@@ -13,10 +13,10 @@ import org.saturnclient.mod.ModSpec;
|
|||||||
* Actual rendering is injected via a mixin; this class owns the
|
* Actual rendering is injected via a mixin; this class owns the
|
||||||
* configuration and exposes two static query methods the mixin uses:
|
* configuration and exposes two static query methods the mixin uses:
|
||||||
* {@link #shouldReplaceName()} and
|
* {@link #shouldReplaceName()} and
|
||||||
* {@link #getNametagString(EntityModule.EntityState)}.
|
* {@link #getNametagString(EntityFeature.EntityState)}.
|
||||||
*
|
*
|
||||||
* No ModuleProvider is required here because the mixin passes the
|
* No ModuleProvider is required here because the mixin passes the
|
||||||
* already-resolved {@link EntityModule.EntityState} directly.
|
* already-resolved {@link EntityFeature.EntityState} directly.
|
||||||
*/
|
*/
|
||||||
public class NametagsMod extends Mod {
|
public class NametagsMod extends Mod {
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ public class NametagsMod extends Mod {
|
|||||||
* Builds the replacement nametag string for the given entity state,
|
* Builds the replacement nametag string for the given entity state,
|
||||||
* or {@code null} if this entity should not have its tag replaced.
|
* or {@code null} if this entity should not have its tag replaced.
|
||||||
*/
|
*/
|
||||||
public static String getNametagString(EntityModule.EntityState state) {
|
public static String getNametagString(EntityFeature.EntityState state) {
|
||||||
if (state.getCustomName() == null)
|
if (state.getCustomName() == null)
|
||||||
return null;
|
return null;
|
||||||
if (!healthDisplay.value)
|
if (!healthDisplay.value)
|
||||||
@@ -92,14 +92,14 @@ public class NametagsMod extends Mod {
|
|||||||
float health = state.getHealth();
|
float health = state.getHealth();
|
||||||
float maxHealth = state.getMaxHealth();
|
float maxHealth = state.getMaxHealth();
|
||||||
|
|
||||||
EntityModule.EntityType type = state.getEntityType();
|
EntityFeature.EntityType type = state.getEntityType();
|
||||||
if (type == EntityModule.EntityType.PASSIVE && !passive.value)
|
if (type == EntityFeature.EntityType.PASSIVE && !passive.value)
|
||||||
return null;
|
return null;
|
||||||
if (type == EntityModule.EntityType.HOSTILE && !hostile.value)
|
if (type == EntityFeature.EntityType.HOSTILE && !hostile.value)
|
||||||
return null;
|
return null;
|
||||||
if (type == EntityModule.EntityType.PLAYER && !players.value)
|
if (type == EntityFeature.EntityType.PLAYER && !players.value)
|
||||||
return null;
|
return null;
|
||||||
if (type == EntityModule.EntityType.OTHER)
|
if (type == EntityFeature.EntityType.OTHER)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (health < 0f || maxHealth < 0f || health > maxHealth)
|
if (health < 0f || maxHealth < 0f || health > maxHealth)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.saturnclient.mod.mods;
|
package org.saturnclient.mod.mods;
|
||||||
|
|
||||||
|
import org.saturnclient.common.feature.PlayerFeature;
|
||||||
import org.saturnclient.common.provider.Providers;
|
import org.saturnclient.common.provider.Providers;
|
||||||
import org.saturnclient.config.property.BoolProperty;
|
import org.saturnclient.config.property.BoolProperty;
|
||||||
import org.saturnclient.config.property.Property;
|
import org.saturnclient.config.property.Property;
|
||||||
@@ -8,13 +9,12 @@ import org.saturnclient.mod.HudMod;
|
|||||||
import org.saturnclient.mod.Mod;
|
import org.saturnclient.mod.Mod;
|
||||||
import org.saturnclient.mod.ModLayout;
|
import org.saturnclient.mod.ModLayout;
|
||||||
import org.saturnclient.mod.ModSpec;
|
import org.saturnclient.mod.ModSpec;
|
||||||
import org.saturnclient.common.module.PlayerModule;
|
|
||||||
import org.saturnclient.ui.RenderScope;
|
import org.saturnclient.ui.RenderScope;
|
||||||
import org.saturnclient.ui.resources.Fonts;
|
import org.saturnclient.ui.resources.Fonts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SpeedometerMod displays the player's current movement speed as
|
* SpeedometerMod displays the player's current movement speed as
|
||||||
* a HUD element. Velocity data comes from {@link PlayerModule}.
|
* a HUD element. Velocity data comes from {@link PlayerFeature}.
|
||||||
*/
|
*/
|
||||||
public class SpeedometerMod extends Mod implements HudMod {
|
public class SpeedometerMod extends Mod implements HudMod {
|
||||||
|
|
||||||
@@ -45,8 +45,8 @@ public class SpeedometerMod extends Mod implements HudMod {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderHud(RenderScope scope) {
|
public void renderHud(RenderScope scope) {
|
||||||
PlayerModule player = Providers.module.player();
|
PlayerFeature player = Providers.module.player();
|
||||||
PlayerModule.Velocity v = player.getVelocity();
|
PlayerFeature.Velocity v = player.getVelocity();
|
||||||
boolean onGround = player.isOnGround();
|
boolean onGround = player.isOnGround();
|
||||||
|
|
||||||
double effectiveY = onGround ? 0.0 : v.y;
|
double effectiveY = onGround ? 0.0 : v.y;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package org.saturnclient.mod.mods;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.saturnclient.common.provider.ModuleProvider;
|
import org.saturnclient.common.provider.FeatureProvider;
|
||||||
import org.saturnclient.common.provider.Providers;
|
import org.saturnclient.common.provider.Providers;
|
||||||
import org.saturnclient.common.ref.game.EffectRef;
|
import org.saturnclient.common.ref.game.EffectRef;
|
||||||
import org.saturnclient.config.property.BoolProperty;
|
import org.saturnclient.config.property.BoolProperty;
|
||||||
@@ -20,7 +20,7 @@ import org.saturnclient.ui.RenderScope;
|
|||||||
* The effect list is supplied by the platform through an interface
|
* The effect list is supplied by the platform through an interface
|
||||||
* returned by a future {@code PlayerModule#getActiveEffects()} call.
|
* returned by a future {@code PlayerModule#getActiveEffects()} call.
|
||||||
* Until that is wired up, the existing {@link StatusEffectsInterface}
|
* Until that is wired up, the existing {@link StatusEffectsInterface}
|
||||||
* bridge is used, accessed via {@link ModuleProvider}.
|
* bridge is used, accessed via {@link FeatureProvider}.
|
||||||
*/
|
*/
|
||||||
public class StatusEffectsMod extends Mod implements HudMod {
|
public class StatusEffectsMod extends Mod implements HudMod {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user