Skip to content

Commit

Permalink
display logo
Browse files Browse the repository at this point in the history
  • Loading branch information
HamaIndustries committed Nov 29, 2024
1 parent 00562fc commit fbbbb63
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.mojang.datafixers.util.Pair;
import net.fabricmc.api.ClientModInitializer;
import net.minecraft.client.gui.screen.CreditsScreen;
import net.minecraft.client.gui.screen.GameMenuScreen;
import net.minecraft.client.gui.screen.option.CreditsAndAttributionScreen;

import java.util.Comparator;
Expand All @@ -12,6 +13,5 @@ public class Modfest_creditsClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
// This entrypoint is suitable for setting up client-specific logic, such as rendering.

}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package symbolics.division.modfest_credits.mixin;

import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import net.minecraft.client.gui.screen.CreditsScreen;
import net.minecraft.util.Identifier;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.sound.MusicSound;
import org.spongepowered.asm.mixin.Mixin;
import symbolics.division.modfest_credits.Modfest_credits;

@Mixin(CreditsScreen.class)
public class CreditsScreenMixin {
private Identifier CREDITS_TEXT_LOCATION;

// @WrapOperation(
// method = "init",
// at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/CreditsScreen;CREDITS_TEXT_LOCATION:Lnet/minecraft/util/Identifier;")
// )
// public Identifier injectCredits(Operation<Identifier> original) {
// return Identifier.of("mf121", "texts/credits.json");
// }
@WrapMethod(method = "getMusic")
private MusicSound wrapGetMusic(Operation<MusicSound> orig) {
return new MusicSound(new RegistryEntry.Direct<>(Modfest_credits.CREDITS_MUSIC), 20, 600, true);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package symbolics.division.modfest_credits.mixin;

import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.CreditsScreen;
import net.minecraft.client.gui.screen.GameMenuScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.TitleScreen;
import net.minecraft.client.gui.screen.option.CreditsAndAttributionScreen;
import net.minecraft.client.gui.screen.option.OptionsScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.GridWidget;
import net.minecraft.text.Text;
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.CallbackInfo;

import java.util.function.Supplier;

@Mixin(TitleScreen.class)
public abstract class GameMenuScreenMixin extends Screen {
protected GameMenuScreenMixin(Text title) {
super(title);
}


@Inject(
method = "init",
at = @At("HEAD")
)
private void initWidgets(CallbackInfo ci) {
int l = this.height / 4 + 48;
this.addDrawableChild(ButtonWidget.builder(Text.translatable("credits_and_attribution.button.credits"), (button) -> {
this.client.setScreen(
new CreditsScreen(false, () -> {
MinecraftClient.getInstance().setScreen((TitleScreen)(Object)this);
})
);
}).dimensions(this.width / 2 - 100, l + 72 + 12 + 20 + 12, 98 * 2, 20).build());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,23 @@

import net.fabricmc.api.ModInitializer;

import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Identifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Modfest_credits implements ModInitializer {
public static final String MOD_ID = "modfest_credits";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);


public static Identifier CREDITS_MUSIC_ID = Identifier.of(MOD_ID, "credits_music");
public static SoundEvent CREDITS_MUSIC = SoundEvent.of(CREDITS_MUSIC_ID);

@Override
public void onInitialize() {

Registry.register(Registries.SOUND_EVENT, CREDITS_MUSIC_ID, CREDITS_MUSIC);
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/main/resources/assets/modfest_credits/sounds.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"credits_music": {
"subtitle": "subtitles.mf_credits.credits_music",
"sounds": [
"modfest_credits:credits_music"
]
}
}
Binary file not shown.

0 comments on commit fbbbb63

Please sign in to comment.