Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

サムエル

Members
  • Joined

  • Last visited

Everything posted by サムエル

  1. I actually didn't even use any loops. So far I just used code created from a schematic to java converter but converted from 1.7 to 1.8. I didn't think it'd make that much difference to change it to loops so I skipped straight to looking for another method. Pastebin doesn't seem to be loading for me so I'll just post part of the (very long) code here. I didn't plan on using it as the final code, I just didn't think I could actually shorten a 5-10 minute freeze to nothing just by using loops. If that's the case, what's the best way I should contain and retrieve this data? In addition, I'd like to know any other ways to make the code more efficient. Also this is an underground structure so I shouldn't have to recalculate light.
  2. I want my mod to build a pre-made custom structure that takes up exactly 32768 blocks. I've tried a code that sets each individual blockstate to the corresponding blockstate in the structure but it makes the game freeze for 5 - 10 minutes and that's just too long. What's the most efficient way I can generate this structure? I prefer it to be generated with the rest of the world but any method where the game doesn't freeze is fine by me. I have the blocks making up the structure as a java file that sets the individual blockstates but I can use regex text replacement to convert it into whatever format is necessary. Edit: The solution is NOT to use a chunk primer but to have a custom world generator that sets block states with a flag of 0 in the world for each chunk. It can still take a couple minutes but that's better than 5 - 10.
  3. Yeah... I just found that out before reading your post. If I knew that I could have figured this out easily. Maybe now I'll learn not to assume things like that.
  4. To do that, I believe I need the door's BlockPos. How do I get the door's BlockPos from within the onNeighbourBlockChange method?
  5. Use setBlockState(blockPos, block.getStateFromMeta(meta)) and it will work the same way. For all I know, there might be a way to set metadata without setting the block's state to a whole new one, but this is what I used for a structure's code when setting each individual block.
  6. So I have created a custom iron door that is different in that it's indestructible. However, I also want it to only open from behind which essentially means the door will only open if it is receiving redstone power from behind the door (anything in front will be ignored). I believe I understand how this would be done (using the onNeighbourBlockChange() method), but I don't understand how to get the position of the door from within that method to find where the neighbour block is relative to the door. For all I know it could be in the first part of the code already and I'm just not seeing it. Either way, I need some help with this. Here is my custom door code: BlockChaosDoorUnbreakable.java
  7. Alright, I finally figured out what you meant. Apparently I didn't read your code comments well enough to see that I was supposed to use EntityPlayerSP thePlayer from Minecraft.getMinecraft() and not the EntityPlayerMP from the server. I see that you were saying that the whole time, I just didn't understand until now. I'd like to get the default background music to stop but I suppose that's for another thread.
  8. Well I clearly don't understand them as well as you do. I've really just been following tutorials for proxies. What is the part that needs to be changed?
  9. Well I have three proxies with the third being ServerProxy. I got that from a tutorial when I was starting the mod, should I only have the two? I think I misunderstood something because nothing is happening when I send the packet. bgmPacket.java ClientProxy.java CommonProxy (server proxy) has the method public void playBGM(EntityPlayer player) except blank. Can you see what I did wrong?
  10. It sounds like you want me to put the method in the common proxy but I don't know of any way to separate client and server from within the common proxy. Am I supposed to put the method in the client proxy and if not, could you show me how I can only affect the client proxy from within the common proxy?
  11. Only once at a time since it's music and wouldn't sound very good with overlap. If I create the sound in the packet, do I just set the activated boolean to true before I send the packet so it doesn't play twice?
  12. The == thing was just out of habit because I don't use Java nearly as much as Javascript and other web-based languages. If I do nothing on the client, where does playSound even execute in single player? If I try to send the packet in single player it tells me EntityPlayerSP can't be cast to EntityPlayerMP. Also, what are you saying shouldn't be static? Are you referring to the MovingSound? I made it static because I don't know how I would be able to access it from the packet handler otherwise.
  13. The following code is in the block's collision code: It seems to work in SP (obviously because it's doing what I did before) but I haven't tried MP yet. Does this look correct given the following class? bgmPacket.java If so, thanks a lot and I'd like to know more about using "SoundSourceEvent" to stop the regular background music because I couldn't find any information regarding that.
  14. I only want the player to hear it. I will have more than one of these tile entities though.
  15. Alright, so if I want to send a packet to the player, do I just put a second constructor in the tile entity to take the triggering player as an argument and send the packet to that player? I don't know if it will matter if that variable is overwritten by a second triggering player and that's why I'm asking.
  16. So I can basically do the same thing as your example but replace IMessage onMessage with ITickableSound onTickableSound which will contain the handling code?
  17. But "send the packet" doesn't tell me how to code it. I have no experience with packets and I don't know what in your tutorial example is only necessary for text, what is necessary for all packets, or what I might need to add for it to work with a sound.
  18. I thought that might be the case, but I still don't know how to do it with sounds and I can't find a single example.
  19. If that's the case, how do I play the sound without accessing the SoundHandler (Edit: I found out I can probably just use "this.worldObj" but if I can just play it on the player's client then I'd like to know how to do that)? Also, to tell if the song is playing (so as to not play another copy over itself if the block collision is triggered twice), do I just use the BGMActivated boolean alone?
  20. Alright, here's my TE code: TileEntityChaosLabyrinthEntrance.java I found out before you posted that the audio file was actually the problem with the looped click and I've since fixed it. I want to know here if I can play the preloop and transition to the looped portion without a seam but if not I can just fade in the looped portion. ChaosBlock is the main mod class in case you might think it's a block.
  21. Nevermind, I had two versions of the same boolean and I only had it enabled in one of them. It seems to work now and loops as well even though there's a minor click in between. So my next question is how can I play the preloop part of the music and then switch to the looped part without a seam?
  22. I tried the playSound with the tile entity and it's still not working. When you're talking about using packets, I can't tell if you're referring to how everything works internally or if you're saying I need to do what it's in your tutorial. If the latter, it's not obvious to me what needs to be changed in that code for it to work with a sound instead of a message and I can't seem to find any other examples for it.
  23. Unless you just mean calling SoundHandler.playSound() from the tile entity, I still don't know how I would apply the method in your tutorial to this. I'm also confused about whether I even need the tile entity when I have the moving sound. If I just have to call playSound() from the tile entity then do I just call the moving sound like I would a non-tickable sound?
  24. What I have tried is this: MovingSoundChaosLabyrinthBGM.java I've never really worked with packets and I'm not sure how I would apply your tutorial to a sound.
  25. I still can't get anything to play. I tried making it the same as a MovingSound code I found in another thread where they said it works and nothing plays. You said to send a packet to the client but I can't seem to find how to do that.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.