yeziqie
首先,在某处实例化一个ResourceLocation来记录你的音乐位置public static ResourceLocation 你的location名字 = new ResourceLocation(你的MOD.MODID, "music.test");

然后在assets\你的MOD下新建sounds.json,内容为:
{
  "music.test": {
    "category": "music",
        "sounds": [
      {
        "name": "music/pump_it",
        "stream": true
      }
    ]
  }

}

然后在assets\你的MOD\sounds\music下放入一首名叫pump_it.ogg的曲子
【原曲:av212109

然后在某处调用如下代码
PositionedSoundRecord currentSound = PositionedSoundRecord.func_147673_a(你的location名字);
Minecraft.getMinecraft().getSoundHandler().playSound(currentSound);




然后你就可以在mc中欣赏到哲♂学音乐啦~

//以上方法存在某些问题,比如和MC原版音乐播放冲突,连续播放导致声音重叠等
//想要了解完整方法或更多内容,请加入我们NullaDev制作组@159628975【欢迎程序猿和美工dalao前往2333
//本方法原作者:@xfgryujk
顺便申个精?

2021.12 数据,可能有更多内容首先,在某处实例化一个ResourceLocation来记录你的音乐位置public static ResourceLocation 你的location名字 = new ResourceLocation(你的MOD.MODID, "music.test");


然后在assets\你的MOD下新建sounds.json,内容为:
{
"music.test": {
    "category": "music",
        "sounds": [
   {
  "name": "music/pump_it",
  "stream": true
   }
    ]
}


}


然后在assets\你的MOD\sounds\music下放入一首名叫pump_it.ogg的曲子
【原曲:av212109


然后在某处调用如下代码
PositionedSoundRecord currentSound = PositionedSoundRecord.func_147673_a(你的location名字);
Minecraft.getMinecraft().getSoundHandler().playSound(currentSound);


然后你就可以在mc中欣赏到哲♂学音乐啦~


//以上方法存在某些问题,比如和MC原版音乐播放冲突,连续播放导致声音重叠等
//想要了解完整方法或更多内容,请加入我们NullaDev制作组@159628975【欢迎程序猿和美工dalao前往2333
//本方法原作者:@xfgryujk
顺便申个精?

RecursiveG
本帖最后由 RecursiveG 于 2016-3-13 13:43 编辑

A. 申精请去顶置贴
B. 不符合精华要求

sahdsg
这东西...
我在1.6.4的时候试终末之诗里播放Alpha.ogg
结果minecraft就卡住不动了

yeziqie
sahdsg 发表于 2016-3-13 15:01
这东西...
我在1.6.4的时候试终末之诗里播放Alpha.ogg
结果minecraft就卡住不动了 ...

大概可能也许没准是1710修复了。。总之实测可以

第一页 上一页 下一页 最后一页