Jump to content

Play sound at nightfall?


Ms_Raven

Recommended Posts

I'm trying to make a sound play for the entire world at nightfall.

But nothing happens.

Could someone help with this?

 

Event:

 

public class TimeEvents

{

Minecraft mc;

ISound sound;

EntityPlayer player;

 

@SubscribeEvent

public void onWorldTick(TickEvent.WorldTickEvent event)

{

if(event.world.getWorldTime() == 10000)

{

if(event.world.provider.dimensionId == 10)

{

ResourceLocation file = new ResourceLocation("apocalypse:sounds.Siren");

sound = PositionedSoundRecord.func_147673_a(file);

mc.getSoundHandler().playSound(sound);

}

}

}

}

 

 

 

The sound file is valid since it can be played with a record, and the class is registered as an event so I'm not sure what's going on.

Link to comment
Share on other sites

Resource location is defined wrong. It thinks that when it only one arg, it's mc's resource, so it becomes something like minecraft:apocalypse:sounds.Siren.

To avoid this, use second resource location constructor(with 2 strings: 1st-domain, 2nd-resource).

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.