當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。