Initial attempts to support forge stuff

This commit is contained in:
Christian Weeks committed 2012-03-31 02:28:14 -04:00
1 parent 160399cee7
commit d6e5df9092
6 files changed
+38 -5

No files matched your search

+6
View File
@@ -88,4 +88,10 @@ public class FMLModContainer implements ModContainer {
return null;
}
@Override
public Object getMod() {
// TODO Auto-generated method stub
return null;
}
}
+4
View File
@@ -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 {
+1
View File
@@ -24,4 +24,5 @@ public interface ModContainer {
void tickEnd();
boolean matches(Object mod);
String getSource();
Object getMod();
}
+5
View File
@@ -107,4 +107,9 @@ public class ModLoaderModContainer implements ModContainer {
public String getSource() {
return modSource;
}
@Override
public Object getMod() {
return mod;
}
}
+9 -4
View File
@@ -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;
}
+13 -1
View File
@@ -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();
}
}