• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java UnableToAccessFieldException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中cpw.mods.fml.relauncher.ReflectionHelper.UnableToAccessFieldException的典型用法代码示例。如果您正苦于以下问题:Java UnableToAccessFieldException类的具体用法?Java UnableToAccessFieldException怎么用?Java UnableToAccessFieldException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UnableToAccessFieldException类属于cpw.mods.fml.relauncher.ReflectionHelper包,在下文中一共展示了UnableToAccessFieldException类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getPrivateValue

import cpw.mods.fml.relauncher.ReflectionHelper.UnableToAccessFieldException; //导入依赖的package包/类
public static <T, E> T getPrivateValue(Class<? super E> classToAccess, E instance, int fieldIndex)
{
    try
    {
        return ReflectionHelper.getPrivateValue(classToAccess, instance, fieldIndex);
    }
    catch (UnableToAccessFieldException e)
    {
        FMLLog.log(Level.ERROR, e, "There was a problem getting field index %d from %s", fieldIndex, classToAccess.getName());
        throw e;
    }
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:13,代码来源:ObfuscationReflectionHelper.java


示例2: setPrivateValue

import cpw.mods.fml.relauncher.ReflectionHelper.UnableToAccessFieldException; //导入依赖的package包/类
public static <T, E> void setPrivateValue(Class<? super T> classToAccess, T instance, E value, int fieldIndex)
{
    try
    {
        ReflectionHelper.setPrivateValue(classToAccess, instance, value, fieldIndex);
    }
    catch (UnableToAccessFieldException e)
    {
        FMLLog.log(Level.ERROR, e, "There was a problem setting field index %d on type %s", fieldIndex, classToAccess.getName());
        throw e;
    }
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:13,代码来源:ObfuscationReflectionHelper.java


示例3: setFinalValue

import cpw.mods.fml.relauncher.ReflectionHelper.UnableToAccessFieldException; //导入依赖的package包/类
public static <T, E> void setFinalValue(Class<? super T> classToAccess, T instance, E value, int fieldIndex) {
    try {
        Field f = classToAccess.getDeclaredFields()[fieldIndex];
        f.setAccessible(true);
        setFinal(f, false);
        f.set(instance, value);
        setFinal(f, true);
    } catch (Exception e) {
        throw new UnableToAccessFieldException(new String[0], e);
    }
}
 
开发者ID:NovaViper,项目名称:ZeroQuest,代码行数:12,代码来源:UnsafeReflectionHelper.java


示例4: getPrivateValue

import cpw.mods.fml.relauncher.ReflectionHelper.UnableToAccessFieldException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static <T, E> T getPrivateValue(Class<? super E> classToAccess, E instance, int fieldIndex)
{
    try
    {
        return ReflectionHelper.getPrivateValue(classToAccess, instance, fieldIndex);
    }
    catch (UnableToAccessFieldException e)
    {
        FMLLog.log(Level.SEVERE, e, "There was a problem getting field index %d from %s", fieldIndex, classToAccess.getName());
        throw e;
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:14,代码来源:ObfuscationReflectionHelper.java


示例5: setPrivateValue

import cpw.mods.fml.relauncher.ReflectionHelper.UnableToAccessFieldException; //导入依赖的package包/类
public static <T, E> void setPrivateValue(Class<? super T> classToAccess, T instance, E value, int fieldIndex)
{
    try
    {
        ReflectionHelper.setPrivateValue(classToAccess, instance, value, fieldIndex);
    }
    catch (UnableToAccessFieldException e)
    {
        FMLLog.log(Level.SEVERE, e, "There was a problem setting field index %d on type %s", fieldIndex, classToAccess.getName());
        throw e;
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:13,代码来源:ObfuscationReflectionHelper.java


示例6: getPotentialArm

import cpw.mods.fml.relauncher.ReflectionHelper.UnableToAccessFieldException; //导入依赖的package包/类
public static ModelRenderer getPotentialArm(ModelBase parent)
{
	if(parent != null)
	{
		Class clz = parent.getClass();
           if(armMappings.containsKey(clz))
           {
               return armMappings.get(clz);
           }
		if(clz == ModelHorse.class)
		{
			ModelHorse dummy = new ModelHorse();
			
			ModelRenderer leg = new ModelRenderer(dummy, 60, 29);
	        leg.addBox(-1.1F, -1.0F, -2.1F, 3, 8, 4);
	        leg.setRotationPoint(-4.0F, 9.0F, -8.0F);
	        
	        ModelRenderer shin = new ModelRenderer(dummy, 60, 41);
	        shin.addBox(-1.1F, 0.0F, -1.6F, 3, 5, 3);
	        shin.setRotationPoint(0.0F, 7.0F, 0.0F);
	        leg.addChild(shin);
	        
	        ModelRenderer hoof = new ModelRenderer(dummy, 60, 51);
	        hoof.addBox(-1.6F, 5.1F, -2.1F, 4, 3, 4);
	        hoof.setRotationPoint(0.0F, 0.0F, 0.0F);

	        shin.addChild(hoof);
	        
	        return leg;
		}
		else
		{
			while(clz != ModelBase.class && ModelBase.class.isAssignableFrom(clz))
			{
				try
				{
					Field[] fields = clz.getDeclaredFields();
					for(Field f : fields)
					{
						f.setAccessible(true);
						if(f.getType() == ModelRenderer.class)
						{
							if(clz == ModelBiped.class && (f.getName().equalsIgnoreCase("bipedRightArm") || f.getName().equalsIgnoreCase("f") || f.getName().equalsIgnoreCase("field_78112_f")) || 
								clz == ModelQuadruped.class && (f.getName().equalsIgnoreCase("leg3") || f.getName().equalsIgnoreCase("e") || f.getName().equalsIgnoreCase("field_78147_e")) ||
								clz == ModelCreeper.class && (f.getName().equalsIgnoreCase("leg3") || f.getName().equalsIgnoreCase("f") || f.getName().equalsIgnoreCase("field_78129_f")) ||
								clz == ModelIronGolem.class && (f.getName().equalsIgnoreCase("ironGolemRightArm") || f.getName().equalsIgnoreCase("c") || f.getName().equalsIgnoreCase("field_78177_c")) ||
								clz == ModelSpider.class && (f.getName().equalsIgnoreCase("spiderLeg7") || f.getName().equalsIgnoreCase("j") || f.getName().equalsIgnoreCase("field_78210_j")) ||
								clz == ModelWolf.class && (f.getName().equalsIgnoreCase("wolfLeg3") || f.getName().equalsIgnoreCase("e") || f.getName().equalsIgnoreCase("field_78182_e")) ||
								clz == ModelOcelot.class && (f.getName().equalsIgnoreCase("ocelotFrontRightLeg") || f.getName().equalsIgnoreCase("d") || f.getName().equalsIgnoreCase("field_78157_d")) ||
								clz != ModelBiped.class && clz != ModelQuadruped.class && clz != ModelCreeper.class && clz != ModelIronGolem.class && clz != ModelSpider.class && clz != ModelWolf.class && clz != ModelOcelot.class &&  
								(f.getName().contains("Right") || f.getName().contains("right")) && (f.getName().contains("arm") || f.getName().contains("hand") || f.getName().contains("Arm") || f.getName().contains("Hand")))
							{
								ModelRenderer arm = (ModelRenderer)f.get(parent);
								if(arm != null)
								{
									return arm; // Add normal parent fields
								}
							}
						}
						else if(f.getType() == ModelRenderer[].class && clz == ModelSquid.class && (f.getName().equalsIgnoreCase("squidTentacles") || f.getName().equalsIgnoreCase("b") || f.getName().equalsIgnoreCase("field_78201_b")))
						{
							return ((ModelRenderer[])f.get(parent))[0];
						}
					}
					clz = clz.getSuperclass();
				}
				catch(Exception e)
				{
					throw new UnableToAccessFieldException(new String[0], e);
				}
			}
		}
	}

	return null;
}
 
开发者ID:iChun,项目名称:Morph,代码行数:77,代码来源:ModelHelper.java



注:本文中的cpw.mods.fml.relauncher.ReflectionHelper.UnableToAccessFieldException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TypedUtil类代码示例发布时间:2022-05-22
下一篇:
Java StageScheduler类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap