Skip to content

Commit 9a42b17

Browse files
committed
ログイン失敗の修正
1 parent bb08ab6 commit 9a42b17

13 files changed

Lines changed: 94 additions & 46 deletions

File tree

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ enable_lwjglx = true
2020
# Mod Information
2121
# HIGHLY RECOMMEND complying with SemVer for mod_version: https://semver.org/
2222
mod_version = 1.0.0
23-
root_package = com.example
24-
mod_id = modid
25-
mod_name = Mod Name
23+
root_package = com.github.gtexpert
24+
mod_id = advancedbackupspatch
25+
mod_name = Advanced Backups Patch
2626

2727
# Mod Metadata (Optional)
2828
mod_description =

gradle/scripts/dependencies.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ dependencies {
2727
// Example - CurseMaven dependencies:
2828
// 'curse.maven:had-enough-items-557549:4543375' << had-enough-items = project slug, 557549 = project id, 4543375 = file id
2929
// Full documentation: https://cursemaven.com/
30+
implementation 'curse.maven:advanced-backups-876284:6148212'
3031

3132
// Example - Modrinth dependencies:
3233
// 'maven.modrinth:jei:4.16.1.1000' << jei = project name, 4.16.1.1000 = file version

src/main/java-templates/com/example/modid/Reference.java renamed to src/main/java-templates/com/github/gtexpert/advancedbackupspatch/Reference.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ private Reference() {}
1010
public static final String MOD_NAME = "{{ mod_name }}";
1111
public static final String VERSION = "{{ mod_version }}";
1212

13-
}
13+
}

src/main/java/com/example/modid/ExampleMod.java

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/main/java/com/example/modid/proxy/ClientProxy.java

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/main/java/com/example/modid/proxy/CommonProxy.java

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/main/java/com/example/modid/proxy/IProxy.java

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.github.gtexpert.advancedbackupspatch;
2+
3+
import java.util.Collections;
4+
import java.util.List;
5+
6+
import net.minecraftforge.fml.common.Mod;
7+
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
8+
9+
import org.apache.logging.log4j.LogManager;
10+
import org.apache.logging.log4j.Logger;
11+
12+
import zone.rong.mixinbooter.ILateMixinLoader;
13+
14+
@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION)
15+
public class AdvancedBackupsPatch implements ILateMixinLoader {
16+
17+
public static final Logger LOGGER = LogManager.getLogger(Reference.MOD_NAME);
18+
19+
@Override
20+
public List<String> getMixinConfigs() {
21+
return Collections.singletonList("mixins.advancedbackupspatch.json");
22+
}
23+
24+
@Mod.EventHandler
25+
public void preInit(FMLPreInitializationEvent event) {
26+
LOGGER.info("Hello From {}!", Reference.MOD_NAME);
27+
}
28+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package com.github.gtexpert.advancedbackupspatch.mixin;
2+
3+
import computer.heather.advancedbackups.network.NetworkHandler;
4+
5+
import net.minecraftforge.common.MinecraftForge;
6+
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
7+
import net.minecraftforge.fml.common.eventhandler.EventBus;
8+
9+
import org.spongepowered.asm.mixin.Mixin;
10+
import org.spongepowered.asm.mixin.injection.At;
11+
import org.spongepowered.asm.mixin.injection.Inject;
12+
import org.spongepowered.asm.mixin.injection.Redirect;
13+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
14+
15+
import computer.heather.advancedbackups.AdvancedBackups;
16+
17+
@Mixin(value = AdvancedBackups.class, remap = false)
18+
public abstract class AdvancedBackupsMixin {
19+
20+
/**
21+
* Disable EVENT_BUS.register(this) in the constructor.
22+
* The mod container is not yet established at construction time, so defer to preInit.
23+
*/
24+
@Redirect(method = "<init>",
25+
at = @At(value = "INVOKE",
26+
target = "Lnet/minecraftforge/fml/common/eventhandler/EventBus;register(Ljava/lang/Object;)V"))
27+
private void redirectEventBusRegister(EventBus bus, Object target) {
28+
// no-op: deferred to preInit
29+
}
30+
31+
/**
32+
* Disable NetworkHandler.registerMessages() in the constructor.
33+
* Defer network channel registration until the mod container is established.
34+
*/
35+
@Redirect(method = "<init>",
36+
at = @At(value = "INVOKE",
37+
target = "Lcomputer/heather/advancedbackups/network/NetworkHandler;registerMessages()V"))
38+
private void redirectNetworkRegister() {
39+
// no-op: deferred to preInit
40+
}
41+
42+
/**
43+
* Register the event bus and network messages at the beginning of preInit,
44+
* where the mod container is properly established.
45+
*/
46+
@Inject(method = "preInit", at = @At("HEAD"))
47+
private void onPreInit(FMLPreInitializationEvent event, CallbackInfo ci) {
48+
MinecraftForge.EVENT_BUS.register(this);
49+
NetworkHandler.registerMessages();
50+
}
51+
}
File renamed without changes.

0 commit comments

Comments
 (0)