當前位置: 首頁>>代碼示例>>Java>>正文


Java PositionedSoundRecord類代碼示例

本文整理匯總了Java中net.minecraft.client.audio.PositionedSoundRecord的典型用法代碼示例。如果您正苦於以下問題:Java PositionedSoundRecord類的具體用法?Java PositionedSoundRecord怎麽用?Java PositionedSoundRecord使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PositionedSoundRecord類屬於net.minecraft.client.audio包,在下文中一共展示了PositionedSoundRecord類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: draw

import net.minecraft.client.audio.PositionedSoundRecord; //導入依賴的package包/類
public IToast.Visibility draw(GuiToast toastGui, long delta)
{
	toastGui.getMinecraft().getTextureManager().bindTexture(TEXTURE_TOASTS);
	GlStateManager.color(1.0F, 1.0F, 1.0F);
	toastGui.drawTexturedModalRect(0, 0, 0, 0, 160, 32);

	toastGui.getMinecraft().fontRenderer.drawString(
			I18n.format(expanded ? "toast.arcanemagic.page_expanded" : "toast.arcanemagic.page_unlocked"), 30, 7,
			0x5bc14d);
	toastGui.getMinecraft().fontRenderer.drawString(I18n.format(unlocked.getUnlocalizedName()), 30, 18, 0x65a595);

	if (!this.hasPlayedSound && delta > 0L)
	{
		this.hasPlayedSound = true;

		toastGui.getMinecraft().getSoundHandler()
				.playSound(PositionedSoundRecord.getRecord(ArcaneMagicSoundHandler.randomLearnSound(), 1.0F, 1.0F));

	}

	RenderHelper.enableGUIStandardItemLighting();
	toastGui.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI((EntityLivingBase) null, unlocked.getIcon(),
			8, 8);
	return delta >= 5000L ? IToast.Visibility.HIDE : IToast.Visibility.SHOW;
}
 
開發者ID:raphydaphy,項目名稱:ArcaneMagic,代碼行數:26,代碼來源:CategoryUnlockedToast.java

示例2: playRecord

