Class ModPlatform

java.lang.Object
net.dillon.dillonlib.platform.ModPlatform
All Implemented Interfaces:
Loadable
Direct Known Subclasses:
NeoForgePlatformImpl

public abstract class ModPlatform extends Object implements Loadable
A platform helper class. Can be used for various different calls and functions, and new methods can easily be added in the mod's specified platform.

Each platform for your mod (ex. fabric and neoforge) should contain three service loaders, one for this class, one for ClientModPlatform (for client-side only access code), and one for the MixinModPlatform, which is a mixin-safe class for methods that can be used in conditional mixin plugins.

Since:
1.0
See Also:
  • Constructor Details

    • ModPlatform

      public ModPlatform()
  • Method Details

    • modId

      public abstract String modId()
      Specified by:
      modId in interface Loadable
      Returns:
      the mod id for this platform. Should return your mod id from your common mod class.
    • logger

      @NotNull public abstract @NotNull org.slf4j.Logger logger()
      Returns:
      the logger for your mod.
    • modVersion

      public abstract String modVersion()
      Returns:
      your mod version.
    • platformName

      @NotNull public abstract @NotNull PlatformName platformName()
      Returns:
      the PlatformName (fabric, neoforge, forge, etc.)
    • platformRelease

      @NotNull public abstract @NotNull PlatformRelease platformRelease()
      Returns:
      the PlatformRelease (stable/release, beta, or alpha).
    • logoWidth

      @NotNull public abstract @NotNull LogoWidth logoWidth()
      Returns:
      the LogoWidth. Used specifically in Dillon's mods, but you can branch your own logic with this if you'd like. Otherwise this doesn't do much.
    • registerEvents

      public void registerEvents()
      Registers events, that should be on all environments. Be careful with this method, because you don't want to register events in the wrong place.
    • registerCommonCommands

      public void registerCommonCommands(com.mojang.brigadier.CommandDispatcher<net.minecraft.commands.CommandSourceStack> dispatcher, net.minecraft.commands.CommandBuildContext commandRegistryAccess)
      Registers commands that should be on all environments.
    • registerServerCommands

      public void registerServerCommands(com.mojang.brigadier.CommandDispatcher<net.minecraft.commands.CommandSourceStack> dispatcher, net.minecraft.commands.CommandBuildContext commandRegistryAccess)
      Registers server-side only commands.