Jump to content

Rexozz

Forge Modder
  • Posts

    40
  • Joined

  • Last visited

Everything posted by Rexozz

  1. Haha Thank you Animefan8888! I've already found this method but I've overlooked the line with the inventory key ^^ Thanks anyway
  2. Why do you load your config this way now and no more as before? You should have the ability to update values with properties! Or do I misunderstand what? Please tell me exactly what you need, because I misunderstand many things!
  3. Hey choonster ^^ If you want to save something to your config when config changed event gets fired, you should compare the event modid with yours and in the if statement call the methods from your config class! And if you want a list with your config categories, you could do something like this (if you meant that): ArrayList<ConfigCategory> list=new ArrayList<ConfigCategory>(); for(String str:config.getCategoryNames()) list.add(config.getCategory(str)); Maybe that should also work with your config elements! Hope that helps
  4. Hi forge-community, I have a problem with my GuiContainer. My gui container has textboxes, but everytime I press my inventory key, my container closes. How would I prevent it from closing? :'( Rexozz ^^
  5. I'm not 100% sure now, but try to create a new instance of your data class everytime you try to load or save data instead of creating one field in your Event class! And make sure that you call it on the server and the client side!
  6. You should use the per world storage if you use different data for nether, end etc.! That makes everything a little clearer if you try to save data per world!
  7. Could you show where you call your MobEventsWorldSavedData?
  8. https://mcforge.readthedocs.io/en/latest/datastorage/worldsaveddata/ Did you read the documentation?
  9. Haha I'm so stupid ^^ I forgot to add the super constructor to initGui() and onUpdate()! But thank you anyway!!!!!
  10. Hey forge-community, Rexozz has another problem! (is kind of embarrassing to me) I wanted to create an Inventory for my entity but everytime I click a slot my inventory is acting totally weird! Sometimes I get the item from another slot or the item disappears or i can't do anything with the slot at all! I used the horse, villager and player classes as reference! Here the sources: My entity: http://pastebin.com/hfBrht4d My container: http://pastebin.com/4MrGqfax My GUI: http://pastebin.com/XZ1pmSaq My GuiHandler: http://pastebin.com/xxfGX35X Can someone help me please? (again) Rexozz ^^
  11. Either I'm really stupid or the "SubscribeEvent" annotation is really not needed here! public static void handleMessages(FMLInterModComms.IMCEvent event)
  12. Show some lines or methods you think they could be improved! I think, nobody would search through your entire code to correct or improve something! No offense!
  13. Yeahhhhh, got my computer to work! Now this is my result: Everything works perfectly! Thanks ^^ EDIT: If someone else has problems with this: 1. Copy the classes GuiWorldSelection, GuiListWorldSelection and GuiListWorldSelectionEntry to your mod and edit the drawEntry method in the GuiListWorldSelectionEntry class 2. Create an class that does this: (you could also use the InitGuiEvent like I, depends on what you want to do! When the events are called is really self-explanatory) And register the event in your client proxy or client side in your main mod or common proxy init method! 3. Here's the source for the event class: http://pastebin.com/w1E98q97 Don't know if there's an easier way but I hope it helps ^^
  14. Ok I'll try this! Unfortenately my #*!#?!*%## brandnew Computer died today so it will take a while to post results! But thank you diesieben07 and Draco18s ^^
  15. Like this one! I decided to do this with images instead of text.
  16. Whoahh, thank you so much! Actually, that would be so easy if I wouldn't think so complicated! First I tried to do it with java reflection! How stupid can I be? Is there another way to achieve this?
  17. Hey folks! I want to add an element to the vanilla world list! But I don't know how to do that without editing some base classes! Can someone help me please?
  18. Haha, it works now, I just wonder how long! Are there any improvements that I could do? PacketClass: http://pastebin.com/KvCqVDM7 PlaySound in PEEntityCreature: public class PEEntityCreature extends EntityCreature implements INpc{ public PEEntityCreature(World worldIn) { super(worldIn); } @Override public void playSound(SoundEvent sound, float volume, float pitch) { if (!this.isSilent()){ if(sound.getSoundName().equals(this.getDeathSound().getSoundName())||sound.getSoundName().equals(this.getHurtSound().getSoundName())) PacketHandler.sendToAllAround(new C00PacketSendSound(new ImplSound(sound,this.getSoundCategory(),volume,pitch,this.posX,this.posY,this.posZ)), this.dimension, this.posX, this.posY, this.posZ, volume > 1.0F ? (double)(16.0F * volume) : 16.0D); else super.playSound(sound, volume, pitch); } } }
  19. How did I know that there will be a thread exception? http://pastebin.com/pb8U8i2m First time playing the sound worked just fine, but then: [05:44:04] [Thread-14/ERROR]: Error in class 'CodecJOrbis' [05:44:04] [Thread-14/ERROR]: Unable to acquire inputstream in method 'initialize'. [05:44:04] [Thread-14/WARN]: ERROR MESSAGE: [05:44:04] [Thread-14/INFO]: C:\Users\Rexozz\Desktop\forge 1.10 modding\PixelEngine\saves\Neue Welt\mapres\sounds\sound\block.grass.step.ogg (Das System kann die angegebene Datei nicht finden) [05:44:04] [Thread-14/WARN]: STACK TRACE: [05:44:04] [Thread-14/INFO]: java.io.FileInputStream.open0(Native Method) [05:44:04] [Thread-14/INFO]: java.io.FileInputStream.open(Unknown Source) [05:44:04] [Thread-14/INFO]: java.io.FileInputStream.<init>(Unknown Source) [05:44:04] [Thread-14/INFO]: java.io.FileInputStream.<init>(Unknown Source) [05:44:04] [Thread-14/INFO]: sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source) [05:44:04] [Thread-14/INFO]: sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source) [05:44:04] [Thread-14/INFO]: paulscode.sound.codecs.CodecJOrbis.initialize(CodecJOrbis.java:281) [05:44:04] [Thread-14/INFO]: paulscode.sound.libraries.LibraryLWJGLOpenAL.loadSound(LibraryLWJGLOpenAL.java:392) [05:44:04] [Thread-14/INFO]: paulscode.sound.libraries.LibraryLWJGLOpenAL.newSource(LibraryLWJGLOpenAL.java:640) [05:44:04] [Thread-14/INFO]: paulscode.sound.SoundSystem.CommandNewSource(SoundSystem.java:1800) [05:44:04] [Thread-14/INFO]: paulscode.sound.SoundSystem.CommandQueue(SoundSystem.java:2415) [05:44:04] [Thread-14/INFO]: paulscode.sound.CommandThread.run(CommandThread.java:121) This is where the sound plays: http://pastebin.com/gUsSSujt
  20. Yeah, I wanted to do so but I thought that would be way too insecure! What if my sound overlaps another playing sounds and causes some problems? I could use the SoundSystem in the SoundManager, but is this safe enough? this.sndSystem.newStreamingSource(false, s, getURLForSoundResource(resourcelocation1), resourcelocation1.toString(), flag, p_sound.getXPosF(), p_sound.getYPosF(), p_sound.getZPosF(), p_sound.getAttenuationType().getTypeInt(), f); For example! When i was digging deeper, I found this one: class SoundSystemStarterThread extends SoundSystem { private SoundSystemStarterThread() { } public boolean playing(String p_playing_1_) { synchronized (SoundSystemConfig.THREAD_SYNC) { if (this.soundLibrary == null) { return false; } else { Source source = (Source)this.soundLibrary.getSources().get(p_playing_1_); return source == null ? false : source.playing() || source.paused() || source.preLoad; } } } } But Threads are not my friends! I know almost nothing about threads. Doesn't matter how often I've read something about them!
  21. Does this mean that I don't need to overwrite the existing method? Just create an implemention of ISound? That would be really awesome But I think that wouldn't work, because the SoundEventAccesor has a list with sounds! EDIT: Oh, okay, in this case, the SoundEventAccesor is just a null check ^^
  22. After many hours of struggling, i've found this useful method: public void playSound(ISound p_sound) { if (this.loaded) { p_sound = net.minecraftforge.client.ForgeHooksClient.playSound(this, p_sound); if (p_sound == null) return; SoundEventAccessor soundeventaccessor = p_sound.createAccessor(this.sndHandler); ResourceLocation resourcelocation = p_sound.getSoundLocation(); if (soundeventaccessor == null) { if (UNABLE_TO_PLAY.add(resourcelocation)) { LOGGER.warn(LOG_MARKER, "Unable to play unknown soundEvent: {}", new Object[] {resourcelocation}); } } else { if (!this.listeners.isEmpty()) { for (ISoundEventListener isoundeventlistener : this.listeners) { isoundeventlistener.soundPlay(p_sound, soundeventaccessor); } } if (this.sndSystem.getMasterVolume() <= 0.0F) { LOGGER.debug(LOG_MARKER, "Skipped playing soundEvent: {}, master volume was zero", new Object[] {resourcelocation}); } else { Sound sound = p_sound.getSound(); if (sound == SoundHandler.MISSING_SOUND) { if (UNABLE_TO_PLAY.add(resourcelocation)) { LOGGER.warn(LOG_MARKER, "Unable to play empty soundEvent: {}", new Object[] {resourcelocation}); } } else { float f3 = p_sound.getVolume(); float f = 16.0F; if (f3 > 1.0F) { f *= f3; } SoundCategory soundcategory = p_sound.getCategory(); float f1 = this.getClampedVolume(p_sound); float f2 = this.getClampedPitch(p_sound); if (f1 == 0.0F) { LOGGER.debug(LOG_MARKER, "Skipped playing sound {}, volume was zero.", new Object[] {sound.getSoundLocation()}); } else { boolean flag = p_sound.canRepeat() && p_sound.getRepeatDelay() == 0; String s = MathHelper.getRandomUuid(ThreadLocalRandom.current()).toString(); ResourceLocation resourcelocation1 = sound.getSoundAsOggLocation(); if (sound.isStreaming()) { this.sndSystem.newStreamingSource(false, s, getURLForSoundResource(resourcelocation1), resourcelocation1.toString(), flag, p_sound.getXPosF(), p_sound.getYPosF(), p_sound.getZPosF(), p_sound.getAttenuationType().getTypeInt(), f); net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlayStreamingSourceEvent(this, p_sound, s)); } else { this.sndSystem.newSource(false, s, getURLForSoundResource(resourcelocation1), resourcelocation1.toString(), flag, p_sound.getXPosF(), p_sound.getYPosF(), p_sound.getZPosF(), p_sound.getAttenuationType().getTypeInt(), f); net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlaySoundSourceEvent(this, p_sound, s)); } LOGGER.debug(LOG_MARKER, "Playing sound {} for event {} as channel {}", new Object[] {sound.getSoundLocation(), resourcelocation1, s}); this.sndSystem.setPitch(s, f2); this.sndSystem.setVolume(s, f1); this.sndSystem.play(s); this.playingSoundsStopTime.put(s, Integer.valueOf(this.playTime + 20)); this.playingSounds.put(s, p_sound); if (soundcategory != SoundCategory.MASTER) { this.categorySounds.put(soundcategory, s); } if (p_sound instanceof ITickableSound) { this.tickableSounds.add((ITickableSound)p_sound); } } } } } } } Could this work?: 1. Create custom SoundManager and inherit from the existing one 2. Get the most important fields via Java Reflection (because they're all private) 3. Override the playsound method Maybe this should do it! ^^
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.