當前位置: 首頁>>代碼示例>>Java>>正文


Java ReflectionHelper.findField方法代碼示例

本文整理匯總了Java中cpw.mods.fml.relauncher.ReflectionHelper.findField方法的典型用法代碼示例。如果您正苦於以下問題:Java ReflectionHelper.findField方法的具體用法?Java ReflectionHelper.findField怎麽用?Java ReflectionHelper.findField使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cpw.mods.fml.relauncher.ReflectionHelper的用法示例。


在下文中一共展示了ReflectionHelper.findField方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: makeOurList

import cpw.mods.fml.relauncher.ReflectionHelper; //導入方法依賴的package包/類
private void makeOurList()
{
    if (serverListInternetField == null)
    {
        if (serverListInternetField == null)
        {
            serverListInternetField = ReflectionHelper.findField(ServerSelectionList.class, "field_148198_l", "serverListInternet");
            serverListInternetField.setAccessible(true);
        }
    }

    try
    {
        ourList = (List<ServerListEntryPublic>) serverListInternetField.get(this);
    }
    catch (IllegalAccessException e)
    {
        CreeperHost.logger.warn("Reflection to get server list failed.", e);
    }
}
 
開發者ID:CreeperHost,項目名稱:CreeperHostGui,代碼行數:21,代碼來源:ServerSelectionListPublic.java

示例2: setServerList

import cpw.mods.fml.relauncher.ReflectionHelper; //導入方法依賴的package包/類
private void setServerList(ServerList serverList)
{
    ourSavedServerList = serverList;
    if (savedServerListField == null)
    {
        savedServerListField = ReflectionHelper.findField(GuiMultiplayer.class, "field_146804_i", "savedServerList");
        savedServerListField.setAccessible(true);
    }

    try
    {
        savedServerListField.set(this, serverList);
    }
    catch (IllegalAccessException e)
    {
        CreeperHost.logger.error("Unable to set server list", e);
    }
}
 
開發者ID:CreeperHost,項目名稱:CreeperHostGui,代碼行數:19,代碼來源:GuiMultiplayerPublic.java

示例3: setLanServerDetector

import cpw.mods.fml.relauncher.ReflectionHelper; //導入方法依賴的package包/類
private void setLanServerDetector(LanServerDetector.ThreadLanServerFind detector)
{
    ourLanServerDetector = detector;
    if (lanServerDetectorField == null)
    {
        lanServerDetectorField = ReflectionHelper.findField(GuiMultiplayer.class, "field_146800_B", "lanServerDetector");
        lanServerDetectorField.setAccessible(true);
    }

    try
    {
        lanServerDetectorField.set(this, detector);
    }
    catch (IllegalAccessException e)
    {
        CreeperHost.logger.error("Unable to set server list", e);
    }
}
 
開發者ID:CreeperHost,項目名稱:CreeperHostGui,代碼行數:19,代碼來源:GuiMultiplayerPublic.java

示例4: setLanServerList

import cpw.mods.fml.relauncher.ReflectionHelper; //導入方法依賴的package包/類
private void setLanServerList(LanServerDetector.LanServerList detector)
{
    ourLanServerList = detector;
    if (lanServerListField == null)
    {
        lanServerListField = ReflectionHelper.findField(GuiMultiplayer.class, "field_146799_A", "lanServerList");
        lanServerListField.setAccessible(true);
    }

    try
    {
        lanServerListField.set(this, detector);
    }
    catch (IllegalAccessException e)
    {
        CreeperHost.logger.error("Unable to set server list", e);
    }
}
 
開發者ID:CreeperHost,項目名稱:CreeperHostGui,代碼行數:19,代碼來源:GuiMultiplayerPublic.java

示例5: setServerListSelector

import cpw.mods.fml.relauncher.ReflectionHelper; //導入方法依賴的package包/類
private void setServerListSelector(ServerSelectionListPublic list)
{
    ourServerListSelector = list;
    if (serverListSelectorField == null)
    {
        serverListSelectorField = ReflectionHelper.findField(GuiMultiplayer.class, "field_146803_h", "serverListSelector");
        serverListSelectorField.setAccessible(true);
    }

    try
    {
        serverListSelectorField.set(this, list);
    }
    catch (IllegalAccessException e)
    {
        CreeperHost.logger.error("Unable to set server list", e);
    }
}
 
開發者ID:CreeperHost,項目名稱:CreeperHostGui,代碼行數:19,代碼來源:GuiMultiplayerPublic.java

示例6: RabbitFoot

import cpw.mods.fml.relauncher.ReflectionHelper; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public RabbitFoot() {
	setTextureName("rabbit_foot");
	setUnlocalizedName(Utils.getUnlocalisedName("rabbit_foot"));
	setCreativeTab(EtFuturum.enableRabbit ? EtFuturum.creativeTab : null);

	if (EtFuturum.enableRabbit)
		try {
			Field f = ReflectionHelper.findField(PotionHelper.class, "potionRequirements", "field_77927_l");
			f.setAccessible(true);
			HashMap<Integer, String> potionRequirements = (HashMap<Integer, String>) f.get(null);
			potionRequirements.put(Potion.jump.getId(), "0 & 1 & !2 & 3");

			Field f2 = ReflectionHelper.findField(PotionHelper.class, "potionAmplifiers", "field_77928_m");
			f2.setAccessible(true);
			HashMap<Integer, String> potionAmplifiers = (HashMap<Integer, String>) f2.get(null);
			potionAmplifiers.put(Potion.jump.getId(), "5");

			Field f3 = ReflectionHelper.findField(Potion.class, "liquidColor", "field_76414_N");
			f3.setAccessible(true);
			f3.set(Potion.jump, 0x22FF4C);
		} catch (Exception e) {
		}
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:25,代碼來源:RabbitFoot.java

示例7: ChunkManagerPlanet

import cpw.mods.fml.relauncher.ReflectionHelper; //導入方法依賴的package包/類
public ChunkManagerPlanet(long seed, WorldType default1, DimensionProperties properties) {

		this.biomeCache = new BiomeCache(this);//new BiomeCacheExtended(this);
		//TODO: more biomes
		//TODO: remove rivers
		GenLayer[] agenlayer = initializeAllBiomeGenerators(seed, default1, properties);//GenLayer.initializeAllBiomeGenerators(seed, default1); //;
		agenlayer = getModdedBiomeGenerators(default1, seed, agenlayer);
		this.genBiomes = agenlayer[0];
		this.biomeIndexLayer = agenlayer[1];
		
		fBiomeCache = ReflectionHelper.findField(BiomeCache.class, "cache", "field_76841_d");
		fBiomeCache.setAccessible(true);
		
		fBiomeCacheMap = ReflectionHelper.findField(BiomeCache.class, "cacheMap", "field_76843_c");
		fBiomeCacheMap.setAccessible(true);
	}
 
開發者ID:zmaster587,項目名稱:AdvancedRocketry,代碼行數:17,代碼來源:ChunkManagerPlanet.java

示例8: setGuiInEvent

import cpw.mods.fml.relauncher.ReflectionHelper; //導入方法依賴的package包/類
public static boolean setGuiInEvent(Object event, GuiScreen replacement)
{
    try
    {
        Field guiField = ReflectionHelper.findField(event.getClass(), "gui");
        guiField.setAccessible(true);
        guiField.set(event, replacement);
        return true;
    }
    catch (IllegalAccessException e)
    {
    }

    return false;
}
 
開發者ID:CreeperHost,項目名稱:CreeperHostGui,代碼行數:16,代碼來源:Util.java

示例9: actionPerformed

import cpw.mods.fml.relauncher.ReflectionHelper; //導入方法依賴的package包/類
@Override
protected void actionPerformed(GuiButton button)
{
    if (button.id == 0)
    {
        if (captiveConnecting != null)
        {
            if (lastNetworkManager != null)
            {
                lastNetworkManager.closeChannel(new ChatComponentText("Aborted"));
            }

            try
            {
                if (cancelField == null)
                {
                    cancelField = ReflectionHelper.findField(GuiConnecting.class, "field_146373_h", "cancel");
                }
                cancelField.set(captiveConnecting, true);
            }
            catch (Throwable e)
            {

            }
        }
    }
    super.actionPerformed(button);
}
 
開發者ID:CreeperHost,項目名稱:CreeperHostGui,代碼行數:29,代碼來源:GuiProgressDisconnected.java

示例10: setFinalField

import cpw.mods.fml.relauncher.ReflectionHelper; //導入方法依賴的package包/類
private void setFinalField(Class<?> cls, Object obj, Object newValue, String... fieldNames) {
	try {
		Field field = ReflectionHelper.findField(cls, fieldNames);
		field.setAccessible(true);

		Field modifiersField = Field.class.getDeclaredField("modifiers");
		modifiersField.setAccessible(true);
		modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);

		field.set(obj, newValue);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:15,代碼來源:EtFuturum.java

示例11: canAddSound

import cpw.mods.fml.relauncher.ReflectionHelper; //導入方法依賴的package包/類
public static boolean canAddSound(final ISound sound) {
    if (Sounds.playingSounds == null) {
        Sounds.playingSounds = ReflectionHelper.findField((Class)SoundManager.class, new String[] { "playingSounds", "field_148629_h" });
        Sounds.soundMgr = ReflectionHelper.findField((Class)SoundHandler.class, new String[] { "sndManager", "field_147694_f" });
    }
    try {
        final SoundManager manager = (SoundManager)Sounds.soundMgr.get(Minecraft.getMinecraft().getSoundHandler());
        final Map map = (Map)Sounds.playingSounds.get(manager);
        return !map.containsValue(sound);
    }
    catch (IllegalAccessException e) {
        return false;
    }
}
 
開發者ID:sameer,項目名稱:ExtraUtilities,代碼行數:15,代碼來源:Sounds.java

示例12: DespawnController

import cpw.mods.fml.relauncher.ReflectionHelper; //導入方法依賴的package包/類
private DespawnController() {
  try {
    fieldpersistenceRequired = ReflectionHelper.findField(EntityLiving.class, "field_82179_bU", "persistenceRequired");
  } catch (Exception e) {
    Log.error("DespawnController: Could not find field: persistenceRequired");
  }
}
 
開發者ID:SleepyTrousers,項目名稱:Structures,代碼行數:8,代碼來源:DespawnController.java

示例13: initTimer

import cpw.mods.fml.relauncher.ReflectionHelper; //導入方法依賴的package包/類
private static Field initTimer() {
  Field f = null;
  try {
    f = ReflectionHelper.findField(Minecraft.class, "field_71428_T", "timer", "Q");
    f.setAccessible(true);
  } catch (Exception e) {
    Log.error("Failed to initialize timer reflection for IO config.");
    e.printStackTrace();
  }
  return f;
}
 
開發者ID:SleepyTrousers,項目名稱:EnderCore,代碼行數:12,代碼來源:RenderUtil.java

示例14: beginIntercepting

import cpw.mods.fml.relauncher.ReflectionHelper; //導入方法依賴的package包/類
public static void beginIntercepting() {
  EnderCore.logger.info("Attempting to initialize texture error message interceptor.");
  try {
    Field f = ReflectionHelper.findField(TextureMap.class, "logger", "field_147635_d", "d");
    Field modifiersField = Field.class.getDeclaredField("modifiers");
    modifiersField.setAccessible(true);
    modifiersField.setInt(f, f.getModifiers() & ~Modifier.FINAL);
    f.setAccessible(true);
    INSTANCE = new TextureErrorRemover((Logger) f.get(null));
    f.set(null, INSTANCE);
  } catch (Exception e) {
    EnderCore.logger.error("Failed to initialize texture error interceptor!", e);
  }
}
 
開發者ID:SleepyTrousers,項目名稱:EnderCore,代碼行數:15,代碼來源:TextureErrorRemover.java

示例15: ItemUpgrade

import cpw.mods.fml.relauncher.ReflectionHelper; //導入方法依賴的package包/類
public ItemUpgrade(int num) {
	super(num);
	icon = new ResourceIcon[num];
	setMaxStackSize(1);

	walkSpeed = ReflectionHelper.findField(net.minecraft.entity.player.PlayerCapabilities.class, "walkSpeed", "field_75097_g");
	walkSpeed.setAccessible(true);
}
 
開發者ID:zmaster587,項目名稱:AdvancedRocketry,代碼行數:9,代碼來源:ItemUpgrade.java


注:本文中的cpw.mods.fml.relauncher.ReflectionHelper.findField方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。