类net.minecraft.util.SoundEvent源码实例Demo

下面列出了怎么用net.minecraft.util.SoundEvent的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: AdvancedRocketry   文件: BlockElectricMushroom.java
@Override
public void onBlockDestroyedByPlayer(World world, BlockPos pos,
		IBlockState state) {
	super.onBlockDestroyedByPlayer(world, pos, state);
	
	if(world.isRemote) {
		FxSystemElectricArc.spawnArc(world, pos.getX() + 0.5f, pos.getY() + 0.5f, pos.getZ() + 0.5f, .3, 7);
		
		world.playSound(pos.getX(), pos.getY(), pos.getZ(), new SoundEvent( new ResourceLocation("advancedrocketry:ElectricShockSmall")), SoundCategory.BLOCKS, .7f,  0.975f + world.rand.nextFloat()*0.05f, false);
	}
}
 
源代码2 项目: NOVA-Core   文件: FWBlockSound.java
@Override
public SoundEvent getBreakSound() {
	return blockSound.getSound(BlockProperty.BlockSound.BlockSoundTrigger.BREAK)
		.map(sound -> (sound.domain.isEmpty() && !sound.name.contains(".")) ? "dig." + sound.name : sound.getID())
		.map(soundID -> SoundEvent.REGISTRY.getObject(new ResourceLocation(soundID)))
		.orElseGet(super::getBreakSound);
}
 
源代码3 项目: CommunityMod   文件: RegUtil.java
public static SoundEvent registerSound(IForgeRegistry<SoundEvent> reg, ResourceLocation name) {
	SoundEvent event = new SoundEvent(name);
	event.setRegistryName(name);

	reg.register(event);

	return event;
}
 
源代码4 项目: CommunityMod   文件: BlockSound.java
public BlockSound(String name, SoundEvent sound) {
    super(Material.ROCK);
    this.setCreativeTab(CommunityGlobals.TAB);
    this.setSoundType(new SoundType(2.0F, 1.0F, sound, sound, sound, sound, sound));
    this.setRegistryName(name);
    this.setTranslationKey(getRegistryName().toString());
}
 
源代码5 项目: CommunityMod   文件: SubmodGnomes.java
@SubscribeEvent
public static void registerSounds(RegistryEvent.Register<SoundEvent> event)
{
	IForgeRegistry<SoundEvent> registry = event.getRegistry();
	
	GNOME_SPEAK = registerSoundEvent(registry, "mob.gnome.say");
	GNOME_DEATH = registerSoundEvent(registry, "mob.gnome.death");
}
 
源代码6 项目: CommunityMod   文件: SubmodGnomes.java
private static SoundEvent registerSoundEvent(IForgeRegistry<SoundEvent> registry, String location)
{
	ResourceLocation rl = new ResourceLocation(CommunityGlobals.MOD_ID, location);
	SoundEvent sound = new SoundEvent(rl);
	sound.setRegistryName(rl);
	registry.register(sound);
	return sound;
}
 
源代码7 项目: Production-Line   文件: ItemPLRecord.java
public ItemPLRecord(String name, SoundEvent soundEvent) {
    super(name, soundEvent);
    this.name = name;
    this.setCreativeTab(ProductionLine.creativeTabPL);
    this.setUnlocalizedName(MOD_ID + "." + name);
    GameRegistry.<Item>register(this, new ResourceLocation(MOD_ID, name));
}
 
源代码8 项目: ForgeHax   文件: WorldListener.java
@Override
public void playSoundToAllNearExcept(
    EntityPlayer player,
    SoundEvent soundIn,
    SoundCategory category,
    double x,
    double y,
    double z,
    float volume,
    float pitch) {
}
 
源代码9 项目: customstuff4   文件: SoundEventDeserializer.java
@Override
public SoundEvent deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
{
    ResourceLocation key = context.deserialize(json, ResourceLocation.class);
    SoundEvent event = SoundEvent.REGISTRY.getObject(key);

    return event;
}
 
源代码10 项目: customstuff4   文件: SoundEventDeserializerTest.java
@Test
public void fromString()
{
    Map<String, SoundEvent> map = gson.fromJson("{ \"sound\": \"item.armor.equip_gold\" }", new TypeToken<Map<String, SoundEvent>>() {}.getType());

    SoundEvent sound = map.get("sound");
    assertNotNull(sound);
    assertSame(SoundEvents.ITEM_ARMOR_EQUIP_GOLD, sound);
}
 
源代码11 项目: NOVA-Core   文件: FWBlockSound.java
@Override
public SoundEvent getPlaceSound() {
	return blockSound.getSound(BlockProperty.BlockSound.BlockSoundTrigger.PLACE)
		.map(sound -> sound.domain.isEmpty() ? "step." + sound.name : sound.getID())
		.map(soundID -> SoundEvent.REGISTRY.getObject(new ResourceLocation(soundID)))
		.orElseGet(super::getPlaceSound);
}
 
