Reorganize for bukkit integration
This commit is contained in:
parent
660521e6f2
commit
dfd15acb6d
|
@ -21,6 +21,7 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
@ -44,7 +45,6 @@ import net.minecraft.src.BaseMod;
|
|||
import net.minecraft.src.BiomeGenBase;
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.ClientRegistry;
|
||||
import net.minecraft.src.CommonRegistry;
|
||||
import net.minecraft.src.EntityItem;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.GameSettings;
|
||||
|
@ -55,6 +55,7 @@ import net.minecraft.src.IInventory;
|
|||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.KeyBinding;
|
||||
import net.minecraft.src.MLProp;
|
||||
import net.minecraft.src.ModTextureStatic;
|
||||
import net.minecraft.src.NetClientHandler;
|
||||
import net.minecraft.src.NetworkManager;
|
||||
|
@ -85,6 +86,8 @@ import cpw.mods.fml.common.ModMetadata;
|
|||
import cpw.mods.fml.common.ReflectionHelper;
|
||||
import cpw.mods.fml.common.modloader.ModLoaderHelper;
|
||||
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
|
||||
import cpw.mods.fml.common.modloader.ModProperty;
|
||||
import cpw.mods.fml.common.registry.FMLRegistry;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -179,7 +182,7 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||
client = minecraft;
|
||||
ReflectionHelper.detectObfuscation(World.class);
|
||||
FMLCommonHandler.instance().registerSidedDelegate(this);
|
||||
CommonRegistry.registerRegistry(new ClientRegistry());
|
||||
FMLRegistry.registerRegistry(new ClientRegistry());
|
||||
Loader.instance().loadMods();
|
||||
}
|
||||
|
||||
|
@ -1055,4 +1058,18 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||
((ITextureFX)effect).onTextureDimensionsUpdate(dim.width, dim.height);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see cpw.mods.fml.common.IFMLSidedHandler#getModLoaderPropertyFor(java.lang.reflect.Field)
|
||||
*/
|
||||
@Override
|
||||
public ModProperty getModLoaderPropertyFor(Field f)
|
||||
{
|
||||
if (f.isAnnotationPresent(MLProp.class))
|
||||
{
|
||||
MLProp prop = f.getAnnotation(MLProp.class);
|
||||
return new ModProperty(prop.info(), prop.min(), prop.max(), prop.name());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import cpw.mods.fml.common.IPlayerTracker;
|
|||
import cpw.mods.fml.common.IWorldGenerator;
|
||||
import cpw.mods.fml.common.ModContainer.TickType;
|
||||
|
||||
public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDispenseHandler, ICraftingHandler, INetworkHandler, IConsoleHandler, IPlayerTracker
|
||||
public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
|
||||
{
|
||||
// CALLBACK MECHANISMS
|
||||
|
||||
|
|
|
@ -3,11 +3,14 @@ package net.minecraft.src;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.registry.FMLRegistry;
|
||||
import cpw.mods.fml.common.registry.IMinecraftRegistry;
|
||||
|
||||
public class ClientRegistry implements IMinecraftRegistry
|
||||
{
|
||||
|
||||
public static ClientRegistry instance() {
|
||||
return (ClientRegistry) CommonRegistry.instance();
|
||||
return (ClientRegistry) FMLRegistry.instance();
|
||||
}
|
||||
@Override
|
||||
public void addRecipe(ItemStack output, Object... params)
|
||||
|
|
|
@ -16,8 +16,10 @@ package net.minecraft.src;
|
|||
|
||||
import java.awt.Dimension;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -28,6 +30,11 @@ import cpw.mods.fml.client.FMLClientHandler;
|
|||
*/
|
||||
public class FMLRenderAccessLibrary
|
||||
{
|
||||
public static Logger getLogger()
|
||||
{
|
||||
return FMLCommonHandler.instance().getFMLLogger();
|
||||
}
|
||||
|
||||
public static void setTextureDimensions(int textureId, int width, int height, List<TextureFX> textureFXList)
|
||||
{
|
||||
FMLClientHandler.instance().setTextureDimensions(textureId, width, height, textureFXList);
|
||||
|
|
|
@ -30,6 +30,7 @@ import cpw.mods.fml.common.ModContainer.TickType;
|
|||
import cpw.mods.fml.common.ReflectionHelper;
|
||||
import cpw.mods.fml.common.modloader.ModLoaderHelper;
|
||||
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
|
||||
import cpw.mods.fml.common.registry.FMLRegistry;
|
||||
|
||||
public class ModLoader
|
||||
{
|
||||
|
@ -176,7 +177,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void addRecipe(ItemStack output, Object... params)
|
||||
{
|
||||
CommonRegistry.addRecipe(output, params);
|
||||
FMLRegistry.addRecipe(output, params);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -187,7 +188,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void addShapelessRecipe(ItemStack output, Object... params)
|
||||
{
|
||||
CommonRegistry.addShapelessRecipe(output, params);
|
||||
FMLRegistry.addShapelessRecipe(output, params);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -198,7 +199,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void addSmelting(int input, ItemStack output)
|
||||
{
|
||||
CommonRegistry.addSmelting(input, output);
|
||||
FMLRegistry.addSmelting(input, output);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -212,7 +213,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void addSpawn(Class<? extends EntityLiving> entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList)
|
||||
{
|
||||
CommonRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, FMLClientHandler.instance().getDefaultOverworldBiomes());
|
||||
FMLRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, FMLClientHandler.instance().getDefaultOverworldBiomes());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -227,7 +228,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void addSpawn(Class<? extends EntityLiving> entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeGenBase... biomes)
|
||||
{
|
||||
CommonRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, biomes);
|
||||
FMLRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, biomes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -241,7 +242,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType spawnList)
|
||||
{
|
||||
CommonRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, FMLClientHandler.instance().getDefaultOverworldBiomes());
|
||||
FMLRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, FMLClientHandler.instance().getDefaultOverworldBiomes());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -256,7 +257,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeGenBase... biomes)
|
||||
{
|
||||
CommonRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, biomes);
|
||||
FMLRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, biomes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -342,7 +343,7 @@ public class ModLoader
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
public static List<BaseMod> getLoadedMods()
|
||||
public static List<cpw.mods.fml.common.modloader.BaseMod> getLoadedMods()
|
||||
{
|
||||
return ModLoaderModContainer.findAll();
|
||||
}
|
||||
|
@ -525,7 +526,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void registerBlock(Block block)
|
||||
{
|
||||
CommonRegistry.registerBlock(block);
|
||||
FMLRegistry.registerBlock(block);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -536,7 +537,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void registerBlock(Block block, Class<? extends ItemBlock> itemclass)
|
||||
{
|
||||
CommonRegistry.registerBlock(block, itemclass);
|
||||
FMLRegistry.registerBlock(block, itemclass);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -548,7 +549,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void registerEntityID(Class<? extends Entity> entityClass, String entityName, int id)
|
||||
{
|
||||
CommonRegistry.registerEntityID(entityClass, entityName, id);
|
||||
FMLRegistry.registerEntityID(entityClass, entityName, id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -562,7 +563,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void registerEntityID(Class<? extends Entity> entityClass, String entityName, int id, int background, int foreground)
|
||||
{
|
||||
CommonRegistry.registerEntityID(entityClass, entityName, id, background, foreground);
|
||||
FMLRegistry.registerEntityID(entityClass, entityName, id, background, foreground);
|
||||
}
|
||||
|
||||
public static void registerKey(BaseMod mod, KeyBinding keyHandler, boolean allowRepeat)
|
||||
|
@ -592,7 +593,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id)
|
||||
{
|
||||
CommonRegistry.registerTileEntity(tileEntityClass, id);
|
||||
FMLRegistry.registerTileEntity(tileEntityClass, id);
|
||||
}
|
||||
|
||||
public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id, TileEntitySpecialRenderer renderer)
|
||||
|
@ -607,7 +608,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void removeBiome(BiomeGenBase biome)
|
||||
{
|
||||
CommonRegistry.removeBiome(biome);
|
||||
FMLRegistry.removeBiome(biome);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -618,7 +619,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void removeSpawn(Class<? extends EntityLiving> entityClass, EnumCreatureType spawnList)
|
||||
{
|
||||
CommonRegistry.removeSpawn(entityClass, spawnList, FMLClientHandler.instance().getDefaultOverworldBiomes());
|
||||
FMLRegistry.removeSpawn(entityClass, spawnList, FMLClientHandler.instance().getDefaultOverworldBiomes());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -630,7 +631,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void removeSpawn(Class<? extends EntityLiving> entityClass, EnumCreatureType spawnList, BiomeGenBase... biomes)
|
||||
{
|
||||
CommonRegistry.removeSpawn(entityClass, spawnList, biomes);
|
||||
FMLRegistry.removeSpawn(entityClass, spawnList, biomes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -641,7 +642,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void removeSpawn(String entityName, EnumCreatureType spawnList)
|
||||
{
|
||||
CommonRegistry.removeSpawn(entityName, spawnList, FMLClientHandler.instance().getDefaultOverworldBiomes());
|
||||
FMLRegistry.removeSpawn(entityName, spawnList, FMLClientHandler.instance().getDefaultOverworldBiomes());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -653,7 +654,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void removeSpawn(String entityName, EnumCreatureType spawnList, BiomeGenBase... biomes)
|
||||
{
|
||||
CommonRegistry.removeSpawn(entityName, spawnList, biomes);
|
||||
FMLRegistry.removeSpawn(entityName, spawnList, biomes);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
{
|
|
@ -16,6 +16,7 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Properties;
|
||||
import java.util.Random;
|
||||
|
@ -25,7 +26,6 @@ import net.minecraft.server.MinecraftServer;
|
|||
import net.minecraft.src.BaseMod;
|
||||
import net.minecraft.src.BiomeGenBase;
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.CommonRegistry;
|
||||
import net.minecraft.src.EntityItem;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.EntityPlayerMP;
|
||||
|
@ -34,6 +34,7 @@ import net.minecraft.src.ICommandListener;
|
|||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.MLProp;
|
||||
import net.minecraft.src.NetworkManager;
|
||||
import net.minecraft.src.Packet1Login;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
|
@ -50,6 +51,8 @@ import cpw.mods.fml.common.ModContainer;
|
|||
import cpw.mods.fml.common.ModMetadata;
|
||||
import cpw.mods.fml.common.ReflectionHelper;
|
||||
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
|
||||
import cpw.mods.fml.common.modloader.ModProperty;
|
||||
import cpw.mods.fml.common.registry.FMLRegistry;
|
||||
|
||||
/**
|
||||
* Handles primary communication from hooked code into the system
|
||||
|
@ -126,7 +129,7 @@ public class FMLServerHandler implements IFMLSidedHandler
|
|||
server = minecraftServer;
|
||||
ReflectionHelper.detectObfuscation(World.class);
|
||||
FMLCommonHandler.instance().registerSidedDelegate(this);
|
||||
CommonRegistry.registerRegistry(new ServerRegistry());
|
||||
FMLRegistry.registerRegistry(new ServerRegistry());
|
||||
Loader.instance().loadMods();
|
||||
}
|
||||
|
||||
|
@ -618,4 +621,18 @@ public class FMLServerHandler implements IFMLSidedHandler
|
|||
{
|
||||
Profiler.func_40517_a();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see cpw.mods.fml.common.IFMLSidedHandler#getModLoaderPropertyFor(java.lang.reflect.Field)
|
||||
*/
|
||||
@Override
|
||||
public ModProperty getModLoaderPropertyFor(Field f)
|
||||
{
|
||||
if (f.isAnnotationPresent(MLProp.class))
|
||||
{
|
||||
MLProp prop = f.getAnnotation(MLProp.class);
|
||||
return new ModProperty(prop.info(), prop.min(), prop.max(), prop.name());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import cpw.mods.fml.common.IPlayerTracker;
|
|||
import cpw.mods.fml.common.IWorldGenerator;
|
||||
import cpw.mods.fml.common.ModContainer.TickType;
|
||||
|
||||
public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDispenseHandler, ICraftingHandler, INetworkHandler, IConsoleHandler, IPlayerTracker
|
||||
public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
|
||||
{
|
||||
// CALLBACK MECHANISMS
|
||||
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* 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 "";
|
||||
|
||||
}
|
|
@ -24,6 +24,7 @@ import cpw.mods.fml.common.ModContainer.TickType;
|
|||
import cpw.mods.fml.common.ReflectionHelper;
|
||||
import cpw.mods.fml.common.modloader.ModLoaderHelper;
|
||||
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
|
||||
import cpw.mods.fml.common.registry.FMLRegistry;
|
||||
import cpw.mods.fml.server.FMLServerHandler;
|
||||
|
||||
public class ModLoader
|
||||
|
@ -164,7 +165,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void addRecipe(ItemStack output, Object... params)
|
||||
{
|
||||
CommonRegistry.addRecipe(output, params);
|
||||
FMLRegistry.addRecipe(output, params);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -175,7 +176,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void addShapelessRecipe(ItemStack output, Object... params)
|
||||
{
|
||||
CommonRegistry.addShapelessRecipe(output, params);
|
||||
FMLRegistry.addShapelessRecipe(output, params);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -186,7 +187,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void addSmelting(int input, ItemStack output)
|
||||
{
|
||||
CommonRegistry.addSmelting(input, output);
|
||||
FMLRegistry.addSmelting(input, output);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -200,7 +201,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void addSpawn(Class <? extends EntityLiving > entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList)
|
||||
{
|
||||
CommonRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, FMLServerHandler.instance().getDefaultOverworldBiomes());
|
||||
FMLRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, FMLServerHandler.instance().getDefaultOverworldBiomes());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -214,7 +215,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void addSpawn(Class<? extends EntityLiving> entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeGenBase... biomes)
|
||||
{
|
||||
CommonRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, biomes);
|
||||
FMLRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, biomes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -228,7 +229,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType spawnList)
|
||||
{
|
||||
CommonRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, FMLServerHandler.instance().getDefaultOverworldBiomes());
|
||||
FMLRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, FMLServerHandler.instance().getDefaultOverworldBiomes());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -242,7 +243,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeGenBase... biomes)
|
||||
{
|
||||
CommonRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, biomes);
|
||||
FMLRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, biomes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -328,7 +329,7 @@ public class ModLoader
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
public static List<BaseMod> getLoadedMods()
|
||||
public static List<cpw.mods.fml.common.modloader.BaseMod> getLoadedMods()
|
||||
{
|
||||
return ModLoaderModContainer.findAll();
|
||||
}
|
||||
|
@ -509,7 +510,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void registerBlock(Block block)
|
||||
{
|
||||
CommonRegistry.registerBlock(block);
|
||||
FMLRegistry.registerBlock(block);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -520,7 +521,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void registerBlock(Block block, Class<? extends ItemBlock> itemclass)
|
||||
{
|
||||
CommonRegistry.registerBlock(block, itemclass);
|
||||
FMLRegistry.registerBlock(block, itemclass);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -532,7 +533,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void registerEntityID(Class<? extends Entity> entityClass, String entityName, int id)
|
||||
{
|
||||
CommonRegistry.registerEntityID(entityClass, entityName, id);
|
||||
FMLRegistry.registerEntityID(entityClass, entityName, id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -546,7 +547,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void registerEntityID(Class<? extends Entity> entityClass, String entityName, int id, int background, int foreground)
|
||||
{
|
||||
CommonRegistry.registerEntityID(entityClass, entityName, id, background, foreground);
|
||||
FMLRegistry.registerEntityID(entityClass, entityName, id, background, foreground);
|
||||
}
|
||||
|
||||
public static void registerKey(BaseMod mod, Object keyHandler, boolean allowRepeat)
|
||||
|
@ -576,12 +577,12 @@ public class ModLoader
|
|||
*/
|
||||
public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id)
|
||||
{
|
||||
CommonRegistry.registerTileEntity(tileEntityClass, id);
|
||||
FMLRegistry.registerTileEntity(tileEntityClass, id);
|
||||
}
|
||||
|
||||
public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id, Object renderer)
|
||||
{
|
||||
CommonRegistry.instance().registerTileEntity(tileEntityClass, id);
|
||||
FMLRegistry.instance().registerTileEntity(tileEntityClass, id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -591,7 +592,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void removeBiome(BiomeGenBase biome)
|
||||
{
|
||||
CommonRegistry.removeBiome(biome);
|
||||
FMLRegistry.removeBiome(biome);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -602,7 +603,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void removeSpawn(Class<? extends EntityLiving> entityClass, EnumCreatureType spawnList)
|
||||
{
|
||||
CommonRegistry.removeSpawn(entityClass, spawnList, FMLServerHandler.instance().getDefaultOverworldBiomes());
|
||||
FMLRegistry.removeSpawn(entityClass, spawnList, FMLServerHandler.instance().getDefaultOverworldBiomes());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -614,7 +615,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void removeSpawn(Class<? extends EntityLiving> entityClass, EnumCreatureType spawnList, BiomeGenBase... biomes)
|
||||
{
|
||||
CommonRegistry.removeSpawn(entityClass, spawnList, biomes);
|
||||
FMLRegistry.removeSpawn(entityClass, spawnList, biomes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -625,7 +626,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void removeSpawn(String entityName, EnumCreatureType spawnList)
|
||||
{
|
||||
CommonRegistry.removeSpawn(entityName, spawnList, FMLServerHandler.instance().getDefaultOverworldBiomes());
|
||||
FMLRegistry.removeSpawn(entityName, spawnList, FMLServerHandler.instance().getDefaultOverworldBiomes());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -637,7 +638,7 @@ public class ModLoader
|
|||
*/
|
||||
public static void removeSpawn(String entityName, EnumCreatureType spawnList, BiomeGenBase... biomes)
|
||||
{
|
||||
CommonRegistry.removeSpawn(entityName, spawnList, biomes);
|
||||
FMLRegistry.removeSpawn(entityName, spawnList, biomes);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
|
|
@ -3,6 +3,8 @@ package net.minecraft.src;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.registry.IMinecraftRegistry;
|
||||
|
||||
public class ServerRegistry implements IMinecraftRegistry
|
||||
{
|
||||
|
||||
|
|
Loading…
Reference in New Issue