├── zmusic-fabric ├── build.gradle ├── zmusic-fabric-1.14.4 │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── zmusic.mixins.json │ │ │ └── fabric.mod.json │ │ │ └── java │ │ │ └── me │ │ │ └── zhenxin │ │ │ └── zmusic │ │ │ ├── mixin │ │ │ ├── Tick.java │ │ │ ├── QuitServer.java │ │ │ └── SoundEvent.java │ │ │ ├── manager │ │ │ └── SoundManagerImpl.java │ │ │ └── ZMusicMod.java │ └── build.gradle ├── zmusic-fabric-1.15.2 │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── zmusic.mixins.json │ │ │ └── fabric.mod.json │ │ │ └── java │ │ │ └── me │ │ │ └── zhenxin │ │ │ └── zmusic │ │ │ ├── mixin │ │ │ ├── Tick.java │ │ │ ├── QuitServer.java │ │ │ └── SoundEvent.java │ │ │ ├── manager │ │ │ └── SoundManagerImpl.java │ │ │ └── ZMusicMod.java │ └── build.gradle ├── zmusic-fabric-1.16.5 │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── zmusic.mixins.json │ │ │ └── fabric.mod.json │ │ │ └── java │ │ │ └── me │ │ │ └── zhenxin │ │ │ └── zmusic │ │ │ ├── mixin │ │ │ ├── Tick.java │ │ │ ├── QuitServer.java │ │ │ └── SoundEvent.java │ │ │ ├── manager │ │ │ └── SoundManagerImpl.java │ │ │ └── ZMusicMod.java │ └── build.gradle ├── zmusic-fabric-1.17.1 │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── zmusic.mixins.json │ │ │ └── fabric.mod.json │ │ │ └── java │ │ │ └── me │ │ │ └── zhenxin │ │ │ └── zmusic │ │ │ ├── mixin │ │ │ ├── Tick.java │ │ │ ├── QuitServer.java │ │ │ └── SoundEvent.java │ │ │ ├── manager │ │ │ └── SoundManagerImpl.java │ │ │ └── ZMusicMod.java │ └── build.gradle ├── zmusic-fabric-1.18.2 │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── zmusic.mixins.json │ │ │ └── fabric.mod.json │ │ │ └── java │ │ │ └── me │ │ │ └── zhenxin │ │ │ └── zmusic │ │ │ ├── mixin │ │ │ ├── Tick.java │ │ │ ├── QuitServer.java │ │ │ └── SoundEvent.java │ │ │ ├── manager │ │ │ └── SoundManagerImpl.java │ │ │ └── ZMusicMod.java │ └── build.gradle ├── zmusic-fabric-1.19.2 │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── zmusic.mixins.json │ │ │ └── fabric.mod.json │ │ │ └── java │ │ │ └── me │ │ │ └── zhenxin │ │ │ └── zmusic │ │ │ ├── mixin │ │ │ ├── Tick.java │ │ │ ├── QuitServer.java │ │ │ └── SoundEvent.java │ │ │ ├── manager │ │ │ └── SoundManagerImpl.java │ │ │ └── ZMusicMod.java │ └── build.gradle ├── zmusic-fabric-1.19.3 │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── zmusic.mixins.json │ │ │ └── fabric.mod.json │ │ │ └── java │ │ │ └── me │ │ │ └── zhenxin │ │ │ └── zmusic │ │ │ ├── mixin │ │ │ ├── Tick.java │ │ │ ├── QuitServer.java │ │ │ └── SoundEvent.java │ │ │ ├── manager │ │ │ └── SoundManagerImpl.java │ │ │ └── ZMusicMod.java │ └── build.gradle ├── zmusic-fabric-1.19.4 │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── zmusic.mixins.json │ │ │ └── fabric.mod.json │ │ │ └── java │ │ │ └── me │ │ │ └── zhenxin │ │ │ └── zmusic │ │ │ ├── mixin │ │ │ ├── Tick.java │ │ │ ├── QuitServer.java │ │ │ └── SoundEvent.java │ │ │ ├── manager │ │ │ └── SoundManagerImpl.java │ │ │ └── ZMusicMod.java │ └── build.gradle ├── zmusic-fabric-1.20.5 │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── zmusic.mixins.json │ │ │ └── fabric.mod.json │ │ │ └── java │ │ │ └── me │ │ │ └── zhenxin │ │ │ └── zmusic │ │ │ ├── mixin │ │ │ ├── Tick.java │ │ │ ├── QuitServer.java │ │ │ └── SoundEvent.java │ │ │ ├── manager │ │ │ └── SoundManagerImpl.java │ │ │ └── ZMusicMod.java │ └── build.gradle ├── zmusic-fabric-1.20 │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── zmusic.mixins.json │ │ │ └── fabric.mod.json │ │ │ └── java │ │ │ └── me │ │ │ └── zhenxin │ │ │ └── zmusic │ │ │ ├── mixin │ │ │ ├── Tick.java │ │ │ ├── QuitServer.java │ │ │ └── SoundEvent.java │ │ │ ├── manager │ │ │ └── SoundManagerImpl.java │ │ │ └── ZMusicMod.java │ └── build.gradle ├── zmusic-fabric-1.21.8 │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── zmusic.mixins.json │ │ │ └── fabric.mod.json │ │ │ └── java │ │ │ └── me │ │ │ └── zhenxin │ │ │ └── zmusic │ │ │ ├── mixin │ │ │ ├── Tick.java │ │ │ ├── QuitServer.java │ │ │ └── SoundEvent.java │ │ │ ├── manager │ │ │ └── SoundManagerImpl.java │ │ │ └── ZMusicMod.java │ └── build.gradle └── zmusic-fabric-1.21 │ ├── src │ └── main │ │ ├── resources │ │ ├── zmusic.mixins.json │ │ └── fabric.mod.json │ │ └── java │ │ └── me │ │ └── zhenxin │ │ └── zmusic │ │ ├── mixin │ │ ├── Tick.java │ │ ├── QuitServer.java │ │ └── SoundEvent.java │ │ ├── manager │ │ └── SoundManagerImpl.java │ │ └── ZMusicMod.java │ └── build.gradle ├── zmusic-forge ├── build.gradle ├── zmusic-forge-1.14.4 │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── pack.mcmeta │ │ │ └── META-INF │ │ │ │ └── mods.toml │ │ │ └── java │ │ │ └── me │ │ │ └── zhenxin │ │ │ └── zmusic │ │ │ ├── manager │ │ │ └── SoundManagerImpl.java │ │ │ ├── event │ │ │ └── ForgeEvent.java │ │ │ └── ZMusicMod.java │ └── build.gradle ├── zmusic-forge-1.15.2 │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── pack.mcmeta │ │ │ └── META-INF │ │ │ │ └── mods.toml │ │ │ └── java │ │ │ └── me │ │ │ └── zhenxin │ │ │ └── zmusic │ │ │ ├── manager │ │ │ └── SoundManagerImpl.java │ │ │ ├── event │ │ │ └── ForgeEvent.java │ │ │ └── ZMusicMod.java │ └── build.gradle ├── zmusic-forge-1.16.5 │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── pack.mcmeta │ │ │ └── META-INF │ │ │ │ └── mods.toml │ │ │ └── java │ │ │ └── me │ │ │ └── zhenxin │ │ │ └── zmusic │ │ │ ├── manager │ │ │ └── SoundManagerImpl.java │ │ │ ├── event │ │ │ └── ForgeEvent.java │ │ │ └── ZMusicMod.java │ └── build.gradle ├── zmusic-forge-1.17.1 │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── pack.mcmeta │ │ │ └── META-INF │ │ │ │ └── mods.toml │ │ │ └── java │ │ │ └── me │ │ │ └── zhenxin │ │ │ └── zmusic │ │ │ ├── manager │ │ │ └── SoundManagerImpl.java │ │ │ ├── event │ │ │ └── ForgeEvent.java │ │ │ └── ZMusicMod.java │ └── build.gradle ├── zmusic-forge-1.18.2 │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── pack.mcmeta │ │ │ └── META-INF │ │ │ │ └── mods.toml │ │ │ └── java │ │ │ └── me │ │ │ └── zhenxin │ │ │ └── zmusic │ │ │ ├── manager │ │ │ └── SoundManagerImpl.java │ │ │ ├── event │ │ │ └── ForgeEvent.java │ │ │ └── ZMusicMod.java │ └── build.gradle ├── zmusic-forge-1.19.2 │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── pack.mcmeta │ │ │ └── META-INF │ │ │ │ └── mods.toml │ │ │ └── java │ │ │ └── me │ │ │ └── zhenxin │ │ │ └── zmusic │ │ │ ├── manager │ │ │ └── SoundManagerImpl.java │ │ │ ├── event │ │ │ └── ForgeEvent.java │ │ │ └── ZMusicMod.java │ └── build.gradle ├── zmusic-forge-1.19.3 │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── pack.mcmeta │ │ │ └── META-INF │ │ │ │ └── mods.toml │ │ │ └── java │ │ │ └── me │ │ │ └── zhenxin │ │ │ └── zmusic │ │ │ ├── manager │ │ │ └── SoundManagerImpl.java │ │ │ ├── event │ │ │ └── ForgeEvent.java │ │ │ └── ZMusicMod.java │ └── build.gradle ├── zmusic-forge-1.19.4 │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── pack.mcmeta │ │ │ └── META-INF │ │ │ │ └── mods.toml │ │ │ └── java │ │ │ └── me │ │ │ └── zhenxin │ │ │ └── zmusic │ │ │ ├── manager │ │ │ └── SoundManagerImpl.java │ │ │ ├── event │ │ │ └── ForgeEvent.java │ │ │ └── ZMusicMod.java │ └── build.gradle ├── zmusic-forge-1.20 │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── pack.mcmeta │ │ │ └── META-INF │ │ │ │ └── mods.toml │ │ │ └── java │ │ │ └── me │ │ │ └── zhenxin │ │ │ └── zmusic │ │ │ ├── manager │ │ │ └── SoundManagerImpl.java │ │ │ ├── event │ │ │ └── ForgeEvent.java │ │ │ └── ZMusicMod.java │ └── build.gradle └── zmusic-forge-1.12.2 │ ├── src │ └── main │ │ ├── resources │ │ └── mcmod.info │ │ └── java │ │ └── me │ │ └── zhenxin │ │ └── zmusic │ │ ├── manager │ │ └── SoundManagerImpl.java │ │ ├── event │ │ └── ForgeEvent.java │ │ └── ZMusicMod.java │ └── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .github ├── dependabot.yml ├── ISSUE_TEMPLATE │ └── config.yml └── workflows │ └── stable.yml ├── zmusic-core ├── src │ └── main │ │ ├── java │ │ └── me │ │ │ └── zhenxin │ │ │ └── zmusic │ │ │ ├── player │ │ │ └── decoder │ │ │ │ ├── BuffPack.java │ │ │ │ ├── ogg │ │ │ │ └── jcraft │ │ │ │ │ ├── oggdecoder │ │ │ │ │ └── OggData.java │ │ │ │ │ ├── jorbis │ │ │ │ │ ├── Util.java │ │ │ │ │ ├── InfoMode.java │ │ │ │ │ ├── PsyLook.java │ │ │ │ │ ├── JOrbisException.java │ │ │ │ │ ├── Residue2.java │ │ │ │ │ ├── Residue1.java │ │ │ │ │ ├── FuncTime.java │ │ │ │ │ ├── FuncMapping.java │ │ │ │ │ ├── Time0.java │ │ │ │ │ ├── FuncResidue.java │ │ │ │ │ ├── FuncFloor.java │ │ │ │ │ └── PsyInfo.java │ │ │ │ │ └── jogg │ │ │ │ │ └── Packet.java │ │ │ │ ├── IDecoder.java │ │ │ │ ├── mp3 │ │ │ │ ├── JavaLayerHook.java │ │ │ │ ├── JavaLayerErrors.java │ │ │ │ ├── FrameDecoder.java │ │ │ │ ├── DecoderErrors.java │ │ │ │ ├── DecoderException.java │ │ │ │ ├── BitstreamErrors.java │ │ │ │ ├── JavaLayerException.java │ │ │ │ ├── Crc16.java │ │ │ │ ├── BitstreamException.java │ │ │ │ └── OutputChannels.java │ │ │ │ └── flac │ │ │ │ ├── DataFormatException.java │ │ │ │ ├── SeekableFileFlacInput.java │ │ │ │ └── ByteArrayFlacInput.java │ │ │ ├── manager │ │ │ └── SoundManager.java │ │ │ ├── event │ │ │ ├── ClientEvent.java │ │ │ └── PacketEvent.java │ │ │ └── ZMusic.java │ │ └── resources │ │ └── me │ │ └── zhenxin │ │ └── zmusic │ │ └── player │ │ └── decoder │ │ └── mp3 │ │ ├── sfd.ser │ │ ├── au2lin.ser │ │ ├── lin2au.ser │ │ └── l3reorder.ser └── build.gradle ├── .gitignore ├── README.md └── settings.gradle /zmusic-fabric/build.gradle: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /zmusic-forge/build.gradle: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zmusic-dev/zmusic-client/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: gradle 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.14.4/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "zmusic resources", 4 | "pack_format": 7 5 | } 6 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.15.2/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "zmusic resources", 4 | "pack_format": 7 5 | } 6 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.16.5/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "zmusic resources", 4 | "pack_format": 7 5 | } 6 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.17.1/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "zmusic resources", 4 | "pack_format": 7 5 | } 6 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.18.2/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "zmusic resources", 4 | "pack_format": 7 5 | } 6 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.19.2/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "zmusic resources", 4 | "pack_format": 7 5 | } 6 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.19.3/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "zmusic resources", 4 | "pack_format": 7 5 | } 6 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.19.4/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "zmusic resources", 4 | "pack_format": 7 5 | } 6 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.20/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "zmusic resources", 4 | "pack_format": 7 5 | } 6 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Submit Issue 4 | url: https://github.com/RealHeart/ZMusic/issues/new/choose 5 | about: ZMusic-issues 6 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/BuffPack.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.player.decoder; 2 | 3 | public class BuffPack { 4 | public byte[] buff; 5 | public int len; 6 | } 7 | -------------------------------------------------------------------------------- /zmusic-core/src/main/resources/me/zhenxin/zmusic/player/decoder/mp3/sfd.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zmusic-dev/zmusic-client/HEAD/zmusic-core/src/main/resources/me/zhenxin/zmusic/player/decoder/mp3/sfd.ser -------------------------------------------------------------------------------- /zmusic-core/src/main/resources/me/zhenxin/zmusic/player/decoder/mp3/au2lin.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zmusic-dev/zmusic-client/HEAD/zmusic-core/src/main/resources/me/zhenxin/zmusic/player/decoder/mp3/au2lin.ser -------------------------------------------------------------------------------- /zmusic-core/src/main/resources/me/zhenxin/zmusic/player/decoder/mp3/lin2au.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zmusic-dev/zmusic-client/HEAD/zmusic-core/src/main/resources/me/zhenxin/zmusic/player/decoder/mp3/lin2au.ser -------------------------------------------------------------------------------- /zmusic-core/src/main/resources/me/zhenxin/zmusic/player/decoder/mp3/l3reorder.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zmusic-dev/zmusic-client/HEAD/zmusic-core/src/main/resources/me/zhenxin/zmusic/player/decoder/mp3/l3reorder.ser -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip 4 | networkTimeout=10000 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/manager/SoundManager.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | /** 4 | * 音频管理器 5 | * 6 | * @author 真心 7 | * @email qgzhenxin@qq.com 8 | * @since 2023/1/29 23:27 9 | */ 10 | public interface SoundManager { 11 | 12 | float volume(); 13 | 14 | void stop(); 15 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.14.4/src/main/resources/zmusic.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "me.zhenxin.zmusic.mixin", 4 | "compatibilityLevel": "JAVA_8", 5 | "injectors": { 6 | "defaultRequire": 1 7 | }, 8 | "client": [ 9 | "QuitServer", 10 | "SoundEvent", 11 | "Tick" 12 | ] 13 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.15.2/src/main/resources/zmusic.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "me.zhenxin.zmusic.mixin", 4 | "compatibilityLevel": "JAVA_8", 5 | "injectors": { 6 | "defaultRequire": 1 7 | }, 8 | "client": [ 9 | "QuitServer", 10 | "SoundEvent", 11 | "Tick" 12 | ] 13 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.16.5/src/main/resources/zmusic.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "me.zhenxin.zmusic.mixin", 4 | "compatibilityLevel": "JAVA_8", 5 | "injectors": { 6 | "defaultRequire": 1 7 | }, 8 | "client": [ 9 | "QuitServer", 10 | "SoundEvent", 11 | "Tick" 12 | ] 13 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.17.1/src/main/resources/zmusic.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "me.zhenxin.zmusic.mixin", 4 | "compatibilityLevel": "JAVA_16", 5 | "injectors": { 6 | "defaultRequire": 1 7 | }, 8 | "client": [ 9 | "QuitServer", 10 | "SoundEvent", 11 | "Tick" 12 | ] 13 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.18.2/src/main/resources/zmusic.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "me.zhenxin.zmusic.mixin", 4 | "compatibilityLevel": "JAVA_17", 5 | "injectors": { 6 | "defaultRequire": 1 7 | }, 8 | "client": [ 9 | "QuitServer", 10 | "SoundEvent", 11 | "Tick" 12 | ] 13 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.2/src/main/resources/zmusic.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "me.zhenxin.zmusic.mixin", 4 | "compatibilityLevel": "JAVA_17", 5 | "injectors": { 6 | "defaultRequire": 1 7 | }, 8 | "client": [ 9 | "QuitServer", 10 | "SoundEvent", 11 | "Tick" 12 | ] 13 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.3/src/main/resources/zmusic.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "me.zhenxin.zmusic.mixin", 4 | "compatibilityLevel": "JAVA_17", 5 | "injectors": { 6 | "defaultRequire": 1 7 | }, 8 | "client": [ 9 | "QuitServer", 10 | "SoundEvent", 11 | "Tick" 12 | ] 13 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.4/src/main/resources/zmusic.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "me.zhenxin.zmusic.mixin", 4 | "compatibilityLevel": "JAVA_17", 5 | "injectors": { 6 | "defaultRequire": 1 7 | }, 8 | "client": [ 9 | "QuitServer", 10 | "SoundEvent", 11 | "Tick" 12 | ] 13 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.20.5/src/main/resources/zmusic.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "me.zhenxin.zmusic.mixin", 4 | "compatibilityLevel": "JAVA_21", 5 | "injectors": { 6 | "defaultRequire": 1 7 | }, 8 | "client": [ 9 | "QuitServer", 10 | "SoundEvent", 11 | "Tick" 12 | ] 13 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.20/src/main/resources/zmusic.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "me.zhenxin.zmusic.mixin", 4 | "compatibilityLevel": "JAVA_17", 5 | "injectors": { 6 | "defaultRequire": 1 7 | }, 8 | "client": [ 9 | "QuitServer", 10 | "SoundEvent", 11 | "Tick" 12 | ] 13 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.21.8/src/main/resources/zmusic.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "me.zhenxin.zmusic.mixin", 4 | "compatibilityLevel": "JAVA_21", 5 | "injectors": { 6 | "defaultRequire": 1 7 | }, 8 | "client": [ 9 | "QuitServer", 10 | "SoundEvent", 11 | "Tick" 12 | ] 13 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.21/src/main/resources/zmusic.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "me.zhenxin.zmusic.mixin", 4 | "compatibilityLevel": "JAVA_21", 5 | "injectors": { 6 | "defaultRequire": 1 7 | }, 8 | "client": [ 9 | "QuitServer", 10 | "SoundEvent", 11 | "Tick" 12 | ] 13 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.12.2/src/main/resources/mcmod.info: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "modid": "zmusic", 4 | "name": "ZMusic Mod", 5 | "description": "Powerful Music System", 6 | "version": "${version}", 7 | "mcversion": "1.12.2", 8 | "url": "https://m.zplu.cc", 9 | "authorList": [ 10 | "ZhenXin" 11 | ] 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/ogg/jcraft/oggdecoder/OggData.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.player.decoder.ogg.jcraft.oggdecoder; 2 | 3 | 4 | public class OggData { 5 | 6 | /** 7 | * The sampling rate 8 | */ 9 | public int rate; 10 | 11 | /** 12 | * The number of channels in the sound file 13 | */ 14 | public int channels; 15 | } -------------------------------------------------------------------------------- /zmusic-core/build.gradle: -------------------------------------------------------------------------------- 1 | //file:noinspection GroovyMissingReturnStatement 2 | //file:noinspection VulnerableLibrariesLocal 3 | 4 | java { 5 | sourceCompatibility = JavaVersion.VERSION_1_8 6 | targetCompatibility = JavaVersion.VERSION_1_8 7 | } 8 | 9 | dependencies { 10 | compileOnly 'org.lwjgl:lwjgl-openal:3.3.6' 11 | compileOnly 'org.apache.logging.log4j:log4j-api:2.25.3' 12 | } 13 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/IDecoder.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.player.decoder; 2 | 3 | public interface IDecoder { 4 | BuffPack decodeFrame() throws Exception; 5 | 6 | void close() throws Exception; 7 | 8 | boolean set() throws Exception; 9 | 10 | int getOutputFrequency(); 11 | 12 | int getOutputChannels(); 13 | 14 | void set(int time); 15 | } 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # gradle 2 | 3 | .gradle/ 4 | build/ 5 | out/ 6 | classes/ 7 | 8 | # eclipse 9 | 10 | *.launch 11 | 12 | # idea 13 | 14 | .idea/ 15 | *.iml 16 | *.ipr 17 | *.iws 18 | 19 | # vscode 20 | 21 | .settings/ 22 | .vscode/ 23 | bin/ 24 | .classpath 25 | .project 26 | 27 | # macos 28 | 29 | *.DS_Store 30 | 31 | # fabric 32 | 33 | run/ 34 | 35 | # java 36 | 37 | hs_err_*.log 38 | replay_*.log 39 | *.hprof 40 | *.jfr -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.20/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'net.minecraftforge.gradle' version '[6.0,6.2)' 3 | } 4 | 5 | java { 6 | sourceCompatibility = JavaVersion.VERSION_17 7 | targetCompatibility = JavaVersion.VERSION_17 8 | } 9 | 10 | minecraft { 11 | mappings channel: 'official', version: '1.20' 12 | } 13 | 14 | dependencies { 15 | minecraft "net.minecraftforge:forge:1.20-46.0.2" 16 | 17 | implementation project(":zmusic-core") 18 | } 19 | 20 | jar { 21 | dependsOn(":zmusic-core:jar") 22 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.17.1/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'net.minecraftforge.gradle' version '[6.0,6.2)' 3 | } 4 | 5 | java { 6 | sourceCompatibility = JavaVersion.VERSION_17 7 | targetCompatibility = JavaVersion.VERSION_17 8 | } 9 | 10 | minecraft { 11 | mappings channel: 'official', version: '1.17.1' 12 | } 13 | 14 | dependencies { 15 | minecraft 'net.minecraftforge:forge:1.17.1-37.1.1' 16 | 17 | implementation project(":zmusic-core") 18 | } 19 | 20 | jar { 21 | dependsOn(":zmusic-core:jar") 22 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.18.2/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'net.minecraftforge.gradle' version '[6.0,6.2)' 3 | } 4 | 5 | java { 6 | sourceCompatibility = JavaVersion.VERSION_17 7 | targetCompatibility = JavaVersion.VERSION_17 8 | } 9 | 10 | minecraft { 11 | mappings channel: 'official', version: '1.18.2' 12 | } 13 | 14 | dependencies { 15 | minecraft 'net.minecraftforge:forge:1.18.2-40.2.0' 16 | 17 | implementation project(":zmusic-core") 18 | } 19 | 20 | jar { 21 | dependsOn(":zmusic-core:jar") 22 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.19.2/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'net.minecraftforge.gradle' version '[6.0,6.2)' 3 | } 4 | 5 | java { 6 | sourceCompatibility = JavaVersion.VERSION_17 7 | targetCompatibility = JavaVersion.VERSION_17 8 | } 9 | 10 | minecraft { 11 | mappings channel: 'official', version: '1.19.2' 12 | } 13 | 14 | dependencies { 15 | minecraft 'net.minecraftforge:forge:1.19.2-43.2.0' 16 | 17 | implementation project(":zmusic-core") 18 | } 19 | 20 | jar { 21 | dependsOn(":zmusic-core:jar") 22 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.19.3/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'net.minecraftforge.gradle' version '[6.0,6.2)' 3 | } 4 | 5 | java { 6 | sourceCompatibility = JavaVersion.VERSION_17 7 | targetCompatibility = JavaVersion.VERSION_17 8 | } 9 | 10 | minecraft { 11 | mappings channel: 'official', version: '1.19.3' 12 | } 13 | 14 | dependencies { 15 | minecraft 'net.minecraftforge:forge:1.19.3-44.1.0' 16 | 17 | implementation project(":zmusic-core") 18 | } 19 | 20 | jar { 21 | dependsOn(":zmusic-core:jar") 22 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.19.4/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'net.minecraftforge.gradle' version '[6.0,6.2)' 3 | } 4 | 5 | java { 6 | sourceCompatibility = JavaVersion.VERSION_17 7 | targetCompatibility = JavaVersion.VERSION_17 8 | } 9 | 10 | minecraft { 11 | mappings channel: 'official', version: '1.19.4' 12 | } 13 | 14 | dependencies { 15 | minecraft 'net.minecraftforge:forge:1.19.4-45.0.9' 16 | 17 | implementation project(":zmusic-core") 18 | } 19 | 20 | jar { 21 | dependsOn(":zmusic-core:jar") 22 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.16.5/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'net.minecraftforge.gradle' version '[6.0,6.2)' 3 | } 4 | 5 | java { 6 | sourceCompatibility = JavaVersion.VERSION_1_8 7 | targetCompatibility = JavaVersion.VERSION_1_8 8 | } 9 | 10 | minecraft { 11 | mappings channel: 'official', version: '1.16.5' 12 | } 13 | 14 | dependencies { 15 | minecraft 'net.minecraftforge:forge:1.16.5-36.2.34' 16 | 17 | implementation project(":zmusic-core") 18 | } 19 | 20 | jar { 21 | dependsOn(":zmusic-core:jar") 22 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.12.2/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'net.minecraftforge.gradle' version '[6.0,6.2)' 3 | } 4 | 5 | java { 6 | sourceCompatibility = JavaVersion.VERSION_1_8 7 | targetCompatibility = JavaVersion.VERSION_1_8 8 | } 9 | 10 | minecraft { 11 | mappings channel: 'snapshot', version: '20171003-1.12' 12 | } 13 | 14 | dependencies { 15 | minecraft 'net.minecraftforge:forge:1.12.2-14.23.5.2859' 16 | 17 | implementation project(":zmusic-core") 18 | } 19 | 20 | jar { 21 | dependsOn(":zmusic-core:jar") 22 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.14.4/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'net.minecraftforge.gradle' version '[6.0,6.2)' 3 | } 4 | 5 | java { 6 | sourceCompatibility = JavaVersion.VERSION_1_8 7 | targetCompatibility = JavaVersion.VERSION_1_8 8 | } 9 | 10 | minecraft { 11 | mappings channel: 'snapshot', version: '20190719-1.14.3' 12 | } 13 | 14 | dependencies { 15 | minecraft 'net.minecraftforge:forge:1.14.4-28.2.26' 16 | 17 | implementation project(":zmusic-core") 18 | } 19 | 20 | jar { 21 | dependsOn(":zmusic-core:jar") 22 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.15.2/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'net.minecraftforge.gradle' version '[6.0,6.2)' 3 | } 4 | 5 | java { 6 | sourceCompatibility = JavaVersion.VERSION_1_8 7 | targetCompatibility = JavaVersion.VERSION_1_8 8 | } 9 | 10 | minecraft { 11 | mappings channel: 'snapshot', version: '20200514-1.15.1' 12 | } 13 | 14 | dependencies { 15 | minecraft 'net.minecraftforge:forge:1.15.2-31.2.57' 16 | 17 | implementation project(":zmusic-core") 18 | } 19 | 20 | jar { 21 | dependsOn(":zmusic-core:jar") 22 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.20/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("fabric-loom") version "1.11-SNAPSHOT" 3 | } 4 | 5 | java { 6 | sourceCompatibility = JavaVersion.VERSION_17 7 | targetCompatibility = JavaVersion.VERSION_17 8 | } 9 | 10 | dependencies { 11 | minecraft("com.mojang:minecraft:1.20") 12 | mappings("net.fabricmc:yarn:1.20+build.1:v2") 13 | modImplementation("net.fabricmc:fabric-loader:0.14.21") 14 | modImplementation("net.fabricmc.fabric-api:fabric-api:0.83.0+1.20") 15 | 16 | implementation(project(":zmusic-core")) 17 | } 18 | 19 | jar { 20 | dependsOn(":zmusic-core:jar") 21 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.21/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("fabric-loom") version "1.11-SNAPSHOT" 3 | } 4 | 5 | java { 6 | sourceCompatibility = JavaVersion.VERSION_21 7 | targetCompatibility = JavaVersion.VERSION_21 8 | } 9 | 10 | dependencies { 11 | minecraft("com.mojang:minecraft:1.21") 12 | mappings("net.fabricmc:yarn:1.21+build.1") 13 | modImplementation("net.fabricmc:fabric-loader:0.15.11") 14 | modImplementation("net.fabricmc.fabric-api:fabric-api:0.100.1+1.21") 15 | 16 | implementation(project(":zmusic-core")) 17 | } 18 | 19 | jar { 20 | dependsOn(":zmusic-core:jar") 21 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.20.5/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("fabric-loom") version "1.11-SNAPSHOT" 3 | } 4 | 5 | java { 6 | sourceCompatibility = JavaVersion.VERSION_21 7 | targetCompatibility = JavaVersion.VERSION_21 8 | } 9 | 10 | dependencies { 11 | minecraft("com.mojang:minecraft:1.20.5") 12 | mappings("net.fabricmc:yarn:1.20.5+build.1") 13 | modImplementation("net.fabricmc:fabric-loader:0.15.11") 14 | modImplementation("net.fabricmc.fabric-api:fabric-api:0.97.8+1.20.5") 15 | 16 | implementation(project(":zmusic-core")) 17 | } 18 | 19 | jar { 20 | dependsOn(":zmusic-core:jar") 21 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.21.8/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("fabric-loom") version "1.11-SNAPSHOT" 3 | } 4 | 5 | java { 6 | sourceCompatibility = JavaVersion.VERSION_21 7 | targetCompatibility = JavaVersion.VERSION_21 8 | } 9 | 10 | dependencies { 11 | minecraft("com.mojang:minecraft:1.21.8") 12 | mappings("net.fabricmc:yarn:1.21.8+build.1") 13 | modImplementation("net.fabricmc:fabric-loader:0.16.14") 14 | modImplementation("net.fabricmc.fabric-api:fabric-api:0.129.0+1.21.8") 15 | 16 | implementation(project(":zmusic-core")) 17 | } 18 | 19 | jar { 20 | dependsOn(":zmusic-core:jar") 21 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.14.4/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("fabric-loom") version "1.11-SNAPSHOT" 3 | } 4 | 5 | java { 6 | sourceCompatibility = JavaVersion.VERSION_1_8 7 | targetCompatibility = JavaVersion.VERSION_1_8 8 | } 9 | 10 | dependencies { 11 | minecraft("com.mojang:minecraft:1.14.4") 12 | mappings("net.fabricmc:yarn:1.14.4+build.18:v2") 13 | modImplementation("net.fabricmc:fabric-loader:0.14.17") 14 | modImplementation("net.fabricmc.fabric-api:fabric-api:0.28.5+1.14") 15 | 16 | implementation(project(":zmusic-core")) 17 | } 18 | 19 | jar { 20 | dependsOn(":zmusic-core:jar") 21 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.15.2/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("fabric-loom") version "1.11-SNAPSHOT" 3 | } 4 | 5 | java { 6 | sourceCompatibility = JavaVersion.VERSION_1_8 7 | targetCompatibility = JavaVersion.VERSION_1_8 8 | } 9 | 10 | dependencies { 11 | minecraft("com.mojang:minecraft:1.15.2") 12 | mappings("net.fabricmc:yarn:1.15.2+build.17:v2") 13 | modImplementation("net.fabricmc:fabric-loader:0.14.17") 14 | modImplementation("net.fabricmc.fabric-api:fabric-api:0.28.5+1.15") 15 | 16 | implementation(project(":zmusic-core")) 17 | } 18 | 19 | jar { 20 | dependsOn(":zmusic-core:jar") 21 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.16.5/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("fabric-loom") version "1.11-SNAPSHOT" 3 | } 4 | 5 | java { 6 | sourceCompatibility = JavaVersion.VERSION_1_8 7 | targetCompatibility = JavaVersion.VERSION_1_8 8 | } 9 | 10 | dependencies { 11 | minecraft("com.mojang:minecraft:1.16.5") 12 | mappings("net.fabricmc:yarn:1.16.5+build.10:v2") 13 | modImplementation("net.fabricmc:fabric-loader:0.14.17") 14 | modImplementation("net.fabricmc.fabric-api:fabric-api:0.42.0+1.16") 15 | 16 | implementation(project(":zmusic-core")) 17 | } 18 | 19 | jar { 20 | dependsOn(":zmusic-core:jar") 21 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.17.1/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("fabric-loom") version "1.11-SNAPSHOT" 3 | } 4 | 5 | java { 6 | sourceCompatibility = JavaVersion.VERSION_16 7 | targetCompatibility = JavaVersion.VERSION_16 8 | } 9 | 10 | dependencies { 11 | minecraft("com.mojang:minecraft:1.17.1") 12 | mappings("net.fabricmc:yarn:1.17.1+build.65:v2") 13 | modImplementation("net.fabricmc:fabric-loader:0.14.17") 14 | modImplementation("net.fabricmc.fabric-api:fabric-api:0.46.1+1.17") 15 | 16 | implementation(project(":zmusic-core")) 17 | } 18 | 19 | jar { 20 | dependsOn(":zmusic-core:jar") 21 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.18.2/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("fabric-loom") version "1.11-SNAPSHOT" 3 | } 4 | 5 | java { 6 | sourceCompatibility = JavaVersion.VERSION_17 7 | targetCompatibility = JavaVersion.VERSION_17 8 | } 9 | 10 | dependencies { 11 | minecraft("com.mojang:minecraft:1.18.2") 12 | mappings("net.fabricmc:yarn:1.18.2+build.4:v2") 13 | modImplementation("net.fabricmc:fabric-loader:0.14.17") 14 | modImplementation("net.fabricmc.fabric-api:fabric-api:0.75.1+1.18.2") 15 | 16 | implementation(project(":zmusic-core")) 17 | } 18 | 19 | jar { 20 | dependsOn(":zmusic-core:jar") 21 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.2/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("fabric-loom") version "1.11-SNAPSHOT" 3 | } 4 | 5 | java { 6 | sourceCompatibility = JavaVersion.VERSION_17 7 | targetCompatibility = JavaVersion.VERSION_17 8 | } 9 | 10 | dependencies { 11 | minecraft("com.mojang:minecraft:1.19.2") 12 | mappings("net.fabricmc:yarn:1.19.2+build.28:v2") 13 | modImplementation("net.fabricmc:fabric-loader:0.14.17") 14 | modImplementation("net.fabricmc.fabric-api:fabric-api:0.75.1+1.19.2") 15 | 16 | implementation(project(":zmusic-core")) 17 | } 18 | 19 | jar { 20 | dependsOn(":zmusic-core:jar") 21 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.3/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("fabric-loom") version "1.11-SNAPSHOT" 3 | } 4 | 5 | java { 6 | sourceCompatibility = JavaVersion.VERSION_17 7 | targetCompatibility = JavaVersion.VERSION_17 8 | } 9 | 10 | dependencies { 11 | minecraft("com.mojang:minecraft:1.19.3") 12 | mappings("net.fabricmc:yarn:1.19.3+build.5:v2") 13 | modImplementation("net.fabricmc:fabric-loader:0.14.17") 14 | modImplementation("net.fabricmc.fabric-api:fabric-api:0.75.1+1.19.3") 15 | 16 | implementation(project(":zmusic-core")) 17 | } 18 | 19 | jar { 20 | dependsOn(":zmusic-core:jar") 21 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.4/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("fabric-loom") version "1.11-SNAPSHOT" 3 | } 4 | 5 | java { 6 | sourceCompatibility = JavaVersion.VERSION_17 7 | targetCompatibility = JavaVersion.VERSION_17 8 | } 9 | 10 | dependencies { 11 | minecraft("com.mojang:minecraft:1.19.4") 12 | mappings("net.fabricmc:yarn:1.19.4+build.1:v2") 13 | modImplementation("net.fabricmc:fabric-loader:0.14.17") 14 | modImplementation("net.fabricmc.fabric-api:fabric-api:0.76.0+1.19.4") 15 | 16 | implementation(project(":zmusic-core")) 17 | } 18 | 19 | jar { 20 | dependsOn(":zmusic-core:jar") 21 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.14.4/src/main/java/me/zhenxin/zmusic/mixin/Tick.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class Tick { 12 | 13 | @Inject(method = "tick", at = @At("TAIL")) 14 | public void tick(CallbackInfo info) { 15 | ZMusic.getPlayer().tick(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.15.2/src/main/java/me/zhenxin/zmusic/mixin/Tick.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class Tick { 12 | 13 | @Inject(method = "tick", at = @At("TAIL")) 14 | public void tick(CallbackInfo info) { 15 | ZMusic.getPlayer().tick(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.16.5/src/main/java/me/zhenxin/zmusic/mixin/Tick.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class Tick { 12 | 13 | @Inject(method = "tick", at = @At("TAIL")) 14 | public void tick(CallbackInfo info) { 15 | ZMusic.getPlayer().tick(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.17.1/src/main/java/me/zhenxin/zmusic/mixin/Tick.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class Tick { 12 | 13 | @Inject(method = "tick", at = @At("TAIL")) 14 | public void tick(CallbackInfo info) { 15 | ZMusic.getPlayer().tick(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.18.2/src/main/java/me/zhenxin/zmusic/mixin/Tick.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class Tick { 12 | 13 | @Inject(method = "tick", at = @At("TAIL")) 14 | public void tick(CallbackInfo info) { 15 | ZMusic.getPlayer().tick(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.2/src/main/java/me/zhenxin/zmusic/mixin/Tick.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class Tick { 12 | 13 | @Inject(method = "tick", at = @At("TAIL")) 14 | public void tick(CallbackInfo info) { 15 | ZMusic.getPlayer().tick(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.3/src/main/java/me/zhenxin/zmusic/mixin/Tick.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class Tick { 12 | 13 | @Inject(method = "tick", at = @At("TAIL")) 14 | public void tick(CallbackInfo info) { 15 | ZMusic.getPlayer().tick(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.4/src/main/java/me/zhenxin/zmusic/mixin/Tick.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class Tick { 12 | 13 | @Inject(method = "tick", at = @At("TAIL")) 14 | public void tick(CallbackInfo info) { 15 | ZMusic.getPlayer().tick(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.20.5/src/main/java/me/zhenxin/zmusic/mixin/Tick.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class Tick { 12 | 13 | @Inject(method = "tick", at = @At("TAIL")) 14 | public void tick(CallbackInfo info) { 15 | ZMusic.getPlayer().tick(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.20/src/main/java/me/zhenxin/zmusic/mixin/Tick.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class Tick { 12 | 13 | @Inject(method = "tick", at = @At("TAIL")) 14 | public void tick(CallbackInfo info) { 15 | ZMusic.getPlayer().tick(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.21.8/src/main/java/me/zhenxin/zmusic/mixin/Tick.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class Tick { 12 | 13 | @Inject(method = "tick", at = @At("TAIL")) 14 | public void tick(CallbackInfo info) { 15 | ZMusic.getPlayer().tick(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.21/src/main/java/me/zhenxin/zmusic/mixin/Tick.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class Tick { 12 | 13 | @Inject(method = "tick", at = @At("TAIL")) 14 | public void tick(CallbackInfo info) { 15 | ZMusic.getPlayer().tick(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.14.4/src/main/java/me/zhenxin/zmusic/mixin/QuitServer.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class QuitServer { 12 | @Inject(method = "disconnect()V", at = @At("TAIL")) 13 | public void Quit(CallbackInfo info) { 14 | ClientEvent.onDisconnect(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.15.2/src/main/java/me/zhenxin/zmusic/mixin/QuitServer.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class QuitServer { 12 | @Inject(method = "disconnect()V", at = @At("TAIL")) 13 | public void Quit(CallbackInfo info) { 14 | ClientEvent.onDisconnect(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.16.5/src/main/java/me/zhenxin/zmusic/mixin/QuitServer.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class QuitServer { 12 | @Inject(method = "disconnect()V", at = @At("TAIL")) 13 | public void Quit(CallbackInfo info) { 14 | ClientEvent.onDisconnect(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.17.1/src/main/java/me/zhenxin/zmusic/mixin/QuitServer.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class QuitServer { 12 | @Inject(method = "disconnect()V", at = @At("TAIL")) 13 | public void Quit(CallbackInfo info) { 14 | ClientEvent.onDisconnect(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.18.2/src/main/java/me/zhenxin/zmusic/mixin/QuitServer.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class QuitServer { 12 | @Inject(method = "disconnect()V", at = @At("TAIL")) 13 | public void Quit(CallbackInfo info) { 14 | ClientEvent.onDisconnect(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.2/src/main/java/me/zhenxin/zmusic/mixin/QuitServer.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class QuitServer { 12 | @Inject(method = "disconnect()V", at = @At("TAIL")) 13 | public void Quit(CallbackInfo info) { 14 | ClientEvent.onDisconnect(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.3/src/main/java/me/zhenxin/zmusic/mixin/QuitServer.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class QuitServer { 12 | @Inject(method = "disconnect()V", at = @At("TAIL")) 13 | public void Quit(CallbackInfo info) { 14 | ClientEvent.onDisconnect(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.4/src/main/java/me/zhenxin/zmusic/mixin/QuitServer.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class QuitServer { 12 | @Inject(method = "disconnect()V", at = @At("TAIL")) 13 | public void Quit(CallbackInfo info) { 14 | ClientEvent.onDisconnect(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.20.5/src/main/java/me/zhenxin/zmusic/mixin/QuitServer.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class QuitServer { 12 | @Inject(method = "disconnect()V", at = @At("TAIL")) 13 | public void Quit(CallbackInfo info) { 14 | ClientEvent.onDisconnect(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.20/src/main/java/me/zhenxin/zmusic/mixin/QuitServer.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class QuitServer { 12 | @Inject(method = "disconnect()V", at = @At("TAIL")) 13 | public void Quit(CallbackInfo info) { 14 | ClientEvent.onDisconnect(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.21/src/main/java/me/zhenxin/zmusic/mixin/QuitServer.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import net.minecraft.client.MinecraftClient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class QuitServer { 12 | @Inject(method = "disconnect()V", at = @At("TAIL")) 13 | public void Quit(CallbackInfo info) { 14 | ClientEvent.onDisconnect(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.20/src/main/resources/META-INF/mods.toml: -------------------------------------------------------------------------------- 1 | modLoader = "javafml" 2 | loaderVersion = "[46,)" 3 | license = "GPL-3.0-only" 4 | issueTrackerURL = "https://github.com/RealHeart/ZMusic/issues" 5 | [[mods]] 6 | modId = "zmusic" 7 | version = "${version}" 8 | displayName = "ZMusic Mod" 9 | description = "Powerful Music System" 10 | displayURL = "https://m.zplu.cc" 11 | authors = "ZhenXin" 12 | [[dependencies.zmusic]] 13 | modId = "forge" 14 | mandatory = true 15 | versionRange = "[46,)" 16 | ordering = "NONE" 17 | side = "CLIENT" 18 | [[dependencies.zmusic]] 19 | modId = "minecraft" 20 | mandatory = true 21 | versionRange = "[1.20,1.21)" 22 | ordering = "NONE" 23 | side = "CLIENT" -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.14.4/src/main/resources/META-INF/mods.toml: -------------------------------------------------------------------------------- 1 | modLoader = "javafml" 2 | loaderVersion = "[28,)" 3 | license = "GPL-3.0-only" 4 | issueTrackerURL = "https://github.com/RealHeart/ZMusic/issues" 5 | [[mods]] 6 | modId = "zmusic" 7 | version = "${version}" 8 | displayName = "ZMusic Mod" 9 | description = "Powerful Music System" 10 | displayURL = "https://m.zplu.cc" 11 | authors = "ZhenXin" 12 | [[dependencies.zmusic]] 13 | modId = "forge" 14 | mandatory = true 15 | versionRange = "[28,)" 16 | ordering = "NONE" 17 | side = "CLIENT" 18 | [[dependencies.zmusic]] 19 | modId = "minecraft" 20 | mandatory = true 21 | versionRange = "[1.14.4,1.15)" 22 | ordering = "NONE" 23 | side = "CLIENT" -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.15.2/src/main/resources/META-INF/mods.toml: -------------------------------------------------------------------------------- 1 | modLoader = "javafml" 2 | loaderVersion = "[31,)" 3 | license = "GPL-3.0-only" 4 | issueTrackerURL = "https://github.com/RealHeart/ZMusic/issues" 5 | [[mods]] 6 | modId = "zmusic" 7 | version = "${version}" 8 | displayName = "ZMusic Mod" 9 | description = "Powerful Music System" 10 | displayURL = "https://m.zplu.cc" 11 | authors = "ZhenXin" 12 | [[dependencies.zmusic]] 13 | modId = "forge" 14 | mandatory = true 15 | versionRange = "[31,)" 16 | ordering = "NONE" 17 | side = "CLIENT" 18 | [[dependencies.zmusic]] 19 | modId = "minecraft" 20 | mandatory = true 21 | versionRange = "[1.15.2,1.16)" 22 | ordering = "NONE" 23 | side = "CLIENT" -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.16.5/src/main/resources/META-INF/mods.toml: -------------------------------------------------------------------------------- 1 | modLoader = "javafml" 2 | loaderVersion = "[36,)" 3 | license = "GPL-3.0-only" 4 | issueTrackerURL = "https://github.com/RealHeart/ZMusic/issues" 5 | [[mods]] 6 | modId = "zmusic" 7 | version = "${version}" 8 | displayName = "ZMusic Mod" 9 | description = "Powerful Music System" 10 | displayURL = "https://m.zplu.cc" 11 | authors = "ZhenXin" 12 | [[dependencies.zmusic]] 13 | modId = "forge" 14 | mandatory = true 15 | versionRange = "[36,)" 16 | ordering = "NONE" 17 | side = "CLIENT" 18 | [[dependencies.zmusic]] 19 | modId = "minecraft" 20 | mandatory = true 21 | versionRange = "[1.16.5,1.17)" 22 | ordering = "NONE" 23 | side = "CLIENT" -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.17.1/src/main/resources/META-INF/mods.toml: -------------------------------------------------------------------------------- 1 | modLoader = "javafml" 2 | loaderVersion = "[37,)" 3 | license = "GPL-3.0-only" 4 | issueTrackerURL = "https://github.com/RealHeart/ZMusic/issues" 5 | [[mods]] 6 | modId = "zmusic" 7 | version = "${version}" 8 | displayName = "ZMusic Mod" 9 | description = "Powerful Music System" 10 | displayURL = "https://m.zplu.cc" 11 | authors = "ZhenXin" 12 | [[dependencies.zmusic]] 13 | modId = "forge" 14 | mandatory = true 15 | versionRange = "[37,)" 16 | ordering = "NONE" 17 | side = "CLIENT" 18 | [[dependencies.zmusic]] 19 | modId = "minecraft" 20 | mandatory = true 21 | versionRange = "[1.17.1,1.18)" 22 | ordering = "NONE" 23 | side = "CLIENT" -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.18.2/src/main/resources/META-INF/mods.toml: -------------------------------------------------------------------------------- 1 | modLoader = "javafml" 2 | loaderVersion = "[40,)" 3 | license = "GPL-3.0-only" 4 | issueTrackerURL = "https://github.com/RealHeart/ZMusic/issues" 5 | [[mods]] 6 | modId = "zmusic" 7 | version = "${version}" 8 | displayName = "ZMusic Mod" 9 | description = "Powerful Music System" 10 | displayURL = "https://m.zplu.cc" 11 | authors = "ZhenXin" 12 | [[dependencies.zmusic]] 13 | modId = "forge" 14 | mandatory = true 15 | versionRange = "[40,)" 16 | ordering = "NONE" 17 | side = "CLIENT" 18 | [[dependencies.zmusic]] 19 | modId = "minecraft" 20 | mandatory = true 21 | versionRange = "[1.18.2,1.19)" 22 | ordering = "NONE" 23 | side = "CLIENT" -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.19.2/src/main/resources/META-INF/mods.toml: -------------------------------------------------------------------------------- 1 | modLoader = "javafml" 2 | loaderVersion = "[43,)" 3 | license = "GPL-3.0-only" 4 | issueTrackerURL = "https://github.com/RealHeart/ZMusic/issues" 5 | [[mods]] 6 | modId = "zmusic" 7 | version = "${version}" 8 | displayName = "ZMusic Mod" 9 | description = "Powerful Music System" 10 | displayURL = "https://m.zplu.cc" 11 | authors = "ZhenXin" 12 | [[dependencies.zmusic]] 13 | modId = "forge" 14 | mandatory = true 15 | versionRange = "[43,)" 16 | ordering = "NONE" 17 | side = "CLIENT" 18 | [[dependencies.zmusic]] 19 | modId = "minecraft" 20 | mandatory = true 21 | versionRange = "[1.19.2,1.20)" 22 | ordering = "NONE" 23 | side = "CLIENT" -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.19.3/src/main/resources/META-INF/mods.toml: -------------------------------------------------------------------------------- 1 | modLoader = "javafml" 2 | loaderVersion = "[44,)" 3 | license = "GPL-3.0-only" 4 | issueTrackerURL = "https://github.com/RealHeart/ZMusic/issues" 5 | [[mods]] 6 | modId = "zmusic" 7 | version = "${version}" 8 | displayName = "ZMusic Mod" 9 | description = "Powerful Music System" 10 | displayURL = "https://m.zplu.cc" 11 | authors = "ZhenXin" 12 | [[dependencies.zmusic]] 13 | modId = "forge" 14 | mandatory = true 15 | versionRange = "[44,)" 16 | ordering = "NONE" 17 | side = "CLIENT" 18 | [[dependencies.zmusic]] 19 | modId = "minecraft" 20 | mandatory = true 21 | versionRange = "[1.19.3,1.20)" 22 | ordering = "NONE" 23 | side = "CLIENT" -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.19.4/src/main/resources/META-INF/mods.toml: -------------------------------------------------------------------------------- 1 | modLoader = "javafml" 2 | loaderVersion = "[45,)" 3 | license = "GPL-3.0-only" 4 | issueTrackerURL = "https://github.com/RealHeart/ZMusic/issues" 5 | [[mods]] 6 | modId = "zmusic" 7 | version = "${version}" 8 | displayName = "ZMusic Mod" 9 | description = "Powerful Music System" 10 | displayURL = "https://m.zplu.cc" 11 | authors = "ZhenXin" 12 | [[dependencies.zmusic]] 13 | modId = "forge" 14 | mandatory = true 15 | versionRange = "[45,)" 16 | ordering = "NONE" 17 | side = "CLIENT" 18 | [[dependencies.zmusic]] 19 | modId = "minecraft" 20 | mandatory = true 21 | versionRange = "[1.19.4,1.20)" 22 | ordering = "NONE" 23 | side = "CLIENT" -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.21.8/src/main/java/me/zhenxin/zmusic/mixin/QuitServer.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import net.minecraft.server.network.ServerQueryNetworkHandler; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(ServerQueryNetworkHandler.class) 11 | public class QuitServer { 12 | @Inject(method = "onDisconnected", at = @At("HEAD")) 13 | public void onDisconnected(CallbackInfo info) { 14 | ClientEvent.onDisconnect(); 15 | } 16 | } -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/event/ClientEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.event; 2 | 3 | /** 4 | * 客户端事件 5 | * 6 | * @author 真心 7 | * @email qgzhenxin@qq.com 8 | * @since 2023/1/29 22:52 9 | */ 10 | public class ClientEvent { 11 | 12 | @SuppressWarnings("AlibabaUndefineMagicConstant") 13 | public static void onPacket(String message) { 14 | if (message.startsWith("[Play]")) { 15 | String data = message.replace("[Play]", ""); 16 | PacketEvent.onPlay(data); 17 | } else if ("[Stop]".equals(message)) { 18 | PacketEvent.onStop(); 19 | } 20 | } 21 | 22 | public static void onDisconnect() { 23 | PacketEvent.onStop(); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/ogg/jcraft/jorbis/Util.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.player.decoder.ogg.jcraft.jorbis; 2 | 3 | class Util { 4 | static int ilog(int v) { 5 | int ret = 0; 6 | while (v != 0) { 7 | ret++; 8 | v >>>= 1; 9 | } 10 | return (ret); 11 | } 12 | 13 | static int ilog2(int v) { 14 | int ret = 0; 15 | while (v > 1) { 16 | ret++; 17 | v >>>= 1; 18 | } 19 | return (ret); 20 | } 21 | 22 | static int icount(int v) { 23 | int ret = 0; 24 | while (v != 0) { 25 | ret += (v & 1); 26 | v >>>= 1; 27 | } 28 | return (ret); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.17.1/src/main/java/me/zhenxin/zmusic/manager/SoundManagerImpl.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.sounds.SoundSource; 5 | 6 | /** 7 | * 音频管理器实现 8 | * 9 | * @author 真心 10 | * @email qgzhenxin@qq.com 11 | * @since 2023/1/29 23:29 12 | */ 13 | public class SoundManagerImpl implements SoundManager { 14 | 15 | @Override 16 | public float volume() { 17 | return Minecraft.getInstance().options.getSoundSourceVolume(SoundSource.RECORDS); 18 | } 19 | 20 | @Override 21 | public void stop() { 22 | Minecraft.getInstance().getSoundManager().stop(null, SoundSource.MUSIC); 23 | Minecraft.getInstance().getSoundManager().stop(null, SoundSource.RECORDS); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.18.2/src/main/java/me/zhenxin/zmusic/manager/SoundManagerImpl.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.sounds.SoundSource; 5 | 6 | /** 7 | * 音频管理器实现 8 | * 9 | * @author 真心 10 | * @email qgzhenxin@qq.com 11 | * @since 2023/1/29 23:29 12 | */ 13 | public class SoundManagerImpl implements SoundManager { 14 | 15 | @Override 16 | public float volume() { 17 | return Minecraft.getInstance().options.getSoundSourceVolume(SoundSource.RECORDS); 18 | } 19 | 20 | @Override 21 | public void stop() { 22 | Minecraft.getInstance().getSoundManager().stop(null, SoundSource.MUSIC); 23 | Minecraft.getInstance().getSoundManager().stop(null, SoundSource.RECORDS); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.19.2/src/main/java/me/zhenxin/zmusic/manager/SoundManagerImpl.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.sounds.SoundSource; 5 | 6 | /** 7 | * 音频管理器实现 8 | * 9 | * @author 真心 10 | * @email qgzhenxin@qq.com 11 | * @since 2023/1/29 23:29 12 | */ 13 | public class SoundManagerImpl implements SoundManager { 14 | 15 | @Override 16 | public float volume() { 17 | return Minecraft.getInstance().options.getSoundSourceVolume(SoundSource.RECORDS); 18 | } 19 | 20 | @Override 21 | public void stop() { 22 | Minecraft.getInstance().getSoundManager().stop(null, SoundSource.MUSIC); 23 | Minecraft.getInstance().getSoundManager().stop(null, SoundSource.RECORDS); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.19.3/src/main/java/me/zhenxin/zmusic/manager/SoundManagerImpl.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.sounds.SoundSource; 5 | 6 | /** 7 | * 音频管理器实现 8 | * 9 | * @author 真心 10 | * @email qgzhenxin@qq.com 11 | * @since 2023/1/29 23:29 12 | */ 13 | public class SoundManagerImpl implements SoundManager { 14 | 15 | @Override 16 | public float volume() { 17 | return Minecraft.getInstance().options.getSoundSourceVolume(SoundSource.RECORDS); 18 | } 19 | 20 | @Override 21 | public void stop() { 22 | Minecraft.getInstance().getSoundManager().stop(null, SoundSource.MUSIC); 23 | Minecraft.getInstance().getSoundManager().stop(null, SoundSource.RECORDS); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.19.4/src/main/java/me/zhenxin/zmusic/manager/SoundManagerImpl.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.sounds.SoundSource; 5 | 6 | /** 7 | * 音频管理器实现 8 | * 9 | * @author 真心 10 | * @email qgzhenxin@qq.com 11 | * @since 2023/1/29 23:29 12 | */ 13 | public class SoundManagerImpl implements SoundManager { 14 | 15 | @Override 16 | public float volume() { 17 | return Minecraft.getInstance().options.getSoundSourceVolume(SoundSource.RECORDS); 18 | } 19 | 20 | @Override 21 | public void stop() { 22 | Minecraft.getInstance().getSoundManager().stop(null, SoundSource.MUSIC); 23 | Minecraft.getInstance().getSoundManager().stop(null, SoundSource.RECORDS); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.20/src/main/java/me/zhenxin/zmusic/manager/SoundManagerImpl.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.sounds.SoundSource; 5 | 6 | /** 7 | * 音频管理器实现 8 | * 9 | * @author 真心 10 | * @email qgzhenxin@qq.com 11 | * @since 2023/1/29 23:29 12 | */ 13 | public class SoundManagerImpl implements SoundManager { 14 | 15 | @Override 16 | public float volume() { 17 | return Minecraft.getInstance().options.getSoundSourceVolume(SoundSource.RECORDS); 18 | } 19 | 20 | @Override 21 | public void stop() { 22 | Minecraft.getInstance().getSoundManager().stop(null, SoundSource.MUSIC); 23 | Minecraft.getInstance().getSoundManager().stop(null, SoundSource.RECORDS); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.12.2/src/main/java/me/zhenxin/zmusic/manager/SoundManagerImpl.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.util.SoundCategory; 5 | 6 | /** 7 | * 音频管理器实现 8 | * 9 | * @author 真心 10 | * @email qgzhenxin@qq.com 11 | * @since 2023/1/29 23:29 12 | */ 13 | public class SoundManagerImpl implements SoundManager { 14 | 15 | @Override 16 | public float volume() { 17 | return Minecraft.getMinecraft().gameSettings.getSoundLevel(SoundCategory.RECORDS); 18 | } 19 | 20 | @Override 21 | public void stop() { 22 | Minecraft.getMinecraft().getSoundHandler().stop("", SoundCategory.MUSIC); 23 | Minecraft.getMinecraft().getSoundHandler().stop("", SoundCategory.RECORDS); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.14.4/src/main/java/me/zhenxin/zmusic/manager/SoundManagerImpl.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.util.SoundCategory; 5 | 6 | /** 7 | * 音频管理器实现 8 | * 9 | * @author 真心 10 | * @email qgzhenxin@qq.com 11 | * @since 2023/1/29 23:29 12 | */ 13 | public class SoundManagerImpl implements SoundManager { 14 | 15 | @Override 16 | public float volume() { 17 | return Minecraft.getInstance().gameSettings.getSoundLevel(SoundCategory.RECORDS); 18 | } 19 | 20 | @Override 21 | public void stop() { 22 | Minecraft.getInstance().getSoundHandler().stop(null, SoundCategory.MUSIC); 23 | Minecraft.getInstance().getSoundHandler().stop(null, SoundCategory.RECORDS); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.15.2/src/main/java/me/zhenxin/zmusic/manager/SoundManagerImpl.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.util.SoundCategory; 5 | 6 | /** 7 | * 音频管理器实现 8 | * 9 | * @author 真心 10 | * @email qgzhenxin@qq.com 11 | * @since 2023/1/29 23:29 12 | */ 13 | public class SoundManagerImpl implements SoundManager { 14 | 15 | @Override 16 | public float volume() { 17 | return Minecraft.getInstance().gameSettings.getSoundLevel(SoundCategory.RECORDS); 18 | } 19 | 20 | @Override 21 | public void stop() { 22 | Minecraft.getInstance().getSoundHandler().stop(null, SoundCategory.MUSIC); 23 | Minecraft.getInstance().getSoundHandler().stop(null, SoundCategory.RECORDS); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.16.5/src/main/java/me/zhenxin/zmusic/manager/SoundManagerImpl.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.util.SoundCategory; 5 | 6 | /** 7 | * 音频管理器实现 8 | * 9 | * @author 真心 10 | * @email qgzhenxin@qq.com 11 | * @since 2023/1/29 23:29 12 | */ 13 | public class SoundManagerImpl implements SoundManager { 14 | 15 | @Override 16 | public float volume() { 17 | return Minecraft.getInstance().options.getSoundSourceVolume(SoundCategory.RECORDS); 18 | } 19 | 20 | @Override 21 | public void stop() { 22 | Minecraft.getInstance().getSoundManager().stop(null, SoundCategory.MUSIC); 23 | Minecraft.getInstance().getSoundManager().stop(null, SoundCategory.RECORDS); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.14.4/src/main/java/me/zhenxin/zmusic/manager/SoundManagerImpl.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | import net.minecraft.client.MinecraftClient; 4 | import net.minecraft.sound.SoundCategory; 5 | 6 | /** 7 | * 音频管理器实现 8 | * 9 | * @author 真心 10 | * @email qgzhenxin@qq.com 11 | * @since 2023/1/29 23:29 12 | */ 13 | public class SoundManagerImpl implements SoundManager { 14 | 15 | @Override 16 | public float volume() { 17 | return MinecraftClient.getInstance().options.getSoundVolume(SoundCategory.RECORDS); 18 | } 19 | 20 | @Override 21 | public void stop() { 22 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.MUSIC); 23 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.RECORDS); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.15.2/src/main/java/me/zhenxin/zmusic/manager/SoundManagerImpl.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | import net.minecraft.client.MinecraftClient; 4 | import net.minecraft.sound.SoundCategory; 5 | 6 | /** 7 | * 音频管理器实现 8 | * 9 | * @author 真心 10 | * @email qgzhenxin@qq.com 11 | * @since 2023/1/29 23:29 12 | */ 13 | public class SoundManagerImpl implements SoundManager { 14 | 15 | @Override 16 | public float volume() { 17 | return MinecraftClient.getInstance().options.getSoundVolume(SoundCategory.RECORDS); 18 | } 19 | 20 | @Override 21 | public void stop() { 22 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.MUSIC); 23 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.RECORDS); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.16.5/src/main/java/me/zhenxin/zmusic/manager/SoundManagerImpl.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | import net.minecraft.client.MinecraftClient; 4 | import net.minecraft.sound.SoundCategory; 5 | 6 | /** 7 | * 音频管理器实现 8 | * 9 | * @author 真心 10 | * @email qgzhenxin@qq.com 11 | * @since 2023/1/29 23:29 12 | */ 13 | public class SoundManagerImpl implements SoundManager { 14 | 15 | @Override 16 | public float volume() { 17 | return MinecraftClient.getInstance().options.getSoundVolume(SoundCategory.RECORDS); 18 | } 19 | 20 | @Override 21 | public void stop() { 22 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.MUSIC); 23 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.RECORDS); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.17.1/src/main/java/me/zhenxin/zmusic/manager/SoundManagerImpl.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | import net.minecraft.client.MinecraftClient; 4 | import net.minecraft.sound.SoundCategory; 5 | 6 | /** 7 | * 音频管理器实现 8 | * 9 | * @author 真心 10 | * @email qgzhenxin@qq.com 11 | * @since 2023/1/29 23:29 12 | */ 13 | public class SoundManagerImpl implements SoundManager { 14 | 15 | @Override 16 | public float volume() { 17 | return MinecraftClient.getInstance().options.getSoundVolume(SoundCategory.RECORDS); 18 | } 19 | 20 | @Override 21 | public void stop() { 22 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.MUSIC); 23 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.RECORDS); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.18.2/src/main/java/me/zhenxin/zmusic/manager/SoundManagerImpl.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | import net.minecraft.client.MinecraftClient; 4 | import net.minecraft.sound.SoundCategory; 5 | 6 | /** 7 | * 音频管理器实现 8 | * 9 | * @author 真心 10 | * @email qgzhenxin@qq.com 11 | * @since 2023/1/29 23:29 12 | */ 13 | public class SoundManagerImpl implements SoundManager { 14 | 15 | @Override 16 | public float volume() { 17 | return MinecraftClient.getInstance().options.getSoundVolume(SoundCategory.RECORDS); 18 | } 19 | 20 | @Override 21 | public void stop() { 22 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.MUSIC); 23 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.RECORDS); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.2/src/main/java/me/zhenxin/zmusic/manager/SoundManagerImpl.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | import net.minecraft.client.MinecraftClient; 4 | import net.minecraft.sound.SoundCategory; 5 | 6 | /** 7 | * 音频管理器实现 8 | * 9 | * @author 真心 10 | * @email qgzhenxin@qq.com 11 | * @since 2023/1/29 23:29 12 | */ 13 | public class SoundManagerImpl implements SoundManager { 14 | 15 | @Override 16 | public float volume() { 17 | return MinecraftClient.getInstance().options.getSoundVolume(SoundCategory.RECORDS); 18 | } 19 | 20 | @Override 21 | public void stop() { 22 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.MUSIC); 23 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.RECORDS); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.3/src/main/java/me/zhenxin/zmusic/manager/SoundManagerImpl.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | import net.minecraft.client.MinecraftClient; 4 | import net.minecraft.sound.SoundCategory; 5 | 6 | /** 7 | * 音频管理器实现 8 | * 9 | * @author 真心 10 | * @email qgzhenxin@qq.com 11 | * @since 2023/1/29 23:29 12 | */ 13 | public class SoundManagerImpl implements SoundManager { 14 | 15 | @Override 16 | public float volume() { 17 | return MinecraftClient.getInstance().options.getSoundVolume(SoundCategory.RECORDS); 18 | } 19 | 20 | @Override 21 | public void stop() { 22 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.MUSIC); 23 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.RECORDS); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.4/src/main/java/me/zhenxin/zmusic/manager/SoundManagerImpl.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | import net.minecraft.client.MinecraftClient; 4 | import net.minecraft.sound.SoundCategory; 5 | 6 | /** 7 | * 音频管理器实现 8 | * 9 | * @author 真心 10 | * @email qgzhenxin@qq.com 11 | * @since 2023/1/29 23:29 12 | */ 13 | public class SoundManagerImpl implements SoundManager { 14 | 15 | @Override 16 | public float volume() { 17 | return MinecraftClient.getInstance().options.getSoundVolume(SoundCategory.RECORDS); 18 | } 19 | 20 | @Override 21 | public void stop() { 22 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.MUSIC); 23 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.RECORDS); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.20.5/src/main/java/me/zhenxin/zmusic/manager/SoundManagerImpl.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | import net.minecraft.client.MinecraftClient; 4 | import net.minecraft.sound.SoundCategory; 5 | 6 | /** 7 | * 音频管理器实现 8 | * 9 | * @author 真心 10 | * @email qgzhenxin@qq.com 11 | * @since 2023/1/29 23:29 12 | */ 13 | public class SoundManagerImpl implements SoundManager { 14 | 15 | @Override 16 | public float volume() { 17 | return MinecraftClient.getInstance().options.getSoundVolume(SoundCategory.RECORDS); 18 | } 19 | 20 | @Override 21 | public void stop() { 22 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.MUSIC); 23 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.RECORDS); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.20/src/main/java/me/zhenxin/zmusic/manager/SoundManagerImpl.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | import net.minecraft.client.MinecraftClient; 4 | import net.minecraft.sound.SoundCategory; 5 | 6 | /** 7 | * 音频管理器实现 8 | * 9 | * @author 真心 10 | * @email qgzhenxin@qq.com 11 | * @since 2023/1/29 23:29 12 | */ 13 | public class SoundManagerImpl implements SoundManager { 14 | 15 | @Override 16 | public float volume() { 17 | return MinecraftClient.getInstance().options.getSoundVolume(SoundCategory.RECORDS); 18 | } 19 | 20 | @Override 21 | public void stop() { 22 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.MUSIC); 23 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.RECORDS); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.21.8/src/main/java/me/zhenxin/zmusic/manager/SoundManagerImpl.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | import net.minecraft.client.MinecraftClient; 4 | import net.minecraft.sound.SoundCategory; 5 | 6 | /** 7 | * 音频管理器实现 8 | * 9 | * @author 真心 10 | * @email qgzhenxin@qq.com 11 | * @since 2023/1/29 23:29 12 | */ 13 | public class SoundManagerImpl implements SoundManager { 14 | 15 | @Override 16 | public float volume() { 17 | return MinecraftClient.getInstance().options.getSoundVolume(SoundCategory.RECORDS); 18 | } 19 | 20 | @Override 21 | public void stop() { 22 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.MUSIC); 23 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.RECORDS); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.21/src/main/java/me/zhenxin/zmusic/manager/SoundManagerImpl.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.manager; 2 | 3 | import net.minecraft.client.MinecraftClient; 4 | import net.minecraft.sound.SoundCategory; 5 | 6 | /** 7 | * 音频管理器实现 8 | * 9 | * @author 真心 10 | * @email qgzhenxin@qq.com 11 | * @since 2023/1/29 23:29 12 | */ 13 | public class SoundManagerImpl implements SoundManager { 14 | 15 | @Override 16 | public float volume() { 17 | return MinecraftClient.getInstance().options.getSoundVolume(SoundCategory.RECORDS); 18 | } 19 | 20 | @Override 21 | public void stop() { 22 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.MUSIC); 23 | MinecraftClient.getInstance().getSoundManager().stopSounds(null, SoundCategory.RECORDS); 24 | } 25 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.14.4/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "zmusic", 4 | "version": "${version}", 5 | "name": "ZMusic Mod", 6 | "description": "Powerful Music System", 7 | "authors": [ 8 | "ZhenXin" 9 | ], 10 | "contact": { 11 | "homepage": "https://m.zplu.cc", 12 | "sources": "https://github.com/RealHeart/ZMusic-Mod", 13 | "issues": "https://github.com/RealHeart/ZMusic-Mod/issues", 14 | "discord": "https://discord.gg/twQgJNufYn" 15 | }, 16 | "license": "GPL-3.0", 17 | "environment": "client", 18 | "entrypoints": { 19 | "main": [ 20 | "me.zhenxin.zmusic.ZMusicMod" 21 | ] 22 | }, 23 | "mixins": [ 24 | "zmusic.mixins.json" 25 | ], 26 | "depends": { 27 | "fabricloader": ">=0.11.3", 28 | "fabric": "*", 29 | "minecraft": "1.14.x", 30 | "java": ">=8" 31 | } 32 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.15.2/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "zmusic", 4 | "version": "${version}", 5 | "name": "ZMusic Mod", 6 | "description": "Powerful Music System", 7 | "authors": [ 8 | "ZhenXin" 9 | ], 10 | "contact": { 11 | "homepage": "https://m.zplu.cc", 12 | "sources": "https://github.com/RealHeart/ZMusic-Mod", 13 | "issues": "https://github.com/RealHeart/ZMusic-Mod/issues", 14 | "discord": "https://discord.gg/twQgJNufYn" 15 | }, 16 | "license": "GPL-3.0", 17 | "environment": "client", 18 | "entrypoints": { 19 | "main": [ 20 | "me.zhenxin.zmusic.ZMusicMod" 21 | ] 22 | }, 23 | "mixins": [ 24 | "zmusic.mixins.json" 25 | ], 26 | "depends": { 27 | "fabricloader": ">=0.11.3", 28 | "fabric": "*", 29 | "minecraft": "1.15.x", 30 | "java": ">=8" 31 | } 32 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.16.5/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "zmusic", 4 | "version": "${version}", 5 | "name": "ZMusic Mod", 6 | "description": "Powerful Music System", 7 | "authors": [ 8 | "ZhenXin" 9 | ], 10 | "contact": { 11 | "homepage": "https://m.zplu.cc", 12 | "sources": "https://github.com/RealHeart/ZMusic-Mod", 13 | "issues": "https://github.com/RealHeart/ZMusic-Mod/issues", 14 | "discord": "https://discord.gg/twQgJNufYn" 15 | }, 16 | "license": "GPL-3.0", 17 | "environment": "client", 18 | "entrypoints": { 19 | "main": [ 20 | "me.zhenxin.zmusic.ZMusicMod" 21 | ] 22 | }, 23 | "mixins": [ 24 | "zmusic.mixins.json" 25 | ], 26 | "depends": { 27 | "fabricloader": ">=0.11.3", 28 | "fabric": "*", 29 | "minecraft": "1.16.x", 30 | "java": ">=8" 31 | } 32 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.17.1/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "zmusic", 4 | "version": "${version}", 5 | "name": "ZMusic Mod", 6 | "description": "Powerful Music System", 7 | "authors": [ 8 | "ZhenXin" 9 | ], 10 | "contact": { 11 | "homepage": "https://m.zplu.cc", 12 | "sources": "https://github.com/RealHeart/ZMusic-Mod", 13 | "issues": "https://github.com/RealHeart/ZMusic-Mod/issues", 14 | "discord": "https://discord.gg/twQgJNufYn" 15 | }, 16 | "license": "GPL-3.0", 17 | "environment": "client", 18 | "entrypoints": { 19 | "main": [ 20 | "me.zhenxin.zmusic.ZMusicMod" 21 | ] 22 | }, 23 | "mixins": [ 24 | "zmusic.mixins.json" 25 | ], 26 | "depends": { 27 | "fabricloader": ">=0.11.3", 28 | "fabric": "*", 29 | "minecraft": "1.17.x", 30 | "java": ">=16" 31 | } 32 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.18.2/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "zmusic", 4 | "version": "${version}", 5 | "name": "ZMusic Mod", 6 | "description": "Powerful Music System", 7 | "authors": [ 8 | "ZhenXin" 9 | ], 10 | "contact": { 11 | "homepage": "https://m.zplu.cc", 12 | "sources": "https://github.com/RealHeart/ZMusic-Mod", 13 | "issues": "https://github.com/RealHeart/ZMusic-Mod/issues", 14 | "discord": "https://discord.gg/twQgJNufYn" 15 | }, 16 | "license": "GPL-3.0", 17 | "environment": "client", 18 | "entrypoints": { 19 | "main": [ 20 | "me.zhenxin.zmusic.ZMusicMod" 21 | ] 22 | }, 23 | "mixins": [ 24 | "zmusic.mixins.json" 25 | ], 26 | "depends": { 27 | "fabricloader": ">=0.14.6", 28 | "fabric": "*", 29 | "minecraft": "~1.18.2", 30 | "java": ">=17" 31 | } 32 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.2/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "zmusic", 4 | "version": "${version}", 5 | "name": "ZMusic Mod", 6 | "description": "Powerful Music System", 7 | "authors": [ 8 | "ZhenXin" 9 | ], 10 | "contact": { 11 | "homepage": "https://m.zplu.cc", 12 | "sources": "https://github.com/RealHeart/ZMusic-Mod", 13 | "issues": "https://github.com/RealHeart/ZMusic-Mod/issues", 14 | "discord": "https://discord.gg/twQgJNufYn" 15 | }, 16 | "license": "GPL-3.0", 17 | "environment": "client", 18 | "entrypoints": { 19 | "main": [ 20 | "me.zhenxin.zmusic.ZMusicMod" 21 | ] 22 | }, 23 | "mixins": [ 24 | "zmusic.mixins.json" 25 | ], 26 | "depends": { 27 | "fabricloader": ">=0.14.14", 28 | "fabric-api": "*", 29 | "minecraft": "~1.19.2", 30 | "java": ">=17" 31 | } 32 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.3/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "zmusic", 4 | "version": "${version}", 5 | "name": "ZMusic Mod", 6 | "description": "Powerful Music System", 7 | "authors": [ 8 | "ZhenXin" 9 | ], 10 | "contact": { 11 | "homepage": "https://m.zplu.cc", 12 | "sources": "https://github.com/RealHeart/ZMusic-Mod", 13 | "issues": "https://github.com/RealHeart/ZMusic-Mod/issues", 14 | "discord": "https://discord.gg/twQgJNufYn" 15 | }, 16 | "license": "GPL-3.0", 17 | "environment": "client", 18 | "entrypoints": { 19 | "main": [ 20 | "me.zhenxin.zmusic.ZMusicMod" 21 | ] 22 | }, 23 | "mixins": [ 24 | "zmusic.mixins.json" 25 | ], 26 | "depends": { 27 | "fabricloader": ">=0.14.14", 28 | "fabric-api": "*", 29 | "minecraft": "~1.19.3", 30 | "java": ">=17" 31 | } 32 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.4/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "zmusic", 4 | "version": "${version}", 5 | "name": "ZMusic Mod", 6 | "description": "Powerful Music System", 7 | "authors": [ 8 | "ZhenXin" 9 | ], 10 | "contact": { 11 | "homepage": "https://m.zplu.cc", 12 | "sources": "https://github.com/RealHeart/ZMusic-Mod", 13 | "issues": "https://github.com/RealHeart/ZMusic-Mod/issues", 14 | "discord": "https://discord.gg/twQgJNufYn" 15 | }, 16 | "license": "GPL-3.0", 17 | "environment": "client", 18 | "entrypoints": { 19 | "main": [ 20 | "me.zhenxin.zmusic.ZMusicMod" 21 | ] 22 | }, 23 | "mixins": [ 24 | "zmusic.mixins.json" 25 | ], 26 | "depends": { 27 | "fabricloader": ">=0.14.14", 28 | "fabric-api": "*", 29 | "minecraft": "~1.19.3", 30 | "java": ">=17" 31 | } 32 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.20.5/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "zmusic", 4 | "version": "${version}", 5 | "name": "ZMusic Mod", 6 | "description": "Powerful Music System", 7 | "authors": [ 8 | "ZhenXin" 9 | ], 10 | "contact": { 11 | "homepage": "https://m.zplu.cc", 12 | "sources": "https://github.com/RealHeart/ZMusic-Mod", 13 | "issues": "https://github.com/RealHeart/ZMusic-Mod/issues", 14 | "discord": "https://discord.gg/twQgJNufYn" 15 | }, 16 | "license": "GPL-3.0", 17 | "environment": "client", 18 | "entrypoints": { 19 | "main": [ 20 | "me.zhenxin.zmusic.ZMusicMod" 21 | ] 22 | }, 23 | "mixins": [ 24 | "zmusic.mixins.json" 25 | ], 26 | "depends": { 27 | "fabricloader": ">=0.14.14", 28 | "fabric-api": "*", 29 | "minecraft": "~1.20.5", 30 | "java": ">=21" 31 | } 32 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.20/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "zmusic", 4 | "version": "${version}", 5 | "name": "ZMusic Mod", 6 | "description": "Powerful Music System", 7 | "authors": [ 8 | "ZhenXin" 9 | ], 10 | "contact": { 11 | "homepage": "https://m.zplu.cc", 12 | "sources": "https://github.com/RealHeart/ZMusic-Mod", 13 | "issues": "https://github.com/RealHeart/ZMusic-Mod/issues", 14 | "discord": "https://discord.gg/twQgJNufYn" 15 | }, 16 | "license": "GPL-3.0", 17 | "environment": "client", 18 | "entrypoints": { 19 | "main": [ 20 | "me.zhenxin.zmusic.ZMusicMod" 21 | ] 22 | }, 23 | "mixins": [ 24 | "zmusic.mixins.json" 25 | ], 26 | "depends": { 27 | "fabricloader": ">=0.14.14", 28 | "fabric-api": "*", 29 | "minecraft": "~1.20", 30 | "java": ">=17" 31 | } 32 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.21/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "zmusic", 4 | "version": "${version}", 5 | "name": "ZMusic Mod", 6 | "description": "Powerful Music System", 7 | "authors": [ 8 | "ZhenXin" 9 | ], 10 | "contact": { 11 | "homepage": "https://m.zplu.cc", 12 | "sources": "https://github.com/RealHeart/ZMusic-Mod", 13 | "issues": "https://github.com/RealHeart/ZMusic-Mod/issues", 14 | "discord": "https://discord.gg/twQgJNufYn" 15 | }, 16 | "license": "GPL-3.0", 17 | "environment": "client", 18 | "entrypoints": { 19 | "main": [ 20 | "me.zhenxin.zmusic.ZMusicMod" 21 | ] 22 | }, 23 | "mixins": [ 24 | "zmusic.mixins.json" 25 | ], 26 | "depends": { 27 | "fabricloader": ">=0.14.14", 28 | "fabric-api": "*", 29 | "minecraft": "~1.21", 30 | "java": ">=21" 31 | } 32 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.21.8/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "zmusic", 4 | "version": "${version}", 5 | "name": "ZMusic Mod", 6 | "description": "Powerful Music System", 7 | "authors": [ 8 | "ZhenXin" 9 | ], 10 | "contact": { 11 | "homepage": "https://m.zplu.cc", 12 | "sources": "https://github.com/RealHeart/ZMusic-Mod", 13 | "issues": "https://github.com/RealHeart/ZMusic-Mod/issues", 14 | "discord": "https://discord.gg/twQgJNufYn" 15 | }, 16 | "license": "GPL-3.0", 17 | "environment": "client", 18 | "entrypoints": { 19 | "main": [ 20 | "me.zhenxin.zmusic.ZMusicMod" 21 | ] 22 | }, 23 | "mixins": [ 24 | "zmusic.mixins.json" 25 | ], 26 | "depends": { 27 | "fabricloader": ">=0.16.14", 28 | "fabric-api": "*", 29 | "minecraft": ">=1.21.7", 30 | "java": ">=21" 31 | } 32 | } -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/event/PacketEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.event; 2 | 3 | import lombok.extern.log4j.Log4j2; 4 | import me.zhenxin.zmusic.ZMusic; 5 | 6 | 7 | /** 8 | * 发包事件 9 | * 10 | * @author 真心 11 | * @email qgzhenxin@qq.com 12 | * @since 2023/1/29 22:50 13 | */ 14 | @Log4j2 15 | class PacketEvent { 16 | 17 | public static void onPlay(String data) { 18 | log.info("Play music from {}", data); 19 | ZMusic.getSoundManager().stop(); 20 | ZMusic.getPlayer().closePlayer(); 21 | ZMusic.getPlayer().setMusic(data); 22 | } 23 | 24 | public static void onStop() { 25 | ZMusic.getPlayer().closePlayer(); 26 | } 27 | 28 | public static void onLyric(String data) { 29 | // TODO: 歌词 30 | } 31 | 32 | public static void onInfo(String data) { 33 | // TODO: 信息 34 | } 35 | 36 | public static void onImg(String data) { 37 | // TODO: 专辑图片 38 | } 39 | } -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/ZMusic.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import lombok.extern.log4j.Log4j2; 6 | import me.zhenxin.zmusic.manager.SoundManager; 7 | import me.zhenxin.zmusic.player.MusicPlayer; 8 | 9 | 10 | /** 11 | * ZMusic 主入口 12 | * 13 | * @author 真心 14 | * @email qgzhenxin@qq.com 15 | * @since 2023/1/28 13:08 16 | */ 17 | @SuppressWarnings({"AlibabaClassNamingShouldBeCamel", "AlibabaConstantFieldShouldBeUpperCase"}) 18 | @Log4j2 19 | public class ZMusic { 20 | @Getter 21 | private static MusicPlayer player; 22 | @Getter 23 | @Setter 24 | private static SoundManager soundManager; 25 | @Getter 26 | private static String version = "3.1.0"; 27 | 28 | public static void onEnable() { 29 | player = new MusicPlayer(); 30 | log.info("Welcome use ZMusic Mod!"); 31 | log.info("Homepage: https://m.zplu.cc"); 32 | log.info("Github: https://github.com/RealHeart/ZMusic-Mod"); 33 | log.info("Discord: https://discord.gg/twQgJNufYn"); 34 | log.info("QQ Group: 1032722724"); 35 | } 36 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.20/src/main/java/me/zhenxin/zmusic/mixin/SoundEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.sound.SoundInstance; 5 | import net.minecraft.client.sound.SoundSystem; 6 | import net.minecraft.sound.SoundCategory; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | @Mixin(SoundSystem.class) 13 | public class SoundEvent { 14 | @Inject(method = "play(Lnet/minecraft/client/sound/SoundInstance;)V", at = @At("HEAD"), cancellable = true) 15 | public void play(SoundInstance soundInstance, CallbackInfo info) { 16 | if (ZMusic.getPlayer().isPlay()) { 17 | SoundCategory data = soundInstance.getCategory(); 18 | switch (data) { 19 | case RECORDS: 20 | case MUSIC: 21 | info.cancel(); 22 | break; 23 | default: 24 | } 25 | } 26 | } 27 | 28 | @Inject(method = "reloadSounds", at = @At("RETURN")) 29 | public void reload(CallbackInfo info) { 30 | ZMusic.getPlayer().setReload(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.21/src/main/java/me/zhenxin/zmusic/mixin/SoundEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.sound.SoundInstance; 5 | import net.minecraft.client.sound.SoundSystem; 6 | import net.minecraft.sound.SoundCategory; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | @Mixin(SoundSystem.class) 13 | public class SoundEvent { 14 | @Inject(method = "play(Lnet/minecraft/client/sound/SoundInstance;)V", at = @At("HEAD"), cancellable = true) 15 | public void play(SoundInstance soundInstance, CallbackInfo info) { 16 | if (ZMusic.getPlayer().isPlay()) { 17 | SoundCategory data = soundInstance.getCategory(); 18 | switch (data) { 19 | case RECORDS: 20 | case MUSIC: 21 | info.cancel(); 22 | break; 23 | default: 24 | } 25 | } 26 | } 27 | 28 | @Inject(method = "reloadSounds", at = @At("RETURN")) 29 | public void reload(CallbackInfo info) { 30 | ZMusic.getPlayer().setReload(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.14.4/src/main/java/me/zhenxin/zmusic/mixin/SoundEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.sound.SoundInstance; 5 | import net.minecraft.client.sound.SoundSystem; 6 | import net.minecraft.sound.SoundCategory; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | @Mixin(SoundSystem.class) 13 | public class SoundEvent { 14 | @Inject(method = "play(Lnet/minecraft/client/sound/SoundInstance;)V", at = @At("HEAD"), cancellable = true) 15 | public void play(SoundInstance soundInstance, CallbackInfo info) { 16 | if (ZMusic.getPlayer().isPlay()) { 17 | SoundCategory data = soundInstance.getCategory(); 18 | switch (data) { 19 | case RECORDS: 20 | case MUSIC: 21 | info.cancel(); 22 | break; 23 | default: 24 | } 25 | } 26 | } 27 | 28 | @Inject(method = "reloadSounds", at = @At("RETURN")) 29 | public void reload(CallbackInfo info) { 30 | ZMusic.getPlayer().setReload(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.15.2/src/main/java/me/zhenxin/zmusic/mixin/SoundEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.sound.SoundInstance; 5 | import net.minecraft.client.sound.SoundSystem; 6 | import net.minecraft.sound.SoundCategory; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | @Mixin(SoundSystem.class) 13 | public class SoundEvent { 14 | @Inject(method = "play(Lnet/minecraft/client/sound/SoundInstance;)V", at = @At("HEAD"), cancellable = true) 15 | public void play(SoundInstance soundInstance, CallbackInfo info) { 16 | if (ZMusic.getPlayer().isPlay()) { 17 | SoundCategory data = soundInstance.getCategory(); 18 | switch (data) { 19 | case RECORDS: 20 | case MUSIC: 21 | info.cancel(); 22 | break; 23 | default: 24 | } 25 | } 26 | } 27 | 28 | @Inject(method = "reloadSounds", at = @At("RETURN")) 29 | public void reload(CallbackInfo info) { 30 | ZMusic.getPlayer().setReload(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.16.5/src/main/java/me/zhenxin/zmusic/mixin/SoundEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.sound.SoundInstance; 5 | import net.minecraft.client.sound.SoundSystem; 6 | import net.minecraft.sound.SoundCategory; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | @Mixin(SoundSystem.class) 13 | public class SoundEvent { 14 | @Inject(method = "play(Lnet/minecraft/client/sound/SoundInstance;)V", at = @At("HEAD"), cancellable = true) 15 | public void play(SoundInstance soundInstance, CallbackInfo info) { 16 | if (ZMusic.getPlayer().isPlay()) { 17 | SoundCategory data = soundInstance.getCategory(); 18 | switch (data) { 19 | case RECORDS: 20 | case MUSIC: 21 | info.cancel(); 22 | break; 23 | default: 24 | } 25 | } 26 | } 27 | 28 | @Inject(method = "reloadSounds", at = @At("RETURN")) 29 | public void reload(CallbackInfo info) { 30 | ZMusic.getPlayer().setReload(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.17.1/src/main/java/me/zhenxin/zmusic/mixin/SoundEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.sound.SoundInstance; 5 | import net.minecraft.client.sound.SoundSystem; 6 | import net.minecraft.sound.SoundCategory; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | @Mixin(SoundSystem.class) 13 | public class SoundEvent { 14 | @Inject(method = "play(Lnet/minecraft/client/sound/SoundInstance;)V", at = @At("HEAD"), cancellable = true) 15 | public void play(SoundInstance soundInstance, CallbackInfo info) { 16 | if (ZMusic.getPlayer().isPlay()) { 17 | SoundCategory data = soundInstance.getCategory(); 18 | switch (data) { 19 | case RECORDS: 20 | case MUSIC: 21 | info.cancel(); 22 | break; 23 | default: 24 | } 25 | } 26 | } 27 | 28 | @Inject(method = "reloadSounds", at = @At("RETURN")) 29 | public void reload(CallbackInfo info) { 30 | ZMusic.getPlayer().setReload(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.18.2/src/main/java/me/zhenxin/zmusic/mixin/SoundEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.sound.SoundInstance; 5 | import net.minecraft.client.sound.SoundSystem; 6 | import net.minecraft.sound.SoundCategory; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | @Mixin(SoundSystem.class) 13 | public class SoundEvent { 14 | @Inject(method = "play(Lnet/minecraft/client/sound/SoundInstance;)V", at = @At("HEAD"), cancellable = true) 15 | public void play(SoundInstance soundInstance, CallbackInfo info) { 16 | if (ZMusic.getPlayer().isPlay()) { 17 | SoundCategory data = soundInstance.getCategory(); 18 | switch (data) { 19 | case RECORDS: 20 | case MUSIC: 21 | info.cancel(); 22 | break; 23 | default: 24 | } 25 | } 26 | } 27 | 28 | @Inject(method = "reloadSounds", at = @At("RETURN")) 29 | public void reload(CallbackInfo info) { 30 | ZMusic.getPlayer().setReload(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.2/src/main/java/me/zhenxin/zmusic/mixin/SoundEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.sound.SoundInstance; 5 | import net.minecraft.client.sound.SoundSystem; 6 | import net.minecraft.sound.SoundCategory; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | @Mixin(SoundSystem.class) 13 | public class SoundEvent { 14 | @Inject(method = "play(Lnet/minecraft/client/sound/SoundInstance;)V", at = @At("HEAD"), cancellable = true) 15 | public void play(SoundInstance soundInstance, CallbackInfo info) { 16 | if (ZMusic.getPlayer().isPlay()) { 17 | SoundCategory data = soundInstance.getCategory(); 18 | switch (data) { 19 | case RECORDS: 20 | case MUSIC: 21 | info.cancel(); 22 | break; 23 | default: 24 | } 25 | } 26 | } 27 | 28 | @Inject(method = "reloadSounds", at = @At("RETURN")) 29 | public void reload(CallbackInfo info) { 30 | ZMusic.getPlayer().setReload(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.3/src/main/java/me/zhenxin/zmusic/mixin/SoundEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.sound.SoundInstance; 5 | import net.minecraft.client.sound.SoundSystem; 6 | import net.minecraft.sound.SoundCategory; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | @Mixin(SoundSystem.class) 13 | public class SoundEvent { 14 | @Inject(method = "play(Lnet/minecraft/client/sound/SoundInstance;)V", at = @At("HEAD"), cancellable = true) 15 | public void play(SoundInstance soundInstance, CallbackInfo info) { 16 | if (ZMusic.getPlayer().isPlay()) { 17 | SoundCategory data = soundInstance.getCategory(); 18 | switch (data) { 19 | case RECORDS: 20 | case MUSIC: 21 | info.cancel(); 22 | break; 23 | default: 24 | } 25 | } 26 | } 27 | 28 | @Inject(method = "reloadSounds", at = @At("RETURN")) 29 | public void reload(CallbackInfo info) { 30 | ZMusic.getPlayer().setReload(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.4/src/main/java/me/zhenxin/zmusic/mixin/SoundEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.sound.SoundInstance; 5 | import net.minecraft.client.sound.SoundSystem; 6 | import net.minecraft.sound.SoundCategory; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | @Mixin(SoundSystem.class) 13 | public class SoundEvent { 14 | @Inject(method = "play(Lnet/minecraft/client/sound/SoundInstance;)V", at = @At("HEAD"), cancellable = true) 15 | public void play(SoundInstance soundInstance, CallbackInfo info) { 16 | if (ZMusic.getPlayer().isPlay()) { 17 | SoundCategory data = soundInstance.getCategory(); 18 | switch (data) { 19 | case RECORDS: 20 | case MUSIC: 21 | info.cancel(); 22 | break; 23 | default: 24 | } 25 | } 26 | } 27 | 28 | @Inject(method = "reloadSounds", at = @At("RETURN")) 29 | public void reload(CallbackInfo info) { 30 | ZMusic.getPlayer().setReload(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.20.5/src/main/java/me/zhenxin/zmusic/mixin/SoundEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.sound.SoundInstance; 5 | import net.minecraft.client.sound.SoundSystem; 6 | import net.minecraft.sound.SoundCategory; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | @Mixin(SoundSystem.class) 13 | public class SoundEvent { 14 | @Inject(method = "play(Lnet/minecraft/client/sound/SoundInstance;)V", at = @At("HEAD"), cancellable = true) 15 | public void play(SoundInstance soundInstance, CallbackInfo info) { 16 | if (ZMusic.getPlayer().isPlay()) { 17 | SoundCategory data = soundInstance.getCategory(); 18 | switch (data) { 19 | case RECORDS: 20 | case MUSIC: 21 | info.cancel(); 22 | break; 23 | default: 24 | } 25 | } 26 | } 27 | 28 | @Inject(method = "reloadSounds", at = @At("RETURN")) 29 | public void reload(CallbackInfo info) { 30 | ZMusic.getPlayer().setReload(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.21.8/src/main/java/me/zhenxin/zmusic/mixin/SoundEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.mixin; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.client.sound.SoundInstance; 5 | import net.minecraft.client.sound.SoundSystem; 6 | import net.minecraft.sound.SoundCategory; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 12 | 13 | @Mixin(SoundSystem.class) 14 | public class SoundEvent { 15 | @Inject(method = "play*", at = @At("HEAD"), cancellable = true) 16 | public void play(SoundInstance soundInstance, CallbackInfoReturnable info) { 17 | if (ZMusic.getPlayer().isPlay()) { 18 | SoundCategory data = soundInstance.getCategory(); 19 | if (data == SoundCategory.RECORDS || data == SoundCategory.MUSIC) { 20 | info.setReturnValue(SoundSystem.PlayResult.NOT_STARTED); 21 | } 22 | } 23 | } 24 | 25 | @Inject(method = "reloadSounds", at = @At("RETURN")) 26 | public void reload(CallbackInfo info) { 27 | ZMusic.getPlayer().setReload(); 28 | } 29 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.12.2/src/main/java/me/zhenxin/zmusic/event/ForgeEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.event; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.util.SoundCategory; 5 | import net.minecraftforge.client.event.sound.PlaySoundEvent; 6 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 7 | import net.minecraftforge.fml.common.gameevent.TickEvent; 8 | import net.minecraftforge.fml.common.network.FMLNetworkEvent; 9 | 10 | /** 11 | * Forge 事件 12 | * 13 | * @author 真心 14 | * @email qgzhenxin@qq.com 15 | * @since 2023/3/17 11:17 16 | */ 17 | public class ForgeEvent { 18 | 19 | @SubscribeEvent 20 | public void onSound(final PlaySoundEvent e) { 21 | if (!ZMusic.getPlayer().isPlay()) { 22 | return; 23 | } 24 | SoundCategory data = e.getSound().getCategory(); 25 | switch (data) { 26 | case MUSIC: 27 | case RECORDS: 28 | e.setResultSound(null); 29 | break; 30 | default: 31 | } 32 | } 33 | 34 | @SubscribeEvent 35 | public void onServerQuit(final FMLNetworkEvent.ClientDisconnectionFromServerEvent e) { 36 | ZMusic.getPlayer().closePlayer(); 37 | } 38 | 39 | 40 | @SubscribeEvent 41 | public void onTick(TickEvent.ClientTickEvent event) { 42 | ZMusic.getPlayer().tick(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.17.1/src/main/java/me/zhenxin/zmusic/event/ForgeEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.event; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.sounds.SoundSource; 5 | import net.minecraftforge.client.event.ClientPlayerNetworkEvent; 6 | import net.minecraftforge.client.event.sound.SoundEvent; 7 | import net.minecraftforge.event.TickEvent; 8 | import net.minecraftforge.eventbus.api.SubscribeEvent; 9 | 10 | /** 11 | * Forge 事件 12 | * 13 | * @author 真心 14 | * @email qgzhenxin@qq.com 15 | * @since 2023/3/17 11:17 16 | */ 17 | public class ForgeEvent { 18 | 19 | @SubscribeEvent 20 | public void onSound(final SoundEvent.SoundSourceEvent e) { 21 | if (!ZMusic.getPlayer().isPlay()) { 22 | return; 23 | } 24 | SoundSource data = e.getSound().getSource(); 25 | //noinspection EnhancedSwitchMigration 26 | switch (data) { 27 | case MUSIC: 28 | case RECORDS: 29 | e.getSource().stop(); 30 | break; 31 | default: 32 | } 33 | } 34 | 35 | @SubscribeEvent 36 | public void onServerQuit(final ClientPlayerNetworkEvent.LoggedOutEvent e) { 37 | ZMusic.getPlayer().closePlayer(); 38 | } 39 | 40 | 41 | @SubscribeEvent 42 | public void onTick(TickEvent.ClientTickEvent event) { 43 | ZMusic.getPlayer().tick(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/ogg/jcraft/jorbis/InfoMode.java: -------------------------------------------------------------------------------- 1 | /* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */ 2 | /* JOrbis 3 | * Copyright (C) 2000 ymnk, JCraft,Inc. 4 | * 5 | * Written by: 2000 ymnk 6 | * 7 | * Many thanks to 8 | * Monty and 9 | * The XIPHOPHORUS Company http://www.xiph.org/ . 10 | * JOrbis has been based on their awesome works, Vorbis codec. 11 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU Library General Public License 14 | * as published by the Free Software Foundation; either version 2 of 15 | * the License, or (at your option) any later version. 16 | 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU Library General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Library General Public 23 | * License along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 | */ 26 | 27 | package me.zhenxin.zmusic.player.decoder.ogg.jcraft.jorbis; 28 | 29 | class InfoMode { 30 | int blockflag; 31 | int windowtype; 32 | int transformtype; 33 | int mapping; 34 | } 35 | -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.15.2/src/main/java/me/zhenxin/zmusic/event/ForgeEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.event; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.util.SoundCategory; 5 | import net.minecraftforge.client.event.ClientPlayerNetworkEvent; 6 | import net.minecraftforge.client.event.sound.SoundEvent; 7 | import net.minecraftforge.event.TickEvent; 8 | import net.minecraftforge.eventbus.api.SubscribeEvent; 9 | 10 | /** 11 | * Forge 事件 12 | * 13 | * @author 真心 14 | * @email qgzhenxin@qq.com 15 | * @since 2023/3/17 11:17 16 | */ 17 | public class ForgeEvent { 18 | 19 | @SubscribeEvent 20 | public void onSound(final SoundEvent.SoundSourceEvent e) { 21 | if (!ZMusic.getPlayer().isPlay()) { 22 | return; 23 | } 24 | SoundCategory data = e.getSound().getCategory(); 25 | switch (data) { 26 | case MUSIC: 27 | case RECORDS: 28 | e.getSource().stop(); 29 | break; 30 | default: 31 | } 32 | } 33 | 34 | @SubscribeEvent 35 | public void onServerQuit(final ClientPlayerNetworkEvent.LoggedOutEvent e) { 36 | try { 37 | ZMusic.getPlayer().closePlayer(); 38 | } catch (Exception e1) { 39 | e1.printStackTrace(); 40 | } 41 | } 42 | 43 | 44 | @SubscribeEvent 45 | public void onTick(TickEvent.ClientTickEvent event) { 46 | ZMusic.getPlayer().tick(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.16.5/src/main/java/me/zhenxin/zmusic/event/ForgeEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.event; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.util.SoundCategory; 5 | import net.minecraftforge.client.event.ClientPlayerNetworkEvent; 6 | import net.minecraftforge.client.event.sound.SoundEvent; 7 | import net.minecraftforge.event.TickEvent; 8 | import net.minecraftforge.eventbus.api.SubscribeEvent; 9 | 10 | /** 11 | * Forge 事件 12 | * 13 | * @author 真心 14 | * @email qgzhenxin@qq.com 15 | * @since 2023/3/17 11:17 16 | */ 17 | public class ForgeEvent { 18 | 19 | @SubscribeEvent 20 | public void onSound(final SoundEvent.SoundSourceEvent e) { 21 | if (!ZMusic.getPlayer().isPlay()) { 22 | return; 23 | } 24 | SoundCategory data = e.getSound().getSource(); 25 | switch (data) { 26 | case MUSIC: 27 | case RECORDS: 28 | e.getSource().stop(); 29 | break; 30 | default: 31 | } 32 | } 33 | 34 | @SubscribeEvent 35 | public void onServerQuit(final ClientPlayerNetworkEvent.LoggedOutEvent e) { 36 | try { 37 | ZMusic.getPlayer().closePlayer(); 38 | } catch (Exception e1) { 39 | e1.printStackTrace(); 40 | } 41 | } 42 | 43 | 44 | @SubscribeEvent 45 | public void onTick(TickEvent.ClientTickEvent event) { 46 | ZMusic.getPlayer().tick(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.14.4/src/main/java/me/zhenxin/zmusic/ZMusicMod.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import me.zhenxin.zmusic.manager.SoundManagerImpl; 5 | import net.fabricmc.api.ModInitializer; 6 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; 7 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; 8 | import net.minecraft.util.Identifier; 9 | 10 | import java.nio.charset.StandardCharsets; 11 | 12 | /** 13 | * Mod 主入口 14 | * 15 | * @author 真心 16 | * @email qgzhenxin@qq.com 17 | * @since 2023/1/28 13:01 18 | */ 19 | @SuppressWarnings("AlibabaClassNamingShouldBeCamel") 20 | public class ZMusicMod implements ModInitializer { 21 | 22 | @Override 23 | public void onInitialize() { 24 | ZMusic.setSoundManager(new SoundManagerImpl()); 25 | Identifier identifier = new Identifier("zmusic", "channel"); 26 | ClientPlayNetworking.registerGlobalReceiver(identifier, (client, handler, buf, responseSender) -> { 27 | byte[] buffer = new byte[buf.readableBytes()]; 28 | buf.readBytes(buffer); 29 | buffer[0] = 0; 30 | String message = new String(buffer, StandardCharsets.UTF_8).substring(1); 31 | ClientEvent.onPacket(message); 32 | }); 33 | ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> ClientEvent.onDisconnect()); 34 | ZMusic.onEnable(); 35 | } 36 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.15.2/src/main/java/me/zhenxin/zmusic/ZMusicMod.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import me.zhenxin.zmusic.manager.SoundManagerImpl; 5 | import net.fabricmc.api.ModInitializer; 6 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; 7 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; 8 | import net.minecraft.util.Identifier; 9 | 10 | import java.nio.charset.StandardCharsets; 11 | 12 | /** 13 | * Mod 主入口 14 | * 15 | * @author 真心 16 | * @email qgzhenxin@qq.com 17 | * @since 2023/1/28 13:01 18 | */ 19 | @SuppressWarnings("AlibabaClassNamingShouldBeCamel") 20 | public class ZMusicMod implements ModInitializer { 21 | 22 | @Override 23 | public void onInitialize() { 24 | ZMusic.setSoundManager(new SoundManagerImpl()); 25 | Identifier identifier = new Identifier("zmusic", "channel"); 26 | ClientPlayNetworking.registerGlobalReceiver(identifier, (client, handler, buf, responseSender) -> { 27 | byte[] buffer = new byte[buf.readableBytes()]; 28 | buf.readBytes(buffer); 29 | buffer[0] = 0; 30 | String message = new String(buffer, StandardCharsets.UTF_8).substring(1); 31 | ClientEvent.onPacket(message); 32 | }); 33 | ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> ClientEvent.onDisconnect()); 34 | ZMusic.onEnable(); 35 | } 36 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.16.5/src/main/java/me/zhenxin/zmusic/ZMusicMod.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import me.zhenxin.zmusic.manager.SoundManagerImpl; 5 | import net.fabricmc.api.ModInitializer; 6 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; 7 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; 8 | import net.minecraft.util.Identifier; 9 | 10 | import java.nio.charset.StandardCharsets; 11 | 12 | /** 13 | * Mod 主入口 14 | * 15 | * @author 真心 16 | * @email qgzhenxin@qq.com 17 | * @since 2023/1/28 13:01 18 | */ 19 | @SuppressWarnings("AlibabaClassNamingShouldBeCamel") 20 | public class ZMusicMod implements ModInitializer { 21 | 22 | @Override 23 | public void onInitialize() { 24 | ZMusic.setSoundManager(new SoundManagerImpl()); 25 | Identifier identifier = new Identifier("zmusic", "channel"); 26 | ClientPlayNetworking.registerGlobalReceiver(identifier, (client, handler, buf, responseSender) -> { 27 | byte[] buffer = new byte[buf.readableBytes()]; 28 | buf.readBytes(buffer); 29 | buffer[0] = 0; 30 | String message = new String(buffer, StandardCharsets.UTF_8).substring(1); 31 | ClientEvent.onPacket(message); 32 | }); 33 | ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> ClientEvent.onDisconnect()); 34 | ZMusic.onEnable(); 35 | } 36 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.17.1/src/main/java/me/zhenxin/zmusic/ZMusicMod.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import me.zhenxin.zmusic.manager.SoundManagerImpl; 5 | import net.fabricmc.api.ModInitializer; 6 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; 7 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; 8 | import net.minecraft.util.Identifier; 9 | 10 | import java.nio.charset.StandardCharsets; 11 | 12 | /** 13 | * Mod 主入口 14 | * 15 | * @author 真心 16 | * @email qgzhenxin@qq.com 17 | * @since 2023/1/28 13:01 18 | */ 19 | @SuppressWarnings("AlibabaClassNamingShouldBeCamel") 20 | public class ZMusicMod implements ModInitializer { 21 | 22 | @Override 23 | public void onInitialize() { 24 | ZMusic.setSoundManager(new SoundManagerImpl()); 25 | Identifier identifier = new Identifier("zmusic", "channel"); 26 | ClientPlayNetworking.registerGlobalReceiver(identifier, (client, handler, buf, responseSender) -> { 27 | byte[] buffer = new byte[buf.readableBytes()]; 28 | buf.readBytes(buffer); 29 | buffer[0] = 0; 30 | String message = new String(buffer, StandardCharsets.UTF_8).substring(1); 31 | ClientEvent.onPacket(message); 32 | }); 33 | ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> ClientEvent.onDisconnect()); 34 | ZMusic.onEnable(); 35 | } 36 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.18.2/src/main/java/me/zhenxin/zmusic/ZMusicMod.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import me.zhenxin.zmusic.manager.SoundManagerImpl; 5 | import net.fabricmc.api.ModInitializer; 6 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; 7 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; 8 | import net.minecraft.util.Identifier; 9 | 10 | import java.nio.charset.StandardCharsets; 11 | 12 | /** 13 | * Mod 主入口 14 | * 15 | * @author 真心 16 | * @email qgzhenxin@qq.com 17 | * @since 2023/1/28 13:01 18 | */ 19 | @SuppressWarnings("AlibabaClassNamingShouldBeCamel") 20 | public class ZMusicMod implements ModInitializer { 21 | 22 | @Override 23 | public void onInitialize() { 24 | ZMusic.setSoundManager(new SoundManagerImpl()); 25 | Identifier identifier = new Identifier("zmusic", "channel"); 26 | ClientPlayNetworking.registerGlobalReceiver(identifier, (client, handler, buf, responseSender) -> { 27 | byte[] buffer = new byte[buf.readableBytes()]; 28 | buf.readBytes(buffer); 29 | buffer[0] = 0; 30 | String message = new String(buffer, StandardCharsets.UTF_8).substring(1); 31 | ClientEvent.onPacket(message); 32 | }); 33 | ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> ClientEvent.onDisconnect()); 34 | ZMusic.onEnable(); 35 | } 36 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.2/src/main/java/me/zhenxin/zmusic/ZMusicMod.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import me.zhenxin.zmusic.manager.SoundManagerImpl; 5 | import net.fabricmc.api.ModInitializer; 6 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; 7 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; 8 | import net.minecraft.util.Identifier; 9 | 10 | import java.nio.charset.StandardCharsets; 11 | 12 | /** 13 | * Mod 主入口 14 | * 15 | * @author 真心 16 | * @email qgzhenxin@qq.com 17 | * @since 2023/1/28 13:01 18 | */ 19 | @SuppressWarnings("AlibabaClassNamingShouldBeCamel") 20 | public class ZMusicMod implements ModInitializer { 21 | 22 | @Override 23 | public void onInitialize() { 24 | ZMusic.setSoundManager(new SoundManagerImpl()); 25 | Identifier identifier = new Identifier("zmusic", "channel"); 26 | ClientPlayNetworking.registerGlobalReceiver(identifier, (client, handler, buf, responseSender) -> { 27 | byte[] buffer = new byte[buf.readableBytes()]; 28 | buf.readBytes(buffer); 29 | buffer[0] = 0; 30 | String message = new String(buffer, StandardCharsets.UTF_8).substring(1); 31 | ClientEvent.onPacket(message); 32 | }); 33 | ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> ClientEvent.onDisconnect()); 34 | ZMusic.onEnable(); 35 | } 36 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.3/src/main/java/me/zhenxin/zmusic/ZMusicMod.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import me.zhenxin.zmusic.manager.SoundManagerImpl; 5 | import net.fabricmc.api.ModInitializer; 6 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; 7 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; 8 | import net.minecraft.util.Identifier; 9 | 10 | import java.nio.charset.StandardCharsets; 11 | 12 | /** 13 | * Mod 主入口 14 | * 15 | * @author 真心 16 | * @email qgzhenxin@qq.com 17 | * @since 2023/1/28 13:01 18 | */ 19 | @SuppressWarnings("AlibabaClassNamingShouldBeCamel") 20 | public class ZMusicMod implements ModInitializer { 21 | 22 | @Override 23 | public void onInitialize() { 24 | ZMusic.setSoundManager(new SoundManagerImpl()); 25 | Identifier identifier = new Identifier("zmusic", "channel"); 26 | ClientPlayNetworking.registerGlobalReceiver(identifier, (client, handler, buf, responseSender) -> { 27 | byte[] buffer = new byte[buf.readableBytes()]; 28 | buf.readBytes(buffer); 29 | buffer[0] = 0; 30 | String message = new String(buffer, StandardCharsets.UTF_8).substring(1); 31 | ClientEvent.onPacket(message); 32 | }); 33 | ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> ClientEvent.onDisconnect()); 34 | ZMusic.onEnable(); 35 | } 36 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.19.4/src/main/java/me/zhenxin/zmusic/ZMusicMod.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import me.zhenxin.zmusic.manager.SoundManagerImpl; 5 | import net.fabricmc.api.ModInitializer; 6 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; 7 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; 8 | import net.minecraft.util.Identifier; 9 | 10 | import java.nio.charset.StandardCharsets; 11 | 12 | /** 13 | * Mod 主入口 14 | * 15 | * @author 真心 16 | * @email qgzhenxin@qq.com 17 | * @since 2023/1/28 13:01 18 | */ 19 | @SuppressWarnings("AlibabaClassNamingShouldBeCamel") 20 | public class ZMusicMod implements ModInitializer { 21 | 22 | @Override 23 | public void onInitialize() { 24 | ZMusic.setSoundManager(new SoundManagerImpl()); 25 | Identifier identifier = new Identifier("zmusic", "channel"); 26 | ClientPlayNetworking.registerGlobalReceiver(identifier, (client, handler, buf, responseSender) -> { 27 | byte[] buffer = new byte[buf.readableBytes()]; 28 | buf.readBytes(buffer); 29 | buffer[0] = 0; 30 | String message = new String(buffer, StandardCharsets.UTF_8).substring(1); 31 | ClientEvent.onPacket(message); 32 | }); 33 | ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> ClientEvent.onDisconnect()); 34 | ZMusic.onEnable(); 35 | } 36 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.20/src/main/java/me/zhenxin/zmusic/ZMusicMod.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import me.zhenxin.zmusic.manager.SoundManagerImpl; 5 | import net.fabricmc.api.ModInitializer; 6 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; 7 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; 8 | import net.minecraft.util.Identifier; 9 | 10 | import java.nio.charset.StandardCharsets; 11 | 12 | /** 13 | * Mod 主入口 14 | * 15 | * @author 真心 16 | * @email qgzhenxin@qq.com 17 | * @since 2023/1/28 13:01 18 | */ 19 | @SuppressWarnings("AlibabaClassNamingShouldBeCamel") 20 | public class ZMusicMod implements ModInitializer { 21 | 22 | @Override 23 | public void onInitialize() { 24 | ZMusic.setSoundManager(new SoundManagerImpl()); 25 | Identifier identifier = new Identifier("zmusic", "channel"); 26 | ClientPlayNetworking.registerGlobalReceiver(identifier, (client, handler, buf, responseSender) -> { 27 | byte[] buffer = new byte[buf.readableBytes()]; 28 | buf.readBytes(buffer); 29 | buffer[0] = 0; 30 | String message = new String(buffer, StandardCharsets.UTF_8).substring(1); 31 | ClientEvent.onPacket(message); 32 | }); 33 | ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> ClientEvent.onDisconnect()); 34 | ZMusic.onEnable(); 35 | } 36 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.14.4/src/main/java/me/zhenxin/zmusic/event/ForgeEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.event; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.util.SoundCategory; 5 | import net.minecraftforge.client.event.ClientPlayerNetworkEvent; 6 | import net.minecraftforge.client.event.sound.SoundEvent; 7 | import net.minecraftforge.event.TickEvent; 8 | import net.minecraftforge.eventbus.api.SubscribeEvent; 9 | 10 | /** 11 | * Forge 事件 12 | * 13 | * @author 真心 14 | * @email qgzhenxin@qq.com 15 | * @since 2023/3/17 11:17 16 | */ 17 | public class ForgeEvent { 18 | 19 | @SubscribeEvent 20 | public void onSound(final SoundEvent.SoundSourceEvent e) { 21 | if (!ZMusic.getPlayer().isPlay()) { 22 | return; 23 | } 24 | SoundCategory data = e.getSound().getCategory(); 25 | switch (data) { 26 | case MUSIC: 27 | case RECORDS: 28 | e.getSource().func_216418_f(); 29 | break; 30 | default: 31 | } 32 | } 33 | 34 | @SubscribeEvent 35 | public void onServerQuit(final ClientPlayerNetworkEvent.LoggedOutEvent e) { 36 | try { 37 | ZMusic.getPlayer().closePlayer(); 38 | } catch (Exception e1) { 39 | e1.printStackTrace(); 40 | } 41 | } 42 | 43 | 44 | @SubscribeEvent 45 | public void onTick(TickEvent.ClientTickEvent event) { 46 | ZMusic.getPlayer().tick(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.19.2/src/main/java/me/zhenxin/zmusic/event/ForgeEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.event; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.sounds.SoundSource; 5 | import net.minecraftforge.client.event.ClientPlayerNetworkEvent; 6 | import net.minecraftforge.client.event.sound.SoundEvent; 7 | import net.minecraftforge.event.TickEvent; 8 | import net.minecraftforge.eventbus.api.SubscribeEvent; 9 | 10 | /** 11 | * Forge 事件 12 | * 13 | * @author 真心 14 | * @email qgzhenxin@qq.com 15 | * @since 2023/3/17 11:17 16 | */ 17 | public class ForgeEvent { 18 | 19 | @SubscribeEvent 20 | public void onSound(final SoundEvent.SoundSourceEvent e) { 21 | if (!ZMusic.getPlayer().isPlay()) { 22 | return; 23 | } 24 | SoundSource data = e.getSound().getSource(); 25 | //noinspection EnhancedSwitchMigration 26 | switch (data) { 27 | case MUSIC: 28 | case RECORDS: 29 | e.getChannel().stop(); 30 | break; 31 | default: 32 | } 33 | } 34 | 35 | @SubscribeEvent 36 | public void onServerQuit(final ClientPlayerNetworkEvent.LoggingOut e) { 37 | try { 38 | ZMusic.getPlayer().closePlayer(); 39 | } catch (Exception e1) { 40 | e1.printStackTrace(); 41 | } 42 | } 43 | 44 | 45 | @SubscribeEvent 46 | public void onTick(TickEvent.ClientTickEvent event) { 47 | ZMusic.getPlayer().tick(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.19.3/src/main/java/me/zhenxin/zmusic/event/ForgeEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.event; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.sounds.SoundSource; 5 | import net.minecraftforge.client.event.ClientPlayerNetworkEvent; 6 | import net.minecraftforge.client.event.sound.SoundEvent; 7 | import net.minecraftforge.event.TickEvent; 8 | import net.minecraftforge.eventbus.api.SubscribeEvent; 9 | 10 | /** 11 | * Forge 事件 12 | * 13 | * @author 真心 14 | * @email qgzhenxin@qq.com 15 | * @since 2023/3/17 11:17 16 | */ 17 | public class ForgeEvent { 18 | 19 | @SubscribeEvent 20 | public void onSound(final SoundEvent.SoundSourceEvent e) { 21 | if (!ZMusic.getPlayer().isPlay()) { 22 | return; 23 | } 24 | SoundSource data = e.getSound().getSource(); 25 | //noinspection EnhancedSwitchMigration 26 | switch (data) { 27 | case MUSIC: 28 | case RECORDS: 29 | e.getChannel().stop(); 30 | break; 31 | default: 32 | } 33 | } 34 | 35 | @SubscribeEvent 36 | public void onServerQuit(final ClientPlayerNetworkEvent.LoggingOut e) { 37 | try { 38 | ZMusic.getPlayer().closePlayer(); 39 | } catch (Exception e1) { 40 | e1.printStackTrace(); 41 | } 42 | } 43 | 44 | 45 | @SubscribeEvent 46 | public void onTick(TickEvent.ClientTickEvent event) { 47 | ZMusic.getPlayer().tick(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.19.4/src/main/java/me/zhenxin/zmusic/event/ForgeEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.event; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.sounds.SoundSource; 5 | import net.minecraftforge.client.event.ClientPlayerNetworkEvent; 6 | import net.minecraftforge.client.event.sound.SoundEvent; 7 | import net.minecraftforge.event.TickEvent; 8 | import net.minecraftforge.eventbus.api.SubscribeEvent; 9 | 10 | /** 11 | * Forge 事件 12 | * 13 | * @author 真心 14 | * @email qgzhenxin@qq.com 15 | * @since 2023/3/17 11:17 16 | */ 17 | public class ForgeEvent { 18 | 19 | @SubscribeEvent 20 | public void onSound(final SoundEvent.SoundSourceEvent e) { 21 | if (!ZMusic.getPlayer().isPlay()) { 22 | return; 23 | } 24 | SoundSource data = e.getSound().getSource(); 25 | //noinspection EnhancedSwitchMigration 26 | switch (data) { 27 | case MUSIC: 28 | case RECORDS: 29 | e.getChannel().stop(); 30 | break; 31 | default: 32 | } 33 | } 34 | 35 | @SubscribeEvent 36 | public void onServerQuit(final ClientPlayerNetworkEvent.LoggingOut e) { 37 | try { 38 | ZMusic.getPlayer().closePlayer(); 39 | } catch (Exception e1) { 40 | e1.printStackTrace(); 41 | } 42 | } 43 | 44 | 45 | @SubscribeEvent 46 | public void onTick(TickEvent.ClientTickEvent event) { 47 | ZMusic.getPlayer().tick(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.20/src/main/java/me/zhenxin/zmusic/event/ForgeEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.event; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.sounds.SoundSource; 5 | import net.minecraftforge.client.event.ClientPlayerNetworkEvent; 6 | import net.minecraftforge.client.event.sound.SoundEvent; 7 | import net.minecraftforge.event.TickEvent; 8 | import net.minecraftforge.eventbus.api.SubscribeEvent; 9 | 10 | /** 11 | * Forge 事件 12 | * 13 | * @author 真心 14 | * @email qgzhenxin@qq.com 15 | * @since 2023/3/17 11:17 16 | */ 17 | public class ForgeEvent { 18 | 19 | @SubscribeEvent 20 | public void onSound(final SoundEvent.SoundSourceEvent e) { 21 | if (!ZMusic.getPlayer().isPlay()) { 22 | return; 23 | } 24 | SoundSource data = e.getSound().getSource(); 25 | //noinspection EnhancedSwitchMigration 26 | switch (data) { 27 | case MUSIC: 28 | case RECORDS: 29 | e.getChannel().stop(); 30 | break; 31 | default: 32 | } 33 | } 34 | 35 | @SubscribeEvent 36 | public void onServerQuit(final ClientPlayerNetworkEvent.LoggingOut e) { 37 | try { 38 | ZMusic.getPlayer().closePlayer(); 39 | } catch (Exception e1) { 40 | e1.printStackTrace(); 41 | } 42 | } 43 | 44 | 45 | @SubscribeEvent 46 | public void onTick(TickEvent.ClientTickEvent event) { 47 | ZMusic.getPlayer().tick(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.18.2/src/main/java/me/zhenxin/zmusic/event/ForgeEvent.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic.event; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import net.minecraft.sounds.SoundSource; 5 | import net.minecraftforge.client.event.ClientPlayerNetworkEvent; 6 | import net.minecraftforge.client.event.sound.SoundEvent; 7 | import net.minecraftforge.event.TickEvent; 8 | import net.minecraftforge.eventbus.api.SubscribeEvent; 9 | 10 | /** 11 | * Forge 事件 12 | * 13 | * @author 真心 14 | * @email qgzhenxin@qq.com 15 | * @since 2023/3/17 11:17 16 | */ 17 | public class ForgeEvent { 18 | 19 | @SubscribeEvent 20 | public void onSound(final SoundEvent.SoundSourceEvent e) { 21 | if (!ZMusic.getPlayer().isPlay()) { 22 | return; 23 | } 24 | SoundSource data = e.getSound().getSource(); 25 | //noinspection EnhancedSwitchMigration 26 | switch (data) { 27 | case MUSIC: 28 | case RECORDS: 29 | e.getChannel().stop(); 30 | break; 31 | default: 32 | } 33 | } 34 | 35 | @SubscribeEvent 36 | public void onServerQuit(final ClientPlayerNetworkEvent.LoggedOutEvent e) { 37 | try { 38 | ZMusic.getPlayer().closePlayer(); 39 | } catch (Exception e1) { 40 | e1.printStackTrace(); 41 | } 42 | } 43 | 44 | 45 | @SubscribeEvent 46 | public void onTick(TickEvent.ClientTickEvent event) { 47 | ZMusic.getPlayer().tick(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/mp3/JavaLayerHook.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 11/19/04 1.0 moved to LGPL. 3 | *----------------------------------------------------------------------- 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Library General Public License as published 6 | * by the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Library General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Library General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 | *---------------------------------------------------------------------- 18 | */ 19 | 20 | package me.zhenxin.zmusic.player.decoder.mp3; 21 | 22 | import java.io.InputStream; 23 | 24 | /** 25 | * The JavaLayerHooks class allows developers to change 26 | * the way the JavaLayer library uses Resources. 27 | */ 28 | 29 | public interface JavaLayerHook { 30 | /** 31 | * Retrieves the named resource. This allows resources to be 32 | * obtained without specifying how they are retrieved. 33 | */ 34 | InputStream getResourceAsStream(String name); 35 | } 36 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/flac/DataFormatException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * FLAC library (Java) 3 | * 4 | * Copyright (c) Project Nayuki 5 | * https://www.nayuki.io/page/flac-library-java 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program (see COPYING.txt and COPYING.LESSER.txt). 19 | * If not, see . 20 | */ 21 | 22 | package me.zhenxin.zmusic.player.decoder.flac; 23 | 24 | 25 | /** 26 | * Thrown when data being read violates the FLAC file format. 27 | */ 28 | @SuppressWarnings("serial") 29 | public class DataFormatException extends RuntimeException { 30 | 31 | /*---- Constructors ----*/ 32 | 33 | public DataFormatException() { 34 | super(); 35 | } 36 | 37 | 38 | public DataFormatException(String msg) { 39 | super(msg); 40 | } 41 | 42 | 43 | public DataFormatException(String msg, Throwable cause) { 44 | super(msg, cause); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/ogg/jcraft/jorbis/PsyLook.java: -------------------------------------------------------------------------------- 1 | /* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */ 2 | /* JOrbis 3 | * Copyright (C) 2000 ymnk, JCraft,Inc. 4 | * 5 | * Written by: 2000 ymnk 6 | * 7 | * Many thanks to 8 | * Monty and 9 | * The XIPHOPHORUS Company http://www.xiph.org/ . 10 | * JOrbis has been based on their awesome works, Vorbis codec. 11 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU Library General Public License 14 | * as published by the Free Software Foundation; either version 2 of 15 | * the License, or (at your option) any later version. 16 | 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU Library General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Library General Public 23 | * License along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 | */ 26 | 27 | package me.zhenxin.zmusic.player.decoder.ogg.jcraft.jorbis; 28 | 29 | class PsyLook { 30 | int n; 31 | PsyInfo vi; 32 | 33 | float[][][] tonecurves; 34 | float[][] peakatt; 35 | float[][][] noisecurves; 36 | 37 | float[] ath; 38 | int[] octave; 39 | 40 | void init(PsyInfo vi, int n, int rate) { 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | ![][banner] 4 | 5 | ![][java] 6 | ![][license] 7 | 8 |
9 | 10 | ## 反馈 11 | 12 | * 提交 [Issues](../../issues) 13 | 14 | ## 开发 15 | 16 | ```shell 17 | git clone https://github.com/RealHeart/ZMusic-Mod 18 | cd ZMusic-Mod 19 | ./gradlew clean build 20 | ``` 21 | 22 | ## 开源协议 23 | 24 | 本项目使用 [GPL-3.0](LICENSE) 协议开放源代码 25 | 26 | ```text 27 | ZMusic Client Mods 28 | Copyright (C) 2023 RealHeart 29 | This program is free software: you can redistribute it and/or modify 30 | it under the terms of the GNU General Public License as published by 31 | the Free Software Foundation, either version 3 of the License, or 32 | (at your option) any later version. 33 | This program is distributed in the hope that it will be useful, 34 | but WITHOUT ANY WARRANTY; without even the implied warranty of 35 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 36 | GNU General Public License for more details. 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | ``` 40 | 41 | ## 鸣谢 42 | 43 | * [JetBrains](https://www.jetbrains.com/zh-cn/) 44 | * [FabricMC](https://fabricmc.net/) 45 | * [AllMusic Mod](https://github.com/Coloryr/AllMusic_M) 46 | 47 | [banner]: https://socialify.git.ci/RealHeart/ZMusic-Mod/image?description=1&forks=1&issues=1&language=1&name=1&owner=1&pulls=1&stargazers=1&theme=Auto 48 | 49 | [java]: https://img.shields.io/badge/java-17-blue?style=for-the-badge 50 | 51 | [license]: https://img.shields.io/github/license/RealHeart/ZMusic-Mod?style=for-the-badge 52 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/ogg/jcraft/jorbis/JOrbisException.java: -------------------------------------------------------------------------------- 1 | /* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */ 2 | /* JOrbis 3 | * Copyright (C) 2000 ymnk, JCraft,Inc. 4 | * 5 | * Written by: 2000 ymnk 6 | * 7 | * Many thanks to 8 | * Monty and 9 | * The XIPHOPHORUS Company http://www.xiph.org/ . 10 | * JOrbis has been based on their awesome works, Vorbis codec. 11 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU Library General Public License 14 | * as published by the Free Software Foundation; either version 2 of 15 | * the License, or (at your option) any later version. 16 | 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU Library General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Library General Public 23 | * License along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 | */ 26 | 27 | package me.zhenxin.zmusic.player.decoder.ogg.jcraft.jorbis; 28 | 29 | public class JOrbisException extends Exception { 30 | 31 | private static final long serialVersionUID = 1L; 32 | 33 | public JOrbisException() { 34 | super(); 35 | } 36 | 37 | public JOrbisException(String s) { 38 | super("JOrbis: " + s); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | maven { 4 | name = 'Fabric' 5 | url = 'https://maven.fabricmc.net/' 6 | } 7 | maven { 8 | name = 'Forge' 9 | url = 'https://maven.minecraftforge.net/' 10 | } 11 | mavenCentral() 12 | gradlePluginPortal() 13 | } 14 | } 15 | 16 | rootProject.name = "ZMusic-Mod" 17 | 18 | include("zmusic-core") 19 | include( 20 | "zmusic-fabric", 21 | "zmusic-fabric:zmusic-fabric-1.21.8", 22 | "zmusic-fabric:zmusic-fabric-1.21", 23 | "zmusic-fabric:zmusic-fabric-1.20.5", 24 | "zmusic-fabric:zmusic-fabric-1.20", 25 | "zmusic-fabric:zmusic-fabric-1.19.4", 26 | "zmusic-fabric:zmusic-fabric-1.19.3", 27 | "zmusic-fabric:zmusic-fabric-1.19.2", 28 | "zmusic-fabric:zmusic-fabric-1.18.2", 29 | "zmusic-fabric:zmusic-fabric-1.17.1", 30 | "zmusic-fabric:zmusic-fabric-1.16.5", 31 | "zmusic-fabric:zmusic-fabric-1.15.2", 32 | "zmusic-fabric:zmusic-fabric-1.14.4" 33 | ) 34 | 35 | include( 36 | "zmusic-forge", 37 | "zmusic-forge:zmusic-forge-1.20", 38 | "zmusic-forge:zmusic-forge-1.19.4", 39 | "zmusic-forge:zmusic-forge-1.19.3", 40 | "zmusic-forge:zmusic-forge-1.19.2", 41 | "zmusic-forge:zmusic-forge-1.18.2", 42 | "zmusic-forge:zmusic-forge-1.17.1", 43 | "zmusic-forge:zmusic-forge-1.16.5", 44 | "zmusic-forge:zmusic-forge-1.15.2", 45 | "zmusic-forge:zmusic-forge-1.14.4", 46 | "zmusic-forge:zmusic-forge-1.12.2" 47 | ) -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/ogg/jcraft/jorbis/Residue2.java: -------------------------------------------------------------------------------- 1 | /* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */ 2 | /* JOrbis 3 | * Copyright (C) 2000 ymnk, JCraft,Inc. 4 | * 5 | * Written by: 2000 ymnk 6 | * 7 | * Many thanks to 8 | * Monty and 9 | * The XIPHOPHORUS Company http://www.xiph.org/ . 10 | * JOrbis has been based on their awesome works, Vorbis codec. 11 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU Library General Public License 14 | * as published by the Free Software Foundation; either version 2 of 15 | * the License, or (at your option) any later version. 16 | 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU Library General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Library General Public 23 | * License along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 | */ 26 | 27 | package me.zhenxin.zmusic.player.decoder.ogg.jcraft.jorbis; 28 | 29 | class Residue2 extends Residue0 { 30 | 31 | int inverse(Block vb, Object vl, float[][] in, int[] nonzero, int ch) { 32 | int i = 0; 33 | for (i = 0; i < ch; i++) 34 | if (nonzero[i] != 0) 35 | break; 36 | if (i == ch) 37 | return (0); /* no nonzero vectors */ 38 | 39 | return (_2inverse(vb, vl, in, ch)); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/mp3/JavaLayerErrors.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 11/19/04 1.0 moved to LGPL. 3 | * 12/12/99 Initial version. mdm@techie.com 4 | *----------------------------------------------------------------------- 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Library General Public License as published 7 | * by the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 | *---------------------------------------------------------------------- 19 | */ 20 | 21 | package me.zhenxin.zmusic.player.decoder.mp3; 22 | 23 | /** 24 | * Exception erorr codes for components of the JavaLayer API. 25 | */ 26 | public interface JavaLayerErrors { 27 | /** 28 | * The first bitstream error code. See the {@link DecoderErrors DecoderErrors} 29 | * interface for other bitstream error codes. 30 | */ 31 | int BITSTREAM_ERROR = 0x100; 32 | 33 | /** 34 | * The first decoder error code. See the {@link DecoderErrors DecoderErrors} 35 | * interface for other decoder error codes. 36 | */ 37 | int DECODER_ERROR = 0x200; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/mp3/FrameDecoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 09/26/08 throw exception on subbband alloc error: Christopher G. Jennings (cjennings@acm.org) 3 | * 11/19/04 1.0 moved to LGPL. 4 | * 12/12/99 Initial version. mdm@techie.com 5 | *----------------------------------------------------------------------- 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Library General Public License as published 8 | * by the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | *---------------------------------------------------------------------- 20 | */ 21 | 22 | package me.zhenxin.zmusic.player.decoder.mp3; 23 | 24 | /** 25 | * Implementations of FrameDecoder are responsible for decoding 26 | * an MPEG audio frame. 27 | */ 28 | //REVIEW: the interface currently is too thin. There should be 29 | // methods to specify the output buffer, the synthesis filters and 30 | // possibly other objects used by the decoder. 31 | public interface FrameDecoder { 32 | /** 33 | * Decodes one frame of MPEG audio. 34 | */ 35 | void decodeFrame() throws DecoderException; 36 | 37 | } 38 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/ogg/jcraft/jorbis/Residue1.java: -------------------------------------------------------------------------------- 1 | /* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */ 2 | /* JOrbis 3 | * Copyright (C) 2000 ymnk, JCraft,Inc. 4 | * 5 | * Written by: 2000 ymnk 6 | * 7 | * Many thanks to 8 | * Monty and 9 | * The XIPHOPHORUS Company http://www.xiph.org/ . 10 | * JOrbis has been based on their awesome works, Vorbis codec. 11 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU Library General Public License 14 | * as published by the Free Software Foundation; either version 2 of 15 | * the License, or (at your option) any later version. 16 | 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU Library General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Library General Public 23 | * License along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 | */ 26 | 27 | package me.zhenxin.zmusic.player.decoder.ogg.jcraft.jorbis; 28 | 29 | class Residue1 extends Residue0 { 30 | 31 | int inverse(Block vb, Object vl, float[][] in, int[] nonzero, int ch) { 32 | int used = 0; 33 | for (int i = 0; i < ch; i++) { 34 | if (nonzero[i] != 0) { 35 | in[used++] = in[i]; 36 | } 37 | } 38 | if (used != 0) { 39 | return (_01inverse(vb, vl, in, used, 1)); 40 | } else { 41 | return 0; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/mp3/DecoderErrors.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 09/26/08 throw exception on subbband alloc error: Christopher G. Jennings (cjennings@acm.org) 3 | * 11/19/04 1.0 moved to LGPL. 4 | * 01/12/99 Initial version. mdm@techie.com 5 | *----------------------------------------------------------------------- 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Library General Public License as published 8 | * by the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | *---------------------------------------------------------------------- 20 | */ 21 | 22 | package me.zhenxin.zmusic.player.decoder.mp3; 23 | 24 | /** 25 | * This interface provides constants describing the error 26 | * codes used by the Decoder to indicate errors. 27 | * 28 | * @author MDM 29 | */ 30 | public interface DecoderErrors extends JavaLayerErrors { 31 | 32 | /** 33 | * Layer not supported by the decoder. 34 | */ 35 | int UNSUPPORTED_LAYER = DECODER_ERROR + 1; 36 | 37 | /** 38 | * Illegal allocation in subband layer. Indicates a corrupt stream. 39 | */ 40 | int ILLEGAL_SUBBAND_ALLOCATION = DECODER_ERROR + 2; 41 | 42 | } 43 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/ogg/jcraft/jogg/Packet.java: -------------------------------------------------------------------------------- 1 | /* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */ 2 | /* JOrbis 3 | * Copyright (C) 2000 ymnk, JCraft,Inc. 4 | * 5 | * Written by: 2000 ymnk 6 | * 7 | * Many thanks to 8 | * Monty and 9 | * The XIPHOPHORUS Company http://www.xiph.org/ . 10 | * JOrbis has been based on their awesome works, Vorbis codec. 11 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU Library General Public License 14 | * as published by the Free Software Foundation; either version 2 of 15 | * the License, or (at your option) any later version. 16 | 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU Library General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Library General Public 23 | * License along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 | */ 26 | 27 | package me.zhenxin.zmusic.player.decoder.ogg.jcraft.jogg; 28 | 29 | public class Packet { 30 | public byte[] packet_base; 31 | public int packet; 32 | public int bytes; 33 | public int b_o_s; 34 | public int e_o_s; 35 | 36 | public long granulepos; 37 | 38 | /** 39 | * sequence number for decode; the framing 40 | * knows where there's a hole in the data, 41 | * but we need coupling so that the codec 42 | * (which is in a seperate abstraction 43 | * layer) also knows about the gap 44 | */ 45 | public long packetno; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/ogg/jcraft/jorbis/FuncTime.java: -------------------------------------------------------------------------------- 1 | /* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */ 2 | /* JOrbis 3 | * Copyright (C) 2000 ymnk, JCraft,Inc. 4 | * 5 | * Written by: 2000 ymnk 6 | * 7 | * Many thanks to 8 | * Monty and 9 | * The XIPHOPHORUS Company http://www.xiph.org/ . 10 | * JOrbis has been based on their awesome works, Vorbis codec. 11 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU Library General Public License 14 | * as published by the Free Software Foundation; either version 2 of 15 | * the License, or (at your option) any later version. 16 | 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU Library General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Library General Public 23 | * License along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 | */ 26 | 27 | package me.zhenxin.zmusic.player.decoder.ogg.jcraft.jorbis; 28 | 29 | import me.zhenxin.zmusic.player.decoder.ogg.jcraft.jogg.Buffer; 30 | 31 | abstract class FuncTime { 32 | public static FuncTime[] time_P = {new Time0()}; 33 | 34 | abstract void pack(Object i, Buffer opb); 35 | 36 | abstract Object unpack(Info vi, Buffer opb); 37 | 38 | abstract Object look(DspState vd, InfoMode vm, Object i); 39 | 40 | abstract void free_info(Object i); 41 | 42 | abstract void free_look(Object i); 43 | 44 | abstract int inverse(Block vb, Object i, float[] in, float[] out); 45 | } 46 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/ogg/jcraft/jorbis/FuncMapping.java: -------------------------------------------------------------------------------- 1 | /* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */ 2 | /* JOrbis 3 | * Copyright (C) 2000 ymnk, JCraft,Inc. 4 | * 5 | * Written by: 2000 ymnk 6 | * 7 | * Many thanks to 8 | * Monty and 9 | * The XIPHOPHORUS Company http://www.xiph.org/ . 10 | * JOrbis has been based on their awesome works, Vorbis codec. 11 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU Library General Public License 14 | * as published by the Free Software Foundation; either version 2 of 15 | * the License, or (at your option) any later version. 16 | 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU Library General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Library General Public 23 | * License along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 | */ 26 | 27 | package me.zhenxin.zmusic.player.decoder.ogg.jcraft.jorbis; 28 | 29 | import me.zhenxin.zmusic.player.decoder.ogg.jcraft.jogg.Buffer; 30 | 31 | abstract class FuncMapping { 32 | public static FuncMapping[] mapping_P = {new Mapping0()}; 33 | 34 | abstract void pack(Info info, Object imap, Buffer buffer); 35 | 36 | abstract Object unpack(Info info, Buffer buffer); 37 | 38 | abstract Object look(DspState vd, InfoMode vm, Object m); 39 | 40 | abstract void free_info(Object imap); 41 | 42 | abstract void free_look(Object imap); 43 | 44 | abstract int inverse(Block vd, Object lm); 45 | } 46 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/ogg/jcraft/jorbis/Time0.java: -------------------------------------------------------------------------------- 1 | /* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */ 2 | /* JOrbis 3 | * Copyright (C) 2000 ymnk, JCraft,Inc. 4 | * 5 | * Written by: 2000 ymnk 6 | * 7 | * Many thanks to 8 | * Monty and 9 | * The XIPHOPHORUS Company http://www.xiph.org/ . 10 | * JOrbis has been based on their awesome works, Vorbis codec. 11 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU Library General Public License 14 | * as published by the Free Software Foundation; either version 2 of 15 | * the License, or (at your option) any later version. 16 | 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU Library General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Library General Public 23 | * License along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 | */ 26 | 27 | package me.zhenxin.zmusic.player.decoder.ogg.jcraft.jorbis; 28 | 29 | import me.zhenxin.zmusic.player.decoder.ogg.jcraft.jogg.Buffer; 30 | 31 | class Time0 extends FuncTime { 32 | void pack(Object i, Buffer opb) { 33 | } 34 | 35 | Object unpack(Info vi, Buffer opb) { 36 | return ""; 37 | } 38 | 39 | Object look(DspState vd, InfoMode mi, Object i) { 40 | return ""; 41 | } 42 | 43 | void free_info(Object i) { 44 | } 45 | 46 | void free_look(Object i) { 47 | } 48 | 49 | int inverse(Block vb, Object i, float[] in, float[] out) { 50 | return 0; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/ogg/jcraft/jorbis/FuncResidue.java: -------------------------------------------------------------------------------- 1 | /* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */ 2 | /* JOrbis 3 | * Copyright (C) 2000 ymnk, JCraft,Inc. 4 | * 5 | * Written by: 2000 ymnk 6 | * 7 | * Many thanks to 8 | * Monty and 9 | * The XIPHOPHORUS Company http://www.xiph.org/ . 10 | * JOrbis has been based on their awesome works, Vorbis codec. 11 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU Library General Public License 14 | * as published by the Free Software Foundation; either version 2 of 15 | * the License, or (at your option) any later version. 16 | 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU Library General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Library General Public 23 | * License along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 | */ 26 | 27 | package me.zhenxin.zmusic.player.decoder.ogg.jcraft.jorbis; 28 | 29 | import me.zhenxin.zmusic.player.decoder.ogg.jcraft.jogg.Buffer; 30 | 31 | abstract class FuncResidue { 32 | public static FuncResidue[] residue_P = {new Residue0(), new Residue1(), 33 | new Residue2()}; 34 | 35 | abstract void pack(Object vr, Buffer opb); 36 | 37 | abstract Object unpack(Info vi, Buffer opb); 38 | 39 | abstract Object look(DspState vd, InfoMode vm, Object vr); 40 | 41 | abstract void free_info(Object i); 42 | 43 | abstract void free_look(Object i); 44 | 45 | abstract int inverse(Block vb, Object vl, float[][] in, int[] nonzero, int ch); 46 | } 47 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/mp3/DecoderException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 11/19/04 1.0 moved to LGPL. 3 | * 01/12/99 Initial version. mdm@techie.com 4 | *----------------------------------------------------------------------- 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Library General Public License as published 7 | * by the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 | *---------------------------------------------------------------------- 19 | */ 20 | 21 | package me.zhenxin.zmusic.player.decoder.mp3; 22 | 23 | /** 24 | * The DecoderException represents the class of 25 | * errors that can occur when decoding MPEG audio. 26 | * 27 | * @author MDM 28 | */ 29 | public class DecoderException extends JavaLayerException 30 | implements DecoderErrors { 31 | 32 | public DecoderException(String msg, Throwable t) { 33 | super(msg, t); 34 | } 35 | 36 | public DecoderException(int errorcode, Throwable t) { 37 | this(getErrorString(errorcode), t); 38 | } 39 | 40 | static public String getErrorString(int errorcode) { 41 | // REVIEW: use resource file to map error codes 42 | // to locale-sensitive strings. 43 | 44 | return "Decoder errorcode " + Integer.toHexString(errorcode); 45 | } 46 | 47 | 48 | } 49 | 50 | -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.12.2/src/main/java/me/zhenxin/zmusic/ZMusicMod.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | import me.zhenxin.zmusic.event.ClientEvent; 5 | import me.zhenxin.zmusic.event.ForgeEvent; 6 | import me.zhenxin.zmusic.manager.SoundManagerImpl; 7 | import net.minecraftforge.common.MinecraftForge; 8 | import net.minecraftforge.fml.common.Mod; 9 | import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; 10 | import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; 11 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 12 | import net.minecraftforge.fml.common.network.FMLNetworkEvent; 13 | import net.minecraftforge.fml.common.network.NetworkRegistry; 14 | 15 | import java.nio.charset.StandardCharsets; 16 | 17 | /** 18 | * Mod 主入口 19 | * 20 | * @author 真心 21 | * @email qgzhenxin@qq.com 22 | * @since 2023/1/28 13:01 23 | */ 24 | @SuppressWarnings("AlibabaClassNamingShouldBeCamel") 25 | @Mod(modid = "zmusic", version = "3.0.0", acceptedMinecraftVersions = "[1.12,)") 26 | public class ZMusicMod { 27 | 28 | @Mod.EventHandler 29 | private void onPreInit(FMLPreInitializationEvent event) { 30 | MinecraftForge.EVENT_BUS.register(new ForgeEvent()); 31 | NetworkRegistry.INSTANCE.newEventDrivenChannel("zmusic:channel").register(this); 32 | } 33 | 34 | @Mod.EventHandler 35 | public void onPostInit(FMLPostInitializationEvent event) { 36 | ZMusic.setSoundManager(new SoundManagerImpl()); 37 | ZMusic.onEnable(); 38 | } 39 | 40 | @SubscribeEvent 41 | public void onClientPacket(final FMLNetworkEvent.ClientCustomPacketEvent evt) { 42 | final ByteBuf directBuf = evt.getPacket().payload(); 43 | byte[] array = new byte[directBuf.readableBytes()]; 44 | directBuf.getBytes(directBuf.readerIndex(), array); 45 | array[0] = 0; 46 | String message = new String(array, StandardCharsets.UTF_8).substring(1); 47 | ClientEvent.onPacket(message); 48 | } 49 | } -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/mp3/BitstreamErrors.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 11/19/04 1.0 moved to LGPL. 3 | * 11/17/04 INVALIDFRAME code added. javalayer@javazoom.net 4 | * 12/12/99 Initial version. mdm@techie.com 5 | *----------------------------------------------------------------------- 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Library General Public License as published 8 | * by the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | *---------------------------------------------------------------------- 20 | */ 21 | 22 | package me.zhenxin.zmusic.player.decoder.mp3; 23 | 24 | /** 25 | * This interface describes all error codes that can be thrown 26 | * in BistreamExceptions. 27 | * 28 | * @author MDM 12/12/99 29 | * @see BitstreamException 30 | * @since 0.0.6 31 | */ 32 | 33 | public interface BitstreamErrors extends JavaLayerErrors { 34 | 35 | /** 36 | * An undeterminable error occurred. 37 | */ 38 | int UNKNOWN_ERROR = BITSTREAM_ERROR; 39 | 40 | /** 41 | * A problem occurred reading from the stream. 42 | */ 43 | int STREAM_ERROR = BITSTREAM_ERROR + 2; 44 | 45 | /** 46 | * The end of the stream was reached. 47 | */ 48 | int STREAM_EOF = BITSTREAM_ERROR + 4; 49 | 50 | /** 51 | * Frame data are missing. 52 | */ 53 | int INVALIDFRAME = BITSTREAM_ERROR + 5; 54 | 55 | } 56 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/ogg/jcraft/jorbis/FuncFloor.java: -------------------------------------------------------------------------------- 1 | /* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */ 2 | /* JOrbis 3 | * Copyright (C) 2000 ymnk, JCraft,Inc. 4 | * 5 | * Written by: 2000 ymnk 6 | * 7 | * Many thanks to 8 | * Monty and 9 | * The XIPHOPHORUS Company http://www.xiph.org/ . 10 | * JOrbis has been based on their awesome works, Vorbis codec. 11 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU Library General Public License 14 | * as published by the Free Software Foundation; either version 2 of 15 | * the License, or (at your option) any later version. 16 | 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU Library General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Library General Public 23 | * License along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 | */ 26 | 27 | package me.zhenxin.zmusic.player.decoder.ogg.jcraft.jorbis; 28 | 29 | import me.zhenxin.zmusic.player.decoder.ogg.jcraft.jogg.Buffer; 30 | 31 | abstract class FuncFloor { 32 | 33 | public static FuncFloor[] floor_P = {new Floor0(), new Floor1()}; 34 | 35 | abstract void pack(Object i, Buffer opb); 36 | 37 | abstract Object unpack(Info vi, Buffer opb); 38 | 39 | abstract Object look(DspState vd, InfoMode mi, Object i); 40 | 41 | abstract void free_info(Object i); 42 | 43 | abstract void free_look(Object i); 44 | 45 | abstract void free_state(Object vs); 46 | 47 | abstract int forward(Block vb, Object i, float[] in, float[] out, Object vs); 48 | 49 | abstract Object inverse1(Block vb, Object i, Object memo); 50 | 51 | abstract int inverse2(Block vb, Object i, Object memo, float[] out); 52 | } 53 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/mp3/JavaLayerException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 11/19/04 1.0 moved to LGPL. 3 | * 12/12/99 Initial version. mdm@techie.com 4 | *----------------------------------------------------------------------- 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Library General Public License as published 7 | * by the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 | *---------------------------------------------------------------------- 19 | */ 20 | 21 | package me.zhenxin.zmusic.player.decoder.mp3; 22 | 23 | import java.io.PrintStream; 24 | 25 | 26 | /** 27 | * The JavaLayerException is the base class for all API-level 28 | * exceptions thrown by JavaLayer. To facilitate conversion and 29 | * common handling of exceptions from other domains, the class 30 | * can delegate some functionality to a contained Throwable instance. 31 | *

