mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-22 13:09:59 +00:00
Reorganize for bukkit integration
This commit is contained in:
1 parent
660521e6f2
commit
dfd15acb6d
23 files changed
+341
-69
No files matched your search
@@ -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
|
||||
{
|
||||
|
||||
|
||||
Reference in new issue
Block a user