Jump to content

How do I make TileEntity play specific sound every 10 seconds? [Radio] 1.7.10


ScottehBoeh

Recommended Posts

I'm adding a Radio to my Vietnam Mod:

 

tWFLwGB.png

 

Any ideas on what code I could add to my EntityRadio class which allows me to play the sound [glow=blue,2,300]"wb:props/ratio/idle"[/glow] ?:

 

 

package net.mcheroesandgenerals.warblocks;

 

import net.minecraft.tileentity.TileEntity;

 

public class EntityRadio extends TileEntity {

 

 

}

 

 

 

It currently has no other code (Since it's a basic static entity)

Link to comment
Share on other sites

Try looking at the jukebox.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Firstly, you should be able to get your block to do this, so you might not need a TE (for this).

 

Start your block "ticking" during placement. Set the tick period to 200 (10 seconds) and then, in the updateTick method, use world.play to initiate your sound where !world.isRemote (not remote). That may seem counter-intuitive (playing a sound on the server), but that's how the sound is communicated to all clients having players within range. Don't do anything client-side; the sound manager should get the message and do it for you (assuming your assets are in order).

 

Note: My experience is in MC 1.8, so some of the names may have changed. However, I think the basic strategy is the same.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

The TileEnt might be important for other reasons, but yes, a block on its own can make sound (see also: note block).

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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