32 | * 33 | * @author MDM 34 | */ 35 | public class JavaLayerException extends Exception { 36 | 37 | private final Throwable exception; 38 | 39 | public JavaLayerException(String msg, Throwable t) { 40 | super(msg); 41 | exception = t; 42 | } 43 | 44 | public void printStackTrace() { 45 | printStackTrace(System.err); 46 | } 47 | 48 | public void printStackTrace(PrintStream ps) { 49 | if (this.exception == null) { 50 | super.printStackTrace(ps); 51 | } else { 52 | exception.printStackTrace(); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /.github/workflows/stable.yml: -------------------------------------------------------------------------------- 1 | name: Stable Build 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | tags: 7 | - 'v*' 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | - name: Setup Java 15 | uses: actions/setup-java@v4 16 | with: 17 | distribution: 'zulu' 18 | java-version: | 19 | 8 20 | 16 21 | 17 22 | 21 23 | cache: 'gradle' 24 | - name: Setup Gradle 25 | run: chmod +x gradlew 26 | - name: Build with Gradle 27 | run: ./gradlew clean build --no-daemon 28 | - name: Release 29 | uses: softprops/action-gh-release@v1 30 | with: 31 | files: | 32 | zmusic-fabric/zmusic-fabric-1.14.4/build/libs/**.jar 33 | zmusic-fabric/zmusic-fabric-1.15.2/build/libs/**.jar 34 | zmusic-fabric/zmusic-fabric-1.16.5/build/libs/**.jar 35 | zmusic-fabric/zmusic-fabric-1.17.1/build/libs/**.jar 36 | zmusic-fabric/zmusic-fabric-1.18.2/build/libs/**.jar 37 | zmusic-fabric/zmusic-fabric-1.19.2/build/libs/**.jar 38 | zmusic-fabric/zmusic-fabric-1.19.3/build/libs/**.jar 39 | zmusic-fabric/zmusic-fabric-1.19.4/build/libs/**.jar 40 | zmusic-fabric/zmusic-fabric-1.20/build/libs/**.jar 41 | zmusic-fabric/zmusic-fabric-1.20.5/build/libs/**.jar 42 | zmusic-fabric/zmusic-fabric-1.21/build/libs/**.jar 43 | zmusic-forge/zmusic-forge-1.12.2/build/libs/**.jar 44 | zmusic-forge/zmusic-forge-1.14.4/build/libs/**.jar 45 | zmusic-forge/zmusic-forge-1.15.2/build/libs/**.jar 46 | zmusic-forge/zmusic-forge-1.16.5/build/libs/**.jar 47 | zmusic-forge/zmusic-forge-1.17.1/build/libs/**.jar 48 | zmusic-forge/zmusic-forge-1.18.2/build/libs/**.jar 49 | zmusic-forge/zmusic-forge-1.19.2/build/libs/**.jar 50 | zmusic-forge/zmusic-forge-1.19.3/build/libs/**.jar 51 | zmusic-forge/zmusic-forge-1.19.4/build/libs/**.jar 52 | zmusic-forge/zmusic-forge-1.20/build/libs/**.jar 53 | -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.20.5/src/main/java/me/zhenxin/zmusic/ZMusicMod.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import me.zhenxin.zmusic.manager.SoundManagerImpl; 5 | import net.fabricmc.api.ModInitializer; 6 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; 7 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; 8 | import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry; 9 | import net.minecraft.network.PacketByteBuf; 10 | import net.minecraft.network.codec.PacketCodec; 11 | import net.minecraft.network.packet.CustomPayload; 12 | import net.minecraft.util.Identifier; 13 | 14 | import java.nio.charset.StandardCharsets; 15 | 16 | /** 17 | * Mod 主入口 18 | * 19 | * @author 真心 20 | * @email qgzhenxin@qq.com 21 | * @since 2023/1/28 13:01 22 | */ 23 | @SuppressWarnings("AlibabaClassNamingShouldBeCamel") 24 | public class ZMusicMod implements ModInitializer { 25 | 26 | @Override 27 | public void onInitialize() { 28 | ZMusic.setSoundManager(new SoundManagerImpl()); 29 | 30 | record MusicPayload(String str) implements CustomPayload { 31 | public static final Id ID = new CustomPayload.Id<>(new Identifier("zmusic", "channel")); 32 | public static final PacketCodec CODEC = PacketCodec.of((value, buf) -> { 33 | }, buf -> { 34 | byte[] buffer = new byte[buf.readableBytes()]; 35 | buf.readBytes(buffer); 36 | buffer[0] = 0; 37 | String message = new String(buffer, StandardCharsets.UTF_8).substring(1); 38 | return new MusicPayload(message); 39 | }); 40 | 41 | 42 | @Override 43 | public Id getId() { 44 | return ID; 45 | } 46 | } 47 | 48 | PayloadTypeRegistry.playS2C().register(MusicPayload.ID, MusicPayload.CODEC); 49 | ClientPlayNetworking.registerGlobalReceiver(MusicPayload.ID, (payload, context) -> { 50 | ClientEvent.onPacket(payload.str); 51 | }); 52 | 53 | ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> ClientEvent.onDisconnect()); 54 | ZMusic.onEnable(); 55 | } 56 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.21.8/src/main/java/me/zhenxin/zmusic/ZMusicMod.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import me.zhenxin.zmusic.manager.SoundManagerImpl; 5 | import net.fabricmc.api.ModInitializer; 6 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; 7 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; 8 | import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry; 9 | import net.minecraft.network.PacketByteBuf; 10 | import net.minecraft.network.codec.PacketCodec; 11 | import net.minecraft.network.packet.CustomPayload; 12 | import net.minecraft.util.Identifier; 13 | 14 | import java.nio.charset.StandardCharsets; 15 | 16 | /** 17 | * Mod 主入口 18 | * 19 | * @author 真心 20 | * @email qgzhenxin@qq.com 21 | * @since 2023/1/28 13:01 22 | */ 23 | @SuppressWarnings("AlibabaClassNamingShouldBeCamel") 24 | public class ZMusicMod implements ModInitializer { 25 | 26 | @Override 27 | public void onInitialize() { 28 | ZMusic.setSoundManager(new SoundManagerImpl()); 29 | 30 | record MusicPayload(String str) implements CustomPayload { 31 | public static final Id ID = new CustomPayload.Id<>(Identifier.of("zmusic", "channel")); 32 | public static final PacketCodec CODEC = PacketCodec.of((value, buf) -> { 33 | }, buf -> { 34 | byte[] buffer = new byte[buf.readableBytes()]; 35 | buf.readBytes(buffer); 36 | buffer[0] = 0; 37 | String message = new String(buffer, StandardCharsets.UTF_8).substring(1); 38 | return new MusicPayload(message); 39 | }); 40 | 41 | 42 | @Override 43 | public Id getId() { 44 | return ID; 45 | } 46 | } 47 | 48 | PayloadTypeRegistry.playS2C().register(MusicPayload.ID, MusicPayload.CODEC); 49 | ClientPlayNetworking.registerGlobalReceiver(MusicPayload.ID, (payload, context) -> { 50 | ClientEvent.onPacket(payload.str); 51 | }); 52 | 53 | ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> ClientEvent.onDisconnect()); 54 | ZMusic.onEnable(); 55 | } 56 | } -------------------------------------------------------------------------------- /zmusic-fabric/zmusic-fabric-1.21/src/main/java/me/zhenxin/zmusic/ZMusicMod.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import me.zhenxin.zmusic.manager.SoundManagerImpl; 5 | import net.fabricmc.api.ModInitializer; 6 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; 7 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; 8 | import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry; 9 | import net.minecraft.network.PacketByteBuf; 10 | import net.minecraft.network.codec.PacketCodec; 11 | import net.minecraft.network.packet.CustomPayload; 12 | import net.minecraft.util.Identifier; 13 | 14 | import java.nio.charset.StandardCharsets; 15 | 16 | /** 17 | * Mod 主入口 18 | * 19 | * @author 真心 20 | * @email qgzhenxin@qq.com 21 | * @since 2023/1/28 13:01 22 | */ 23 | @SuppressWarnings("AlibabaClassNamingShouldBeCamel") 24 | public class ZMusicMod implements ModInitializer { 25 | 26 | @Override 27 | public void onInitialize() { 28 | ZMusic.setSoundManager(new SoundManagerImpl()); 29 | 30 | record MusicPayload(String str) implements CustomPayload { 31 | public static final Id ID = new CustomPayload.Id<>(Identifier.of("zmusic", "channel")); 32 | public static final PacketCodec CODEC = PacketCodec.of((value, buf) -> { 33 | }, buf -> { 34 | byte[] buffer = new byte[buf.readableBytes()]; 35 | buf.readBytes(buffer); 36 | buffer[0] = 0; 37 | String message = new String(buffer, StandardCharsets.UTF_8).substring(1); 38 | return new MusicPayload(message); 39 | }); 40 | 41 | 42 | @Override 43 | public Id getId() { 44 | return ID; 45 | } 46 | } 47 | 48 | PayloadTypeRegistry.playS2C().register(MusicPayload.ID, MusicPayload.CODEC); 49 | ClientPlayNetworking.registerGlobalReceiver(MusicPayload.ID, (payload, context) -> { 50 | ClientEvent.onPacket(payload.str); 51 | }); 52 | 53 | ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> ClientEvent.onDisconnect()); 54 | ZMusic.onEnable(); 55 | } 56 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.14.4/src/main/java/me/zhenxin/zmusic/ZMusicMod.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import me.zhenxin.zmusic.event.ForgeEvent; 5 | import me.zhenxin.zmusic.manager.SoundManagerImpl; 6 | import net.minecraft.network.PacketBuffer; 7 | import net.minecraft.util.ResourceLocation; 8 | import net.minecraftforge.common.MinecraftForge; 9 | import net.minecraftforge.eventbus.api.IEventBus; 10 | import net.minecraftforge.fml.common.Mod; 11 | import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; 12 | import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; 13 | import net.minecraftforge.fml.network.NetworkEvent; 14 | import net.minecraftforge.fml.network.NetworkRegistry; 15 | import net.minecraftforge.fml.network.simple.SimpleChannel; 16 | 17 | import java.nio.charset.StandardCharsets; 18 | import java.util.function.Supplier; 19 | 20 | /** 21 | * Mod 主入口 22 | * 23 | * @author 真心 24 | * @email qgzhenxin@qq.com 25 | * @since 2023/1/28 13:01 26 | */ 27 | @SuppressWarnings("AlibabaClassNamingShouldBeCamel") 28 | @Mod("zmusic") 29 | public class ZMusicMod { 30 | public ZMusicMod() { 31 | IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); 32 | modEventBus.addListener(this::setup); 33 | MinecraftForge.EVENT_BUS.register(new ForgeEvent()); 34 | } 35 | 36 | private void setup(FMLClientSetupEvent event) { 37 | ZMusic.setSoundManager(new SoundManagerImpl()); 38 | SimpleChannel channel = NetworkRegistry.newSimpleChannel(new ResourceLocation("zmusic", "channel"), 39 | () -> "1.0", s -> true, s -> true); 40 | channel.registerMessage(666, String.class, this::enc, this::dec, this::proc); 41 | ZMusic.onEnable(); 42 | } 43 | 44 | private void enc(String str, PacketBuffer buffer) { 45 | buffer.writeBytes(str.getBytes(StandardCharsets.UTF_8)); 46 | } 47 | 48 | 49 | private String dec(PacketBuffer buffer) { 50 | return buffer.toString(StandardCharsets.UTF_8); 51 | } 52 | 53 | private void proc(String message, Supplier supplier) { 54 | ClientEvent.onPacket(message); 55 | NetworkEvent.Context context = supplier.get(); 56 | context.setPacketHandled(true); 57 | } 58 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.15.2/src/main/java/me/zhenxin/zmusic/ZMusicMod.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import me.zhenxin.zmusic.event.ForgeEvent; 5 | import me.zhenxin.zmusic.manager.SoundManagerImpl; 6 | import net.minecraft.network.PacketBuffer; 7 | import net.minecraft.util.ResourceLocation; 8 | import net.minecraftforge.common.MinecraftForge; 9 | import net.minecraftforge.eventbus.api.IEventBus; 10 | import net.minecraftforge.fml.common.Mod; 11 | import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; 12 | import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; 13 | import net.minecraftforge.fml.network.NetworkEvent; 14 | import net.minecraftforge.fml.network.NetworkRegistry; 15 | import net.minecraftforge.fml.network.simple.SimpleChannel; 16 | 17 | import java.nio.charset.StandardCharsets; 18 | import java.util.function.Supplier; 19 | 20 | /** 21 | * Mod 主入口 22 | * 23 | * @author 真心 24 | * @email qgzhenxin@qq.com 25 | * @since 2023/1/28 13:01 26 | */ 27 | @SuppressWarnings("AlibabaClassNamingShouldBeCamel") 28 | @Mod("zmusic") 29 | public class ZMusicMod { 30 | public ZMusicMod() { 31 | IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); 32 | modEventBus.addListener(this::setup); 33 | MinecraftForge.EVENT_BUS.register(new ForgeEvent()); 34 | } 35 | 36 | private void setup(FMLClientSetupEvent event) { 37 | ZMusic.setSoundManager(new SoundManagerImpl()); 38 | SimpleChannel channel = NetworkRegistry.newSimpleChannel(new ResourceLocation("zmusic", "channel"), 39 | () -> "1.0", s -> true, s -> true); 40 | channel.registerMessage(666, String.class, this::enc, this::dec, this::proc); 41 | ZMusic.onEnable(); 42 | } 43 | 44 | private void enc(String str, PacketBuffer buffer) { 45 | buffer.writeBytes(str.getBytes(StandardCharsets.UTF_8)); 46 | } 47 | 48 | 49 | private String dec(PacketBuffer buffer) { 50 | return buffer.toString(StandardCharsets.UTF_8); 51 | } 52 | 53 | private void proc(String message, Supplier supplier) { 54 | ClientEvent.onPacket(message); 55 | NetworkEvent.Context context = supplier.get(); 56 | context.setPacketHandled(true); 57 | } 58 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.16.5/src/main/java/me/zhenxin/zmusic/ZMusicMod.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import me.zhenxin.zmusic.event.ForgeEvent; 5 | import me.zhenxin.zmusic.manager.SoundManagerImpl; 6 | import net.minecraft.network.PacketBuffer; 7 | import net.minecraft.util.ResourceLocation; 8 | import net.minecraftforge.common.MinecraftForge; 9 | import net.minecraftforge.eventbus.api.IEventBus; 10 | import net.minecraftforge.fml.common.Mod; 11 | import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; 12 | import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; 13 | import net.minecraftforge.fml.network.NetworkEvent; 14 | import net.minecraftforge.fml.network.NetworkRegistry; 15 | import net.minecraftforge.fml.network.simple.SimpleChannel; 16 | 17 | import java.nio.charset.StandardCharsets; 18 | import java.util.function.Supplier; 19 | 20 | /** 21 | * Mod 主入口 22 | * 23 | * @author 真心 24 | * @email qgzhenxin@qq.com 25 | * @since 2023/1/28 13:01 26 | */ 27 | @SuppressWarnings("AlibabaClassNamingShouldBeCamel") 28 | @Mod("zmusic") 29 | public class ZMusicMod { 30 | public ZMusicMod() { 31 | IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); 32 | modEventBus.addListener(this::setup); 33 | MinecraftForge.EVENT_BUS.register(new ForgeEvent()); 34 | } 35 | 36 | private void setup(FMLClientSetupEvent event) { 37 | ZMusic.setSoundManager(new SoundManagerImpl()); 38 | SimpleChannel channel = NetworkRegistry.newSimpleChannel(new ResourceLocation("zmusic", "channel"), 39 | () -> "1.0", s -> true, s -> true); 40 | channel.registerMessage(666, String.class, this::enc, this::dec, this::proc); 41 | ZMusic.onEnable(); 42 | } 43 | 44 | private void enc(String str, PacketBuffer buffer) { 45 | buffer.writeBytes(str.getBytes(StandardCharsets.UTF_8)); 46 | } 47 | 48 | 49 | private String dec(PacketBuffer buffer) { 50 | return buffer.toString(StandardCharsets.UTF_8); 51 | } 52 | 53 | private void proc(String message, Supplier supplier) { 54 | ClientEvent.onPacket(message); 55 | NetworkEvent.Context context = supplier.get(); 56 | context.setPacketHandled(true); 57 | } 58 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.18.2/src/main/java/me/zhenxin/zmusic/ZMusicMod.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import me.zhenxin.zmusic.event.ForgeEvent; 5 | import me.zhenxin.zmusic.manager.SoundManagerImpl; 6 | import net.minecraft.network.FriendlyByteBuf; 7 | import net.minecraft.resources.ResourceLocation; 8 | import net.minecraftforge.common.MinecraftForge; 9 | import net.minecraftforge.eventbus.api.IEventBus; 10 | import net.minecraftforge.fml.common.Mod; 11 | import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; 12 | import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; 13 | import net.minecraftforge.network.NetworkEvent; 14 | import net.minecraftforge.network.NetworkRegistry; 15 | import net.minecraftforge.network.simple.SimpleChannel; 16 | 17 | import java.nio.charset.StandardCharsets; 18 | import java.util.function.Supplier; 19 | 20 | /** 21 | * Mod 主入口 22 | * 23 | * @author 真心 24 | * @email qgzhenxin@qq.com 25 | * @since 2023/1/28 13:01 26 | */ 27 | @SuppressWarnings("AlibabaClassNamingShouldBeCamel") 28 | @Mod("zmusic") 29 | public class ZMusicMod { 30 | public ZMusicMod() { 31 | IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); 32 | modEventBus.addListener(this::setup); 33 | MinecraftForge.EVENT_BUS.register(new ForgeEvent()); 34 | } 35 | 36 | private void setup(FMLClientSetupEvent event) { 37 | ZMusic.setSoundManager(new SoundManagerImpl()); 38 | SimpleChannel channel = NetworkRegistry.newSimpleChannel(new ResourceLocation("zmusic", "channel"), 39 | () -> "1.0", s -> true, s -> true); 40 | channel.registerMessage(666, String.class, this::enc, this::dec, this::proc); 41 | ZMusic.onEnable(); 42 | } 43 | 44 | private void enc(String str, FriendlyByteBuf buffer) { 45 | buffer.writeBytes(str.getBytes(StandardCharsets.UTF_8)); 46 | } 47 | 48 | 49 | private String dec(FriendlyByteBuf buffer) { 50 | return buffer.toString(StandardCharsets.UTF_8); 51 | } 52 | 53 | private void proc(String message, Supplier supplier) { 54 | ClientEvent.onPacket(message); 55 | NetworkEvent.Context context = supplier.get(); 56 | context.setPacketHandled(true); 57 | } 58 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.17.1/src/main/java/me/zhenxin/zmusic/ZMusicMod.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import me.zhenxin.zmusic.event.ClientEvent; 4 | import me.zhenxin.zmusic.event.ForgeEvent; 5 | import me.zhenxin.zmusic.manager.SoundManagerImpl; 6 | import net.minecraft.network.FriendlyByteBuf; 7 | import net.minecraft.resources.ResourceLocation; 8 | import net.minecraftforge.common.MinecraftForge; 9 | import net.minecraftforge.eventbus.api.IEventBus; 10 | import net.minecraftforge.fml.common.Mod; 11 | import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; 12 | import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; 13 | import net.minecraftforge.fmllegacy.network.NetworkEvent; 14 | import net.minecraftforge.fmllegacy.network.NetworkRegistry; 15 | import net.minecraftforge.fmllegacy.network.simple.SimpleChannel; 16 | 17 | import java.nio.charset.StandardCharsets; 18 | import java.util.function.Supplier; 19 | 20 | /** 21 | * Mod 主入口 22 | * 23 | * @author 真心 24 | * @email qgzhenxin@qq.com 25 | * @since 2023/1/28 13:01 26 | */ 27 | @SuppressWarnings("AlibabaClassNamingShouldBeCamel") 28 | @Mod("zmusic") 29 | public class ZMusicMod { 30 | public ZMusicMod() { 31 | IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); 32 | modEventBus.addListener(this::setup); 33 | MinecraftForge.EVENT_BUS.register(new ForgeEvent()); 34 | } 35 | 36 | private void setup(FMLClientSetupEvent event) { 37 | ZMusic.setSoundManager(new SoundManagerImpl()); 38 | SimpleChannel channel = NetworkRegistry.newSimpleChannel(new ResourceLocation("zmusic", "channel"), 39 | () -> "1.0", s -> true, s -> true); 40 | channel.registerMessage(666, String.class, this::enc, this::dec, this::proc); 41 | ZMusic.onEnable(); 42 | } 43 | 44 | private void enc(String str, FriendlyByteBuf buffer) { 45 | buffer.writeBytes(str.getBytes(StandardCharsets.UTF_8)); 46 | } 47 | 48 | 49 | private String dec(FriendlyByteBuf buffer) { 50 | return buffer.toString(StandardCharsets.UTF_8); 51 | } 52 | 53 | private void proc(String message, Supplier supplier) { 54 | ClientEvent.onPacket(message); 55 | NetworkEvent.Context context = supplier.get(); 56 | context.setPacketHandled(true); 57 | } 58 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.20/src/main/java/me/zhenxin/zmusic/ZMusicMod.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import me.zhenxin.zmusic.event.ClientEvent; 5 | import me.zhenxin.zmusic.event.ForgeEvent; 6 | import me.zhenxin.zmusic.manager.SoundManagerImpl; 7 | import net.minecraft.network.FriendlyByteBuf; 8 | import net.minecraft.resources.ResourceLocation; 9 | import net.minecraftforge.common.MinecraftForge; 10 | import net.minecraftforge.eventbus.api.IEventBus; 11 | import net.minecraftforge.fml.common.Mod; 12 | import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; 13 | import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; 14 | import net.minecraftforge.network.NetworkEvent; 15 | import net.minecraftforge.network.NetworkRegistry; 16 | import net.minecraftforge.network.simple.SimpleChannel; 17 | 18 | import java.nio.charset.StandardCharsets; 19 | import java.util.function.Supplier; 20 | 21 | /** 22 | * Mod 主入口 23 | * 24 | * @author 真心 25 | * @email qgzhenxin@qq.com 26 | * @since 2023/1/28 13:01 27 | */ 28 | @SuppressWarnings("AlibabaClassNamingShouldBeCamel") 29 | @Mod("zmusic") 30 | public class ZMusicMod { 31 | public ZMusicMod() { 32 | IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); 33 | modEventBus.addListener(this::setup); 34 | MinecraftForge.EVENT_BUS.register(new ForgeEvent()); 35 | } 36 | 37 | private void setup(FMLClientSetupEvent event) { 38 | ZMusic.setSoundManager(new SoundManagerImpl()); 39 | SimpleChannel channel = NetworkRegistry.newSimpleChannel(new ResourceLocation("zmusic", "channel"), 40 | () -> "1.0", s -> true, s -> true); 41 | channel.registerMessage(666, String.class, this::enc, this::dec, this::proc); 42 | ZMusic.onEnable(); 43 | } 44 | 45 | private void enc(String str, FriendlyByteBuf buffer) { 46 | buffer.writeBytes(str.getBytes(StandardCharsets.UTF_8)); 47 | } 48 | 49 | 50 | private String dec(FriendlyByteBuf buffer) { 51 | return buffer.toString(StandardCharsets.UTF_8); 52 | } 53 | 54 | private void proc(String message, Supplier supplier) { 55 | ClientEvent.onPacket(message); 56 | NetworkEvent.Context context = supplier.get(); 57 | context.setPacketHandled(true); 58 | } 59 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.19.2/src/main/java/me/zhenxin/zmusic/ZMusicMod.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import me.zhenxin.zmusic.event.ClientEvent; 5 | import me.zhenxin.zmusic.event.ForgeEvent; 6 | import me.zhenxin.zmusic.manager.SoundManagerImpl; 7 | import net.minecraft.network.FriendlyByteBuf; 8 | import net.minecraft.resources.ResourceLocation; 9 | import net.minecraftforge.common.MinecraftForge; 10 | import net.minecraftforge.eventbus.api.IEventBus; 11 | import net.minecraftforge.fml.common.Mod; 12 | import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; 13 | import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; 14 | import net.minecraftforge.network.NetworkEvent; 15 | import net.minecraftforge.network.NetworkRegistry; 16 | import net.minecraftforge.network.simple.SimpleChannel; 17 | 18 | import java.nio.charset.StandardCharsets; 19 | import java.util.function.Supplier; 20 | 21 | /** 22 | * Mod 主入口 23 | * 24 | * @author 真心 25 | * @email qgzhenxin@qq.com 26 | * @since 2023/1/28 13:01 27 | */ 28 | @SuppressWarnings("AlibabaClassNamingShouldBeCamel") 29 | @Mod("zmusic") 30 | public class ZMusicMod { 31 | public ZMusicMod() { 32 | IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); 33 | modEventBus.addListener(this::setup); 34 | MinecraftForge.EVENT_BUS.register(new ForgeEvent()); 35 | } 36 | 37 | private void setup(FMLClientSetupEvent event) { 38 | ZMusic.setSoundManager(new SoundManagerImpl()); 39 | SimpleChannel channel = NetworkRegistry.newSimpleChannel(new ResourceLocation("zmusic", "channel"), 40 | () -> "1.0", s -> true, s -> true); 41 | channel.registerMessage(666, String.class, this::enc, this::dec, this::proc); 42 | ZMusic.onEnable(); 43 | } 44 | 45 | private void enc(String str, FriendlyByteBuf buffer) { 46 | buffer.writeBytes(str.getBytes(StandardCharsets.UTF_8)); 47 | } 48 | 49 | 50 | private String dec(FriendlyByteBuf buffer) { 51 | return buffer.toString(StandardCharsets.UTF_8); 52 | } 53 | 54 | private void proc(String message, Supplier supplier) { 55 | ClientEvent.onPacket(message); 56 | NetworkEvent.Context context = supplier.get(); 57 | context.setPacketHandled(true); 58 | } 59 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.19.3/src/main/java/me/zhenxin/zmusic/ZMusicMod.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import me.zhenxin.zmusic.event.ClientEvent; 5 | import me.zhenxin.zmusic.event.ForgeEvent; 6 | import me.zhenxin.zmusic.manager.SoundManagerImpl; 7 | import net.minecraft.network.FriendlyByteBuf; 8 | import net.minecraft.resources.ResourceLocation; 9 | import net.minecraftforge.common.MinecraftForge; 10 | import net.minecraftforge.eventbus.api.IEventBus; 11 | import net.minecraftforge.fml.common.Mod; 12 | import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; 13 | import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; 14 | import net.minecraftforge.network.NetworkEvent; 15 | import net.minecraftforge.network.NetworkRegistry; 16 | import net.minecraftforge.network.simple.SimpleChannel; 17 | 18 | import java.nio.charset.StandardCharsets; 19 | import java.util.function.Supplier; 20 | 21 | /** 22 | * Mod 主入口 23 | * 24 | * @author 真心 25 | * @email qgzhenxin@qq.com 26 | * @since 2023/1/28 13:01 27 | */ 28 | @SuppressWarnings("AlibabaClassNamingShouldBeCamel") 29 | @Mod("zmusic") 30 | public class ZMusicMod { 31 | public ZMusicMod() { 32 | IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); 33 | modEventBus.addListener(this::setup); 34 | MinecraftForge.EVENT_BUS.register(new ForgeEvent()); 35 | } 36 | 37 | private void setup(FMLClientSetupEvent event) { 38 | ZMusic.setSoundManager(new SoundManagerImpl()); 39 | SimpleChannel channel = NetworkRegistry.newSimpleChannel(new ResourceLocation("zmusic", "channel"), 40 | () -> "1.0", s -> true, s -> true); 41 | channel.registerMessage(666, String.class, this::enc, this::dec, this::proc); 42 | ZMusic.onEnable(); 43 | } 44 | 45 | private void enc(String str, FriendlyByteBuf buffer) { 46 | buffer.writeBytes(str.getBytes(StandardCharsets.UTF_8)); 47 | } 48 | 49 | 50 | private String dec(FriendlyByteBuf buffer) { 51 | return buffer.toString(StandardCharsets.UTF_8); 52 | } 53 | 54 | private void proc(String message, Supplier supplier) { 55 | ClientEvent.onPacket(message); 56 | NetworkEvent.Context context = supplier.get(); 57 | context.setPacketHandled(true); 58 | } 59 | } -------------------------------------------------------------------------------- /zmusic-forge/zmusic-forge-1.19.4/src/main/java/me/zhenxin/zmusic/ZMusicMod.java: -------------------------------------------------------------------------------- 1 | package me.zhenxin.zmusic; 2 | 3 | import me.zhenxin.zmusic.ZMusic; 4 | import me.zhenxin.zmusic.event.ClientEvent; 5 | import me.zhenxin.zmusic.event.ForgeEvent; 6 | import me.zhenxin.zmusic.manager.SoundManagerImpl; 7 | import net.minecraft.network.FriendlyByteBuf; 8 | import net.minecraft.resources.ResourceLocation; 9 | import net.minecraftforge.common.MinecraftForge; 10 | import net.minecraftforge.eventbus.api.IEventBus; 11 | import net.minecraftforge.fml.common.Mod; 12 | import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; 13 | import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; 14 | import net.minecraftforge.network.NetworkEvent; 15 | import net.minecraftforge.network.NetworkRegistry; 16 | import net.minecraftforge.network.simple.SimpleChannel; 17 | 18 | import java.nio.charset.StandardCharsets; 19 | import java.util.function.Supplier; 20 | 21 | /** 22 | * Mod 主入口 23 | * 24 | * @author 真心 25 | * @email qgzhenxin@qq.com 26 | * @since 2023/1/28 13:01 27 | */ 28 | @SuppressWarnings("AlibabaClassNamingShouldBeCamel") 29 | @Mod("zmusic") 30 | public class ZMusicMod { 31 | public ZMusicMod() { 32 | IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); 33 | modEventBus.addListener(this::setup); 34 | MinecraftForge.EVENT_BUS.register(new ForgeEvent()); 35 | } 36 | 37 | private void setup(FMLClientSetupEvent event) { 38 | ZMusic.setSoundManager(new SoundManagerImpl()); 39 | SimpleChannel channel = NetworkRegistry.newSimpleChannel(new ResourceLocation("zmusic", "channel"), 40 | () -> "1.0", s -> true, s -> true); 41 | channel.registerMessage(666, String.class, this::enc, this::dec, this::proc); 42 | ZMusic.onEnable(); 43 | } 44 | 45 | private void enc(String str, FriendlyByteBuf buffer) { 46 | buffer.writeBytes(str.getBytes(StandardCharsets.UTF_8)); 47 | } 48 | 49 | 50 | private String dec(FriendlyByteBuf buffer) { 51 | return buffer.toString(StandardCharsets.UTF_8); 52 | } 53 | 54 | private void proc(String message, Supplier supplier) { 55 | ClientEvent.onPacket(message); 56 | NetworkEvent.Context context = supplier.get(); 57 | context.setPacketHandled(true); 58 | } 59 | } -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/flac/SeekableFileFlacInput.java: -------------------------------------------------------------------------------- 1 | /* 2 | * FLAC library (Java) 3 | * 4 | * Copyright (c) Project Nayuki 5 | * https://www.nayuki.io/page/flac-library-java 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program (see COPYING.txt and COPYING.LESSER.txt). 19 | * If not, see . 20 | */ 21 | 22 | package me.zhenxin.zmusic.player.decoder.flac; 23 | 24 | import me.zhenxin.zmusic.player.MusicPlayer; 25 | 26 | import java.io.BufferedInputStream; 27 | import java.io.IOException; 28 | import java.io.RandomAccessFile; 29 | 30 | 31 | /** 32 | * A FLAC input stream based on a {@link RandomAccessFile}. 33 | */ 34 | public final class SeekableFileFlacInput extends AbstractFlacLowLevelInput { 35 | 36 | /*---- Fields ----*/ 37 | 38 | // The underlying byte-based input stream to read from. 39 | private BufferedInputStream raf; 40 | 41 | /*---- Constructors ----*/ 42 | 43 | public SeekableFileFlacInput(MusicPlayer player) { 44 | super(); 45 | this.raf = new BufferedInputStream(player); 46 | } 47 | 48 | /*---- Methods ----*/ 49 | 50 | public long getLength() { 51 | try { 52 | return raf.available(); 53 | } catch (IOException e) { 54 | throw new RuntimeException(e); 55 | } 56 | } 57 | 58 | protected int readUnderlying(byte[] buf, int off, int len) throws IOException { 59 | return raf.read(buf, off, len); 60 | } 61 | 62 | // Closes the underlying RandomAccessFile stream (very important). 63 | public void close() throws IOException { 64 | if (raf != null) { 65 | raf.close(); 66 | raf = null; 67 | super.close(); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/mp3/Crc16.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 11/19/04 : 1.0 moved to LGPL. 3 | * 4 | * 02/12/99 : Java Conversion by E.B , javalayer@javazoom.net 5 | * 6 | * @(#) crc.h 1.5, last edit: 6/15/94 16:55:32 7 | * @(#) Copyright (C) 1993, 1994 Tobias Bading (bading@cs.tu-berlin.de) 8 | * @(#) Berlin University of Technology 9 | *----------------------------------------------------------------------- 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Library General Public License as published 12 | * by the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Library General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Library General Public 21 | * License along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23 | *---------------------------------------------------------------------- 24 | */ 25 | package me.zhenxin.zmusic.player.decoder.mp3; 26 | 27 | /** 28 | * 16-Bit CRC checksum 29 | */ 30 | public final class Crc16 { 31 | private short crc; 32 | 33 | /** 34 | * Dummy Constructor 35 | */ 36 | public Crc16() { 37 | crc = (short) 0xFFFF; 38 | } 39 | 40 | /** 41 | * Feed a bitstring to the crc calculation (0 < length <= 32). 42 | */ 43 | public void add_bits(int bitstring, int length) { 44 | int bitmask = 1 << (length - 1); 45 | do 46 | if (((crc & 0x8000) == 0) ^ ((bitstring & bitmask) == 0)) { 47 | crc <<= 1; 48 | short polynomial = (short) 0x8005; 49 | crc ^= polynomial; 50 | } else 51 | crc <<= 1; 52 | while ((bitmask >>>= 1) != 0); 53 | } 54 | 55 | /** 56 | * Return the calculated checksum. 57 | * Erase it for next calls to add_bits(). 58 | */ 59 | public short checksum() { 60 | short sum = crc; 61 | crc = (short) 0xFFFF; 62 | return sum; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/mp3/BitstreamException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 11/19/04 1.0 moved to LGPL. 3 | * 12/12/99 Initial version. mdm@techie.com 4 | *----------------------------------------------------------------------- 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Library General Public License as published 7 | * by the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 | *---------------------------------------------------------------------- 19 | */ 20 | 21 | package me.zhenxin.zmusic.player.decoder.mp3; 22 | 23 | /** 24 | * Instances of BitstreamException are thrown 25 | * when operations on a Bitstream fail. 26 | *

27 | * The exception provides details of the exception condition 28 | * in two ways: 29 | *

  1. 30 | * as an error-code describing the nature of the error 31 | *


  2. 32 | * as the Throwable instance, if any, that was thrown 33 | * indicating that an exceptional condition has occurred. 34 | *

35 | * 36 | * @author MDM 12/12/99 37 | * @since 0.0.6 38 | */ 39 | 40 | public class BitstreamException extends JavaLayerException 41 | implements BitstreamErrors { 42 | private int errorcode = UNKNOWN_ERROR; 43 | 44 | public BitstreamException(String msg, Throwable t) { 45 | super(msg, t); 46 | } 47 | 48 | public BitstreamException(int errorcode, Throwable t) { 49 | this(getErrorString(errorcode), t); 50 | this.errorcode = errorcode; 51 | } 52 | 53 | static public String getErrorString(int errorcode) { 54 | // REVIEW: use resource bundle to map error codes 55 | // to locale-sensitive strings. 56 | 57 | return "Bitstream errorcode " + Integer.toHexString(errorcode); 58 | } 59 | 60 | public int getErrorCode() { 61 | return errorcode; 62 | } 63 | 64 | 65 | } 66 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/mp3/OutputChannels.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 11/19/04 1.0 moved to LGPL. 3 | * 12/12/99 Initial implementation. mdm@techie.com. 4 | *----------------------------------------------------------------------- 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Library General Public License as published 7 | * by the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 | *---------------------------------------------------------------------- 19 | */ 20 | 21 | package me.zhenxin.zmusic.player.decoder.mp3; 22 | 23 | 24 | /** 25 | * A Type-safe representation of the the supported output channel 26 | * constants. 27 | *

28 | * This class is immutable and, hence, is thread safe. 29 | * 30 | * @author Mat McGowan 12/12/99 31 | * @since 0.0.7 32 | */ 33 | public class OutputChannels { 34 | /** 35 | * Flag to indicate output should include both channels. 36 | */ 37 | public static final int BOTH_CHANNELS = 0; 38 | 39 | /** 40 | * Flag to indicate output should include the left channel only. 41 | */ 42 | public static final int LEFT_CHANNEL = 1; 43 | 44 | /** 45 | * Flag to indicate output should include the right channel only. 46 | */ 47 | public static final int RIGHT_CHANNEL = 2; 48 | 49 | /** 50 | * Flag to indicate output is mono. 51 | */ 52 | public static final int DOWNMIX_CHANNELS = 3; 53 | 54 | 55 | private final int outputChannels; 56 | 57 | private OutputChannels(int channels) { 58 | outputChannels = channels; 59 | 60 | if (channels < 0 || channels > 3) 61 | throw new IllegalArgumentException("channels"); 62 | } 63 | 64 | 65 | public boolean equals(Object o) { 66 | boolean equals = false; 67 | 68 | if (o instanceof OutputChannels) { 69 | OutputChannels oc = (OutputChannels) o; 70 | equals = (oc.outputChannels == outputChannels); 71 | } 72 | 73 | return equals; 74 | } 75 | 76 | public int hashCode() { 77 | return outputChannels; 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/ogg/jcraft/jorbis/PsyInfo.java: -------------------------------------------------------------------------------- 1 | /* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */ 2 | /* JOrbis 3 | * Copyright (C) 2000 ymnk, JCraft,Inc. 4 | * 5 | * Written by: 2000 ymnk 6 | * 7 | * Many thanks to 8 | * Monty and 9 | * The XIPHOPHORUS Company http://www.xiph.org/ . 10 | * JOrbis has been based on their awesome works, Vorbis codec. 11 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU Library General Public License 14 | * as published by the Free Software Foundation; either version 2 of 15 | * the License, or (at your option) any later version. 16 | 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU Library General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Library General Public 23 | * License along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 | */ 26 | 27 | package me.zhenxin.zmusic.player.decoder.ogg.jcraft.jorbis; 28 | 29 | // psychoacoustic setup 30 | class PsyInfo { 31 | int athp; 32 | int decayp; 33 | int smoothp; 34 | int noisefitp; 35 | int noisefit_subblock; 36 | float noisefit_threshdB; 37 | 38 | float ath_att; 39 | 40 | int tonemaskp; 41 | float[] toneatt_125Hz = new float[5]; 42 | float[] toneatt_250Hz = new float[5]; 43 | float[] toneatt_500Hz = new float[5]; 44 | float[] toneatt_1000Hz = new float[5]; 45 | float[] toneatt_2000Hz = new float[5]; 46 | float[] toneatt_4000Hz = new float[5]; 47 | float[] toneatt_8000Hz = new float[5]; 48 | 49 | int peakattp; 50 | float[] peakatt_125Hz = new float[5]; 51 | float[] peakatt_250Hz = new float[5]; 52 | float[] peakatt_500Hz = new float[5]; 53 | float[] peakatt_1000Hz = new float[5]; 54 | float[] peakatt_2000Hz = new float[5]; 55 | float[] peakatt_4000Hz = new float[5]; 56 | float[] peakatt_8000Hz = new float[5]; 57 | 58 | int noisemaskp; 59 | float[] noiseatt_125Hz = new float[5]; 60 | float[] noiseatt_250Hz = new float[5]; 61 | float[] noiseatt_500Hz = new float[5]; 62 | float[] noiseatt_1000Hz = new float[5]; 63 | float[] noiseatt_2000Hz = new float[5]; 64 | float[] noiseatt_4000Hz = new float[5]; 65 | float[] noiseatt_8000Hz = new float[5]; 66 | 67 | float max_curve_dB; 68 | 69 | float attack_coeff; 70 | float decay_coeff; 71 | 72 | void free() { 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /zmusic-core/src/main/java/me/zhenxin/zmusic/player/decoder/flac/ByteArrayFlacInput.java: -------------------------------------------------------------------------------- 1 | /* 2 | * FLAC library (Java) 3 | * 4 | * Copyright (c) Project Nayuki 5 | * https://www.nayuki.io/page/flac-library-java 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program (see COPYING.txt and COPYING.LESSER.txt). 19 | * If not, see . 20 | */ 21 | 22 | package me.zhenxin.zmusic.player.decoder.flac; 23 | 24 | import java.io.IOException; 25 | import java.util.Objects; 26 | 27 | 28 | /** 29 | * A FLAC input stream based on a fixed byte array. 30 | */ 31 | public final class ByteArrayFlacInput extends AbstractFlacLowLevelInput { 32 | 33 | /*---- Fields ----*/ 34 | 35 | // The underlying byte array to read from. 36 | private byte[] data; 37 | private int offset; 38 | 39 | 40 | 41 | /*---- Constructors ----*/ 42 | 43 | public ByteArrayFlacInput(byte[] b) { 44 | super(); 45 | data = Objects.requireNonNull(b); 46 | offset = 0; 47 | } 48 | 49 | 50 | 51 | /*---- Methods ----*/ 52 | 53 | public long getLength() { 54 | return data.length; 55 | } 56 | 57 | 58 | public void seekTo(long pos) { 59 | offset = (int) pos; 60 | positionChanged(pos); 61 | } 62 | 63 | 64 | protected int readUnderlying(byte[] buf, int off, int len) { 65 | if (off < 0 || off > buf.length || len < 0 || len > buf.length - off) 66 | throw new ArrayIndexOutOfBoundsException(); 67 | int n = Math.min(data.length - offset, len); 68 | if (n == 0) 69 | return -1; 70 | System.arraycopy(data, offset, buf, off, n); 71 | offset += n; 72 | return n; 73 | } 74 | 75 | 76 | // Discards data buffers and invalidates this stream. Because this class and its superclass 77 | // only use memory and have no native resources, it's okay to simply let a ByteArrayFlacInput 78 | // be garbage-collected without calling close(). 79 | public void close() throws IOException { 80 | if (data != null) { 81 | data = null; 82 | super.close(); 83 | } 84 | } 85 | 86 | } 87 | --------------------------------------------------------------------------------