本文整理汇总了Java中net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent类的典型用法代码示例。如果您正苦于以下问题:Java FMLServerAboutToStartEvent类的具体用法?Java FMLServerAboutToStartEvent怎么用?Java FMLServerAboutToStartEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FMLServerAboutToStartEvent类属于net.minecraftforge.fml.common.event包,在下文中一共展示了FMLServerAboutToStartEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyStateEventPatch
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent; //导入依赖的package包/类
@Override
public <T extends FMLStateEvent> boolean applyStateEventPatch(T e) {
FMLServerAboutToStartEvent event = (FMLServerAboutToStartEvent) e;
Field commandManager = ReflectionHelper.getField(ObfuscatedField.MinecraftServer_commandManager);
if (commandManager != null) {
try {
commandManager.set(event.getServer(), new ServerCommandManager(event.getServer(), event.getServer().getCommandManager()));
PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(this.displayName, true);
return true;
}
catch (Exception ex) {
PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(this.displayName, false);
return false;
}
}
else {
PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(this.displayName, false);
return false;
}
}
示例2: applyServerStartPatches
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent; //导入依赖的package包/类
private boolean applyServerStartPatches(FMLServerAboutToStartEvent event) {
boolean success = networkManagers == null ? false : ReflectionHelper.set(ObfuscatedField.NetworkSystem_networkManagers,
networkManagers, event.getServer().getNetworkSystem(), Collections.<NetworkManager>synchronizedList(new ArrayList<NetworkManager>() {
private static final long serialVersionUID = 498247631553542876L;
@Override
public boolean add(NetworkManager manager) {
PatchEntityPlayerSP.this.onNetworkManagerAdd(manager);
return super.add(manager);
}
}));
PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(this.displayName, success);
return success;
}
示例3: beforeServerStart
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent; //导入依赖的package包/类
@Mod.EventHandler
public void beforeServerStart(FMLServerAboutToStartEvent event) {
ICommandManager manager = event.getServer().getCommandManager();
if (manager instanceof CommandHandler) {
((CommandHandler) manager).registerCommand(new DebugDamageCommand());
}
}
示例4: serverPreInit
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent; //导入依赖的package包/类
@Mod.EventHandler
public void serverPreInit(FMLServerAboutToStartEvent event) {
// System.out.println("Starting server");
if (!event.getServer().isDedicatedServer())
for (WeaponData weapon : MapList.nameToData.values())
ClientProxy.RegisterWeaponData(weapon);
/*if(event.getSide()==Side.SERVER)
AchievementPage.registerAchievementPage(new TF2Achievements());*/
}
示例5: onServerAboutToStart
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent; //导入依赖的package包/类
@Mod.EventHandler
public void onServerAboutToStart(FMLServerAboutToStartEvent event)
{
File worldDir = new File(((AnvilSaveConverter) event.getServer().getActiveAnvilConverter()).savesDirectory, event.getServer().getFolderName());
DimensionConfig.instance().readDimensionConfig(worldDir);
// This needs to be here so that we are able to override existing dimensions before
// they get loaded during server start.
// But on the other hand we don't want to register the rest of the dimensions yet,
// otherwise they would be considered 'static dimensions' and get loaded on server start.
DimensionConfig.instance().registerOverriddenDimensions();
}
示例6: applyStateEventPatch
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent; //导入依赖的package包/类
@Override
public <T extends FMLStateEvent> boolean applyStateEventPatch(T e) {
FMLServerAboutToStartEvent event = (FMLServerAboutToStartEvent) e;
try {
Constructor<PlayerList> ctor;
if (event.getServer().isDedicatedServer())
ctor = (Constructor<PlayerList>) (Constructor<?>) DedicatedPlayerList.class.getDeclaredConstructor(DedicatedServer.class);
else
ctor = (Constructor<PlayerList>) (Constructor<?>) IntegratedPlayerList.class.getDeclaredConstructor(IntegratedServer.class);
ctor.setAccessible(true);
if (event.getServer().isDedicatedServer())
event.getServer().setPlayerList(ctor.newInstance((DedicatedServer) event.getServer()));
else
event.getServer().setPlayerList(ctor.newInstance((IntegratedServer) event.getServer()));
PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(this.displayName, true);
return true;
}
catch (Exception ex) {
PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(this.displayName, false);
return false;
}
}
示例7: applyStateEventPatch
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent; //导入依赖的package包/类
@Override
public boolean applyStateEventPatch(FMLStateEvent event) {
if (event instanceof FMLPostInitializationEvent)
return applyPostInitPatches((FMLPostInitializationEvent) event);
else if (event instanceof FMLServerAboutToStartEvent)
return applyServerStartPatches((FMLServerAboutToStartEvent) event);
else
throw new IllegalArgumentException("Invalid Event");
}
示例8: serverAboutToStart
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent; //导入依赖的package包/类
@Mod.EventHandler
public void serverAboutToStart(FMLServerAboutToStartEvent event)
{
// (Re-)Load the config when the server is about to start.
// This means that in single player you can just save and exit to main menu,
// make changes to the config and then load a world and have the new configs be used.
Configs.reload();
}
示例9: onServerAboutToStartEvent
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent; //导入依赖的package包/类
@Mod.EventHandler
public void onServerAboutToStartEvent(FMLServerAboutToStartEvent event)
{
// Register data fixers
ModFixs dataFixer = proxy.getDataFixer();
TileEntityID renames = new TileEntityID();
dataFixer.registerFix(FixTypes.BLOCK_ENTITY, renames);
dataFixer.registerFix(FixTypes.ITEM_INSTANCE, renames);
}
示例10: serverStarting
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent; //导入依赖的package包/类
@Mod.EventHandler
public void serverStarting(FMLServerAboutToStartEvent event)
{
SessionState.serverHasMod = 1;
SessionState.currentKing = "";
proxy.initCommands(event.getServer());
}
示例11: serverAboutToStart
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent; //导入依赖的package包/类
@EventHandler
public void serverAboutToStart(FMLServerAboutToStartEvent event)
{
proxy.serverAboutToStart(event);
}
示例12: serverAboutToStart
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent; //导入依赖的package包/类
@Override
public void serverAboutToStart(FMLServerAboutToStartEvent event) {
// inject server
ServerInjector.InjectIntegrated(FMLCommonHandler.instance().getMinecraftServerInstance());
}
示例13: serverAboutToStart
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent; //导入依赖的package包/类
@Override
public void serverAboutToStart(FMLServerAboutToStartEvent event) {
// inject server
ServerInjector.InjectDedicated(FMLCommonHandler.instance().getMinecraftServerInstance());
}
示例14: serverSet
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent; //导入依赖的package包/类
@Mod.EventHandler
public void serverSet(FMLServerAboutToStartEvent event) {
server = event.getServer();
}
示例15: serverAboutToStart
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent; //导入依赖的package包/类
@EventHandler
public void serverAboutToStart(@Nonnull final FMLServerAboutToStartEvent event) {
proxy.serverAboutToStart(event);
}