本文整理汇总了Java中net.minecraftforge.client.event.sound.PlaySoundEvent17类的典型用法代码示例。如果您正苦于以下问题:Java PlaySoundEvent17类的具体用法?Java PlaySoundEvent17怎么用?Java PlaySoundEvent17使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlaySoundEvent17类属于net.minecraftforge.client.event.sound包,在下文中一共展示了PlaySoundEvent17类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPlaySound
import net.minecraftforge.client.event.sound.PlaySoundEvent17; //导入依赖的package包/类
@SubscribeEvent
public void onPlaySound(PlaySoundEvent17 event)
{
if (mc.currentScreen instanceof GuiGameOver)
{
if (!event.name.equals("static"))
{
event.result = null;
}
}
// else if (mc.currentScreen instanceof GuiMonitor)
// {
// if (event.name.equals("gui.button.press"))
// {
// event.result = null;
// }
// }
}
示例2: witherSoundKilling
import net.minecraftforge.client.event.sound.PlaySoundEvent17; //导入依赖的package包/类
@SubscribeEvent
public void witherSoundKilling(final PlaySoundEvent17 event) {
if (!ExtraUtils.disableWitherNoiseUnlessNearby) {
return;
}
if (!"mob.wither.spawn".equals(event.name)) {
return;
}
for (final Entity e : (List<Entity>)(Minecraft.getMinecraft().theWorld.getLoadedEntityList())) {
if (e.getClass() == EntityWither.class) {
return;
}
}
event.result = null;
}
示例3: soundMufflerPlay
import net.minecraftforge.client.event.sound.PlaySoundEvent17; //导入依赖的package包/类
@SubscribeEvent
public void soundMufflerPlay(final PlaySoundEvent17 event) {
if (Minecraft.getMinecraft().theWorld != null && ExtraUtils.soundMuffler != null && event.result != null) {
final World world = (World)Minecraft.getMinecraft().theWorld;
if (event.result instanceof ITickableSound) {
return;
}
final float x = event.result.getXPosF();
final float y = event.result.getYPosF();
final float z = event.result.getZPosF();
for (int dx = (int)Math.floor(x - 8.0f) >> 4; dx <= (int)Math.floor(x + 8.0f) >> 4; ++dx) {
for (int dz = (int)Math.floor(z - 8.0f) >> 4; dz <= (int)Math.floor(z + 8.0f) >> 4; ++dz) {
for (final TileEntity var19 : (Collection<TileEntity>) world.getChunkFromChunkCoords(dx, dz).chunkTileEntityMap.values()) {
if (var19 instanceof TileEntitySoundMuffler) {
if (var19.getBlockMetadata() == 1) {
continue;
}
double d = (var19.xCoord + 0.5 - x) * (var19.xCoord + 0.5 - x) + (var19.yCoord + 0.5 - y) * (var19.yCoord + 0.5 - y) + (var19.zCoord + 0.5 - z) * (var19.zCoord + 0.5 - z);
if (d > 64.0) {
continue;
}
if (d <= 0.0) {
continue;
}
event.result = (ISound)new SoundMuffled(event.result);
d = Math.sqrt(d);
if (d != 0.0) {
d = 1.0 / d / 8.0;
}
world.spawnParticle("smoke", (double)x, (double)y, (double)z, (var19.xCoord + 0.5 - x) * d, (var19.yCoord + 0.5 - y) * d, (var19.zCoord + 0.5 - z) * d);
}
}
}
}
}
}
示例4: onSoundPlay
import net.minecraftforge.client.event.sound.PlaySoundEvent17; //导入依赖的package包/类
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onSoundPlay(PlaySoundEvent17 event)
{
if (this.mc.thePlayer != null && mc.thePlayer.dimension == Main.DIM_ID && event.category == SoundCategory.MUSIC)
event.manager.setSoundCategoryVolume(SoundCategory.MUSIC, 0);
}
示例5: playSound
import net.minecraftforge.client.event.sound.PlaySoundEvent17; //导入依赖的package包/类
public static ISound playSound(SoundManager manager, ISound sound)
{
SoundEventAccessorComposite accessor = manager.field_148622_c.func_147680_a(sound.func_147650_b());
PlaySoundEvent17 e = new PlaySoundEvent17(manager, sound, (accessor == null ? null : accessor.func_148728_d()));
MinecraftForge.EVENT_BUS.post(e);
return e.result;
}
示例6: playSound
import net.minecraftforge.client.event.sound.PlaySoundEvent17; //导入依赖的package包/类
public static ISound playSound(SoundManager manager, ISound sound)
{
SoundEventAccessorComposite accessor = manager.sndHandler.getSound(sound.getPositionedSoundLocation());
PlaySoundEvent17 e = new PlaySoundEvent17(manager, sound, (accessor == null ? null : accessor.getSoundCategory()));
MinecraftForge.EVENT_BUS.post(e);
return e.result;
}
示例7: onPlaySoundEvent
import net.minecraftforge.client.event.sound.PlaySoundEvent17; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onPlaySoundEvent(PlaySoundEvent17 event)
{
if (event != null && event.name != null && event.name.contains(CarpentersBlocks.MODID))
{
if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
{
World world = FMLClientHandler.instance().getClient().theWorld;
int x = MathHelper.floor_double(event.sound.getXPosF());
int y = MathHelper.floor_double(event.sound.getYPosF());
int z = MathHelper.floor_double(event.sound.getZPosF());
// We'll set a default block type to be safe
Block block = Blocks.planks;
// Grab approximate origin, and gather accurate block type
TEBase TE = getApproximateSoundOrigin(world, x, y, z);
if (TE != null && TE.hasAttribute(TE.ATTR_COVER[6])) {
block = BlockProperties.toBlock(BlockProperties.getCoverSafe(TE, 6));
}
if (event.name.startsWith("step.")) {
event.result = new PositionedSoundRecord(new ResourceLocation(block.stepSound.getStepResourcePath()), block.stepSound.getVolume() * 0.15F, block.stepSound.getPitch(), x + 0.5F, y + 0.5F, z + 0.5F);
} else { // "dig." usually
event.result = new PositionedSoundRecord(new ResourceLocation(block.stepSound.getBreakSound()), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F, x + 0.5F, y + 0.5F, z + 0.5F);
}
}
}
}
示例8: rainKiller
import net.minecraftforge.client.event.sound.PlaySoundEvent17; //导入依赖的package包/类
@SubscribeEvent
public void rainKiller(final PlaySoundEvent17 event) {
if (Minecraft.getMinecraft().theWorld != null && Minecraft.getMinecraft().thePlayer != null && ExtraUtils.soundMuffler != null) {
if (event == null || !"ambient.weather.rain".equals(event.name)) {
return;
}
final World world = (World)Minecraft.getMinecraft().theWorld;
NBTTagCompound tags = new NBTTagCompound();
if (Minecraft.getMinecraft().thePlayer.getEntityData().hasKey("PlayerPersisted")) {
tags = Minecraft.getMinecraft().thePlayer.getEntityData().getCompoundTag("PlayerPersisted");
}
else {
Minecraft.getMinecraft().thePlayer.getEntityData().setTag("PlayerPersisted", (NBTBase)tags);
}
final boolean force = tags.hasKey("ExtraUtilities|Rain") && tags.getBoolean("ExtraUtilities|Rain");
if (!force && TileEntityRainMuffler.playerNeedsMuffler) {
TileEntityRainMuffler.playerNeedsMufflerInstantCheck = false;
}
else {
event.result = null;
if (force) {
return;
}
boolean flag = false;
if (world.provider.dimensionId != TileEntityRainMuffler.curDimension) {
flag = true;
}
else if (!(world.getTileEntity(TileEntityRainMuffler.curX, TileEntityRainMuffler.curY, TileEntityRainMuffler.curZ) instanceof TileEntityRainMuffler)) {
flag = true;
}
else if (world.getTileEntity(TileEntityRainMuffler.curX, TileEntityRainMuffler.curY, TileEntityRainMuffler.curZ).getDistanceFrom((double)Minecraft.getMinecraft().thePlayer.chunkCoordX, (double)Minecraft.getMinecraft().thePlayer.chunkCoordX, (double)Minecraft.getMinecraft().thePlayer.chunkCoordZ) > 4096.0) {
flag = true;
}
if (flag) {
TileEntityRainMuffler.playerNeedsMuffler = true;
TileEntityRainMuffler.playerNeedsMufflerInstantCheck = true;
TileEntityRainMuffler.curDimension = -100;
}
}
}
}
示例9: onSoundPlayed
import net.minecraftforge.client.event.sound.PlaySoundEvent17; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onSoundPlayed(PlaySoundEvent17 event)
{
//The event.result starts off equal to event.sound, but could have been altered or set to null by another mod
if (event.result == null) return;
EntityPlayerSP player = FMLClientHandler.instance().getClient().thePlayer;
if (player != null && player.worldObj != null && player.worldObj.provider instanceof IGalacticraftWorldProvider && event != null)
{
//Only modify standard game sounds, not music
if (event.result.getAttenuationType() != ISound.AttenuationType.NONE)
{
PlayerGearData gearData = ClientProxyCore.playerItemData.get(player.getGameProfile().getName());
float x = event.result.getXPosF();
float y = event.result.getYPosF();
float z = event.result.getZPosF();
if (gearData == null || gearData.getFrequencyModule() == -1)
{
// If the player doesn't have a frequency module, and the player isn't in an oxygenated environment
// Note: this is a very simplistic approach, and nowhere near realistic, but required for performance reasons
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(x - 0.0015D, y - 0.0015D, z - 0.0015D, x + 0.0015D, y + 0.0015D, z + 0.0015D);
boolean playerInAtmosphere = OxygenUtil.isAABBInBreathableAirBlock(player);
boolean soundInAtmosphere = OxygenUtil.isAABBInBreathableAirBlock(player.worldObj, bb);
if ((!playerInAtmosphere || !soundInAtmosphere))
{
float volume = event.result.getVolume();
//First check for duplicate firing of PlaySoundEvent17 on this handler's own playing of a reduced volume sound (see below)
for (int i = 0; i < this.soundPlayList.size(); i++)
{
SoundPlayEntry entry = this.soundPlayList.get(i);
if (entry.name.equals(event.name) && entry.x == x && entry.y == y && entry.z == z && entry.volume == volume)
{
this.soundPlayList.remove(i);
return;
}
}
//If it's not a duplicate: play the same sound but at reduced volume
float newVolume = volume / Math.max(0.01F, ((IGalacticraftWorldProvider) player.worldObj.provider).getSoundVolReductionAmount());
this.soundPlayList.add(new SoundPlayEntry(event.name, x, y, z, newVolume));
ISound newSound = new PositionedSoundRecord(event.result.getPositionedSoundLocation(), newVolume, event.result.getPitch(), x, y, z);
event.manager.playSound(newSound);
event.result = null;
return;
}
}
}
}
}
示例10: onSoundPlaying
import net.minecraftforge.client.event.sound.PlaySoundEvent17; //导入依赖的package包/类
@SubscribeEvent
public void onSoundPlaying(PlaySoundEvent17 event) {
logger.info("Playing sound: " + event.name);
}