diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index 277a3fa1..eb4cf4f8 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -1471,6 +1471,7 @@ Voxel type work (04/14/2025) Inventory sounds for some materials +Inventory audio work diff --git a/src/main/java/electrosphere/client/item/ItemActions.java b/src/main/java/electrosphere/client/interact/ItemActions.java similarity index 99% rename from src/main/java/electrosphere/client/item/ItemActions.java rename to src/main/java/electrosphere/client/interact/ItemActions.java index bdd0b37c..3ecbfc91 100644 --- a/src/main/java/electrosphere/client/item/ItemActions.java +++ b/src/main/java/electrosphere/client/interact/ItemActions.java @@ -1,4 +1,4 @@ -package electrosphere.client.item; +package electrosphere.client.interact; import org.joml.Vector3d; diff --git a/src/main/java/electrosphere/controls/categories/ControlCategoryMainGame.java b/src/main/java/electrosphere/controls/categories/ControlCategoryMainGame.java index 03cf2d30..871ecec5 100644 --- a/src/main/java/electrosphere/controls/categories/ControlCategoryMainGame.java +++ b/src/main/java/electrosphere/controls/categories/ControlCategoryMainGame.java @@ -10,7 +10,7 @@ import electrosphere.audio.VirtualAudioSourceManager.VirtualAudioSourceType; import electrosphere.client.entity.camera.CameraEntityUtils; import electrosphere.client.entity.crosshair.Crosshair; import electrosphere.client.interact.ClientInteractionEngine; -import electrosphere.client.item.ItemActions; +import electrosphere.client.interact.ItemActions; import electrosphere.client.ui.components.PlayerInventoryWindow; import electrosphere.client.ui.menu.WindowStrings; import electrosphere.client.ui.menu.WindowUtils; diff --git a/src/main/java/electrosphere/entity/state/inventory/InventoryUtils.java b/src/main/java/electrosphere/entity/state/inventory/InventoryUtils.java index 4aa05080..55bf5f14 100644 --- a/src/main/java/electrosphere/entity/state/inventory/InventoryUtils.java +++ b/src/main/java/electrosphere/entity/state/inventory/InventoryUtils.java @@ -2,7 +2,9 @@ package electrosphere.entity.state.inventory; import org.joml.Vector3d; +import electrosphere.audio.VirtualAudioSourceManager.VirtualAudioSourceType; import electrosphere.engine.Globals; +import electrosphere.engine.assetmanager.AssetDataStrings; import electrosphere.entity.ClientEntityUtils; import electrosphere.entity.Entity; import electrosphere.entity.EntityDataStrings; @@ -14,6 +16,7 @@ import electrosphere.entity.state.equip.ServerToolbarState; import electrosphere.entity.state.gravity.GravityUtils; import electrosphere.entity.types.creature.CreatureUtils; import electrosphere.entity.types.item.ItemUtils; +import electrosphere.game.data.item.Item; import electrosphere.logger.LoggerInterface; import electrosphere.net.parser.net.message.EntityMessage; import electrosphere.net.parser.net.message.InventoryMessage; @@ -404,11 +407,24 @@ public class InventoryUtils { InventoryUtils.serverAttemptEjectItemTransform(creature,item); } - //need creature so we can figure out where to drop the item + /** + * Attempts ejecting an item from a client's inventory + * need creature so we can figure out where to drop the item + * @param creature The creature + * @param item The item + */ public static void clientAttemptEjectItem(Entity creature, Entity item){ //if we're the client, tell the server we want to try the transform NetworkMessage requestPickupMessage = InventoryMessage.constructremoveItemFromInventoryMessage(Globals.clientSceneWrapper.mapClientToServerId(item.getId())); Globals.clientConnection.queueOutgoingMessage(requestPickupMessage); + if(Globals.virtualAudioSourceManager != null){ + Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(item)); + if(itemData != null && itemData.getItemAudio() != null && itemData.getItemAudio().getUIReleaseAudio() != null){ + Globals.virtualAudioSourceManager.createVirtualAudioSource(itemData.getItemAudio().getUIReleaseAudio(), VirtualAudioSourceType.UI, false); + } else { + Globals.virtualAudioSourceManager.createVirtualAudioSource(AssetDataStrings.UI_SFX_ITEM_RELEASE, VirtualAudioSourceType.UI, false); + } + } } /** diff --git a/src/main/java/electrosphere/server/player/PlayerActions.java b/src/main/java/electrosphere/server/player/PlayerActions.java index b00164ef..30b3a701 100644 --- a/src/main/java/electrosphere/server/player/PlayerActions.java +++ b/src/main/java/electrosphere/server/player/PlayerActions.java @@ -3,7 +3,7 @@ package electrosphere.server.player; import org.joml.Vector3d; import org.joml.Vector3i; -import electrosphere.client.item.ItemActions; +import electrosphere.client.interact.ItemActions; import electrosphere.engine.Globals; import electrosphere.entity.Entity; import electrosphere.entity.state.block.ServerBlockTree;