Everything posted by Rexozz
-
[Solved] Custom SoundManager problem!
Ok, I think i got it now! I will try this and post the working code on this forum.
-
[Solved] Custom SoundManager problem!
I know that's not supported, but it's possible! I've done it many times! Maybe i could create an class implementing the IWorldEventListener and create my own public void playSound(@Nullable EntityPlayer player, double x, double y, double z, SoundEvent soundIn, SoundCategory category, float volume, float pitch) { net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(player, soundIn, category, volume, pitch); if (event.isCanceled() || event.getSound() == null) return; soundIn = event.getSound(); category = event.getCategory(); volume = event.getVolume(); pitch = event.getPitch(); for (int i = 0; i < this.eventListeners.size(); ++i) { ((IWorldEventListener)this.eventListeners.get(i)).playSoundToAllNearExcept(player, soundIn, category, x, y, z, volume, pitch); } } method. I know that this isn't easy, because there are so many other classes needed to play the sound, but if i could create my own SoundPlayEvent and register the soundevents in an additional map (temporary data, until i unloaded a map and register new soundevents after loading another map) in my mod, would that work then? I create a new superclass for my entities that handle the new sound management and let my existing entity inherit from that class! Maybe this should work ^^ EDIT: I could read thorugh the classes to learn how the sound system is working and then create my OWN CUSTOM sound system, especially for this mod ^^
-
[Solved] Custom SoundManager problem!
Ok, didn't know that! NPCs for example. The user can set the sound via a GUI. Or for background music, like in adventure games triggered by a block ^^ Maybe I should create a new instance of the existing soundsystem and edit some base classes to mute the old one? But I think that's not a good idea, mod compatibility is a big problem then! Although it doesn't matter if my mod is compatible or not, because it should be a single mod anyway. Ah, maybe I should say that this mod should be a SinglePlayer mod! I think that's very important information ^^
-
[Solved] Custom SoundManager problem!
Sure, it has worked when I registered them by loading the world ^^ But then they also registered for all worlds, because they registered for the mod and not for single world And if a world uses a sound with the same name as another, there was a conflict, because soundevents can't registered twice but I think you already know that haha so i tried to give each world an UUID which the sound also gets and thats why I let my mod write the sounds JSON, otherwise the user has to write the uuid in front of each sound in the sounds.json
-
[Solved] Custom SoundManager problem!
While developing the map the user can use the folder resource pack method and only zip up the resource pack when they distribute the map. Must the user do this by itself, or do i have to make this possible with my mod Why do you want to edit the user's resource pack? Haha no, I meant that if the user use the method to change single textures, my mod changes them! But now I know, that I should do this with resourcepacks too ^^ Make the IResourcePack regenerate the generated sounds.json data using an IResourceManagerReloadListener , which will tell you when Minecraft reloads the resources. You can then use the file watch API to tell Minecraft to reload resources automatically if a new file is added. Yeah, but the new sounds aren't registered in the forge registry then ^^ (wow, i really should do something for my english, horrible )
-
[Solved] Custom SoundManager problem!
Because the user don't need additional programs to edit content, not beacause he hasn't such programms, but it costs more time for the user ^^ second reason, my code will be much bigger with zip methods if I want my mod to change files in that zip! But if you recommend this way rather than mine, then I really should do that ^^ Ok, now with the sound registry Register the sounds everytime the user added a new sound Should I do this with a FileWatcher that notifies the mod to register new sounds? But then the sounds also registered for other maps
-
[Solved] Custom SoundManager problem!
This is not true. [/qoute] Vanilla Minecraft already supports bundling resource packs with a map. but then it must be a zipped file, and I don't want this ^^ EDIT: And the sounds must be registered anyway! That's my actual problem, but im open to everything! (sry if my first post wasn't declaring this obviously)
-
[Solved] Custom SoundManager problem!
Because he would then have to work with zip files, and this is really nerfwrecking, mostly ^^ And this way, the resources come with the map, so the user don't have to download and set them manually
-
[Solved] Custom SoundManager problem!
"User" is the mod user ^^ The User adds resources to the map (each map has different resources)! He creates the map and adds scripts etc. Then he uploads the map and other users can download and play them
-
[Solved] Custom SoundManager problem!
Ehm, the user should've the ability to add their custom sounds and resources to the folder while game's runinng! Then reload the resources!
-
[Solved] Custom SoundManager problem!
I also thought that it's a stupid idea! The idead behind this was that the user haven't to write it by itself But I definetely should delete this section ^^
-
[Solved] Custom SoundManager problem!
Hello Forge-Community! First of all, I'm an Austrian, so my English isn't the best! Secondly, I'm a beginner in Java and Forge, please don't judge me too hard! ^^ Ok, I wanted to make an dynamic SoundManager which loads the sounds from a custom path respectively custom resource pack which implements IResourcePack! Everything worked fine, my SoundManager, my ResourcePack and everything else, until I tried to register a sound manager individual for each map. I tried to give each soundmanager an unique id, here are my classes: (and again, please don't judge me too much for my bad coding skills ^^) My WorldEvents class: http://pastebin.com/yPEH9QpX My Registry class: http://pastebin.com/DAzGip3t My WorldRegistry class: http://pastebin.com/dTRaqURj My SoundManager & SoundFolder class: http://pastebin.com/Rg1mRXWe And my WorldData class: http://pastebin.com/iqRyAQxr I coded all myself except the WorldData class for which I needed a tutorial! ^^ Please don't reply with code examples (except there is no alternative)! Just declare what's wrong if you can help me (like: something in this class must be static or mustn't be final) Thank you
-
Tile Entity GUI Not working
Yeah. YOURCONTAINERANDGUIID is the number you used when opening the gui player.openGui(modInstance, ID....); additional info: gui id's should be unique for your mod, don't define them multiple Create a field in your gui handler class: public static final YOUR_GUIID=0; public static final ANOTHER_GUIID=1; and then access this ids instead of typing a number, so you can't get confused if you need them EDIT: please place the onBlockActivated in your block class and not in your tileentity (maybe you already done that, i've seen it in your sources you linked)
-
Tile Entity GUI Not working
Try replacing: @Override public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { TileEntity tile_entity = world.getTileEntity(new BlockPos(x, y, z)); if (tile_entity instanceof SCTileEntity) { return new ContainerSCTileEntity(player.inventory, (SCTileEntity) tile_entity, x, y); } return null; } @Override public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { TileEntity tile_entity = world.getTileEntity(new BlockPos(x, y, z)); if (tile_entity instanceof SCTileEntity) { return new GuiSCTileEntity(player.inventory, (SCTileEntity) tile_entity); } return null; } with: @Override public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { TileEntity tile_entity = world.getTileEntity(new BlockPos(x, y, z)); switch(id){ case YOURCONTAINERANDGUIID: return new ContainerSCTileEntity(player.inventory, (SCTileEntity) tile_entity, x, y); break; } return null; } @Override public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { TileEntity tile_entity = world.getTileEntity(new BlockPos(x, y, z)); switch(id){ case YOURCONTAINERANDGUIID: return new GuiSCTileEntity(player.inventory, (SCTileEntity) tile_entity); break; } return null; } PS: sorry for my bad english
IPS spam blocked by CleanTalk.