当前位置: 首页>>代码示例>>Java>>正文


Java SoundEvent类代码示例

本文整理汇总了Java中net.minecraft.util.SoundEvent的典型用法代码示例。如果您正苦于以下问题:Java SoundEvent类的具体用法?Java SoundEvent怎么用?Java SoundEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SoundEvent类属于net.minecraft.util包,在下文中一共展示了SoundEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: playRecord

import net.minecraft.util.SoundEvent; //导入依赖的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

示例2: playEquipSound

import net.minecraft.util.SoundEvent; //导入依赖的package包/类
protected void playEquipSound(ItemStack stack)
{
    if (!stack.func_190926_b())
    {
        SoundEvent soundevent = SoundEvents.ITEM_ARMOR_EQUIP_GENERIC;
        Item item = stack.getItem();

        if (item instanceof ItemArmor)
        {
            soundevent = ((ItemArmor)item).getArmorMaterial().getSoundEvent();
        }
        else if (item == Items.ELYTRA)
        {
            soundevent = SoundEvents.field_191258_p;
        }

        this.playSound(soundevent, 1.0F, 1.0F);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:EntityLivingBase.java

示例3: registerSounds

import net.minecraft.util.SoundEvent; //导入依赖的package包/类
@SubscribeEvent
public void registerSounds(Register<SoundEvent> event)
{
	IForgeRegistry<SoundEvent> registry = event.getRegistry();
	ArcaneMagicSoundHandler.register("spell", registry);
	ArcaneMagicSoundHandler.register("scepter_1", registry);
	ArcaneMagicSoundHandler.register("scepter_2", registry);
	ArcaneMagicSoundHandler.register("scepter_3", registry);
	ArcaneMagicSoundHandler.register("page_1", registry);
	ArcaneMagicSoundHandler.register("page_2", registry);
	ArcaneMagicSoundHandler.register("arcane_transfiguration_success", registry);
	ArcaneMagicSoundHandler.register("write_1", registry);
	ArcaneMagicSoundHandler.register("write_2", registry);
	ArcaneMagicSoundHandler.register("learn_1", registry);
	ArcaneMagicSoundHandler.register("learn_2", registry);
	ArcaneMagicSoundHandler.register("reconstruct", registry);
	ArcaneMagicSoundHandler.register("clack", registry);
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:19,代码来源:ModRegistry.java

示例4: notifyDataManagerChange

import net.minecraft.util.SoundEvent; //导入依赖的package包/类
@Override
public void notifyDataManagerChange(DataParameter<?> key) {
	this.adjustSize();
	
	// System.out.println("Watcher update: "+data);
	if (!this.world.isRemote && key == CONSTRUCTING) {
		this.setSoundState(this.dataManager.get(CONSTRUCTING) >= this.getConstructionTime()? 0 : 25);
	}
	if (this.world.isRemote && key == SOUND_STATE) {
		SoundEvent sound = this.getSoundNameForState(this.getSoundState());
		if (sound != null) {
			// System.out.println("Playing Sound: "+sound);
			if (this.buildingSound != null)
				this.buildingSound.stopPlaying();
			this.buildingSound = new BuildingSound(this, sound, this.getSoundState());
			ClientProxy.playBuildingSound(buildingSound);
		}
		else{
			if(this.buildingSound != null)
				this.buildingSound.stopPlaying();
		}
	}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:24,代码来源:EntityBuilding.java

示例5: fromBytes

import net.minecraft.util.SoundEvent; //导入依赖的package包/类
@Override
public void fromBytes(ByteBuf buffer) {
    super.fromBytes(buffer);
    soundEvent = new SoundEvent(new ResourceLocation(ByteBufUtils.readUTF8String(buffer)));
    category = SoundCategory.values()[buffer.readInt()];
    volume = buffer.readFloat();
    pitch = buffer.readFloat();
    bool = buffer.readBoolean();
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:10,代码来源:PacketPlaySound.java

示例6: tryEmptyContainer

import net.minecraft.util.SoundEvent; //导入依赖的package包/类
/**
 * Takes a filled container and tries to empty it into the given tank.
 *
 * @param container        The filled container. Will not be modified.
 * @param fluidDestination The fluid handler to be filled by the container.
 * @param maxAmount        The largest amount of fluid that should be transferred.
 * @param player           Player for making the bucket drained sound. Pass null for no noise.
 * @param doDrain          true if the container should actually be drained, false if it should be simulated.
 * @return The empty container if successful, null if the fluid handler couldn't be filled.
 *         NOTE The empty container will have a stackSize of 0 when a filled container is consumable,
 *              i.e. it has a "null" empty container but has successfully been emptied.
 */
@Nullable
public static ItemStack tryEmptyContainer(ItemStack container, IFluidHandler fluidDestination, int maxAmount, @Nullable EntityPlayer player, boolean doDrain)
{
    container = container.copy(); // do not modify the input
    container.stackSize = 1;
    IFluidHandler containerFluidHandler = getFluidHandler(container);
    if (containerFluidHandler != null)
    {
        FluidStack simulatedTransfer = tryFluidTransfer(fluidDestination, containerFluidHandler, maxAmount, false);
        if (simulatedTransfer != null)
        {
            if (doDrain)
            {
                tryFluidTransfer(fluidDestination, containerFluidHandler, maxAmount, true);
                if (player != null)
                {
                    SoundEvent soundevent = simulatedTransfer.getFluid().getEmptySound(simulatedTransfer);
                    player.playSound(soundevent, 1f, 1f);
                }
            }
            else
            {
                containerFluidHandler.drain(simulatedTransfer, true);
            }
            return container;
        }
    }
    return null;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:42,代码来源:FluidUtil.java

示例7: makeHorseRearWithSound

import net.minecraft.util.SoundEvent; //导入依赖的package包/类
public void makeHorseRearWithSound()
{
    this.makeHorseRear();
    SoundEvent soundevent = this.getAngrySound();

    if (soundevent != null)
    {
        this.playSound(soundevent, this.getSoundVolume(), this.getSoundPitch());
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:11,代码来源:EntityHorse.java

示例8: playSound

import net.minecraft.util.SoundEvent; //导入依赖的package包/类
public void playSound(@Nullable EntityPlayer player, double x, double y, double z, SoundEvent soundIn, SoundCategory category, float volume, float pitch)
{
    if (player == this.mc.player)
    {
        this.playSound(x, y, z, soundIn, category, volume, pitch, false);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:8,代码来源:WorldClient.java

示例9: SoundGlassAmbience

import net.minecraft.util.SoundEvent; //导入依赖的package包/类
public SoundGlassAmbience(SoundEvent soundIn, SoundCategory categoryIn, float volume, float pitch, TerminalPlacement placement)
{
    super(soundIn, categoryIn);
    this.volume = volume;
    this.pitch = pitch;
    this.repeat = true;
    this.repeatDelay = 0;

    this.xPosF = (float)placement.master.getPos().getX();
    this.yPosF = (float)placement.master.getPos().getY();
    this.zPosF = (float)placement.master.getPos().getZ();

    this.placement = placement;
}
 
开发者ID:iChun,项目名称:GeneralLaymansAestheticSpyingScreen,代码行数:15,代码来源:SoundGlassAmbience.java

示例10: func_190687_dF

import net.minecraft.util.SoundEvent; //导入依赖的package包/类
public void func_190687_dF()
{
    this.makeHorseRear();
    SoundEvent soundevent = this.getAngrySound();

    if (soundevent != null)
    {
        this.playSound(soundevent, this.getSoundVolume(), this.getSoundPitch());
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:11,代码来源:AbstractHorse.java

示例11: onRegisterSound

import net.minecraft.util.SoundEvent; //导入依赖的package包/类
@SubscribeEvent
public void onRegisterSound(RegistryEvent.Register<SoundEvent> event)
{
    Torched.soundRPT = new SoundEvent(new ResourceLocation("torched", "rpt")).setRegistryName(new ResourceLocation("torched", "rpt"));
    Torched.soundTube = new SoundEvent(new ResourceLocation("torched", "tube")).setRegistryName(new ResourceLocation("torched", "tube"));

    event.getRegistry().register(Torched.soundRPT);
    event.getRegistry().register(Torched.soundTube);
}
 
开发者ID:iChun,项目名称:Torched,代码行数:10,代码来源:EventHandlerServer.java

示例12: ImmersiveSound

import net.minecraft.util.SoundEvent; //导入依赖的package包/类
public ImmersiveSound(SoundEvent event, World world, BlockPos pos, float baseVolume, boolean repeat) {
    super(event, SoundCategory.BLOCKS);
    this.world = world;
    this.pos = pos;
    this.xPosF = pos.getX();
    this.yPosF = pos.getY();
    this.zPosF = pos.getZ();
    this.attenuationType = AttenuationType.LINEAR;
    this.repeat = repeat;
    this.repeatDelay = 0;
    this.sound = event;
    this.baseVolume = baseVolume;
}
 
开发者ID:McJty,项目名称:Lector,代码行数:14,代码来源:ImmersiveSound.java

示例13: playSound

import net.minecraft.util.SoundEvent; //导入依赖的package包/类
@Override
public void playSound(EntityPlayer player, BlockPos pos, SoundEvent soundIn, SoundCategory category, float volume,
		float pitch) {
	if (m_proxyWorld != null && Util.isPrefixInCallStack(m_modPrefix)) {
		m_proxyWorld.playSound(player, pos, soundIn, category, volume, pitch);
	} else if (m_realWorld != null) {
		m_realWorld.playSound(player, pos, soundIn, category, volume, pitch);
	} else {
		super.playSound(player, pos, soundIn, category, volume, pitch);
	}
}
 
开发者ID:orbwoi,项目名称:UniversalRemote,代码行数:12,代码来源:WorldServerProxy.java

示例14: playRecord

import net.minecraft.util.SoundEvent; //导入依赖的package包/类
@Override
public void playRecord(BlockPos blockPositionIn, SoundEvent soundEventIn) {
	if (m_proxyWorld != null && Util.isPrefixInCallStack(m_modPrefix)) {
		m_proxyWorld.playRecord(blockPositionIn, soundEventIn);
	} else if (m_realWorld != null) {
		m_realWorld.playRecord(blockPositionIn, soundEventIn);
	} else {
		super.playRecord(blockPositionIn, soundEventIn);
	}
}
 
开发者ID:orbwoi,项目名称:UniversalRemote,代码行数:11,代码来源:WorldServerProxy.java

示例15: getAngrySound

import net.minecraft.util.SoundEvent; //导入依赖的package包/类
@Nullable
protected SoundEvent getAngrySound()
{
    this.openHorseMouth();
    this.makeHorseRear();
    HorseType horsetype = this.getType();
    return horsetype.isUndead() ? null : (horsetype.hasMuleEars() ? SoundEvents.ENTITY_DONKEY_ANGRY : SoundEvents.ENTITY_HORSE_ANGRY);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:9,代码来源:EntityHorse.java


注:本文中的net.minecraft.util.SoundEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。