mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 19:39:22 +00:00
World
This commit is contained in:
1 parent
776eb00ed3
commit
4b4146bbed
9 files changed
+369
-395
No files matched your search
@@ -25,6 +25,7 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
@@ -336,9 +337,9 @@ public class ForgeEventFactory
|
||||
return event.canUpdate;
|
||||
}
|
||||
|
||||
public static PlaySoundAtEntityEvent onPlaySoundAtEntity(Entity entity, SoundEvent name, float volume, float pitch)
|
||||
public static PlaySoundAtEntityEvent onPlaySoundAtEntity(Entity entity, SoundEvent name, SoundCategory category, float volume, float pitch)
|
||||
{
|
||||
PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(entity, name, volume, pitch);
|
||||
PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(entity, name, category, volume, pitch);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.minecraftforge.event.entity;
|
||||
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
|
||||
/**
|
||||
@@ -28,27 +29,31 @@ import net.minecraft.util.SoundEvent;
|
||||
public class PlaySoundAtEntityEvent extends EntityEvent
|
||||
{
|
||||
private SoundEvent name;
|
||||
private SoundCategory category;
|
||||
private final float volume;
|
||||
private final float pitch;
|
||||
private float newVolume;
|
||||
private float newPitch;
|
||||
|
||||
public PlaySoundAtEntityEvent(Entity entity, SoundEvent name, float volume, float pitch)
|
||||
public PlaySoundAtEntityEvent(Entity entity, SoundEvent name, SoundCategory category, float volume, float pitch)
|
||||
{
|
||||
super(entity);
|
||||
this.name = name;
|
||||
this.category = category;
|
||||
this.volume = volume;
|
||||
this.pitch = pitch;
|
||||
this.newVolume = volume;
|
||||
this.newPitch = pitch;
|
||||
}
|
||||
|
||||
public SoundEvent getSound(){ return this.name; }
|
||||
public SoundEvent getSound() { return this.name; }
|
||||
public SoundCategory getCategory() { return this.category; }
|
||||
public float getDefaultVolume() { return this.volume; }
|
||||
public float getDefaultPitch() { return this.pitch; }
|
||||
public float getVolume() { return this.newVolume; }
|
||||
public float getPitch() { return this.newPitch; }
|
||||
public void setSound(SoundEvent value) { this.name = value; }
|
||||
public void setCategory(SoundCategory category) { this.category = category; }
|
||||
public void setVolume(float value) { this.newVolume = value; }
|
||||
public void setPitch(float value) { this.newPitch = value; }
|
||||
}
|
||||
Reference in new issue
Block a user