mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 12:42:26 +00:00
Fix up event naming, move them to sensible packages and document everything a bit.
This commit is contained in:
1 parent
220bf8730a
commit
56a3926b86
95 files changed
+333
-251
No files matched your search
@@ -25,16 +25,16 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.common.event.FMLFingerprintViolationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostResourceLoadEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreRegistrationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartedEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStoppedEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;
|
||||
import net.minecraftforge.fml.common.event.ModLifecycleEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostRegistrationEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLFingerprintViolationEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent;
|
||||
import net.minecraftforge.fml.event.server.FMLServerStartedEvent;
|
||||
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.event.server.FMLServerStoppedEvent;
|
||||
import net.minecraftforge.fml.event.server.FMLServerStoppingEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.ModLifecycleEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
/**
|
||||
@@ -67,11 +67,11 @@ public @interface Mod
|
||||
*
|
||||
* These suggestions are mostly just suggestions on what to do in each event.
|
||||
* <ul>
|
||||
* <li> {@link FMLPreRegistrationEvent} : Run before anything else. Read your config, create blocks,
|
||||
* <li> {@link FMLCommonSetupEvent} : Run before anything else. Read your config, create blocks,
|
||||
* items, etc, and register them with the {@link GameRegistry}.</li>
|
||||
* <li> {@link FMLPostRegistrationEvent} : Do your mod setup. Build whatever data structures you care about. Register recipes,
|
||||
* <li> {@link InterModEnqueueEvent} : Do your mod setup. Build whatever data structures you care about. Register recipes,
|
||||
* send {@link FMLInterModComms} messages to other mods.</li>
|
||||
* <li> {@link FMLPostResourceLoadEvent} : Handle interaction with other mods, complete your setup based on this.</li>
|
||||
* <li> {@link InterModProcessEvent} : Handle interaction with other mods, complete your setup based on this.</li>
|
||||
* </ul>
|
||||
* <p>These are the server lifecycle events. They are fired whenever a server is running, or about to run. Each time a server
|
||||
* starts they will be fired in this sequence.
|
||||
@@ -86,9 +86,9 @@ public @interface Mod
|
||||
* The second set of events are more specialized, for receiving notification of specific
|
||||
* information.
|
||||
* <ul>
|
||||
* <li> {@link FMLFingerprintViolationEvent} : Sent just before {@link FMLPreRegistrationEvent}
|
||||
* <li> {@link FMLFingerprintViolationEvent} : Sent just before {@link FMLCommonSetupEvent}
|
||||
* if something is wrong with your mod signature</li>
|
||||
* <li> {@link IMCEvent} : Sent just after {@link FMLPostRegistrationEvent} if you have IMC messages waiting
|
||||
* <li> {@link IMCEvent} : Sent just after {@link InterModEnqueueEvent} if you have IMC messages waiting
|
||||
* from other mods</li>
|
||||
* </ul>
|
||||
*
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common.event;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class FMLClientInitEvent extends ModLifecycleEvent
|
||||
{
|
||||
private final Supplier<Minecraft> minecraftSupplier;
|
||||
|
||||
public FMLClientInitEvent(Supplier<Minecraft> mc, ModContainer container)
|
||||
{
|
||||
super(container);
|
||||
this.minecraftSupplier = mc;
|
||||
}
|
||||
|
||||
public Supplier<Minecraft> getMinecraftSupplier()
|
||||
{
|
||||
return minecraftSupplier;
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common.event;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
|
||||
/**
|
||||
* A special event used when the {@link Mod#certificateFingerprint()} doesn't match the certificate loaded from the JAR
|
||||
* file. You could use this to log a warning that the code that is running might not be yours, for example.
|
||||
*/
|
||||
public class FMLFingerprintViolationEvent extends ModLifecycleEvent
|
||||
{
|
||||
|
||||
private final boolean isDirectory;
|
||||
private final Set<String> fingerprints;
|
||||
private final File source;
|
||||
private final String expectedFingerprint;
|
||||
|
||||
public FMLFingerprintViolationEvent(boolean isDirectory, File source, ImmutableSet<String> fingerprints, String expectedFingerprint)
|
||||
{
|
||||
super(null);
|
||||
this.isDirectory = isDirectory;
|
||||
this.source = source;
|
||||
this.fingerprints = fingerprints;
|
||||
this.expectedFingerprint = expectedFingerprint;
|
||||
}
|
||||
|
||||
public boolean isDirectory() { return isDirectory; }
|
||||
public Set<String> getFingerprints() { return fingerprints; }
|
||||
public File getSource() { return source; }
|
||||
public String getExpectedFingerprint() { return expectedFingerprint; }
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common.event;
|
||||
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
|
||||
/**
|
||||
* This is a mostly internal event fired to mod containers that indicates that loading is complete. Mods should not
|
||||
* in general override or otherwise attempt to implement this event.
|
||||
*
|
||||
* @author cpw
|
||||
*/
|
||||
public class FMLLoadCompleteEvent extends ModLifecycleEvent
|
||||
{
|
||||
public FMLLoadCompleteEvent(final ModContainer container)
|
||||
{
|
||||
super(container);
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common.event;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
* Called whenever the ID mapping might have changed. If you register for this event, you
|
||||
* will be called back whenever the client or server loads an ID set. This includes both
|
||||
* when the ID maps are loaded from disk, as well as when the ID maps revert to the initial
|
||||
* state.
|
||||
*
|
||||
* Note: you cannot change the IDs that have been allocated, but you might want to use
|
||||
* this event to update caches or other in-mod artifacts that might be impacted by an ID
|
||||
* change.
|
||||
*
|
||||
* @see net.minecraftforge.fml.common.Mod.EventHandler for how to subscribe to this event
|
||||
* @author cpw
|
||||
*/
|
||||
public class FMLModIdMappingEvent extends ModLifecycleEvent
|
||||
{
|
||||
public class ModRemapping
|
||||
{
|
||||
public final ResourceLocation registry;
|
||||
public final ResourceLocation key;
|
||||
public final int oldId;
|
||||
public final int newId;
|
||||
|
||||
private ModRemapping(ResourceLocation registry, ResourceLocation key, int oldId, int newId)
|
||||
{
|
||||
this.registry = registry;
|
||||
this.key = key;
|
||||
this.oldId = oldId;
|
||||
this.newId = newId;
|
||||
}
|
||||
}
|
||||
|
||||
private final Map<ResourceLocation, ImmutableList<ModRemapping>> remaps;
|
||||
private final ImmutableSet<ResourceLocation> keys;
|
||||
|
||||
public final boolean isFrozen;
|
||||
public FMLModIdMappingEvent(Map<ResourceLocation, Map<ResourceLocation, Integer[]>> remaps, boolean isFrozen)
|
||||
{
|
||||
super(null);
|
||||
this.isFrozen = isFrozen;
|
||||
this.remaps = Maps.newHashMap();
|
||||
remaps.forEach((name, rm) ->
|
||||
{
|
||||
List<ModRemapping> tmp = Lists.newArrayList();
|
||||
rm.forEach((key, value) -> tmp.add(new ModRemapping(name, key, value[0], value[1])));
|
||||
tmp.sort(Comparator.comparingInt(o -> o.newId));
|
||||
this.remaps.put(name, ImmutableList.copyOf(tmp));
|
||||
});
|
||||
this.keys = ImmutableSet.copyOf(this.remaps.keySet());
|
||||
}
|
||||
|
||||
public ImmutableSet<ResourceLocation> getRegistries()
|
||||
{
|
||||
return this.keys;
|
||||
}
|
||||
|
||||
public ImmutableList<ModRemapping> getRemaps(ResourceLocation registry)
|
||||
{
|
||||
return this.remaps.get(registry);
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common.event;
|
||||
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
|
||||
/**
|
||||
* Called after {@link FMLPreRegistrationEvent} and before {@link FMLPostResourceLoadEvent} during mod
|
||||
* startup.
|
||||
*
|
||||
* This is the second of three commonly called events during mod initialization.
|
||||
*
|
||||
* Recommended activities: Register your recipes and Ore Dictionary entries in the
|
||||
* {@link net.minecraftforge.fml.common.registry.GameRegistry} and {@link net.minecraftforge.oredict.OreDictionary}
|
||||
* Dispatch requests through {@link FMLInterModComms} to other mods, to tell them what you wish them to do.
|
||||
*
|
||||
* @see net.minecraftforge.fml.common.Mod.EventHandler for how to subscribe to this event
|
||||
* @author cpw
|
||||
*/
|
||||
public class FMLPostRegistrationEvent extends ModLifecycleEvent
|
||||
{
|
||||
|
||||
public FMLPostRegistrationEvent(final ModContainer container)
|
||||
{
|
||||
super(container);
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common.event;
|
||||
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
|
||||
/**
|
||||
* Called after {@link FMLPostRegistrationEvent} has been dispatched on every mod. This is the third and last
|
||||
* commonly called event during mod initialization.
|
||||
*
|
||||
* Recommended activities: interact with other mods to establish cross-mod behaviours.
|
||||
*
|
||||
* @author cpw
|
||||
*/
|
||||
public class FMLPostResourceLoadEvent extends ModLifecycleEvent
|
||||
{
|
||||
public FMLPostResourceLoadEvent(final ModContainer container)
|
||||
{
|
||||
super(container);
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common.event;
|
||||
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
|
||||
/**
|
||||
* Called before {@link FMLPostRegistrationEvent} during mod startup.
|
||||
*
|
||||
* This is the first of three commonly called events during mod initialization.
|
||||
*
|
||||
* Recommended activities:
|
||||
* Setup your logging {@link #getModLog()}
|
||||
* Load any configuration data you might have {@link #getSuggestedConfigurationFile()}
|
||||
* Search for a version.properties file and load it {@link #getVersionProperties()}
|
||||
* Configure your {@link ModMetadata} programmatically {@link #getModMetadata()}
|
||||
* Discover parts of your mod by using annotation search {@link #getAsmData()}
|
||||
*
|
||||
* @see net.minecraftforge.fml.common.Mod.EventHandler for how to subscribe to this event
|
||||
* @author cpw
|
||||
*/
|
||||
public class FMLPreRegistrationEvent extends ModLifecycleEvent
|
||||
{
|
||||
public FMLPreRegistrationEvent(final ModContainer container)
|
||||
{
|
||||
super(container);
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common.event;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
/**
|
||||
* Called before the server begins loading anything. Called after {@link FMLPostResourceLoadEvent} on the dedicated
|
||||
* server, and after the player has hit "Play Selected World" in the client. Called before {@link FMLServerStartingEvent}.
|
||||
*
|
||||
* You can obtain a reference to the server with this event.
|
||||
* @author cpw
|
||||
*/
|
||||
public class FMLServerAboutToStartEvent extends ServerLifecycleEvent {
|
||||
|
||||
public FMLServerAboutToStartEvent(MinecraftServer server)
|
||||
{
|
||||
super(server);
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common.event;
|
||||
|
||||
import net.minecraft.server.dedicated.DedicatedServer;
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class FMLServerInitEvent extends ModLifecycleEvent
|
||||
{
|
||||
private final Supplier<DedicatedServer> serverSupplier;
|
||||
|
||||
public FMLServerInitEvent(Supplier<DedicatedServer> server, ModContainer container)
|
||||
{
|
||||
super(container);
|
||||
this.serverSupplier = server;
|
||||
}
|
||||
|
||||
public Supplier<DedicatedServer> getServerSupplier()
|
||||
{
|
||||
return serverSupplier;
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common.event;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
/**
|
||||
* Called after {@link FMLServerStartingEvent} when the server is available and ready to play.
|
||||
*
|
||||
* @author cpw
|
||||
*/
|
||||
public class FMLServerStartedEvent extends ServerLifecycleEvent
|
||||
{
|
||||
|
||||
public FMLServerStartedEvent(final MinecraftServer server)
|
||||
{
|
||||
super(server);
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common.event;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
/**
|
||||
* Called after {@link FMLServerAboutToStartEvent} and before {@link FMLServerStartedEvent}.
|
||||
* This event allows for customizations of the server, such as loading custom commands, perhaps customizing recipes or
|
||||
* other activities.
|
||||
*
|
||||
* @author cpw
|
||||
*/
|
||||
public class FMLServerStartingEvent extends ServerLifecycleEvent
|
||||
{
|
||||
public FMLServerStartingEvent(final MinecraftServer server)
|
||||
{
|
||||
super(server);
|
||||
}
|
||||
|
||||
public CommandDispatcher<CommandSource> getCommandDispatcher() {
|
||||
return server.getCommandManager().getDispatcher();
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common.event;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
/**
|
||||
* Called after {@link FMLServerStoppingEvent} when the server has completely shut down.
|
||||
* Called immediately before shutting down, on the dedicated server, and before returning
|
||||
* to the main menu on the client.
|
||||
*
|
||||
* @author cpw
|
||||
*/
|
||||
public class FMLServerStoppedEvent extends ServerLifecycleEvent {
|
||||
public FMLServerStoppedEvent(MinecraftServer server)
|
||||
{
|
||||
super(server);
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common.event;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
/**
|
||||
* Called when the server begins an orderly shutdown, before {@link FMLServerStoppedEvent}.
|
||||
*
|
||||
* @author cpw
|
||||
*/
|
||||
public class FMLServerStoppingEvent extends ServerLifecycleEvent
|
||||
{
|
||||
public FMLServerStoppingEvent(MinecraftServer server)
|
||||
{
|
||||
super(server);
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common.event;
|
||||
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
|
||||
/**
|
||||
* Parent type to all ModLifecycle events. This is based on Forge EventBus. They fire through the
|
||||
* ModContainer's eventbus instance.
|
||||
*/
|
||||
public class ModLifecycleEvent extends Event
|
||||
{
|
||||
private final ModContainer container;
|
||||
|
||||
public ModLifecycleEvent(ModContainer container)
|
||||
{
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
public final String description()
|
||||
{
|
||||
String cn = getClass().getName();
|
||||
return cn.substring(cn.lastIndexOf('.')+4,cn.length()-5);
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common.event;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
public class ServerLifecycleEvent extends Event
|
||||
{
|
||||
|
||||
protected final MinecraftServer server;
|
||||
|
||||
public ServerLifecycleEvent(MinecraftServer server)
|
||||
{
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
public MinecraftServer getServer()
|
||||
{
|
||||
return server;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user