generated from QuiltMC/quilt-template-mod
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from Pixaurora/feature/minecraft-b1.7
Add support for Minecraft Beta 1.7
- Loading branch information
Showing
54 changed files
with
1,179 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
build-logic/src/main/kotlin/kit_tunes.legacy_submodule.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import org.gradle.accessors.dm.LibrariesForLibs | ||
import net.pixaurora.kit_tunes.build_logic.ProjectMetadata | ||
import net.pixaurora.kit_tunes.build_logic.mod_resources_gen.extension.ModResourcesExtension | ||
|
||
plugins { | ||
id("kit_tunes.submodule") | ||
id("ploceus") | ||
} | ||
|
||
val libs = the<LibrariesForLibs>() | ||
|
||
loom { | ||
clientOnlyMinecraftJar() | ||
} | ||
|
||
ploceus { | ||
clientOnlyMappings() | ||
} | ||
|
||
val minecraft_version = project.property("minecraft_version") | ||
|
||
dependencies { | ||
minecraft("com.mojang:minecraft:${minecraft_version}") | ||
mappings(ploceus.featherMappings(project.property("feather_build") as String)) | ||
|
||
exceptions(ploceus.raven(project.property("raven_build") as String)) | ||
signatures(ploceus.sparrow(project.property("sparrow_build") as String)) | ||
nests(ploceus.nests(project.property("nests_build") as String)) | ||
|
||
|
||
modImplementation(libs.quilt.loader) | ||
} | ||
|
7 changes: 7 additions & 0 deletions
7
build-logic/src/main/kotlin/kit_tunes.modern_submodule.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
plugins { | ||
id("kit_tunes.submodule") | ||
} | ||
|
||
dependencies { | ||
mappings(loom.officialMojangMappings()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
plugins { | ||
id("kit_tunes.java.08") | ||
id("kit_tunes.legacy_submodule") | ||
} | ||
|
||
mod { | ||
intermediaryMappings = "net.fabricmc:intermediary" | ||
accessWidener("kitten_sounds.accesswidener") | ||
mixin("kitten_sounds.mixins.json") | ||
} | ||
|
||
dependencies { | ||
implementation(project(":projects:kit-tunes-api")) | ||
implementation(project(":projects:kitten-heart")) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Mod properties | ||
|
||
minecraft_version_min = 1.0.0-beta.7.3 | ||
minecraft_version_max = 1.0.0-beta.7.3 | ||
|
||
minecraft_version = b1.7.3 | ||
|
||
feather_build = 23 | ||
raven_build = 1 | ||
sparrow_build = 1 | ||
nests_build = 4 |
42 changes: 42 additions & 0 deletions
42
...itten-sounds/b1.7.3/src/main/java/net/pixaurora/kitten_sounds/impl/MusicControlsImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package net.pixaurora.kitten_sounds.impl; | ||
|
||
import java.util.concurrent.atomic.AtomicReference; | ||
|
||
import net.pixaurora.kitten_heart.impl.music.control.MusicControls; | ||
import net.pixaurora.kitten_heart.impl.music.control.PlaybackState; | ||
|
||
public class MusicControlsImpl implements MusicControls { | ||
private String source; | ||
private final AtomicReference<PlaybackState> playbackState = new AtomicReference<>(PlaybackState.STOPPED); | ||
|
||
public void channel(String source) { | ||
this.source = source; | ||
} | ||
|
||
@Override | ||
public void pause() { | ||
SoundEventsUtils.system().pause(this.source); | ||
} | ||
|
||
@Override | ||
public void unpause() { | ||
SoundEventsUtils.system().play(this.source); | ||
} | ||
|
||
@Override | ||
public PlaybackState playbackState() { | ||
return this.playbackState.get(); | ||
} | ||
|
||
public void updatePlaybackState() { | ||
this.playbackState.set(computePlaybackState()); | ||
} | ||
|
||
public PlaybackState computePlaybackState() { | ||
if (SoundEventsUtils.system().playing(this.source)) { | ||
return PlaybackState.PLAYING; | ||
} else { | ||
return PlaybackState.PAUSED; | ||
} | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...cts/kitten-sounds/b1.7.3/src/main/java/net/pixaurora/kitten_sounds/impl/MusicPolling.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package net.pixaurora.kitten_sounds.impl; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import net.minecraft.client.sound.system.SoundFile; | ||
import net.pixaurora.kitten_heart.impl.EventHandling; | ||
import net.pixaurora.kitten_heart.impl.music.progress.PolledListeningProgress; | ||
|
||
public class MusicPolling { | ||
public static List<PolledSong> TRACKS_TO_POLL = new ArrayList<>(); | ||
public static List<PolledSong> POLLED_TRACKS = new ArrayList<>(); | ||
|
||
public static void onPlaySong(SoundFile sound, String source) { | ||
MusicControlsImpl controls = new MusicControlsImpl(); | ||
|
||
PolledListeningProgress progress = EventHandling | ||
.handleTrackStart(SoundEventsUtils.minecraftTypeToInternalType(sound.path), controls); | ||
|
||
TRACKS_TO_POLL.add(new PolledSong(source, progress, controls)); | ||
} | ||
|
||
public static void pollTrackProgress() { | ||
TRACKS_TO_POLL.removeIf((polledSong) -> { | ||
if (SoundEventsUtils.system().playing(polledSong.polled())) { | ||
POLLED_TRACKS.add(polledSong); | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
}); | ||
|
||
POLLED_TRACKS.removeIf((polledSong) -> { | ||
if (!SoundEventsUtils.system().playing(polledSong.polled())) { | ||
EventHandling.handleTrackEnd(polledSong.progress()); | ||
|
||
return true; | ||
} else { | ||
polledSong.progress().measureProgress(polledSong); | ||
polledSong.controls().updatePlaybackState(); | ||
|
||
return false; | ||
} | ||
|
||
}); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
projects/kitten-sounds/b1.7.3/src/main/java/net/pixaurora/kitten_sounds/impl/PolledSong.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package net.pixaurora.kitten_sounds.impl; | ||
|
||
import net.pixaurora.kitten_heart.impl.music.progress.PolledListeningProgress; | ||
import net.pixaurora.kitten_heart.impl.music.progress.SongProgressTracker; | ||
|
||
public class PolledSong implements SongProgressTracker { | ||
private final String source; | ||
|
||
private final PolledListeningProgress progress; | ||
private final MusicControlsImpl controls; | ||
|
||
public PolledSong(String source, PolledSong previous) { | ||
this.source = source; | ||
this.progress = previous.progress; | ||
this.controls = previous.controls; | ||
} | ||
|
||
public PolledSong(String source, PolledListeningProgress progress, MusicControlsImpl controls) { | ||
this.source = source; | ||
this.progress = progress; | ||
this.controls = controls; | ||
} | ||
|
||
public String polled() { | ||
return this.source; | ||
} | ||
|
||
public PolledListeningProgress progress() { | ||
return this.progress; | ||
} | ||
|
||
public MusicControlsImpl controls() { | ||
return this.controls; | ||
} | ||
|
||
@Override | ||
public float kit_tunes$playbackPosition() { | ||
float millisPlayed = System.currentTimeMillis() - this.progress.startTime().toEpochMilli(); | ||
return millisPlayed / 1000; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...kitten-sounds/b1.7.3/src/main/java/net/pixaurora/kitten_sounds/impl/SoundEventsUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package net.pixaurora.kitten_sounds.impl; | ||
|
||
import net.minecraft.client.sound.system.SoundEngine; | ||
import net.pixaurora.kit_tunes.api.resource.ResourcePath; | ||
import net.pixaurora.kitten_heart.impl.resource.ResourcePathImpl; | ||
import paulscode.sound.SoundSystem; | ||
|
||
public class SoundEventsUtils { | ||
public static SoundSystem system() { | ||
return SoundEngine.system; | ||
} | ||
|
||
public static ResourcePath minecraftTypeToInternalType(String identifier) { | ||
return new ResourcePathImpl("", identifier); | ||
} | ||
} |
Oops, something went wrong.