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.
    • modVersion

      public abstract String modVersion()
      Returns:
      your mod version.
      See Also:
    • release

      public abstract Release release()
      Returns:
      the Release for your mod (stable, beta, alpha).
    • platform

      public abstract Platform platform()
      Returns:
      the Platform for your mod (fabric, neoforge, forge, etc.)
    • 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.