import net.minecraft.client.audio.PositionedSoundRecord; //導入依賴的package包/類
public void playRecord(String recordName, BlockPos blockPosIn)
{
    ISound isound = (ISound)this.mapSoundPositions.get(blockPosIn);

    if (isound != null)
    {
        this.mc.getSoundHandler().stopSound(isound);
        this.mapSoundPositions.remove(blockPosIn);
    }

    if (recordName != null)
    {
        ItemRecord itemrecord = ItemRecord.getRecord(recordName);

        if (itemrecord != null)
        {
            this.mc.ingameGUI.setRecordPlayingMessage(itemrecord.getRecordNameLocal());
        }

        PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(new ResourceLocation(recordName), (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ());
        this.mapSoundPositions.put(blockPosIn, positionedsoundrecord);
        this.mc.getSoundHandler().playSound(positionedsoundrecord);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:25,代碼來源:RenderGlobal.java

示例3: playSound

import net.minecraft.client.audio.PositionedSoundRecord; //導入依賴的package包/類
/**
 * par8 is loudness, all pars passed to minecraftInstance.sndManager.playSound
 */
public void playSound(double x, double y, double z, String soundName, float volume, float pitch, boolean distanceDelay)
{
    double d0 = this.mc.getRenderViewEntity().getDistanceSq(x, y, z);
    PositionedSoundRecord positionedsoundrecord = new PositionedSoundRecord(new ResourceLocation(soundName), volume, pitch, (float)x, (float)y, (float)z);

    if (distanceDelay && d0 > 100.0D)
    {
        double d1 = Math.sqrt(d0) / 40.0D;
        this.mc.getSoundHandler().playDelayedSound(positionedsoundrecord, (int)(d1 * 20.0D));
    }
    else
    {
        this.mc.getSoundHandler().playSound(positionedsoundrecord);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:19,代碼來源:WorldClient.java

示例4: mouseReleased

import net.minecraft.client.audio.PositionedSoundRecord; //導入依賴的package包/類
public void mouseReleased(int mouseX, int mouseY)
{
    if (this.field_146155_p)
    {
        if (this.field_146153_r == SoundCategory.MASTER)
        {
            float f = 1.0F;
        }
        else
        {
            GuiScreenOptionsSounds.this.game_settings_4.getSoundLevel(this.field_146153_r);
        }

        GuiScreenOptionsSounds.this.mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
    }

    this.field_146155_p = false;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:19,代碼來源:GuiScreenOptionsSounds.java

示例5: func_148132_a

import net.minecraft.client.audio.PositionedSoundRecord; //導入依賴的package包/類
protected void func_148132_a(int p_148132_1_, int p_148132_2_)
{
    this.field_148218_l = -1;

    if (p_148132_1_ >= 79 && p_148132_1_ < 115)
    {
        this.field_148218_l = 0;
    }
    else if (p_148132_1_ >= 129 && p_148132_1_ < 165)
    {
        this.field_148218_l = 1;
    }
    else if (p_148132_1_ >= 179 && p_148132_1_ < 215)
    {
        this.field_148218_l = 2;
    }

    if (this.field_148218_l >= 0)
    {
        this.func_148212_h(this.field_148218_l);
        this.mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:24,代碼來源:GuiStats.java

示例6: onScreenShotShield

import net.minecraft.client.audio.PositionedSoundRecord; //導入依賴的package包/類
@SubscribeEvent
public void onScreenShotShield(final @Nonnull ScreenShotShieldEvent.Post event) {
	if (Config.getConfig().notifyChat.get()) {
		final String mode = ScreenShotShieldRegistery.getListener(Config.getConfig().ssmode.get()).name();
		ChatBuilder.create("mchelishield.notification.chat.screenshot.message").useTranslation().setParams(mode).chatClient();
		ChatBuilder.create("mchelishield.notification.chat.screenshot.message.mode").useTranslation().setParams(mode).chatClient();
	}
	if (Config.getConfig().notifySound.get())
		FMLClientHandler.instance().getClient().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("mchelishield", "notification.sound"), 1.0F));
	if (Config.getConfig().notifyEffect.get())
		this.effectStrength = .75f;
	if (Config.getConfig().notifyOverlay.get()) {
		this.text = I18n.format("mchelishield.notification.overlay.screenshot.message");
		this.textStrength = 1f;
	}
}
 
開發者ID:Team-Fruit,項目名稱:McHeliPrivacyShield,代碼行數:17,代碼來源:CoreHandler.java

示例7: onModListShield

import net.minecraft.client.audio.PositionedSoundRecord; //導入依賴的package包/類
@SubscribeEvent
public void onModListShield(final @Nonnull ModListShieldEvent.Post event) {
	if (Config.getConfig().notifyChat.get()) {
		final String mode = ModListShieldRegistery.getListener(Config.getConfig().mlmode.get()).name();
		ChatBuilder.create("mchelishield.notification.chat.modlist.message").useTranslation().setParams(mode).chatClient();
		ChatBuilder.create("mchelishield.notification.chat.modlist.message.mode").useTranslation().setParams(mode).chatClient();
	}
	if (Config.getConfig().notifySound.get())
		FMLClientHandler.instance().getClient().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("mchelishield", "notification.sound"), 1.0F));
	if (Config.getConfig().notifyEffect.get())
		this.effectStrength = .75f;
	if (Config.getConfig().notifyOverlay.get()) {
		this.text = I18n.format("mchelishield.notification.overlay.modlist.message");
		this.textStrength = 1f;
	}
}
 
開發者ID:Team-Fruit,項目名稱:McHeliPrivacyShield,代碼行數:17,代碼來源:CoreHandler.java

示例8: playRecord

import net.minecraft.client.audio.PositionedSoundRecord; //導入依賴的package包/類
public void playRecord(@Nullable SoundEvent soundIn, BlockPos pos)
{
    ISound isound = (ISound)this.mapSoundPositions.get(pos);

    if (isound != null)
    {
        this.mc.getSoundHandler().stopSound(isound);
        this.mapSoundPositions.remove(pos);
    }

    if (soundIn != null)
    {
        ItemRecord itemrecord = ItemRecord.getBySound(soundIn);

        if (itemrecord != null)
        {
            this.mc.ingameGUI.setRecordPlayingMessage(itemrecord.getRecordNameLocal());
        }

        PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.getRecordSoundRecord(soundIn, (float)pos.getX(), (float)pos.getY(), (float)pos.getZ());
        this.mapSoundPositions.put(pos, positionedsoundrecord);
        this.mc.getSoundHandler().playSound(positionedsoundrecord);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:25,代碼來源:RenderGlobal.java

示例9: onGuiOpen

import net.minecraft.client.audio.PositionedSoundRecord; //導入依賴的package包/類
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onGuiOpen(GuiOpenEvent event)
{
    if(event.getGui() instanceof GuiMainMenu && !played)
    {
        played = true;
        if(playOn == 1 || playOn == 3)
        {
            SoundEvent sound = SoundEvent.REGISTRY.getObject(new ResourceLocation(name));
            if(sound != null)
            {
                Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(sound, (float)pitch));
            }
            else
            {
                logger.log(Level.WARN, "Could not find sound: %s", new ResourceLocation(name));
            }
        }
    }
}
 
開發者ID:iChun,項目名稱:Ding,代碼行數:22,代碼來源:Ding.java

示例10: onWorldTick

import net.minecraft.client.audio.PositionedSoundRecord; //導入依賴的package包/類
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onWorldTick(TickEvent.WorldTickEvent event)
{
    if(playWorld && event.phase == TickEvent.Phase.END && Minecraft.getMinecraft().player != null && (Minecraft.getMinecraft().player.ticksExisted > 20 || Minecraft.getMinecraft().isGamePaused()))
    {
        playWorld = false;
        if(playOn == 2 || playOn == 3)
        {
            SoundEvent sound = SoundEvent.REGISTRY.getObject(new ResourceLocation(nameWorld));
            if(sound != null)
            {
                Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(sound, (float)pitchWorld));
            }
            else
            {
                FMLLog.log("Ding", Level.WARN, "Could not find sound: %s", new ResourceLocation(nameWorld));
            }
        }
    }
}
 
開發者ID:iChun,項目名稱:Ding,代碼行數:22,代碼來源:Ding.java

示例11: PlayMusic

import net.minecraft.client.audio.PositionedSoundRecord; //導入依賴的package包/類
public static ISound PlayMusic (ISound musicIn) {
	Minecraft mc = Minecraft.getMinecraft();
	WorldClient world = mc.world;
	EntityPlayerSP player = mc.player;

	if (rand.nextFloat() > 0.5) {
		return musicIn;
	}
	
	if (world == null) {
		return musicIn;
	} else {
		switch (Biome.getIdForBiome(world.getBiome(player.getPosition()))) {
		case OCEAN:
	        musicIn = PositionedSoundRecord.getMusicRecord(ModSound.OCEAN);
			return musicIn;
		case DEEP_OCEAN:
	        musicIn = PositionedSoundRecord.getMusicRecord(ModSound.OCEAN);
			return musicIn;
		default:
			return musicIn;
		}
	}
}
 
開發者ID:williambl,項目名稱:EssentialFeatures,代碼行數:25,代碼來源:CustomMusic.java

示例12: mouseClicked

import net.minecraft.client.audio.PositionedSoundRecord; //導入依賴的package包/類
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException
{
    super.mouseClicked(mouseX, mouseY, mouseButton);

    if (mouseButton == 0)
    {
        this.buttons.forEach(button ->
        {
            if (button.getKey().isMouseInside(mouseX - this.guiLeft, mouseY - this.guiTop))
            {
                button.getValue().run();
                this.mc.getSoundHandler().playSound(
                        PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
            }
        });
    }
}
 
開發者ID:OPMCorp,項目名稱:Qbar,代碼行數:19,代碼來源:GuiMachineBase.java

示例13: mouseClicked

import net.minecraft.client.audio.PositionedSoundRecord; //導入依賴的package包/類
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
    super.mouseClicked(mouseX, mouseY, mouseButton);
    if (mouseButton == 0) {
        int yClick = (mouseY - y - 25) / (fontRenderer.FONT_HEIGHT * 2 + 4) + scrollOffset;

        int yTask = y + 25 + (fontRenderer.FONT_HEIGHT + 2) * ((yClick - scrollOffset) * 2);
        if (mouseX >= x + 2 && mouseX <= x + 12 && mouseY >= yTask && mouseY <= yTask + fontRenderer.FONT_HEIGHT) {
            if (yClick < tasks.size() && yClick >= 0) {
                PacketHandler.INSTANCE.sendToServer(new MessageModifyTask(tasks.get(yClick).getTaskID()));
                tasks.remove(yClick);
                mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));

                if (tasks.size() <= maxTasks) {
                    scrollBar.setVisible(false);
                    scrollOffset = 0;
                }
            }
        }
    }

}
 
開發者ID:univrsal,項目名稱:IIDY,代碼行數:23,代碼來源:GuiListTasks.java

示例14: mouseClicked

import net.minecraft.client.audio.PositionedSoundRecord; //導入依賴的package包/類
@Override
protected void mouseClicked(int mouseX, int mouseY, int button) {
	int x = (this.width-this.xSize)/2;
	int y = (this.height-this.ySize)/2;
	int scaleFactor = new ScaledResolution(Minecraft.getMinecraft(), x, y).getScaleFactor();
	if (mouseX > x+(43*scaleFactor) && mouseX < x+(52*scaleFactor)
			&& mouseY > y+(13*scaleFactor) && mouseY < y+(26*scaleFactor)) {
		Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
		//TODO: Help (sub-)gui
	} else if (mouseX > x+(43*scaleFactor) && mouseX < x+(52*scaleFactor)
			&& mouseY > y+(94*scaleFactor) && mouseY < y+(107*scaleFactor)) {
		Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
		//TODO:Start infusion
	} else {
		super.mouseClicked(mouseX, mouseY, button);
	}
}
 
開發者ID:austinv11,項目名稱:DartCraft2,代碼行數:18,代碼來源:GuiInfuser.java

示例15: onBGMusic

import net.minecraft.client.audio.PositionedSoundRecord; //導入依賴的package包/類
@SubscribeEvent
public void onBGMusic(PlaySoundEvent event)
{
	if(event.getSound() != null && event.getSound().getCategory() != null && event.getSound().getCategory() == SoundCategory.MUSIC)
	{
		if(event.getManager().isSoundPlaying(iSound))
		{
			event.setResultSound(null);
		}
		else
		{
			iSound = PositionedSoundRecord.getMusicRecord(TFC_Sounds.TFCMUSIC);
			event.setResultSound(iSound);
		}
	}
}
 
開發者ID:Deadrik,項目名稱:TFC2,代碼行數:17,代碼來源:BackgroundMusicHandler.java


注:本文中的net.minecraft.client.audio.PositionedSoundRecord類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。