inventory audio work
Some checks reported errors
studiorailgun/Renderer/pipeline/head Something is wrong with the build of this commit

This commit is contained in:
austin 2025-04-14 16:57:54 -04:00
parent b41ccfacfd
commit 2532e73656
5 changed files with 21 additions and 4 deletions

View File

@ -1471,6 +1471,7 @@ Voxel type work
(04/14/2025)
Inventory sounds for some materials
Inventory audio work

View File

@ -1,4 +1,4 @@
package electrosphere.client.item;
package electrosphere.client.interact;
import org.joml.Vector3d;

View File

@ -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;

View File

@ -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);
}
}
}
/**

View File

@ -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;