-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start getting Forge/NeoForged mashed in. Also start creating ModLoade…
…rUtil for future ease
- Loading branch information
Showing
14 changed files
with
250 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{ | ||
"versions": [ | ||
"1.20.4-forge", | ||
"1.20.4-neoforge", | ||
"1.20.4-fabric" | ||
] | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/dev/tr7zw/firstperson/FirstPersonBootstrap.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//#if FORGE | ||
//$$package dev.tr7zw.firstperson; | ||
//$$ | ||
//$$import net.minecraftforge.api.distmarker.Dist; | ||
//$$import net.minecraftforge.fml.DistExecutor; | ||
//$$import net.minecraftforge.fml.common.Mod; | ||
//$$ | ||
//$$@Mod("firstperson") | ||
//$$public class FirstPersonBootstrap { | ||
//$$ | ||
//$$ public FirstPersonBootstrap() { | ||
//$$ DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> FirstPersonModelMod::new); | ||
//$$ } | ||
//$$ | ||
//$$} | ||
//#elseif NEOFORGE | ||
//$$package dev.tr7zw.firstperson; | ||
//$$ | ||
//$$import net.neoforged.api.distmarker.Dist; | ||
//$$import net.neoforged.fml.DistExecutor; | ||
//$$import net.neoforged.fml.common.Mod; | ||
//$$ | ||
//$$@Mod("firstperson") | ||
//$$public class FirstPersonBootstrap { | ||
//$$ | ||
//$$ public FirstPersonBootstrap() { | ||
//$$ DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> FirstPersonModelMod::new); | ||
//$$ } | ||
//$$ | ||
//$$} | ||
//#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 15 additions & 26 deletions
41
src/main/java/dev/tr7zw/firstperson/FirstPersonModelMod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,22 @@ | ||
package dev.tr7zw.firstperson; | ||
|
||
import dev.tr7zw.firstperson.api.FirstPersonAPI; | ||
import dev.tr7zw.firstperson.modsupport.FreecamSupport; | ||
//spotless:off | ||
//#if FABRIC | ||
import net.fabricmc.api.ClientModInitializer; | ||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; | ||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; | ||
import net.fabricmc.loader.api.FabricLoader; | ||
|
||
public class FirstPersonModelMod extends FirstPersonModelCore implements ClientModInitializer { | ||
|
||
@Override | ||
public void onInitializeClient() { | ||
sharedSetup(); | ||
ClientTickEvents.END_CLIENT_TICK.register(e -> { | ||
onTick(); | ||
}); | ||
try { | ||
if (FabricLoader.getInstance().isModLoaded("freecam")) { | ||
FirstPersonAPI.registerPlayerHandler(new FreecamSupport()); | ||
FirstPersonModelCore.LOGGER.info("Freecam support loaded."); | ||
} | ||
} catch (Throwable ex) { | ||
FirstPersonModelCore.LOGGER.warn("Error during initialization of mod support.", ex); | ||
} | ||
} | ||
|
||
@Override | ||
public void registerKeybinds() { | ||
KeyBindingHelper.registerKeyBinding(keyBinding); | ||
} | ||
|
||
@Override | ||
public void onInitializeClient() { | ||
sharedSetup(); | ||
} | ||
//#else | ||
//$$ import dev.tr7zw.util.ModLoaderUtil; | ||
//$$ public class FirstPersonModelMod extends FirstPersonModelCore { | ||
//$$ public FirstPersonModelMod() { | ||
//$$ ModLoaderUtil.registerClientSetupListener(this::sharedSetup); | ||
//$$ } | ||
//#endif | ||
//spotless:on | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/java/dev/tr7zw/firstperson/modsupport/ModSupportLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package dev.tr7zw.firstperson.modsupport; | ||
|
||
import dev.tr7zw.firstperson.FirstPersonModelCore; | ||
import dev.tr7zw.firstperson.api.FirstPersonAPI; | ||
import dev.tr7zw.util.ModLoaderUtil; | ||
|
||
public class ModSupportLoader { | ||
|
||
public static void loadSupport() { | ||
// spotless:off | ||
//#if FABRIC | ||
try { | ||
if (ModLoaderUtil.isModLoaded("freecam")) { | ||
FirstPersonAPI.registerPlayerHandler(new FreecamSupport()); | ||
FirstPersonModelCore.LOGGER.info("Freecam support loaded."); | ||
} | ||
} catch (Throwable ex) { | ||
FirstPersonModelCore.LOGGER.warn("Error during initialization of mod support.", ex); | ||
} | ||
//#endif | ||
//spotless:on | ||
} | ||
|
||
} |
Oops, something went wrong.