Skip to content

Commit

Permalink
cloud tweaks, music bug
Browse files Browse the repository at this point in the history
  • Loading branch information
MBatt1 committed Sep 15, 2024
1 parent 35cf764 commit 775a87e
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package net.id.paradiselost.mixin.client;

import net.id.paradiselost.util.ParadiseLostSoundEvents;
import net.id.paradiselost.world.dimension.ParadiseLostDimension;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.sound.MusicSound;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(MinecraftClient.class)
public class MinecraftClientMixin {

@Shadow
@Nullable
ClientPlayerEntity player;

@Inject(method = "getMusicType", at = @At(value = "RETURN"), cancellable = true)
void getMusicType(CallbackInfoReturnable<MusicSound> cir) {
if (this.player != null && this.player.getWorld().getRegistryKey() == ParadiseLostDimension.PARADISE_LOST_WORLD_KEY) {
cir.setReturnValue(ParadiseLostSoundEvents.PARADISE_MUSIC_SOUND);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.sound.MusicSound;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Identifier;

import static net.id.paradiselost.ParadiseLost.locate;
Expand Down Expand Up @@ -38,6 +40,8 @@ public final class ParadiseLostSoundEvents {

public static final SoundEvent MUSIC_PARADISE_LOST = register("music.paradise");

public static final MusicSound PARADISE_MUSIC_SOUND = new MusicSound(Registries.SOUND_EVENT.getEntry(MUSIC_PARADISE_LOST), 6000, 24000, true);

public static void init() {
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/main/resources/paradise_lost.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
],
"client": [
"client.ClientWorldMixin",
"client.MinecraftClientMixin",
"client.network.ClientPlayerEntityMixin",
"client.render.BackgroundRendererMixin",
"client.render.CloudRendererMixin",
Expand Down

0 comments on commit 775a87e

Please sign in to comment.