Package org.cyclops.cyclopscore.init
Class ModBase<T extends ModBase>
java.lang.Object
org.cyclops.cyclopscore.init.ModBase<T>
- Direct Known Subclasses:
ModBaseVersionable
Base class for mods which adds a few convenience methods.
Dont forget to call the supers for the init events.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classUnique references to values that can be registered inside a mod. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ModBase.EnumReferenceKey<Boolean>static final ModBase.EnumReferenceKey<Boolean>static final ModBase.EnumReferenceKey<Boolean>static final ModBase.EnumReferenceKey<Boolean>static final ModBase.EnumReferenceKey<String>static final ModBase.EnumReferenceKey<String>static final ModBase.EnumReferenceKey<String> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected com.mojang.brigadier.builder.LiteralArgumentBuilder<net.minecraft.commands.CommandSourceStack>protected CapabilityConstructorRegistryprotected abstract IClientProxyprotected abstract ICommonProxyprotected ConfigHandlerprotected net.minecraft.world.item.CreativeModeTab.BuilderconstructDefaultCreativeModeTab(net.minecraft.world.item.CreativeModeTab.Builder builder) protected CreativeModeTabConfigprotected IMCHandlerprotected LoggerHelperprotected ModCompatLoaderprotected PacketHandlerprotected RegistryManagerbooleanstatic ModBaseGet the mod by id.net.minecraftforge.fml.ModContainergetProxy()<T> TGet the value for a generic reference key.protected booleaninthashCode()protected voidloadModCompats(ModCompatLoader modCompatLoader) This is called only once to let the mod compatibilities register themselves.voidLog a new info message for this mod.voidLog a new message of the given level for this mod.protected voidonConfigsRegister(ConfigHandler configHandler) Called when the configs should be registered.protected voidonRegisterCommands(net.minecraftforge.event.RegisterCommandsEvent event) protected voidonRegisterKeyMappings(net.minecraftforge.client.event.RegisterKeyMappingsEvent event) protected voidonServerAboutToStart(net.minecraftforge.event.server.ServerAboutToStartEvent event) Register the things that are related to when the server is about to start.protected voidonServerStarted(net.minecraftforge.event.server.ServerStartedEvent event) Register the things that are related to server starting.protected voidonServerStarting(net.minecraftforge.event.server.ServerStartingEvent event) Register the things that are related to when the server is starting.protected voidonServerStopping(net.minecraftforge.event.server.ServerStoppingEvent event) Register the things that are related to server stopping, like persistent storage.<T> voidputGenericReference(ModBase.EnumReferenceKey<T> key, T value) Save a mod value.voidregisterDefaultCreativeTabEntry(net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.item.CreativeModeTab.TabVisibility visibility) voidregisterWorldStorage(WorldStorage worldStorage) Register a new world storage type.protected voidsetup(net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent event) Called on the Forge setup lifecycle event.protected voidsetupClient(net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent event) Called on the Forge client setup lifecycle event.toString()
-
Field Details
-
REFKEY_TEXTURE_PATH_GUI
-
REFKEY_TEXTURE_PATH_MODELS
-
REFKEY_TEXTURE_PATH_SKINS
-
REFKEY_RETROGEN
-
REFKEY_CRASH_ON_INVALID_RECIPE
-
REFKEY_CRASH_ON_MODCOMPAT_CRASH
-
REFKEY_INFOBOOK_REWARDS
-
-
Constructor Details
-
ModBase
-
-
Method Details
-
getModName
-
getContainer
public net.minecraftforge.fml.ModContainer getContainer()- Returns:
- The mod container of this mod.
-
constructLoggerHelper
-
constructConfigHandler
-
constructRegistryManager
-
constructPacketHandler
-
constructModCompatLoader
-
constructCapabilityConstructorRegistry
-
constructIMCHandler
-
constructBaseCommand
protected com.mojang.brigadier.builder.LiteralArgumentBuilder<net.minecraft.commands.CommandSourceStack> constructBaseCommand() -
putGenericReference
Save a mod value.- Type Parameters:
T- The value type.- Parameters:
key- The key.value- The value.
-
loadModCompats
This is called only once to let the mod compatibilities register themselves.- Parameters:
modCompatLoader- The loader.
-
getReferenceValue
Get the value for a generic reference key. The default keys can be found inModBase.- Type Parameters:
T- The type of value.- Parameters:
key- The key of a value.- Returns:
- The value for the given key.
-
log
Log a new info message for this mod.- Parameters:
message- The message to show.
-
log
Log a new message of the given level for this mod.- Parameters:
level- The level in which the message must be shown.message- The message to show.
-
setup
protected void setup(net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent event) Called on the Forge setup lifecycle event.- Parameters:
event- The setup event.
-
setupClient
protected void setupClient(net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent event) Called on the Forge client setup lifecycle event.- Parameters:
event- The setup event.
-
onRegisterKeyMappings
protected void onRegisterKeyMappings(net.minecraftforge.client.event.RegisterKeyMappingsEvent event) -
onServerStarting
protected void onServerStarting(net.minecraftforge.event.server.ServerStartingEvent event) Register the things that are related to when the server is starting.- Parameters:
event- The Forge server starting event.
-
onRegisterCommands
protected void onRegisterCommands(net.minecraftforge.event.RegisterCommandsEvent event) -
onServerAboutToStart
protected void onServerAboutToStart(net.minecraftforge.event.server.ServerAboutToStartEvent event) Register the things that are related to when the server is about to start.- Parameters:
event- The Forge server about to start event.
-
onServerStarted
protected void onServerStarted(net.minecraftforge.event.server.ServerStartedEvent event) Register the things that are related to server starting.- Parameters:
event- The Forge server started event.
-
onServerStopping
protected void onServerStopping(net.minecraftforge.event.server.ServerStoppingEvent event) Register the things that are related to server stopping, like persistent storage.- Parameters:
event- The Forge server stopping event.
-
registerWorldStorage
Register a new world storage type. Make sure to call this at least before the eventServerStartedEventis called.- Parameters:
worldStorage- The world storage to register.
-
constructClientProxy
-
constructCommonProxy
-
registerDefaultCreativeTabEntry
public void registerDefaultCreativeTabEntry(net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.item.CreativeModeTab.TabVisibility visibility) -
constructDefaultCreativeModeTabConfig
-
constructDefaultCreativeModeTab
protected net.minecraft.world.item.CreativeModeTab.Builder constructDefaultCreativeModeTab(net.minecraft.world.item.CreativeModeTab.Builder builder) -
hasDefaultCreativeModeTab
protected boolean hasDefaultCreativeModeTab()- Returns:
- If a default creative tab should be constructed.
If so, make sure to override
constructDefaultCreativeModeTab(CreativeModeTab.Builder).
-
onConfigsRegister
Called when the configs should be registered.- Parameters:
configHandler- The config handler to register to.
-
getProxy
- Returns:
- The proxy for this mod.
-
toString
-
hashCode
public int hashCode() -
equals
-
get
Get the mod by id.- Parameters:
modId- The mod id.- Returns:
- The mod instance or null.
-