Mod maison nosingleplayer 1.0.0 (bouton Solo désactivé) + atlas
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package fr.surviepote.nosingleplayer;
|
||||
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class NoSingleplayer implements ClientModInitializer {
|
||||
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger("nosingleplayer");
|
||||
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
LOGGER.info("[SurviePote] Solo désactivé, direction le multi.");
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package fr.surviepote.nosingleplayer.mixin;
|
||||
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.screens.TitleScreen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
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 TitleScreenMixin {
|
||||
|
||||
@Inject(method = "init", at = @At("TAIL"))
|
||||
private void surviepote$disableSingleplayer(CallbackInfo ci) {
|
||||
TitleScreen self = (TitleScreen) (Object) this;
|
||||
String solo = Component.translatable("menu.singleplayer").getString();
|
||||
for (GuiEventListener child : self.children()) {
|
||||
if (child instanceof Button button && button.getMessage().getString().equals(solo)) {
|
||||
button.active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "nosingleplayer",
|
||||
"version": "${version}",
|
||||
"name": "NoSingleplayer (SurviePote)",
|
||||
"description": "Désactive le bouton Solo du menu principal (serveur SurviePote).",
|
||||
"authors": ["SurviePote"],
|
||||
"license": "MIT",
|
||||
"environment": "client",
|
||||
"entrypoints": {
|
||||
"client": ["fr.surviepote.nosingleplayer.NoSingleplayer"]
|
||||
},
|
||||
"mixins": ["nosingleplayer.mixins.json"],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.16.0",
|
||||
"minecraft": "~26.3",
|
||||
"java": ">=25"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "fr.surviepote.nosingleplayer.mixin",
|
||||
"compatibilityLevel": "JAVA_25",
|
||||
"client": ["TitleScreenMixin"],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user