Bunch of hooks re-added : network is more complete now, lot of basemod cleanup, moving stuff into

the registry area
This commit is contained in:
Christian committed 2012-08-06 22:30:13 -04:00
1 parent 8e96e60179
commit d8b92064d7
42 files changed
+539 -487

No files matched your search

@@ -75,7 +75,6 @@ import net.minecraft.src.RenderBlocks;
import net.minecraft.src.RenderEngine;
import net.minecraft.src.RenderManager;
import net.minecraft.src.RenderPlayer;
import net.minecraft.src.SidedProxy;
import net.minecraft.src.StringTranslate;
import net.minecraft.src.TextureFX;
import net.minecraft.src.TexturePackBase;
@@ -99,6 +98,7 @@ import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.common.ProxyInjector;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.common.modloader.ModLoaderHelper;
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
@@ -274,14 +274,6 @@ public class FMLClientHandler implements IFMLSidedHandler
return INSTANCE;
}
/**
* Return the minecraft instance
*/
@Override
public Object getMinecraftInstance()
{
return client;
}
/**
* @param player
* @param gui
@@ -303,20 +295,6 @@ public class FMLClientHandler implements IFMLSidedHandler
client.field_71424_I.func_76319_b();
}
/* (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;
}
/**
* @param mods
*/
@@ -344,38 +322,6 @@ public class FMLClientHandler implements IFMLSidedHandler
return Side.CLIENT;
}
@Override
public ProxyInjector findSidedProxyOn(cpw.mods.fml.common.modloader.BaseMod mod)
{
for (Field f : mod.getClass().getDeclaredFields())
{
if (f.isAnnotationPresent(SidedProxy.class))
{
SidedProxy sp = f.getAnnotation(SidedProxy.class);
return new ProxyInjector(sp.clientSide(), sp.serverSide(), sp.bukkitSide(), f);
}
}
return null;
}
@Override
public String getCurrentLanguage()
{
return null;
}
@Override
public Properties getCurrentLanguageTable()
{
return null;
}
@Override
public String getObjectName(Object minecraftObject)
{
return null;
}
public boolean hasOptifine()
{
return optifineContainer!=null;
+17 -20
View File
@@ -26,22 +26,13 @@ import cpw.mods.fml.common.IPlayerTracker;
import cpw.mods.fml.common.IWorldGenerator;
import cpw.mods.fml.common.TickType;
public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModProxy
{
// CALLBACK MECHANISMS
public void keyBindingEvent(Object keybinding)
public final boolean doTickInGame(TickType tick, boolean tickEnd, Object... data)
{
this.keyboardEvent((KeyBinding)keybinding);
}
/**
* @param minecraftInstance
* @return
*/
public final boolean doTickInGame(TickType tick, boolean tickEnd, Object minecraftInstance, Object... data)
{
Minecraft mc = (Minecraft) minecraftInstance;
Minecraft mc = FMLClientHandler.instance().getClient();
boolean hasWorld = true;
// World and render ticks
if (tickEnd && ( tick==TickType.RENDER || tick==TickType.GAME ) && hasWorld) {
@@ -50,9 +41,9 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
return true;
}
public final boolean doTickInGUI(TickType tick, boolean tickEnd, Object minecraftInstance, Object... data)
public final boolean doTickInGUI(TickType tick, boolean tickEnd, Object... data)
{
Minecraft mc = (Minecraft) minecraftInstance;
Minecraft mc = FMLClientHandler.instance().getClient();
if (tickEnd && ( tick==TickType.RENDER || tick==TickType.GAME ) || tick == TickType.GUILOAD) {
return onTickInGUI((Float) data[0], mc, mc.field_71462_r);
}
@@ -60,17 +51,22 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
}
/**
* @param minecraftInstance
* @return
*//*
*//**
* @param renderers
*/
*//*
public final void onRenderHarvest(Map renderers)
{
addRenderer((Map<Class<? extends Entity>,Render>)renderers);
}
/**
*//**
*
*/
*//*
public final void onRegisterAnimations()
{
registerAnimation(FMLClientHandler.instance().getClient());
@@ -159,15 +155,16 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
}
}
/**
*//**
* NO-OP on client side
*/
*//*
@Override
public final boolean handleCommand(String command, Object... data)
{
return false;
}
// BASEMOD API
*/ // BASEMOD API
/**
* Override if you wish to provide a fuel item for the furnace and return the fuel value of the item
*
@@ -23,6 +23,7 @@ import cpw.mods.fml.client.BlockRenderManager;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.TextureFXManager;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
/**
*
@@ -35,17 +36,17 @@ public class FMLRenderAccessLibrary
{
public static Logger getLogger()
{
return FMLCommonHandler.instance().getFMLLogger();
return FMLLog.getLogger();
}
public static void log(Level level, String message)
{
getLogger().log(level, message);
FMLLog.log(level, message);
}
public static void log(Level level, String message, Throwable throwable)
{
getLogger().log(level, message, throwable);
FMLLog.log(level, throwable, message);
}
public static void setTextureDimensions(int textureId, int width, int height, List<TextureFX> textureFXList)
+3 -2
View File
@@ -40,6 +40,7 @@ import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
public class ModLoader
@@ -128,7 +129,7 @@ public class ModLoader
*/
public static void addLocalization(String key, String lang, String value)
{
FMLCommonHandler.instance().addStringLocalization(key, lang, value);
LanguageRegistry.instance().addStringLocalization(key, lang, value);
}
/**
@@ -151,7 +152,7 @@ public class ModLoader
*/
public static void addName(Object instance, String lang, String name)
{
FMLCommonHandler.instance().addNameForObject(instance, lang, name);
LanguageRegistry.instance().addNameForObject(instance, lang, name);
}
/**
-46
View File
@@ -1,46 +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.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author cpw
*
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface SidedProxy
{
/**
* The name of the client side class to load and populate
* @return
*/
String clientSide() default "";
/**
* The name of the server side class to load and populate
* @return
*/
String serverSide() default "";
/**
* The name of the a special bukkit plugin class to load and populate
*/
String bukkitSide() default "";
}