Add in an optional modid identifier for @SidedProxy. It's main use is when both scala and java @Mods reside in the
same package, and you want the @SidedProxy behaviour for a specific @Mod language type. In general it should not be needed otherwise.
This commit is contained in:
parent
fea7a25a86
commit
1261c7a3e0
2 changed files with 19 additions and 2 deletions
|
@ -17,6 +17,8 @@ import java.lang.reflect.Modifier;
|
|||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import cpw.mods.fml.common.discovery.ASMDataTable;
|
||||
import cpw.mods.fml.common.discovery.ASMDataTable.ASMData;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
@ -46,7 +48,13 @@ public class ProxyInjector
|
|||
throw new LoaderException();
|
||||
}
|
||||
|
||||
String targetType = side.isClient() ? target.getAnnotation(SidedProxy.class).clientSide() : target.getAnnotation(SidedProxy.class).serverSide();
|
||||
SidedProxy annotation = target.getAnnotation(SidedProxy.class);
|
||||
if (!Strings.isNullOrEmpty(annotation.modId()) && !annotation.modId().equals(mod.getModId()))
|
||||
{
|
||||
FMLLog.fine("Skipping proxy injection for %s.%s since it is not for mod %s", targ.getClassName(), targ.getObjectName(), mod.getModId());
|
||||
continue;
|
||||
}
|
||||
String targetType = side.isClient() ? annotation.clientSide() : annotation.serverSide();
|
||||
Object proxy=Class.forName(targetType, true, mcl).newInstance();
|
||||
|
||||
if (languageAdapter.supportsStatics() && (target.getModifiers() & Modifier.STATIC) == 0 )
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
@ -35,8 +35,17 @@ public @interface SidedProxy
|
|||
*/
|
||||
String serverSide() default "";
|
||||
|
||||
@Deprecated
|
||||
/**
|
||||
* Not implemented
|
||||
* The name of a special bukkit plugin class to load and populate
|
||||
*/
|
||||
String bukkitSide() default "";
|
||||
|
||||
/**
|
||||
* The (optional) name of a mod to load this proxy for. This will help ensure correct behaviour when loading a combined
|
||||
* scala/java mod package. It is almost never going to be required, unless you ship both Scala and Java {@link Mod} content
|
||||
* in a single jar.
|
||||
*/
|
||||
String modId() default "";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue