2012-05-03 23:40:55 +00:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*/
|
2012-05-10 22:54:25 +00:00
|
|
|
package net.minecraft.src;
|
2012-05-03 23:40:55 +00:00
|
|
|
|
2012-08-17 13:24:38 +00:00
|
|
|
import static cpw.mods.fml.common.Side.CLIENT;
|
|
|
|
|
2012-05-05 18:42:46 +00:00
|
|
|
import java.awt.image.BufferedImage;
|
2012-05-14 05:38:53 +00:00
|
|
|
import java.util.Collections;
|
2012-05-03 23:40:55 +00:00
|
|
|
import java.util.List;
|
2012-05-05 18:42:46 +00:00
|
|
|
import java.util.Map;
|
2012-05-03 23:40:55 +00:00
|
|
|
import java.util.logging.Logger;
|
|
|
|
|
2012-05-04 21:02:12 +00:00
|
|
|
import net.minecraft.client.Minecraft;
|
2012-08-02 19:20:30 +00:00
|
|
|
import net.minecraft.server.MinecraftServer;
|
2012-05-04 21:02:12 +00:00
|
|
|
import cpw.mods.fml.client.FMLClientHandler;
|
2012-05-07 05:26:21 +00:00
|
|
|
import cpw.mods.fml.client.SpriteHelper;
|
2012-07-31 02:31:07 +00:00
|
|
|
import cpw.mods.fml.client.TextureFXManager;
|
2012-08-10 20:37:06 +00:00
|
|
|
import cpw.mods.fml.client.modloader.ModLoaderClientHelper;
|
|
|
|
import cpw.mods.fml.client.modloader.ModLoaderKeyBindingHandler;
|
2012-08-02 04:38:30 +00:00
|
|
|
import cpw.mods.fml.client.registry.ClientRegistry;
|
2012-08-02 19:20:30 +00:00
|
|
|
import cpw.mods.fml.client.registry.KeyBindingRegistry;
|
|
|
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
2012-05-03 23:40:55 +00:00
|
|
|
import cpw.mods.fml.common.FMLCommonHandler;
|
2012-08-02 19:20:30 +00:00
|
|
|
import cpw.mods.fml.common.FMLLog;
|
2012-05-03 23:40:55 +00:00
|
|
|
import cpw.mods.fml.common.Loader;
|
2012-08-17 13:24:38 +00:00
|
|
|
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
2012-08-14 02:51:53 +00:00
|
|
|
import cpw.mods.fml.common.asm.SideOnly;
|
2012-05-07 04:54:18 +00:00
|
|
|
import cpw.mods.fml.common.modloader.ModLoaderHelper;
|
2012-05-04 21:02:12 +00:00
|
|
|
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
|
2012-08-06 13:52:42 +00:00
|
|
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
2012-08-13 23:57:40 +00:00
|
|
|
import cpw.mods.fml.common.network.PacketDispatcher;
|
2012-08-06 13:52:42 +00:00
|
|
|
import cpw.mods.fml.common.network.Player;
|
2012-08-02 19:20:30 +00:00
|
|
|
import cpw.mods.fml.common.registry.EntityRegistry;
|
2012-08-01 23:40:57 +00:00
|
|
|
import cpw.mods.fml.common.registry.GameRegistry;
|
2012-08-07 02:30:13 +00:00
|
|
|
import cpw.mods.fml.common.registry.LanguageRegistry;
|
2012-08-17 13:24:38 +00:00
|
|
|
import cpw.mods.fml.server.FMLServerHandler;
|
2012-05-03 23:40:55 +00:00
|
|
|
|
|
|
|
public class ModLoader
|
|
|
|
{
|
2012-08-04 15:26:51 +00:00
|
|
|
public static final String fmlMarker = "This is an FML marker";
|
2012-05-14 05:38:53 +00:00
|
|
|
// TODO dirty workaround for millinaire
|
2012-05-14 15:38:54 +00:00
|
|
|
@Deprecated
|
|
|
|
public static final Map<String,Map<String,String>> localizedStrings=Collections.emptyMap();
|
2012-05-03 23:40:55 +00:00
|
|
|
/**
|
|
|
|
* Not used on the server.
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param achievement
|
|
|
|
* @param name
|
|
|
|
* @param description
|
|
|
|
*/
|
|
|
|
public static void addAchievementDesc(Achievement achievement, String name, String description)
|
|
|
|
{
|
2012-08-02 19:20:30 +00:00
|
|
|
String achName=achievement.func_75970_i();
|
2012-05-06 00:33:40 +00:00
|
|
|
addLocalization(achName, name);
|
|
|
|
addLocalization(achName+".desc", description);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-10 22:54:25 +00:00
|
|
|
* This method is a call in hook from modified external code. Implemented elsewhere.
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-10 22:54:25 +00:00
|
|
|
* {@link FMLCommonHandler#fuelLookup(int, int)}
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param id
|
|
|
|
* @param metadata
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@Deprecated
|
|
|
|
public static int addAllFuel(int id, int metadata)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-05-14 05:38:53 +00:00
|
|
|
@Deprecated
|
2012-08-14 02:51:53 +00:00
|
|
|
@SideOnly(CLIENT)
|
2012-05-07 05:26:21 +00:00
|
|
|
public static void addAllRenderers(Map<Class<? extends Entity>, Render> renderers)
|
2012-05-05 18:42:46 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-08-14 02:51:53 +00:00
|
|
|
@SideOnly(CLIENT)
|
2012-05-07 05:26:21 +00:00
|
|
|
public static void addAnimation(TextureFX anim)
|
2012-05-05 18:42:46 +00:00
|
|
|
{
|
2012-07-31 02:31:07 +00:00
|
|
|
TextureFXManager.instance().addAnimation(anim);
|
2012-05-05 18:42:46 +00:00
|
|
|
}
|
|
|
|
|
2012-05-03 23:40:55 +00:00
|
|
|
/**
|
2012-05-10 22:54:25 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param armor
|
|
|
|
* @return
|
|
|
|
*/
|
2012-08-14 02:51:53 +00:00
|
|
|
@SideOnly(CLIENT)
|
2012-05-03 23:40:55 +00:00
|
|
|
public static int addArmor(String armor)
|
|
|
|
{
|
2012-08-13 23:57:40 +00:00
|
|
|
return RenderingRegistry.addNewArmourRendererPrefix(armor);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-10 22:54:25 +00:00
|
|
|
* This method adds the supplied biome to the set of candidate biomes for the default world generator type.
|
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param biome
|
|
|
|
*/
|
|
|
|
public static void addBiome(BiomeGenBase biome)
|
|
|
|
{
|
2012-08-02 19:20:30 +00:00
|
|
|
GameRegistry.addBiome(biome);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
2012-08-23 03:46:16 +00:00
|
|
|
public static void addEntityTracker(BaseMod mod, Class<? extends Entity> entityClass, int entityTypeId, int updateRange, int updateInterval, boolean sendVelocityInfo)
|
|
|
|
{
|
|
|
|
ModLoaderHelper.buildEntityTracker(mod, entityClass, entityTypeId, updateRange, updateInterval, sendVelocityInfo);
|
|
|
|
}
|
2012-05-03 23:40:55 +00:00
|
|
|
/**
|
2012-05-10 22:54:25 +00:00
|
|
|
* Add localization for the specified string
|
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param key
|
|
|
|
* @param value
|
|
|
|
*/
|
|
|
|
public static void addLocalization(String key, String value)
|
|
|
|
{
|
2012-05-05 23:52:53 +00:00
|
|
|
addLocalization(key, "en_US", value);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-10 22:54:25 +00:00
|
|
|
* Add localization for the specified string
|
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param key
|
|
|
|
* @param lang
|
|
|
|
* @param value
|
|
|
|
*/
|
|
|
|
public static void addLocalization(String key, String lang, String value)
|
|
|
|
{
|
2012-08-07 02:30:13 +00:00
|
|
|
LanguageRegistry.instance().addStringLocalization(key, lang, value);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-10 22:54:25 +00:00
|
|
|
* Name the specified minecraft object with the supplied name
|
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param instance
|
|
|
|
* @param name
|
|
|
|
*/
|
|
|
|
public static void addName(Object instance, String name)
|
|
|
|
{
|
2012-05-05 23:52:53 +00:00
|
|
|
addName(instance,"en_US",name);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unimplemented on the server as it does not generate names
|
2012-05-10 22:54:25 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param instance
|
|
|
|
* @param lang
|
|
|
|
* @param name
|
|
|
|
*/
|
|
|
|
public static void addName(Object instance, String lang, String name)
|
|
|
|
{
|
2012-08-07 02:30:13 +00:00
|
|
|
LanguageRegistry.instance().addNameForObject(instance, lang, name);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unimplemented on the server as it does not render textures
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param fileToOverride
|
|
|
|
* @param fileToAdd
|
|
|
|
* @return
|
|
|
|
*/
|
2012-08-14 02:51:53 +00:00
|
|
|
@SideOnly(CLIENT)
|
2012-05-03 23:40:55 +00:00
|
|
|
public static int addOverride(String fileToOverride, String fileToAdd)
|
|
|
|
{
|
2012-08-13 23:57:40 +00:00
|
|
|
return RenderingRegistry.addTextureOverride(fileToOverride, fileToAdd);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unimplemented on the server as it does not render textures
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param path
|
|
|
|
* @param overlayPath
|
|
|
|
* @param index
|
|
|
|
*/
|
2012-08-14 02:51:53 +00:00
|
|
|
@SideOnly(CLIENT)
|
2012-05-03 23:40:55 +00:00
|
|
|
public static void addOverride(String path, String overlayPath, int index)
|
|
|
|
{
|
2012-08-13 23:57:40 +00:00
|
|
|
RenderingRegistry.addTextureOverride(path, overlayPath, index);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a Shaped Recipe
|
2012-05-10 22:54:25 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param output
|
|
|
|
* @param params
|
|
|
|
*/
|
|
|
|
public static void addRecipe(ItemStack output, Object... params)
|
|
|
|
{
|
2012-08-01 23:40:57 +00:00
|
|
|
GameRegistry.addRecipe(output, params);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a shapeless recipe
|
2012-05-10 22:54:25 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param output
|
|
|
|
* @param params
|
|
|
|
*/
|
|
|
|
public static void addShapelessRecipe(ItemStack output, Object... params)
|
|
|
|
{
|
2012-08-01 23:40:57 +00:00
|
|
|
GameRegistry.addShapelessRecipe(output, params);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a new product to be smelted
|
2012-05-10 22:54:25 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param input
|
|
|
|
* @param output
|
|
|
|
*/
|
|
|
|
public static void addSmelting(int input, ItemStack output)
|
|
|
|
{
|
2012-08-02 19:20:30 +00:00
|
|
|
GameRegistry.addSmelting(input, output, 1.0f);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
2012-08-18 14:09:25 +00:00
|
|
|
/**
|
|
|
|
* Add a new product to be smelted
|
|
|
|
*
|
|
|
|
* @param input
|
|
|
|
* @param output
|
|
|
|
*/
|
|
|
|
public static void addSmelting(int input, ItemStack output, float experience)
|
|
|
|
{
|
|
|
|
GameRegistry.addSmelting(input, output, experience);
|
|
|
|
}
|
2012-05-03 23:40:55 +00:00
|
|
|
/**
|
|
|
|
* Add a mob to the spawn list
|
2012-05-10 22:54:25 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param entityClass
|
|
|
|
* @param weightedProb
|
|
|
|
* @param min
|
|
|
|
* @param max
|
|
|
|
* @param spawnList
|
|
|
|
*/
|
2012-05-05 18:42:46 +00:00
|
|
|
public static void addSpawn(Class<? extends EntityLiving> entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList)
|
2012-05-03 23:40:55 +00:00
|
|
|
{
|
2012-08-02 19:20:30 +00:00
|
|
|
EntityRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, WorldType.base12Biomes);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a mob to the spawn list
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param entityClass
|
|
|
|
* @param weightedProb
|
|
|
|
* @param min
|
|
|
|
* @param max
|
|
|
|
* @param spawnList
|
|
|
|
* @param biomes
|
|
|
|
*/
|
2012-05-10 22:54:25 +00:00
|
|
|
public static void addSpawn(Class<? extends EntityLiving> entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeGenBase... biomes)
|
2012-05-03 23:40:55 +00:00
|
|
|
{
|
2012-08-02 19:20:30 +00:00
|
|
|
EntityRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, biomes);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a mob to the spawn list
|
2012-05-10 22:54:25 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param entityName
|
|
|
|
* @param weightedProb
|
|
|
|
* @param min
|
|
|
|
* @param max
|
|
|
|
* @param spawnList
|
|
|
|
*/
|
|
|
|
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType spawnList)
|
|
|
|
{
|
2012-08-02 19:20:30 +00:00
|
|
|
EntityRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, WorldType.base12Biomes);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a mob to the spawn list
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param entityName
|
|
|
|
* @param weightedProb
|
|
|
|
* @param min
|
|
|
|
* @param max
|
|
|
|
* @param spawnList
|
|
|
|
* @param biomes
|
|
|
|
*/
|
|
|
|
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeGenBase... biomes)
|
|
|
|
{
|
2012-08-02 19:20:30 +00:00
|
|
|
EntityRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, biomes);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-10 22:54:25 +00:00
|
|
|
* This method is a call in hook from modified external code. Implemented elsewhere.
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param world
|
|
|
|
* @param x
|
|
|
|
* @param y
|
|
|
|
* @param z
|
|
|
|
* @param xVel
|
|
|
|
* @param zVel
|
|
|
|
* @param item
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@Deprecated
|
|
|
|
public static boolean dispenseEntity(World world, double x, double y, double z, int xVel, int zVel, ItemStack item)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a container and drop all the items in it on the ground around
|
2012-05-10 22:54:25 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param world
|
|
|
|
* @param x
|
|
|
|
* @param y
|
|
|
|
* @param z
|
|
|
|
*/
|
|
|
|
public static void genericContainerRemoval(World world, int x, int y, int z)
|
|
|
|
{
|
2012-07-31 02:31:07 +00:00
|
|
|
/* TileEntity te = world.func_603_b(x, y, z);
|
2012-05-03 23:40:55 +00:00
|
|
|
|
|
|
|
if (!(te instanceof IInventory))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-05-10 22:54:25 +00:00
|
|
|
IInventory inv = (IInventory)te;
|
2012-05-03 23:40:55 +00:00
|
|
|
|
2012-05-04 21:02:12 +00:00
|
|
|
for (int l = 0; l < inv.func_469_c(); l++)
|
2012-05-03 23:40:55 +00:00
|
|
|
{
|
2012-05-04 21:02:12 +00:00
|
|
|
ItemStack itemstack = inv.func_468_c(l);
|
2012-05-03 23:40:55 +00:00
|
|
|
|
|
|
|
if (itemstack == null)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-05-04 21:02:12 +00:00
|
|
|
float f = world.field_1037_n.nextFloat() * 0.8F + 0.1F;
|
|
|
|
float f1 = world.field_1037_n.nextFloat() * 0.8F + 0.1F;
|
|
|
|
float f2 = world.field_1037_n.nextFloat() * 0.8F + 0.1F;
|
2012-05-03 23:40:55 +00:00
|
|
|
|
2012-05-04 21:02:12 +00:00
|
|
|
while (itemstack.field_1615_a > 0)
|
2012-05-03 23:40:55 +00:00
|
|
|
{
|
2012-05-04 21:02:12 +00:00
|
|
|
int i1 = world.field_1037_n.nextInt(21) + 10;
|
2012-05-03 23:40:55 +00:00
|
|
|
|
2012-05-04 21:02:12 +00:00
|
|
|
if (i1 > itemstack.field_1615_a)
|
2012-05-03 23:40:55 +00:00
|
|
|
{
|
2012-05-05 18:42:46 +00:00
|
|
|
i1 = itemstack.field_1615_a;
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
2012-05-05 18:42:46 +00:00
|
|
|
itemstack.field_1615_a -= i1;
|
2012-05-10 22:54:25 +00:00
|
|
|
EntityItem entityitem = new EntityItem(world, (float)te.field_823_f + f, (float)te.field_822_g + f1, (float)te.field_821_h + f2, new ItemStack(itemstack.field_1617_c, i1, itemstack.func_21181_i()));
|
2012-05-03 23:40:55 +00:00
|
|
|
float f3 = 0.05F;
|
2012-05-05 18:42:46 +00:00
|
|
|
entityitem.field_608_an = (float) world.field_1037_n.nextGaussian() * f3;
|
|
|
|
entityitem.field_607_ao = (float) world.field_1037_n.nextGaussian() * f3 + 0.2F;
|
|
|
|
entityitem.field_606_ap = (float) world.field_1037_n.nextGaussian() * f3;
|
2012-05-03 23:40:55 +00:00
|
|
|
|
2012-05-04 21:02:12 +00:00
|
|
|
if (itemstack.func_40710_n())
|
2012-05-03 23:40:55 +00:00
|
|
|
{
|
2012-05-05 18:42:46 +00:00
|
|
|
entityitem.field_801_a.func_40706_d((NBTTagCompound) itemstack.func_40709_o().func_40195_b());
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
2012-05-04 21:02:12 +00:00
|
|
|
world.func_674_a(entityitem);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
}
|
2012-07-31 02:31:07 +00:00
|
|
|
*/ }
|
2012-05-03 23:40:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a list of all BaseMod loaded into the system
|
|
|
|
* {@link ModLoaderModContainer#findAll}
|
2012-05-10 22:54:25 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @return
|
|
|
|
*/
|
2012-06-01 02:42:23 +00:00
|
|
|
public static List<BaseMod> getLoadedMods()
|
2012-05-03 23:40:55 +00:00
|
|
|
{
|
2012-06-01 02:42:23 +00:00
|
|
|
return ModLoaderModContainer.findAll(BaseMod.class);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-10 22:54:25 +00:00
|
|
|
* Get a logger instance {@link FMLCommonHandler#getFMLLogger()}
|
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public static Logger getLogger()
|
|
|
|
{
|
2012-08-02 19:20:30 +00:00
|
|
|
return FMLLog.getLogger();
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
2012-08-14 02:51:53 +00:00
|
|
|
@SideOnly(CLIENT)
|
2012-05-07 05:26:21 +00:00
|
|
|
public static Minecraft getMinecraftInstance()
|
2012-05-05 18:42:46 +00:00
|
|
|
{
|
|
|
|
return FMLClientHandler.instance().getClient();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-05 18:42:46 +00:00
|
|
|
* @return
|
|
|
|
*/
|
2012-08-02 19:20:30 +00:00
|
|
|
public static MinecraftServer getMinecraftServerInstance()
|
2012-05-05 18:42:46 +00:00
|
|
|
{
|
2012-08-02 19:20:30 +00:00
|
|
|
return FMLCommonHandler.instance().getMinecraftServerInstance();
|
2012-05-05 18:42:46 +00:00
|
|
|
}
|
|
|
|
|
2012-05-03 23:40:55 +00:00
|
|
|
/**
|
|
|
|
* Get a value from a field using reflection
|
2012-07-22 14:26:38 +00:00
|
|
|
* {@link ObfuscationReflectionHelper#getPrivateValue(Class, Object, int)}
|
2012-05-10 22:54:25 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param instanceclass
|
|
|
|
* @param instance
|
|
|
|
* @param fieldindex
|
|
|
|
* @return
|
|
|
|
*/
|
2012-05-05 18:42:46 +00:00
|
|
|
public static <T, E> T getPrivateValue(Class<? super E> instanceclass, E instance, int fieldindex)
|
2012-05-03 23:40:55 +00:00
|
|
|
{
|
2012-07-22 14:26:38 +00:00
|
|
|
return ObfuscationReflectionHelper.getPrivateValue(instanceclass, instance, fieldindex);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a value from a field using reflection
|
2012-07-22 14:26:38 +00:00
|
|
|
* {@link ObfuscationReflectionHelper#getPrivateValue(Class, Object, String)}
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param instanceclass
|
|
|
|
* @param instance
|
|
|
|
* @param field
|
|
|
|
* @return
|
|
|
|
*/
|
2012-05-05 18:42:46 +00:00
|
|
|
public static <T, E> T getPrivateValue(Class<? super E> instanceclass, E instance, String field)
|
2012-05-03 23:40:55 +00:00
|
|
|
{
|
2012-07-22 14:26:38 +00:00
|
|
|
return ObfuscationReflectionHelper.getPrivateValue(instanceclass, instance, field);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-05 18:42:46 +00:00
|
|
|
* Stubbed method on the server to return a unique model id
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-05 18:42:46 +00:00
|
|
|
*/
|
2012-08-14 02:51:53 +00:00
|
|
|
@SideOnly(CLIENT)
|
2012-05-07 21:44:49 +00:00
|
|
|
public static int getUniqueBlockModelID(BaseMod mod, boolean inventoryRenderer)
|
2012-05-05 18:42:46 +00:00
|
|
|
{
|
2012-08-10 20:37:06 +00:00
|
|
|
return ModLoaderClientHelper.obtainBlockModelIdFor(mod, inventoryRenderer);
|
2012-05-05 18:42:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-10 22:54:25 +00:00
|
|
|
* Get a new unique entity id
|
|
|
|
* {@link Entity#getNextId()}
|
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public static int getUniqueEntityId()
|
|
|
|
{
|
2012-08-02 19:20:30 +00:00
|
|
|
return EntityRegistry.findGlobalUniqueEntityId();
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
2012-08-14 02:51:53 +00:00
|
|
|
@SideOnly(CLIENT)
|
2012-05-06 23:32:59 +00:00
|
|
|
public static int getUniqueSpriteIndex(String path)
|
2012-05-05 18:42:46 +00:00
|
|
|
{
|
2012-05-07 05:26:21 +00:00
|
|
|
return SpriteHelper.getUniqueSpriteIndex(path);
|
2012-05-06 23:32:59 +00:00
|
|
|
}
|
2012-06-26 20:24:50 +00:00
|
|
|
|
2012-05-05 18:42:46 +00:00
|
|
|
/**
|
|
|
|
* To properly implement packet 250 protocol you should always check your
|
|
|
|
* channel is active prior to sending the packet
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-05 18:42:46 +00:00
|
|
|
* @param player
|
|
|
|
* @param channel
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public static boolean isChannelActive(EntityPlayer player, String channel)
|
|
|
|
{
|
2012-08-06 13:52:42 +00:00
|
|
|
return NetworkRegistry.instance().isChannelActive(channel, (Player)player);
|
2012-05-05 18:42:46 +00:00
|
|
|
}
|
|
|
|
|
2012-08-14 02:51:53 +00:00
|
|
|
@SideOnly(CLIENT)
|
2012-05-07 05:26:21 +00:00
|
|
|
public static boolean isGUIOpen(Class<? extends GuiScreen> gui)
|
2012-05-05 18:42:46 +00:00
|
|
|
{
|
2012-07-31 02:31:07 +00:00
|
|
|
return FMLClientHandler.instance().getClient().field_71462_r != null && FMLClientHandler.instance().getClient().field_71462_r.equals(gui);
|
2012-05-05 18:42:46 +00:00
|
|
|
}
|
|
|
|
|
2012-05-03 23:40:55 +00:00
|
|
|
/**
|
2012-05-10 22:54:25 +00:00
|
|
|
* Is the named mod loaded?
|
|
|
|
* {@link Loader#isModLoaded(String)}
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param modname
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public static boolean isModLoaded(String modname)
|
|
|
|
{
|
|
|
|
return Loader.isModLoaded(modname);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-05 18:42:46 +00:00
|
|
|
* Implemented elsewhere
|
|
|
|
*/
|
|
|
|
@Deprecated
|
2012-05-07 05:26:21 +00:00
|
|
|
public static void loadConfig()
|
2012-05-05 18:42:46 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-08-14 02:51:53 +00:00
|
|
|
@SideOnly(CLIENT)
|
2012-05-07 21:44:49 +00:00
|
|
|
public static BufferedImage loadImage(RenderEngine renderEngine, String path) throws Exception
|
2012-05-05 18:42:46 +00:00
|
|
|
{
|
2012-07-31 02:31:07 +00:00
|
|
|
return TextureFXManager.instance().loadImageFromTexturePack(renderEngine, path);
|
2012-05-05 18:42:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Call in from elsewhere. Unimplemented here.
|
|
|
|
* @param player
|
|
|
|
* @param item
|
|
|
|
*/
|
|
|
|
@Deprecated
|
2012-05-07 05:26:21 +00:00
|
|
|
public static void onItemPickup(EntityPlayer player, ItemStack item)
|
2012-05-05 18:42:46 +00:00
|
|
|
{
|
|
|
|
}
|
2012-05-07 05:26:21 +00:00
|
|
|
/**
|
|
|
|
* Call in from elsewhere. Unimplemented here.
|
|
|
|
*/
|
|
|
|
@Deprecated
|
2012-08-14 02:51:53 +00:00
|
|
|
@SideOnly(CLIENT)
|
2012-05-07 05:26:21 +00:00
|
|
|
public static void onTick(float tick, Minecraft game)
|
2012-05-05 18:42:46 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-08-14 02:51:53 +00:00
|
|
|
@SideOnly(CLIENT)
|
2012-05-07 05:26:21 +00:00
|
|
|
public static void openGUI(EntityPlayer player, GuiScreen gui)
|
2012-05-05 18:42:46 +00:00
|
|
|
{
|
2012-05-07 21:44:49 +00:00
|
|
|
FMLClientHandler.instance().displayGuiScreen(player, gui);
|
2012-05-05 18:42:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Deprecated
|
2012-05-10 04:07:46 +00:00
|
|
|
public static void populateChunk(IChunkProvider generator, int chunkX, int chunkZ, World world)
|
2012-05-05 18:42:46 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-10 22:54:25 +00:00
|
|
|
* This method is a call in hook from modified external code. Implemented elsewhere.
|
|
|
|
* {@link FMLServerHandler#handlePacket250(Packet250CustomPayload, EntityPlayer)}
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param packet
|
|
|
|
*/
|
|
|
|
@Deprecated
|
|
|
|
public static void receivePacket(Packet250CustomPayload packet)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-05-07 21:44:49 +00:00
|
|
|
@Deprecated
|
2012-08-14 02:51:53 +00:00
|
|
|
@SideOnly(CLIENT)
|
2012-05-07 21:44:49 +00:00
|
|
|
public static KeyBinding[] registerAllKeys(KeyBinding[] keys)
|
2012-05-05 18:42:46 +00:00
|
|
|
{
|
|
|
|
return keys;
|
|
|
|
}
|
|
|
|
|
2012-05-07 21:44:49 +00:00
|
|
|
@Deprecated
|
2012-08-14 02:51:53 +00:00
|
|
|
@SideOnly(CLIENT)
|
2012-05-10 04:07:46 +00:00
|
|
|
public static void registerAllTextureOverrides(RenderEngine cache)
|
2012-05-05 18:42:46 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-05-03 23:40:55 +00:00
|
|
|
/**
|
|
|
|
* Register a new block
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param block
|
|
|
|
*/
|
|
|
|
public static void registerBlock(Block block)
|
|
|
|
{
|
2012-08-02 19:20:30 +00:00
|
|
|
GameRegistry.registerBlock(block);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register a new block
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param block
|
|
|
|
* @param itemclass
|
|
|
|
*/
|
2012-05-05 18:42:46 +00:00
|
|
|
public static void registerBlock(Block block, Class<? extends ItemBlock> itemclass)
|
2012-05-03 23:40:55 +00:00
|
|
|
{
|
2012-08-02 19:20:30 +00:00
|
|
|
GameRegistry.registerBlock(block, itemclass);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
2012-08-21 01:44:28 +00:00
|
|
|
public static void registerContainerID(BaseMod mod, int id)
|
2012-08-21 01:43:59 +00:00
|
|
|
{
|
|
|
|
ModLoaderHelper.buildGuiHelper(mod, id);
|
|
|
|
}
|
2012-05-03 23:40:55 +00:00
|
|
|
/**
|
|
|
|
* Register a new entity ID
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param entityClass
|
|
|
|
* @param entityName
|
|
|
|
* @param id
|
|
|
|
*/
|
2012-05-05 18:42:46 +00:00
|
|
|
public static void registerEntityID(Class<? extends Entity> entityClass, String entityName, int id)
|
2012-05-03 23:40:55 +00:00
|
|
|
{
|
2012-08-09 10:04:25 +00:00
|
|
|
EntityRegistry.registerGlobalEntityID(entityClass, entityName, id);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register a new entity ID
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param entityClass
|
|
|
|
* @param entityName
|
|
|
|
* @param id
|
|
|
|
* @param background
|
|
|
|
* @param foreground
|
|
|
|
*/
|
2012-05-05 18:42:46 +00:00
|
|
|
public static void registerEntityID(Class<? extends Entity> entityClass, String entityName, int id, int background, int foreground)
|
2012-05-03 23:40:55 +00:00
|
|
|
{
|
2012-08-09 10:04:25 +00:00
|
|
|
EntityRegistry.registerGlobalEntityID(entityClass, entityName, id, background, foreground);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
2012-08-14 02:51:53 +00:00
|
|
|
@SideOnly(CLIENT)
|
2012-08-21 01:44:28 +00:00
|
|
|
public static void registerKey(BaseMod mod, KeyBinding keyHandler, boolean allowRepeat)
|
2012-05-05 18:42:46 +00:00
|
|
|
{
|
2012-08-19 05:44:33 +00:00
|
|
|
ModLoaderClientHelper.registerKeyBinding(mod, keyHandler, allowRepeat);
|
2012-05-05 18:42:46 +00:00
|
|
|
}
|
|
|
|
|
2012-05-03 23:40:55 +00:00
|
|
|
/**
|
2012-08-11 15:01:18 +00:00
|
|
|
* Register the mod for packets on this channel.
|
2012-05-03 23:40:55 +00:00
|
|
|
* {@link FMLCommonHandler#registerChannel(cpw.mods.fml.common.ModContainer, String)}
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param mod
|
|
|
|
* @param channel
|
|
|
|
*/
|
2012-08-21 01:44:28 +00:00
|
|
|
public static void registerPacketChannel(BaseMod mod, String channel)
|
2012-05-03 23:40:55 +00:00
|
|
|
{
|
2012-08-06 21:27:21 +00:00
|
|
|
NetworkRegistry.instance().registerChannel(ModLoaderHelper.buildPacketHandlerFor(mod), channel);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register a new tile entity class
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param tileEntityClass
|
|
|
|
* @param id
|
|
|
|
*/
|
2012-05-05 18:42:46 +00:00
|
|
|
public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id)
|
2012-05-03 23:40:55 +00:00
|
|
|
{
|
2012-08-02 19:20:30 +00:00
|
|
|
GameRegistry.registerTileEntity(tileEntityClass, id);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
2012-08-14 02:51:53 +00:00
|
|
|
@SideOnly(CLIENT)
|
2012-05-10 04:07:46 +00:00
|
|
|
public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id, TileEntitySpecialRenderer renderer)
|
2012-05-05 18:42:46 +00:00
|
|
|
{
|
2012-08-02 19:20:30 +00:00
|
|
|
ClientRegistry.registerTileEntity(tileEntityClass, id, renderer);
|
2012-05-05 18:42:46 +00:00
|
|
|
}
|
|
|
|
|
2012-05-03 23:40:55 +00:00
|
|
|
/**
|
2012-05-05 18:42:46 +00:00
|
|
|
* Remove a biome from the list of generated biomes
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param biome
|
|
|
|
*/
|
|
|
|
public static void removeBiome(BiomeGenBase biome)
|
|
|
|
{
|
2012-08-02 19:20:30 +00:00
|
|
|
GameRegistry.removeBiome(biome);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a spawn
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param entityClass
|
|
|
|
* @param spawnList
|
|
|
|
*/
|
2012-05-05 18:42:46 +00:00
|
|
|
public static void removeSpawn(Class<? extends EntityLiving> entityClass, EnumCreatureType spawnList)
|
2012-05-03 23:40:55 +00:00
|
|
|
{
|
2012-08-02 19:20:30 +00:00
|
|
|
EntityRegistry.removeSpawn(entityClass, spawnList, WorldType.base12Biomes);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a spawn
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param entityClass
|
|
|
|
* @param spawnList
|
|
|
|
* @param biomes
|
|
|
|
*/
|
2012-05-05 18:42:46 +00:00
|
|
|
public static void removeSpawn(Class<? extends EntityLiving> entityClass, EnumCreatureType spawnList, BiomeGenBase... biomes)
|
2012-05-03 23:40:55 +00:00
|
|
|
{
|
2012-08-02 19:20:30 +00:00
|
|
|
EntityRegistry.removeSpawn(entityClass, spawnList, biomes);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a spawn
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param entityName
|
|
|
|
* @param spawnList
|
|
|
|
*/
|
|
|
|
public static void removeSpawn(String entityName, EnumCreatureType spawnList)
|
|
|
|
{
|
2012-08-02 19:20:30 +00:00
|
|
|
EntityRegistry.removeSpawn(entityName, spawnList, WorldType.base12Biomes);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a spawn
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param entityName
|
|
|
|
* @param spawnList
|
|
|
|
* @param biomes
|
|
|
|
*/
|
|
|
|
public static void removeSpawn(String entityName, EnumCreatureType spawnList, BiomeGenBase... biomes)
|
|
|
|
{
|
2012-08-03 08:50:48 +00:00
|
|
|
EntityRegistry.removeSpawn(entityName, spawnList, biomes);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
2012-05-10 22:54:25 +00:00
|
|
|
@Deprecated
|
2012-08-14 02:51:53 +00:00
|
|
|
@SideOnly(CLIENT)
|
2012-05-10 04:07:46 +00:00
|
|
|
public static boolean renderBlockIsItemFull3D(int modelID)
|
2012-05-05 18:42:46 +00:00
|
|
|
{
|
2012-08-10 20:37:06 +00:00
|
|
|
return RenderingRegistry.instance().renderItemAsFull3DBlock(modelID);
|
2012-05-05 18:42:46 +00:00
|
|
|
}
|
|
|
|
|
2012-05-10 22:54:25 +00:00
|
|
|
@Deprecated
|
2012-08-14 02:51:53 +00:00
|
|
|
@SideOnly(CLIENT)
|
2012-05-10 04:07:46 +00:00
|
|
|
public static void renderInvBlock(RenderBlocks renderer, Block block, int metadata, int modelID)
|
2012-05-05 18:42:46 +00:00
|
|
|
{
|
2012-08-10 20:37:06 +00:00
|
|
|
RenderingRegistry.instance().renderInventoryBlock(renderer, block, metadata, modelID);
|
2012-05-05 18:42:46 +00:00
|
|
|
}
|
|
|
|
|
2012-05-10 22:54:25 +00:00
|
|
|
@Deprecated
|
2012-08-14 02:51:53 +00:00
|
|
|
@SideOnly(CLIENT)
|
2012-05-10 04:07:46 +00:00
|
|
|
public static boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelID)
|
2012-05-05 18:42:46 +00:00
|
|
|
{
|
2012-08-10 20:37:06 +00:00
|
|
|
return RenderingRegistry.instance().renderWorldBlock(renderer, world, x, y, z, block, modelID);
|
2012-05-05 18:42:46 +00:00
|
|
|
}
|
|
|
|
|
2012-05-03 23:40:55 +00:00
|
|
|
/**
|
2012-05-10 22:54:25 +00:00
|
|
|
* Configuration is handled elsewhere
|
|
|
|
* {@link ModLoaderModContainer}
|
2012-05-03 23:40:55 +00:00
|
|
|
*/
|
|
|
|
@Deprecated
|
|
|
|
public static void saveConfig()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-08-13 23:57:40 +00:00
|
|
|
/**
|
|
|
|
* Send a packet from client to server
|
|
|
|
*
|
|
|
|
* @param packet
|
|
|
|
*/
|
2012-05-11 21:31:28 +00:00
|
|
|
public static void sendPacket(Packet packet) {
|
2012-08-13 23:57:40 +00:00
|
|
|
PacketDispatcher.sendPacketToServer(packet);
|
2012-05-11 21:31:28 +00:00
|
|
|
}
|
2012-05-03 23:40:55 +00:00
|
|
|
/**
|
2012-05-05 18:42:46 +00:00
|
|
|
* Send a chat message to the server
|
2012-05-04 21:02:12 +00:00
|
|
|
* {@link FMLClientHandler#handleChatPacket(Packet3Chat, EntityPlayer)}
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param text
|
|
|
|
*/
|
2012-05-10 22:54:25 +00:00
|
|
|
@Deprecated
|
2012-05-03 23:40:55 +00:00
|
|
|
public static void serverChat(String text)
|
|
|
|
{
|
2012-05-05 18:42:46 +00:00
|
|
|
//TODO
|
|
|
|
}
|
|
|
|
|
2012-05-10 22:54:25 +00:00
|
|
|
@Deprecated
|
2012-08-14 02:51:53 +00:00
|
|
|
@SideOnly(CLIENT)
|
2012-05-10 04:07:46 +00:00
|
|
|
public static void serverLogin(NetClientHandler handler, Packet1Login loginPacket)
|
2012-05-05 18:42:46 +00:00
|
|
|
{
|
|
|
|
//TODO
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
2012-08-21 01:44:28 +00:00
|
|
|
public static void serverOpenWindow(EntityPlayerMP player, Container container, int ID, int x, int y, int z)
|
2012-08-21 01:43:59 +00:00
|
|
|
{
|
|
|
|
ModLoaderHelper.openGui(ID, player, container, x, y, z);
|
|
|
|
}
|
|
|
|
|
2012-05-03 23:40:55 +00:00
|
|
|
/**
|
|
|
|
* Indicate that you want to receive ticks
|
2012-05-10 22:54:25 +00:00
|
|
|
*
|
|
|
|
* @param mod receiving the events
|
|
|
|
* @param enable indicates whether you want to recieve them or not
|
|
|
|
* @param useClock don't receive render subticks, just world ticks
|
2012-05-03 23:40:55 +00:00
|
|
|
*/
|
2012-08-21 01:44:28 +00:00
|
|
|
public static void setInGameHook(BaseMod mod, boolean enable, boolean useClock)
|
2012-05-03 23:40:55 +00:00
|
|
|
{
|
2012-05-07 04:54:18 +00:00
|
|
|
ModLoaderHelper.updateStandardTicks(mod, enable, useClock);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
2012-06-26 20:24:50 +00:00
|
|
|
|
2012-08-21 01:44:28 +00:00
|
|
|
public static void setInGUIHook(BaseMod mod, boolean enable, boolean useClock)
|
2012-05-05 18:42:46 +00:00
|
|
|
{
|
2012-05-07 04:54:18 +00:00
|
|
|
ModLoaderHelper.updateGUITicks(mod, enable, useClock);
|
2012-05-05 18:42:46 +00:00
|
|
|
}
|
|
|
|
|
2012-05-03 23:40:55 +00:00
|
|
|
/**
|
|
|
|
* Set a private field to a value using reflection
|
2012-07-22 14:26:38 +00:00
|
|
|
* {@link ObfuscationReflectionHelper#setPrivateValue(Class, Object, int, Object)}
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param instanceclass
|
|
|
|
* @param instance
|
|
|
|
* @param fieldindex
|
|
|
|
* @param value
|
|
|
|
*/
|
2012-05-05 18:42:46 +00:00
|
|
|
public static <T, E> void setPrivateValue(Class<? super T> instanceclass, T instance, int fieldindex, E value)
|
2012-05-03 23:40:55 +00:00
|
|
|
{
|
2012-07-22 14:26:38 +00:00
|
|
|
ObfuscationReflectionHelper.setPrivateValue(instanceclass, instance, value, fieldindex);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a private field to a value using reflection
|
2012-07-22 14:26:38 +00:00
|
|
|
* {@link ObfuscationReflectionHelper#setPrivateValue(Class, Object, String, Object)}
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param instanceclass
|
|
|
|
* @param instance
|
|
|
|
* @param field
|
|
|
|
* @param value
|
|
|
|
*/
|
2012-05-05 18:42:46 +00:00
|
|
|
public static <T, E> void setPrivateValue(Class<? super T> instanceclass, T instance, String field, E value)
|
2012-05-03 23:40:55 +00:00
|
|
|
{
|
2012-07-22 14:26:38 +00:00
|
|
|
ObfuscationReflectionHelper.setPrivateValue(instanceclass, instance, value, field);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-10 22:54:25 +00:00
|
|
|
* This method is a call in hook from modified external code. Implemented elsewhere.
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param player
|
|
|
|
* @param item
|
|
|
|
* @param matrix
|
|
|
|
*/
|
|
|
|
@Deprecated
|
|
|
|
public static void takenFromCrafting(EntityPlayer player, ItemStack item, IInventory matrix)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-10 22:54:25 +00:00
|
|
|
* This method is a call in hook from modified external code. Implemented elsewhere.
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param player
|
|
|
|
* @param item
|
|
|
|
*/
|
|
|
|
@Deprecated
|
|
|
|
public static void takenFromFurnace(EntityPlayer player, ItemStack item)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Throw the offered exception. Likely will stop the game.
|
2012-06-26 20:24:50 +00:00
|
|
|
*
|
2012-05-03 23:40:55 +00:00
|
|
|
* @param message
|
|
|
|
* @param e
|
|
|
|
*/
|
|
|
|
public static void throwException(String message, Throwable e)
|
|
|
|
{
|
2012-05-10 22:54:25 +00:00
|
|
|
FMLCommonHandler.instance().raiseException(e, message, true);
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|
2012-06-26 20:24:50 +00:00
|
|
|
|
2012-05-06 23:32:59 +00:00
|
|
|
public static void throwException(Throwable e)
|
|
|
|
{
|
|
|
|
throwException("Exception in ModLoader", e);
|
|
|
|
}
|
2012-05-03 23:40:55 +00:00
|
|
|
}
|