当前位置: 首页>>代码示例>>Java>>正文


Java ReflectionHelper.findMethod方法代码示例

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


在下文中一共展示了ReflectionHelper.findMethod方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: notifyPlayers

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public static void notifyPlayers(WorldServer world) {
	if (RorysConfig.enableSleepInDay) {
		if (world.getWorldTime() == RorysConfig.sleepDayTime) {
			world.provider.resetRainAndThunder();

			Iterator iterator = world.playerEntities.iterator();
			while (iterator.hasNext()) {
				EntityPlayer entityplayer = (EntityPlayer) iterator.next();
				entityplayer.addChatMessage(new ChatComponentText(String.format(StatCollector.translateToLocal("message.rorysmod.sleeping.wakeup"), EnumChatFormatting.AQUA + entityplayer.getDisplayName() + EnumChatFormatting.WHITE)));
			}
		}
	} else {
		Method wakeAllPlayers = ReflectionHelper.findMethod(WorldServer.class, world, new String[] { "wakeAllPlayers", "func_73053_d" });
		try {
			wakeAllPlayers.invoke(world, new Object[] {});
		} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
			e.printStackTrace();
		}
	}
}
 
开发者ID:roryclaasen,项目名称:RorysMod,代码行数:22,代码来源:CoreHelper.java

示例2: doHeal

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
private void doHeal(EntityLivingBase guy) {
	armSwing(!didSwing); // Swings arm and heals the specified person.
	EntityPotion potion = new EntityPotion(worldObj, this,
			handPotion().getItemDamage());
	worldObj.spawnEntityInWorld(potion);

	// potion.onImpact(new MovingObjectPosition(guy));
	try {
		final Method onImpact = ReflectionHelper.findMethod(
				EntityPotion.class, potion, MCP_ONIMPACT,
				MovingObjectPosition.class);
		onImpact.invoke(potion, new MovingObjectPosition(guy));
	} catch (Exception e) {
		e.printStackTrace();
	}

	setPathToEntity((PathEntity) null);
	healTime = 200;
	setRarePotion(rand.nextInt(4) == 0);
}
 
开发者ID:allaryin,项目名称:FairyFactions,代码行数:21,代码来源:EntityFairy.java

示例3: drawString

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
@Override
public int drawString(String text, int x, int y, int color, boolean dropShadow) {
	if (dropShadow) {
		Method renderString = ReflectionHelper.findMethod(FontRenderer.class, this, renderStringObfNames,
				String.class, int.class, int.class, int.class, boolean.class);
		try {
			renderString.invoke(this, text, x, y+1, color, true);
			renderString.invoke(this, text, x, y-1, color, true);
			renderString.invoke(this, text, x-1, y, color, true);
			renderString.invoke(this, text, x+1, y, color, true);
		} catch (Exception e) {}
		return super.drawString(text, x, y, color, false);
	} else {
		return super.drawString(text, x, y, color, false);
	}
}
 
开发者ID:Hunternif,项目名称:Dota2Items,代码行数:17,代码来源:FontRendererContourShadow.java

示例4: resetTimer

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
public void resetTimer(final MobSpawnerBaseLogic logic) {
    if (this.cache == null) {
        this.cache = ReflectionHelper.findMethod((Class)MobSpawnerBaseLogic.class, (Object)logic, new String[] { "resetTimer", "func_98273_j" }, new Class[0]);
    }
    try {
        this.cache.invoke(logic, new Object[0]);
    }
    catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:12,代码来源:BlockCursedEarth.java

示例5: run

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
@Override
public void run(){
    try {
        if(getAsieSplashMethod == null) {
            Class okuTickHandler = Class.forName("okushama.drama.TickHandlerClient");
            okuTickHandlerInstance = okuTickHandler.newInstance();
            getAsieSplashMethod = ReflectionHelper.findMethod(okuTickHandler, okuTickHandlerInstance, new String[]{"asieSplash"});
        }
        cachedLine = (String)getAsieSplashMethod.invoke(okuTickHandlerInstance);
    } catch(Exception e) {
        Log.warning("Reflection failed on the Drama Splash getter!");
        e.printStackTrace();
        failed = true;
    }
}
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:16,代码来源:DramaSplash.java

示例6: getSilkTouchBlock

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
private static ItemStack getSilkTouchBlock(Block block, int meta){
    ItemStack stack = silkTouchBlocks.get(Block.getIdFromBlock(block));
    if(stack == null) {
        Method method = ReflectionHelper.findMethod(Block.class, block, new String[]{"func_149644_j", "createStackedBlock"}, int.class);
        try {
            stack = (ItemStack)method.invoke(block, meta);
        } catch(Exception e) {
            Log.error("Reflection failed when trying to get a silk touch block!");
            e.printStackTrace();
        }
        silkTouchBlocks.put(Block.getIdFromBlock(block), stack);
    }
    return stack.copy();
}
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:15,代码来源:DroneAIDig.java

示例7: findMethod

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
public static <E> Method findMethod(Class<? super E> clazz, String[] methodNames, Class<?>... methodTypes) {
    return ReflectionHelper.findMethod(clazz, null, methodNames, methodTypes);
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:4,代码来源:Injector.java


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