first
This commit is contained in:
parent
48a71a2259
commit
b595b49d36
14 changed files with 192 additions and 172 deletions
21
src/main/java/me/kawaiizenbo/moonlight/Moonlight.java
Normal file
21
src/main/java/me/kawaiizenbo/moonlight/Moonlight.java
Normal file
|
@ -0,0 +1,21 @@
|
|||
package me.kawaiizenbo.moonlight;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import me.kawaiizenbo.moonlight.util.ColorUtils;
|
||||
|
||||
public class Moonlight implements ModInitializer
|
||||
{
|
||||
public static final Moonlight INSTANCE = new Moonlight();
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger("Moonlight");
|
||||
public static final String clientTag = ColorUtils.aqua + "Moonlight Meadows";
|
||||
public static final String versionTag = ColorUtils.magenta + "v0.dev";
|
||||
|
||||
@Override
|
||||
public void onInitialize()
|
||||
{
|
||||
LOGGER.info("Moonlight loading...");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package me.kawaiizenbo.moonlight.mixin;
|
||||
|
||||
import me.kawaiizenbo.moonlight.ui.AltManagerScreen;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
@Mixin(MultiplayerScreen.class)
|
||||
public class MultiplayerScreenMixin extends Screen
|
||||
{
|
||||
protected MultiplayerScreenMixin(Text title)
|
||||
{
|
||||
super(title);
|
||||
}
|
||||
|
||||
@Inject(at = @At("TAIL"), method = "init")
|
||||
private void altManagerButton(int y, int spacingY, CallbackInfo callbackInfo)
|
||||
{
|
||||
this.addDrawableChild(new ButtonWidget(this.width - 102, 2, 100, 20, Text.literal("Alt Manager"), (button) -> {
|
||||
MinecraftClient.getInstance().setScreen(AltManagerScreen.INSTANCE);
|
||||
})).active = true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package me.kawaiizenbo.moonlight.mixin;
|
||||
|
||||
import me.kawaiizenbo.moonlight.Moonlight;
|
||||
import me.kawaiizenbo.moonlight.ui.AltManagerScreen;
|
||||
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
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 net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.TitleScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
@Mixin(TitleScreen.class)
|
||||
public abstract class TitleScreenMixin extends Screen
|
||||
{
|
||||
@Shadow
|
||||
@Final
|
||||
private boolean doBackgroundFade;
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private long backgroundFadeStart;
|
||||
|
||||
public TitleScreenMixin()
|
||||
{
|
||||
super(null);
|
||||
}
|
||||
|
||||
@Inject(at = @At("TAIL"), method = "render")
|
||||
private void clientTag(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo info)
|
||||
{
|
||||
float f = this.doBackgroundFade ? (Util.getMeasuringTimeMs() - this.backgroundFadeStart) / 1000.0F : 1.0F;
|
||||
float g = this.doBackgroundFade ? MathHelper.clamp(f - 1.0F, 0.0F, 1.0F) : 1.0F;
|
||||
int l = MathHelper.ceil(g * 255.0F) << 24;
|
||||
|
||||
DrawableHelper.drawStringWithShadow(matrices, this.textRenderer, Moonlight.clientTag + " " + Moonlight.versionTag, 2, 2, 16777215 | l);
|
||||
}
|
||||
|
||||
@Inject(at = @At("TAIL"), method = "init")
|
||||
private void altManagerButton(int y, int spacingY, CallbackInfo callbackInfo)
|
||||
{
|
||||
this.addDrawableChild(new ButtonWidget(this.width - 102, 2, 100, 20, Text.literal("Alt Manager"), (button) -> {
|
||||
MinecraftClient.getInstance().setScreen(AltManagerScreen.INSTANCE);
|
||||
})).active = true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package me.kawaiizenbo.moonlight.ui;
|
||||
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
public class AltManagerScreen extends Screen
|
||||
{
|
||||
|
||||
public static AltManagerScreen INSTANCE = new AltManagerScreen(null);
|
||||
protected AltManagerScreen(Text title)
|
||||
{
|
||||
super(title);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package me.kawaiizenbo.moonlight.util;
|
||||
|
||||
public class ChatUtils
|
||||
{
|
||||
|
||||
}
|
30
src/main/java/me/kawaiizenbo/moonlight/util/ColorUtils.java
Normal file
30
src/main/java/me/kawaiizenbo/moonlight/util/ColorUtils.java
Normal file
|
@ -0,0 +1,30 @@
|
|||
package me.kawaiizenbo.moonlight.util;
|
||||
|
||||
public class ColorUtils
|
||||
{
|
||||
public static String colorChar = "\247";
|
||||
|
||||
public static String black = "\2470";
|
||||
public static String darkBlue = "\2471";
|
||||
public static String darkGreen = "\2472";
|
||||
public static String darkAqua = "\2473";
|
||||
public static String darkRed = "\2474";
|
||||
public static String darkMagenta = "\2475";
|
||||
public static String gold = "\2476";
|
||||
public static String gray = "\2477";
|
||||
public static String darkGray = "\2478";
|
||||
public static String blue = "\2479";
|
||||
public static String green = "\247a";
|
||||
public static String aqua = "\247b";
|
||||
public static String red = "\247c";
|
||||
public static String magenta = "\247d";
|
||||
public static String yellow = "\247e";
|
||||
public static String white = "\247f";
|
||||
|
||||
public static String underline = "\247u";
|
||||
public static String bold = "\247l";
|
||||
public static String italic = "\247o";
|
||||
public static String strikethrough = "\247m";
|
||||
public static String cipher = "\247k";
|
||||
public static String reset = "\247r";
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
package net.fabricmc.example;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ExampleMod implements ModInitializer {
|
||||
// This logger is used to write text to the console and the log file.
|
||||
// It is considered best practice to use your mod id as the logger's name.
|
||||
// That way, it's clear which mod wrote info, warnings, and errors.
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger("modid");
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
// This code runs as soon as Minecraft is in a mod-load-ready state.
|
||||
// However, some things (like resources) may still be uninitialized.
|
||||
// Proceed with mild caution.
|
||||
|
||||
LOGGER.info("Hello Fabric world!");
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package net.fabricmc.example.mixin;
|
||||
|
||||
import net.fabricmc.example.ExampleMod;
|
||||
import net.minecraft.client.gui.screen.TitleScreen;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(TitleScreen.class)
|
||||
public class ExampleMixin {
|
||||
@Inject(at = @At("HEAD"), method = "init()V")
|
||||
private void init(CallbackInfo info) {
|
||||
ExampleMod.LOGGER.info("This line is printed by an example mod mixin!");
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 453 B |
BIN
src/main/resources/assets/moonlight/icon.png
Normal file
BIN
src/main/resources/assets/moonlight/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
|
@ -1,29 +1,29 @@
|
|||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "modid",
|
||||
"id": "moonlight",
|
||||
"version": "${version}",
|
||||
|
||||
"name": "Example Mod",
|
||||
"description": "This is an example description! Tell everyone what your mod is about!",
|
||||
"name": "Moonlight Meadows",
|
||||
"description": "Utility mod with a focus on stability.",
|
||||
"authors": [
|
||||
"Me!"
|
||||
"KawaiiZenbo"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://fabricmc.net/",
|
||||
"sources": "https://github.com/FabricMC/fabric-example-mod"
|
||||
"homepage": "https://kawaiizenbo.me/",
|
||||
"sources": "https://github.com/kawaiizenbo/MoonlightMeadows"
|
||||
},
|
||||
|
||||
"license": "CC0-1.0",
|
||||
"icon": "assets/modid/icon.png",
|
||||
"license": "MIT",
|
||||
"icon": "assets/moonlight/icon.png",
|
||||
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"main": [
|
||||
"net.fabricmc.example.ExampleMod"
|
||||
"me.kawaiizenbo.moonlight.Moonlight"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
"modid.mixins.json"
|
||||
"moonlight.mixins.json"
|
||||
],
|
||||
|
||||
"depends": {
|
||||
|
@ -31,8 +31,5 @@
|
|||
"fabric-api": "*",
|
||||
"minecraft": "~1.19",
|
||||
"java": ">=17"
|
||||
},
|
||||
"suggests": {
|
||||
"another-mod": "*"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "net.fabricmc.example.mixin",
|
||||
"package": "me.kawaiizenbo.moonlight.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"ExampleMixin"
|
||||
"TitleScreenMixin",
|
||||
"MultiplayerScreenMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
Loading…
Add table
Add a link
Reference in a new issue