diff --git a/common/fml/FMLModContainer.java b/common/fml/FMLModContainer.java index d0daf54562..8b8c196eee 100644 --- a/common/fml/FMLModContainer.java +++ b/common/fml/FMLModContainer.java @@ -88,4 +88,10 @@ public class FMLModContainer implements ModContainer { return null; } + @Override + public Object getMod() { + // TODO Auto-generated method stub + return null; + } + } diff --git a/common/fml/Loader.java b/common/fml/Loader.java index 1e890d2e5f..970f246984 100644 --- a/common/fml/Loader.java +++ b/common/fml/Loader.java @@ -120,6 +120,10 @@ public class Loader { } private void load() { + log.fine("Attempting to load mods contained in the minecraft jar file"); + + attemptFileLoad(new File(".","minecraft_server.jar")); + File modsDir = new File(".", "mods"); String canonicalModsPath; try { diff --git a/common/fml/ModContainer.java b/common/fml/ModContainer.java index a248432440..dbc323b61c 100644 --- a/common/fml/ModContainer.java +++ b/common/fml/ModContainer.java @@ -24,4 +24,5 @@ public interface ModContainer { void tickEnd(); boolean matches(Object mod); String getSource(); + Object getMod(); } diff --git a/server/fml/ml/ModLoaderModContainer.java b/server/fml/ml/ModLoaderModContainer.java index ad6e638ad5..3849aeb338 100644 --- a/server/fml/ml/ModLoaderModContainer.java +++ b/server/fml/ml/ModLoaderModContainer.java @@ -107,4 +107,9 @@ public class ModLoaderModContainer implements ModContainer { public String getSource() { return modSource; } + + @Override + public Object getMod() { + return mod; + } } diff --git a/server/net/minecraft/src/BaseMod.java b/server/net/minecraft/src/BaseMod.java index 2dc5bb795c..2689c70ef8 100644 --- a/server/net/minecraft/src/BaseMod.java +++ b/server/net/minecraft/src/BaseMod.java @@ -1,6 +1,5 @@ /* - * The FML Forge Mod Loader suite. - * Copyright (C) 2012 cpw + * The FML Forge Mod Loader suite. Copyright (C) 2012 cpw * * 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; either version 2.1 of the License, or any later version. @@ -39,7 +38,9 @@ public abstract class BaseMod { public void generateSurface(World world, Random random, int chunkX, int chunkZ) { } - public String getName() { return ""; } + public String getName() { + return getClass().getSimpleName(); + } public String getPriorities() { return null; @@ -55,7 +56,11 @@ public abstract class BaseMod { public void onItemPickup(EntityPlayer player, ItemStack item) { } - // boolean onTickInGame(float tick, Minecraft game); + /** + * Ticked every game tick if you have subscribed to tick events through {@link ModLoader#setInGameHook(BaseMod, boolean, boolean)} + * @param minecraftServer the server + * @return true to continue receiving ticks + */ public boolean onTickInGame(MinecraftServer minecraftServer) { return false; } diff --git a/server/net/minecraft/src/ModLoader.java b/server/net/minecraft/src/ModLoader.java index c50535ce75..618ae9b70c 100644 --- a/server/net/minecraft/src/ModLoader.java +++ b/server/net/minecraft/src/ModLoader.java @@ -20,6 +20,7 @@ import fml.Loader; import fml.ml.ModLoaderModContainer; import fml.obf.FMLHandler; +import net.minecraft.server.MinecraftServer; import net.minecraft.src.Achievement; import net.minecraft.src.BiomeGenBase; import net.minecraft.src.Block; @@ -108,7 +109,7 @@ public class ModLoader { return ModLoaderModContainer.findAll(); } - static Logger getLogger() { + public static Logger getLogger() { return FMLHandler.getMinecraftLogger(); } @@ -180,6 +181,13 @@ public class ModLoader { static void serverChat(String text) { } + /** + * Indicate that you want to receive ticks + * + * @param mod receiving the events + * @param enable indicates whether you want to recieve them or not + * @param useClock Not used in server side: all ticks are sent on the server side (no render subticks) + */ static void setInGameHook(BaseMod mod, boolean enable, boolean useClock) { ModLoaderModContainer mlmc=(ModLoaderModContainer) ModLoaderModContainer.findContainerFor(mod); mlmc.setTicking(enable); @@ -199,4 +207,8 @@ public class ModLoader { static void throwException(String message, Throwable e) { } + + public static MinecraftServer getMinecraftServerInstance() { + return FMLHandler.INSTANCE.getServer(); + } } \ No newline at end of file