diff --git a/assets/Data/game/blockTypes.json b/assets/Data/game/blockTypes.json index cb7a4702..f17be9ac 100644 --- a/assets/Data/game/blockTypes.json +++ b/assets/Data/game/blockTypes.json @@ -6,13 +6,18 @@ }, { "id" : 1, - "name" : "brick", + "name" : "brick_flat", "texture" : "/Textures/block/tileableSlabstone.png" }, { "id" : 2, "name" : "wood", "texture" : "/Textures/wooden.png" + }, + { + "id" : 3, + "name" : "brick_fant", + "texture" : "/Textures/block/ruin_wall_01.png" } ] } \ No newline at end of file diff --git a/assets/Textures/block/ruin_wall_01.png b/assets/Textures/block/ruin_wall_01.png new file mode 100644 index 00000000..64a677f3 Binary files /dev/null and b/assets/Textures/block/ruin_wall_01.png differ diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index 1c9ab5a7..2eafbc05 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -1554,6 +1554,8 @@ Align block lookups for interaction targeting Cursor logic around blocks Block destruction work Block cursor custom textures +New block type +Fix inventory item tooltip not clearing diff --git a/src/main/java/electrosphere/client/ui/components/NaturalInventoryPanel.java b/src/main/java/electrosphere/client/ui/components/NaturalInventoryPanel.java index bcb9047d..6624f972 100644 --- a/src/main/java/electrosphere/client/ui/components/NaturalInventoryPanel.java +++ b/src/main/java/electrosphere/client/ui/components/NaturalInventoryPanel.java @@ -244,4 +244,13 @@ public class NaturalInventoryPanel { return div; } + /** + * Clears the tooltip + */ + public static void clearTooltip(){ + if(itemTooltip != null){ + Tooltip.destroy(itemTooltip); + } + } + } diff --git a/src/main/java/electrosphere/client/ui/components/PlayerInventoryWindow.java b/src/main/java/electrosphere/client/ui/components/PlayerInventoryWindow.java index cef97865..fbdc5127 100644 --- a/src/main/java/electrosphere/client/ui/components/PlayerInventoryWindow.java +++ b/src/main/java/electrosphere/client/ui/components/PlayerInventoryWindow.java @@ -51,6 +51,8 @@ public class PlayerInventoryWindow { if(Globals.virtualAudioSourceManager != null){ Globals.virtualAudioSourceManager.createVirtualAudioSource(AssetDataStrings.UI_SFX_INVENTORY_CLOSE, VirtualAudioSourceType.UI, false); } + NaturalInventoryPanel.clearTooltip(); + ToolbarInventoryPanel.clearTooltip(); Globals.renderingEngine.getPostProcessingPipeline().setApplyBlur(false); return false; }}); diff --git a/src/main/java/electrosphere/client/ui/components/ToolbarInventoryPanel.java b/src/main/java/electrosphere/client/ui/components/ToolbarInventoryPanel.java index 06906428..bb0710e1 100644 --- a/src/main/java/electrosphere/client/ui/components/ToolbarInventoryPanel.java +++ b/src/main/java/electrosphere/client/ui/components/ToolbarInventoryPanel.java @@ -251,4 +251,13 @@ public class ToolbarInventoryPanel { return div; } + /** + * Clears the tooltip + */ + public static void clearTooltip(){ + if(itemTooltip != null){ + Tooltip.destroy(itemTooltip); + } + } + } diff --git a/src/main/java/electrosphere/controls/cursor/CursorState.java b/src/main/java/electrosphere/controls/cursor/CursorState.java index 820ea593..4b4cb101 100644 --- a/src/main/java/electrosphere/controls/cursor/CursorState.java +++ b/src/main/java/electrosphere/controls/cursor/CursorState.java @@ -377,7 +377,7 @@ public class CursorState { } } if(clearBlockCursor){ - CursorState.hide(); + Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE); } } } diff --git a/src/main/java/electrosphere/renderer/ui/elements/Tooltip.java b/src/main/java/electrosphere/renderer/ui/elements/Tooltip.java index ca172172..ee162633 100644 --- a/src/main/java/electrosphere/renderer/ui/elements/Tooltip.java +++ b/src/main/java/electrosphere/renderer/ui/elements/Tooltip.java @@ -145,6 +145,9 @@ public class Tooltip extends StandardDrawableContainerElement { * @param target The tooltip to destroy */ public static void destroy(Tooltip target){ + if(target == null){ + throw new Error("Tooltip is null"); + } Globals.signalSystem.post(SignalType.UI_MODIFICATION,()->{ Window tooltipWindow = (Window)Globals.elementService.getWindow(WindowStrings.TOOLTIP_WINDOW); tooltipWindow.removeChild(target); diff --git a/src/main/java/electrosphere/renderer/ui/elements/Window.java b/src/main/java/electrosphere/renderer/ui/elements/Window.java index b0a41239..9e9a1276 100644 --- a/src/main/java/electrosphere/renderer/ui/elements/Window.java +++ b/src/main/java/electrosphere/renderer/ui/elements/Window.java @@ -629,9 +629,11 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme @Override public void removeChild(Element child) { + if(childList.contains(child)){ + Yoga.YGNodeRemoveChild(yogaNode, child.getYogaNode()); + } childList.remove(child); child.setParent(null); - Yoga.YGNodeRemoveChild(yogaNode, child.getYogaNode()); } @Override