Reorganize for bukkit integration

This commit is contained in:
Christian Weeks committed 2012-05-31 22:09:45 -04:00
1 parent 660521e6f2
commit dfd15acb6d
23 files changed
+341 -69

No files matched your search

@@ -37,8 +37,6 @@ import java.util.zip.ZipInputStream;
import cpw.mods.fml.common.ModContainer.SourceType;
import cpw.mods.fml.common.ModContainer.TickType;
import net.minecraft.src.StringTranslate;
/**
* The main class for non-obfuscated hook handling code
*
@@ -507,4 +505,12 @@ public class FMLCommonHandler
}
}
/**
* @return
*/
public IFMLSidedHandler getSidedDelegate()
{
return sidedDelegate;
}
}
@@ -17,9 +17,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.minecraft.src.Block;
import net.minecraft.src.IBlockAccess;
public class FMLModContainer implements ModContainer
{
private Mod modDescriptor;
@@ -2,9 +2,12 @@ package cpw.mods.fml.common;
import java.io.File;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.util.Properties;
import java.util.logging.Logger;
import cpw.mods.fml.common.modloader.ModProperty;
public interface IFMLSidedHandler
{
Logger getMinecraftLogger();
@@ -20,4 +23,5 @@ public interface IFMLSidedHandler
ModMetadata readMetadataFrom(InputStream input, ModContainer mod) throws Exception;
void profileStart(String profileLabel);
void profileEnd();
ModProperty getModLoaderPropertyFor(Field f);
}
@@ -27,12 +27,12 @@ public interface IWorldGenerator
/**
* Generate some world
*
* @param random the chunk specific {@link Random} as built in {@link FMLClientHandler#onChunkPopulate(net.minecraft.src.IChunkProvider, int, int, net.minecraft.src.World, net.minecraft.src.IChunkProvider)}.
* @param random the chunk specific {@link Random}.
* @param chunkX the block X coordinate of this chunk.
* @param chunkZ the block Z coordinate of this chunk.
* @param world : additionalData[0] The minecraft {@link net.minecraft.src.World} we're generating for.
* @param generator : additionalData[1] The {@link net.minecraft.src.IChunkProvider} that is generating.
* @param chunkProvider : additionalData[2] {@link net.minecraft.src.IChunkProvider} that is requesting the world generation.
* @param world : additionalData[0] The minecraft {@link World} we're generating for.
* @param generator : additionalData[1] The {@link IChunkProvider} that is generating.
* @param chunkProvider : additionalData[2] {@link IChunkProvider} that is requesting the world generation.
*
*/
public void generate(Random random, int chunkX, int chunkZ, Object...additionalData);
+1 -1
View File
@@ -293,7 +293,7 @@ public class Loader
* The found resources are first loaded into the {@link #modClassLoader} (always) then scanned for class resources matching the specification above.
*
* If they provide the {@link Mod} annotation, they will be loaded as "FML mods", which currently is effectively a NO-OP.
* If they are determined to be {@link net.minecraft.src.BaseMod} subclasses they are loaded as such.
* If they are determined to be {@link BaseMod} subclasses they are loaded as such.
*
* Finally, if they are successfully loaded as classes, they are then added to the available mod list.
*/
@@ -20,9 +20,6 @@ import java.util.Map;
import cpw.mods.fml.common.ModContainer.SourceType;
import net.minecraft.src.Block;
import net.minecraft.src.IBlockAccess;
/**
* The container that wraps around mods in the system.
* <p>The philosophy is that individual mod implementation technologies should not impact the actual loading and management
@@ -0,0 +1,89 @@
/*
* 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.
*
* 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 cpw.mods.fml.common.modloader;
import java.util.Map;
import cpw.mods.fml.common.IConsoleHandler;
import cpw.mods.fml.common.ICraftingHandler;
import cpw.mods.fml.common.IDispenseHandler;
import cpw.mods.fml.common.INetworkHandler;
import cpw.mods.fml.common.IPickupNotifier;
import cpw.mods.fml.common.IPlayerTracker;
import cpw.mods.fml.common.IWorldGenerator;
import cpw.mods.fml.common.ModContainer.TickType;
/**
*
* Marker interface for BaseMod
*
* @author cpw
*
*/
public interface BaseMod extends IWorldGenerator, IPickupNotifier, IDispenseHandler, ICraftingHandler, INetworkHandler, IConsoleHandler, IPlayerTracker
{
/**
*
*/
void modsLoaded();
/**
*
*/
void load();
/**
* @param tick
* @param b
* @param minecraftInstance
* @param data
* @return
*/
boolean doTickInGame(TickType tick, boolean b, Object minecraftInstance, Object[] data);
/**
* @return
*/
String getName();
/**
* @return
*/
String getPriorities();
/**
* @param itemId
* @param itemDamage
* @return
*/
int addFuel(int itemId, int itemDamage);
/**
* @param renderers
*/
void onRenderHarvest(Map renderers);
/**
*
*/
void onRegisterAnimations();
/**
* @return
*/
String getVersion();
}
@@ -18,7 +18,6 @@ import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.src.BaseMod;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.ModContainer.TickType;
@@ -30,14 +30,11 @@ import java.util.Map;
import java.util.Properties;
import java.util.StringTokenizer;
import net.minecraft.src.BaseMod;
import net.minecraft.src.Block;
import net.minecraft.src.IBlockAccess;
import net.minecraft.src.MLProp;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.IConsoleHandler;
import cpw.mods.fml.common.ICraftingHandler;
import cpw.mods.fml.common.IDispenseHandler;
import cpw.mods.fml.common.IFMLSidedHandler;
import cpw.mods.fml.common.IKeyHandler;
import cpw.mods.fml.common.INetworkHandler;
import cpw.mods.fml.common.IPickupNotifier;
@@ -132,6 +129,7 @@ public class ModLoaderModContainer implements ModContainer
*/
private void configureMod()
{
IFMLSidedHandler sideHandler = FMLCommonHandler.instance().getSidedDelegate();
File configDir = Loader.instance().getConfigDir();
String modConfigName = modClazz.getSimpleName();
File modConfig = new File(configDir, String.format("%s.cfg", modConfigName));
@@ -166,12 +164,11 @@ public class ModLoaderModContainer implements ModContainer
continue;
}
if (!f.isAnnotationPresent(MLProp.class))
ModProperty property = sideHandler.getModLoaderPropertyFor(f);
if (property == null)
{
continue;
}
MLProp property = f.getAnnotation(MLProp.class);
String propertyName = property.name().length() > 0 ? property.name() : f.getName();
String propertyValue = null;
Object defaultValue = null;
@@ -242,7 +239,7 @@ public class ModLoaderModContainer implements ModContainer
}
}
private Object parseValue(String val, MLProp property, Class<?> type, String propertyName, String modConfigName)
private Object parseValue(String val, ModProperty property, Class<?> type, String propertyName, String modConfigName)
{
if (type.isAssignableFrom(String.class))
{
@@ -0,0 +1,69 @@
/*
* 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.
*
* 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 cpw.mods.fml.common.modloader;
import java.io.File;
/**
* @author cpw
*
*/
public class ModProperty
{
private String info;
private double min;
private double max;
private String name;
public ModProperty(String info, double min, double max, String name)
{
this.info = info;
this.min = min;
this.max = max;
this.name = name;
}
/**
* @return
*/
public String name()
{
// TODO Auto-generated method stub
return name;
}
/**
* @return
*/
public double min()
{
// TODO Auto-generated method stub
return min;
}
/**
* @return
*/
public double max()
{
// TODO Auto-generated method stub
return max;
}
/**
* @return
*/
public String info()
{
// TODO Auto-generated method stub
return info;
}
}
@@ -11,10 +11,19 @@
* 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.minecraft.src;
package cpw.mods.fml.common.registry;
import net.minecraft.src.BiomeGenBase;
import net.minecraft.src.Block;
import net.minecraft.src.Entity;
import net.minecraft.src.EntityLiving;
import net.minecraft.src.EnumCreatureType;
import net.minecraft.src.ItemBlock;
import net.minecraft.src.ItemStack;
import net.minecraft.src.TileEntity;
public class CommonRegistry
public class FMLRegistry
{
private static IMinecraftRegistry instance;
@@ -1,4 +1,13 @@
package net.minecraft.src;
package cpw.mods.fml.common.registry;
import net.minecraft.src.BiomeGenBase;
import net.minecraft.src.Block;
import net.minecraft.src.Entity;
import net.minecraft.src.EntityLiving;
import net.minecraft.src.EnumCreatureType;
import net.minecraft.src.ItemBlock;
import net.minecraft.src.ItemStack;
import net.minecraft.src.TileEntity;
public interface IMinecraftRegistry
{
-48
View File
@@ -1,48 +0,0 @@
/*
* 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.
*
* 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.minecraft.src;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.RetentionPolicy.*;
import static java.lang.annotation.ElementType.*;
/**
* @author cpw
*
*/
@Retention(value = RUNTIME)
@Target(value = FIELD)
public @interface MLProp
{
/**
* Adds additional help to top of configuration file.
*/
String info() default "";
/**
* Maximum value allowed if field is a number.
*/
double max() default Double.MAX_VALUE;
/**
* Minimum value allowed if field is a number.
*/
double min() default Double.MIN_VALUE;
/**
* Overrides the field name for property key.
*/
String name() default "";
}