mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 16:54:22 +00:00
Added newVolume and newPitch to PlaySoundAtEntityEvent. Deprecated ForgeEventFactory.onPlaySoundAt, added replacement ForgeEventFactory.onPlaySoundAtEntity.
This commit is contained in:
1 parent
888bab92c3
commit
3b567a92d8
4 files changed
+82
-57
No files matched your search
@@ -304,12 +304,23 @@ public class ForgeEventFactory
|
||||
return event.canUpdate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use {@link #onPlaySoundAtEntity(Entity,String,float,float)}
|
||||
*/
|
||||
@Deprecated
|
||||
public static String onPlaySoundAt(Entity entity, String name, float volume, float pitch)
|
||||
{
|
||||
PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(entity, name, volume, pitch);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event.name;
|
||||
}
|
||||
|
||||
public static PlaySoundAtEntityEvent onPlaySoundAtEntity(Entity entity, String name, float volume, float pitch)
|
||||
{
|
||||
PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(entity, name, volume, pitch);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
public static int onItemExpire(EntityItem entity, ItemStack item)
|
||||
{
|
||||
|
||||
@@ -10,8 +10,10 @@ import net.minecraft.entity.Entity;
|
||||
* and World#playerSoundToNearExcept(EntityPlayer, String, float, float).<br>
|
||||
* <br>
|
||||
* {@link #name} contains the name of the sound to be played at the Entity.<br>
|
||||
* {@link #volume} contains the volume at which the sound is to be played.<br>
|
||||
* {@link #pitch} contains the pitch at which the sound is to be played.<br>
|
||||
* {@link #volume} contains the volume at which the sound is to be played originally.<br>
|
||||
* {@link #pitch} contains the pitch at which the sound is to be played originally.<br>
|
||||
* {@link #newVolume} contains the volume at which the sound is actually played.<br>
|
||||
* {@link #newPitch} contains the pitch at which the sound is actually played.<br>
|
||||
* Changing the {@link #name} field will cause the sound of this name to be played instead of the originally intended sound.<br>
|
||||
* <br>
|
||||
* This event is {@link Cancelable}.<br>
|
||||
@@ -27,6 +29,8 @@ public class PlaySoundAtEntityEvent extends EntityEvent
|
||||
public String name;
|
||||
public final float volume;
|
||||
public final float pitch;
|
||||
public float newVolume;
|
||||
public float newPitch;
|
||||
|
||||
public PlaySoundAtEntityEvent(Entity entity, String name, float volume, float pitch)
|
||||
{
|
||||
@@ -34,5 +38,7 @@ public class PlaySoundAtEntityEvent extends EntityEvent
|
||||
this.name = name;
|
||||
this.volume = volume;
|
||||
this.pitch = pitch;
|
||||
this.newVolume = volume;
|
||||
this.newPitch = pitch;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user