源代码12 项目: NOVA-Core   文件: FWBlockSound.java
@Override
public SoundEvent getStepSound() {
	return blockSound.getSound(BlockProperty.BlockSound.BlockSoundTrigger.WALK)
		.map(sound -> (sound.domain.isEmpty() && !sound.name.contains(".")) ? "step." + sound.name : sound.getID())
		.map(soundID -> SoundEvent.REGISTRY.getObject(new ResourceLocation(soundID)))
		.orElseGet(super::getBreakSound);
}
 
源代码13 项目: GokiStats   文件: GokiSounds.java
@SubscribeEvent
public void registerSounds(RegistryEvent.Register<SoundEvent> event) {
    event.getRegistry().registerAll(
            new SoundEvent(new ResourceLocation(MODID, "treasure")),
            new SoundEvent(new ResourceLocation(MODID, "magician")),
            new SoundEvent(new ResourceLocation(MODID, "reaper"))
    );
}
 
源代码14 项目: TofuCraftReload   文件: TofuSounds.java
private static SoundEvent createEvent(String name) {
    SoundEvent sound = new SoundEvent(new ResourceLocation(TofuMain.MODID, name));
    sound.setRegistryName(new ResourceLocation(TofuMain.MODID, name));
    return sound;
}
 
源代码15 项目: TofuCraftReload   文件: TofuSounds.java
@SubscribeEvent
public static void registerSounds(RegistryEvent.Register<SoundEvent> evt) {
    evt.getRegistry().register(TOFUNIAN_YES);
    evt.getRegistry().register(TOFUNIAN_AMBIENT);
    evt.getRegistry().register(TOFUBUGLE);
}
 
源代码16 项目: AdvancedRocketry   文件: TileLathe.java
@Override
public SoundEvent getSound() {
	return AudioRegistry.lathe;
}
 
源代码17 项目: TofuCraftReload   文件: EntityTofuGandlem.java
protected SoundEvent getSpellPrepareSound() {
    return SoundEvents.ENTITY_ZOMBIE_VILLAGER_CONVERTED;
}
 
源代码18 项目: TofuCraftReload   文件: EntityTofuGandlem.java
protected SoundEvent getSpellPrepareSound() {
    return SoundEvents.EVOCATION_ILLAGER_PREPARE_SUMMON;
}
 
源代码19 项目: TofuCraftReload   文件: EntityTofuGandlem.java
@Nullable
protected abstract SoundEvent getSpellPrepareSound();
 
@Override
protected void playMachineSound(SoundEvent event) {
	world.playSound(getPos().getX(), getPos().getY() + 7, getPos().getZ(), event, SoundCategory.BLOCKS, Minecraft.getMinecraft().gameSettings.getSoundLevel(SoundCategory.BLOCKS),  0.975f + world.rand.nextFloat()*0.05f, false);
}
 
源代码21 项目: TofuCraftReload   文件: EntityTofunian.java
@Override
protected SoundEvent getAmbientSound() {

    return TofuSounds.TOFUNIAN_AMBIENT;
}
 
源代码22 项目: AdvancedRocketry   文件: TileChemicalReactor.java
@Override
public SoundEvent getSound() {
	return AudioRegistry.rollingMachine;
}
 
源代码23 项目: TofuCraftReload   文件: EntityTofunian.java
@Override
protected SoundEvent getHurtSound(DamageSource damageSource) {

    return null;
}
 
源代码24 项目: AdvancedRocketry   文件: TileGravityController.java
@Override
public SoundEvent getSound() {
	return AudioRegistry.gravityOhhh;
}
 
源代码25 项目: Sakura_mod   文件: EntitySamuraiIllager.java
protected SoundEvent getDeathSound() {
    return SoundEvents.VINDICATION_ILLAGER_DEATH;
}
 
源代码26 项目: Sakura_mod   文件: CommonProxy.java
@SubscribeEvent
public static void onSoundEvenrRegistration(RegistryEvent.Register<SoundEvent> event) {
    event.getRegistry().register(TAIKO.setRegistryName(new ResourceLocation(SakuraMain.MODID, "taiko")));
}
 
源代码27 项目: CommunityMod   文件: GnuLinux.java
@SubscribeEvent
public static void onRegisterSounds(RegistryEvent.Register<SoundEvent> event) {
    GNU_LINUX = RegUtil.registerSound(event.getRegistry(), new ResourceLocation(CommunityGlobals.MOD_ID, "gnu_linux"));
}
 
源代码28 项目: CommunityMod   文件: ModSounds.java
@SubscribeEvent
public static void registerSoundEvents(RegistryEvent.Register<SoundEvent> event) {
    event.getRegistry().registerAll(E_SOUND, BRUH_2_SOUND);
}
 
源代码29 项目: CommunityMod   文件: EntityExplodingChicken.java
protected SoundEvent getAmbientSound()
{
    return SoundEvents.ENTITY_CHICKEN_AMBIENT;
}
 
源代码30 项目: CommunityMod   文件: EntityExplodingChicken.java
protected SoundEvent getHurtSound(DamageSource damageSourceIn)
{
    return SoundEvents.ENTITY_CHICKEN_HURT;
}
 
 类所在包
 同包方法