Some compatibility fixes for Rei's minimap, and tidy up a couple of things
This commit is contained in:
parent
4d87779d39
commit
11c1cae8b0
|
@ -34,10 +34,12 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
|
|||
{
|
||||
// CALLBACK MECHANISMS
|
||||
|
||||
private boolean fml_lastWorld = false;
|
||||
|
||||
public final boolean doTickInGame(TickType tick, boolean tickEnd, Object... data)
|
||||
{
|
||||
Minecraft mc = FMLClientHandler.instance().getClient();
|
||||
boolean hasWorld = true;
|
||||
boolean hasWorld = mc.field_71441_e != null;
|
||||
// World and render ticks
|
||||
if (tickEnd && ( tick==TickType.RENDER || tick==TickType.CLIENT ) && hasWorld) {
|
||||
return onTickInGame((Float) data[0], mc);
|
||||
|
@ -48,6 +50,16 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
|
|||
public final boolean doTickInGUI(TickType tick, boolean tickEnd, Object... data)
|
||||
{
|
||||
Minecraft mc = FMLClientHandler.instance().getClient();
|
||||
boolean hasWorld = mc.field_71441_e != null;
|
||||
if (!hasWorld && !fml_lastWorld)
|
||||
{
|
||||
fml_lastWorld = true;
|
||||
}
|
||||
else if (!hasWorld && fml_lastWorld)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tickEnd && ( tick==TickType.RENDER || tick==TickType.CLIENT)) {
|
||||
return onTickInGUI((Float) data[0], mc, mc.field_71462_r);
|
||||
}
|
||||
|
|
|
@ -84,6 +84,7 @@ public class FMLModContainer implements ModContainer
|
|||
.put(FMLServerStoppingEvent.class, Mod.ServerStopping.class)
|
||||
.build();
|
||||
private static final BiMap<Class<? extends Annotation>, Class<? extends FMLStateEvent>> modTypeAnnotations = modAnnotationTypes.inverse();
|
||||
private String annotationDependencies;
|
||||
|
||||
|
||||
public FMLModContainer(String className, File modSource, Map<String,Object> modDescriptor)
|
||||
|
@ -138,7 +139,8 @@ public class FMLModContainer implements ModContainer
|
|||
List<ArtifactVersion> requirements = Lists.newArrayList();
|
||||
List<ArtifactVersion> dependencies = Lists.newArrayList();
|
||||
List<ArtifactVersion> dependants = Lists.newArrayList();
|
||||
Loader.instance().computeDependencies((String) descriptor.get("dependencies"), requirements, dependencies, dependants);
|
||||
annotationDependencies = (String) descriptor.get("dependencies");
|
||||
Loader.instance().computeDependencies(annotationDependencies, requirements, dependencies, dependants);
|
||||
modMetadata.requiredMods = requirements;
|
||||
modMetadata.dependencies = dependencies;
|
||||
modMetadata.dependants = dependants;
|
||||
|
@ -176,7 +178,7 @@ public class FMLModContainer implements ModContainer
|
|||
@Override
|
||||
public String getSortingRules()
|
||||
{
|
||||
return modMetadata.printableSortingRules();
|
||||
return (overridesMetadata ? annotationDependencies : modMetadata.printableSortingRules());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -147,7 +147,7 @@ public class LoadController
|
|||
{
|
||||
builder.put(mc, mc.getMod());
|
||||
}
|
||||
if (mc.getMod()==null && !mc.isImmutable())
|
||||
if (mc.getMod()==null && !mc.isImmutable() && state!=LoaderState.CONSTRUCTING)
|
||||
{
|
||||
FMLLog.severe("There is a severe problem with %s - it appears not to have constructed correctly", mc.getModId());
|
||||
if (state != LoaderState.CONSTRUCTING)
|
||||
|
|
|
@ -156,6 +156,6 @@ public class ModMetadata
|
|||
|
||||
public String printableSortingRules()
|
||||
{
|
||||
return null;
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import cpw.mods.fml.common.FMLCommonHandler;
|
|||
import cpw.mods.fml.common.ICraftingHandler;
|
||||
import cpw.mods.fml.common.IFuelHandler;
|
||||
import cpw.mods.fml.common.IWorldGenerator;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
import cpw.mods.fml.common.network.IConnectionHandler;
|
||||
|
@ -42,7 +43,7 @@ public class ModLoaderHelper
|
|||
public static IModLoaderSidedHelper sidedHelper;
|
||||
public static void updateStandardTicks(BaseMod mod, boolean enable, boolean useClock)
|
||||
{
|
||||
ModLoaderModContainer mlmc = findOrBuildModContainer(mod);
|
||||
ModLoaderModContainer mlmc = (ModLoaderModContainer) Loader.instance().activeModContainer();
|
||||
BaseModTicker ticker = mlmc.getGameTickHandler();
|
||||
EnumSet<TickType> ticks = ticker.ticks();
|
||||
// If we're enabled we get render ticks
|
||||
|
|
|
@ -33,6 +33,7 @@ import java.util.logging.Level;
|
|||
|
||||
import net.minecraft.src.MLProp;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
|
@ -103,7 +104,7 @@ public class ModLoaderModContainer implements ModContainer
|
|||
this.modClazzName = className;
|
||||
this.modSource = modSource;
|
||||
this.modId = className.contains(".") ? className.substring(className.lastIndexOf('.')+1) : className;
|
||||
this.sortingProperties = sortingProperties;
|
||||
this.sortingProperties = Strings.isNullOrEmpty(sortingProperties) ? "" : sortingProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -494,6 +495,9 @@ public class ModLoaderModContainer implements ModContainer
|
|||
{
|
||||
ModClassLoader modClassLoader = event.getModClassLoader();
|
||||
modClassLoader.addFile(modSource);
|
||||
EnumSet<TickType> ticks = EnumSet.noneOf(TickType.class);
|
||||
this.gameTickHandler = new BaseModTicker(ticks, false);
|
||||
this.guiTickHandler = new BaseModTicker(ticks.clone(), true);
|
||||
Class<? extends BaseModProxy> modClazz = (Class<? extends BaseModProxy>) Class.forName(modClazzName, true, modClassLoader);
|
||||
configureMod(modClazz, event.getASMHarvestedData());
|
||||
isNetworkMod = FMLNetworkHandler.instance().registerNetworkMod(this, modClazz, event.getASMHarvestedData());
|
||||
|
@ -512,9 +516,6 @@ public class ModLoaderModContainer implements ModContainer
|
|||
{
|
||||
try
|
||||
{
|
||||
EnumSet<TickType> ticks = EnumSet.noneOf(TickType.class);
|
||||
this.gameTickHandler = new BaseModTicker(ticks, false);
|
||||
this.guiTickHandler = new BaseModTicker(ticks.clone(), true);
|
||||
this.gameTickHandler.setMod(mod);
|
||||
this.guiTickHandler.setMod(mod);
|
||||
TickRegistry.registerTickHandler(this.gameTickHandler, Side.CLIENT);
|
||||
|
|
Loading…
Reference in New Issue