diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index e62f3bfb..f31267a0 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -1450,6 +1450,7 @@ Static rocks which harvest into rock items that spawn in forest (04/05/2025) Stone Axe item Fix human data for RH sword slash attack moves +Cursor only for specific items diff --git a/src/main/java/electrosphere/entity/state/equip/ClientToolbarState.java b/src/main/java/electrosphere/entity/state/equip/ClientToolbarState.java index f0b6d151..7ce08337 100644 --- a/src/main/java/electrosphere/entity/state/equip/ClientToolbarState.java +++ b/src/main/java/electrosphere/entity/state/equip/ClientToolbarState.java @@ -43,6 +43,11 @@ public class ClientToolbarState implements BehaviorTree { * The maximum number of toolbar slots */ public static final int MAX_TOOLBAR_SIZE = 10; + + /** + * Token for displaying cursor + */ + public static final String CURSOR_TOKEN = "CURSOR"; /** * The selected toolbar slot @@ -171,6 +176,18 @@ public class ClientToolbarState implements BehaviorTree { Globals.clientSceneWrapper.getScene().removeEntityFromTag(toEquip, EntityTags.TARGETABLE); GravityUtils.clientAttemptDeactivateGravity(toEquip); } + + //cursor logic + if(targetPoint != null){ + Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(toEquip); + if(Globals.playerCursor != null){ + if(itemData.getTokens().contains(ClientToolbarState.CURSOR_TOKEN)){ + Globals.clientSceneWrapper.getScene().registerEntityToTag(Globals.playerCursor, EntityTags.DRAWABLE); + } else { + Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerCursor, EntityTags.DRAWABLE); + } + } + } } /** @@ -233,6 +250,10 @@ public class ClientToolbarState implements BehaviorTree { } } + if(Globals.playerCursor != null){ + Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerCursor, EntityTags.DRAWABLE); + } + //null out the attached entity this.equippedEntity = null; }