Added MinecraftForge.isClient() function that returns true if you are in the Minecraft Client, (As defined as net.minecraft.client.Minecraft existing) false otherwise.

Fixed a typo on PacketEntitySpawn that caused speed to be assigned improperly.
A little code cleanup.
This commit is contained in:
LexManos 2012-03-22 19:46:36 -07:00
parent 96b698dc85
commit 65b3742636
3 changed files with 22 additions and 3 deletions

View File

@ -121,7 +121,8 @@ public class MinecraftForgeClient
public static IItemRenderer getItemRenderer(ItemStack item, ItemRenderType type) public static IItemRenderer getItemRenderer(ItemStack item, ItemRenderType type)
{ {
IItemRenderer renderer = customItemRenderers[item.itemID]; IItemRenderer renderer = customItemRenderers[item.itemID];
if (renderer != null && renderer.handleRenderType(item, type)) { if (renderer != null && renderer.handleRenderType(item, type))
{
return customItemRenderers[item.itemID]; return customItemRenderers[item.itemID];
} }
return null; return null;
@ -149,7 +150,7 @@ public class MinecraftForgeClient
* If they do not match (such is the case in different versionf of MC) it exits the process with a error * If they do not match (such is the case in different versionf of MC) it exits the process with a error
* *
* @param version The version to find, usually "Minecraft Minecraft 1.2.3" * @param version The version to find, usually "Minecraft Minecraft 1.2.3"
* @param message The error message to display int eh crash log * @param message The error message to display in the crash log
*/ */
public static void checkMinecraftVersion(String version, String message) public static void checkMinecraftVersion(String version, String message)
{ {

View File

@ -1006,6 +1006,24 @@ public class MinecraftForge
ForgeHooks.arrowLooseHandlers.add(handler); ForgeHooks.arrowLooseHandlers.add(handler);
} }
private static int isClient = -1;
public static boolean isClient()
{
if (isClient == -1)
{
try
{
Class.forName("net.minecraft.client.Minecraft", false, MinecraftForge.class.getClassLoader());
isClient = 1;
}
catch (ClassNotFoundException e)
{
isClient = 0;
}
}
return isClient == 1;
}
static static
{ {
addDungeonMob("Skeleton", 1.0f); addDungeonMob("Skeleton", 1.0f);

View File

@ -94,7 +94,7 @@ public class PacketEntitySpawn extends ForgePacket
{ {
speedX = data.readShort(); speedX = data.readShort();
speedY = data.readShort(); speedY = data.readShort();
speedX = data.readShort(); speedZ = data.readShort();
} }
} }
@Override @Override