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


Java ReflectionHelper.getPrivateValue方法代码示例

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


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

示例1: onCollideWithPlayer

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
@Override
public void onCollideWithPlayer(EntityPlayer player) {
	boolean inGround = false;
	try {
		inGround = ReflectionHelper.getPrivateValue(EntityArrow.class, this, "inGround", "field_70254_i");
	} catch (Exception e) {
	}

	if (!worldObj.isRemote && inGround && arrowShake <= 0 && isEffectValid()) {
		boolean flag = canBePickedUp == 1 || canBePickedUp == 2 && player.capabilities.isCreativeMode;

		ItemStack stack = new ItemStack(ModItems.tipped_arrow);
		TippedArrow.setEffect(stack, Potion.potionTypes[effect.getPotionID()], effect.getDuration());

		if (canBePickedUp == 1 && !player.inventory.addItemStackToInventory(stack))
			flag = false;

		if (flag) {
			playSound("random.pop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
			player.onItemPickup(this, 1);
			setDead();
		}
	}
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:25,代码来源:EntityTippedArrow.java

示例2: processCommand

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
public void processCommand(final ICommandSender icommandsender, final String[] astring) {
    final File f = new File(Minecraft.getMinecraft().mcDataDir, "extrautilities_localization.txt");
    final Map<String, Properties> k = (Map<String, Properties>)ReflectionHelper.getPrivateValue((Class)LanguageRegistry.class, (Object)LanguageRegistry.instance(), new String[] { "modLanguageData" });
    final String lang = FMLCommonHandler.instance().getCurrentLanguage();
    final Properties p = k.get(lang);
    String t = "";
    for (final Map.Entry<Object, Object> entry : p.entrySet()) {
        t = t + entry.getKey() + "=" + entry.getValue() + "\n";
    }
    try {
        Files.write((CharSequence)t, f, Charsets.UTF_8);
        LogHelper.info("Dumped Language data to " + f.getAbsolutePath(), new Object[0]);
    }
    catch (Exception exception) {
        exception.printStackTrace();
    }
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:18,代码来源:CommandDumpLocalization.java

示例3: getSheep

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
public ArrayList getSheep( final World world ) {
	final List list = world.getEntitiesWithinAABB( EntitySheep.class, fairy.boundingBox.expand( 5D, 5D, 5D ) );

	if ( list.size() < 1 ) {
		return null;
	}

	final ArrayList list2 = new ArrayList();

	for ( int i = 0; i < list.size(); i++ ) {
		final EntitySheep entity1 = (EntitySheep) list.get( i );

		final int fleeingTick = ReflectionHelper.getPrivateValue(EntityCreature.class, entity1, MCP_FLEEINGTICK);
		if ( fairy.canEntityBeSeen( entity1 ) && entity1.getHealth() > 0 && entity1.getEntityToAttack() == null
				&& fleeingTick <= 0 && entity1.getGrowingAge() >= 0 && !entity1.getSheared() ) {
			list2.add( entity1 );
		}
	}

	if ( list2.size() <= 0 ) {
		return null;
	} else {
		return list2;
	}
}
 
开发者ID:allaryin,项目名称:FairyFactions,代码行数:26,代码来源:FairyJob.java

示例4: inject

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
/**
 * Inserts the resource pack into the game. Enabling the resource pack will
 * not be required, it will load automatically.
 * <p>
 * A cache of the pack zip will be kept in "resourcepack/[pack name].zip"
 * where "resourcepack" is a folder at the same level as the directory passed
 * into the constructor.
 */
public void inject() {
  if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
    try {
      if (defaultResourcePacks == null) {
        defaultResourcePacks = ReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(), "defaultResourcePacks", "field_110449_ao", "ap");
      }

      File dest = new File(dir.getParent() + "/resourcepack/" + zip.getName());
      EnderFileUtils.safeDelete(dest);
      FileUtils.copyFile(zip, dest);
      EnderFileUtils.safeDelete(zip);
      writeNewFile(new File(dest.getParent() + "/readme.txt"),
          EnderCore.lang.localize("resourcepack.readme") + "\n\n" + EnderCore.lang.localize("resourcepack.readme2"));
      defaultResourcePacks.add(new FileResourcePack(dest));
    } catch (Exception e) {
      EnderCore.logger.error("Failed to inject resource pack for mod {}", modid, e);
    }
  } else {
    EnderCore.logger.info("Skipping resource pack, we are on a dedicated server.");
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderCore,代码行数:30,代码来源:ResourcePackAssembler.java

示例5: SilverfishModel

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
public SilverfishModel()
{
	normal = new ModelSilverfish();
	
	body = ReflectionHelper.getPrivateValue( ModelSilverfish.class, this, 0 );
	wings = ReflectionHelper.getPrivateValue( ModelSilverfish.class, this, 1 );
       body[ 3 ].rotateAngleX = body[ 4 ].rotateAngleX = body[ 5 ].rotateAngleX = body[ 6 ].rotateAngleX = 3.14f / 2;
       body[ 3 ].rotationPointZ = body[ 4 ].rotationPointZ = body[ 5 ].rotationPointZ = body[ 6 ].rotationPointZ = 0;
       body[ 6 ].offsetY = 0;
       body[ 5 ].offsetY = -0.1f;
       body[ 4 ].rotateAngleX *= -0.7f;
       body[ 4 ].offsetZ = 0.06f;
       body[ 4 ].offsetY = -0.2f;
       body[ 3 ].rotateAngleX *= -0.45f;
       body[ 3 ].offsetY = -0.3f;
       body[ 3 ].offsetZ = -0.05f;
       wings[ 1 ].rotateAngleX = body[ 5 ].rotateAngleX*1.4f;
       wings[ 1 ].rotationPointZ = body[ 5 ].rotationPointZ;
       wings[ 1 ].offsetY = body[ 4 ].offsetX;
       wings[ 1 ].offsetZ = -0.05f;
}
 
开发者ID:spacechase0,项目名称:UsefulPets,代码行数:22,代码来源:SilverfishModel.java

示例6: write

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
@Override
public void write(ByteBuf out) {
	NBTTagCompound nbt = (NBTTagCompound)ReflectionHelper.getPrivateValue(S35PacketUpdateTileEntity.class, (S35PacketUpdateTileEntity)tile.getDescriptionPacket(), "field_148860_e");


	out.writeInt(((Entity)entity).worldObj.provider.dimensionId);
	out.writeInt(((Entity)entity).getEntityId());
	out.writeInt(x);
	out.writeInt(y);
	out.writeInt(z);

	PacketBuffer packetBuffer = new PacketBuffer(out);
	try {
		packetBuffer.writeNBTTagCompoundToBuffer(nbt);
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:zmaster587,项目名称:AdvancedRocketry,代码行数:19,代码来源:PacketStorageTileUpdate.java

示例7: init

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
public static void init() {
	if (Settings.Tweaks.enableEE3Tweaks) {
		try {
			List<RecipeAludel> aludelRecipeList = ReflectionHelper.getPrivateValue(AludelRecipeManager.class,
					AludelRecipeManager.getInstance(), "aludelRecipes");

			for (RecipeAludel recipe : aludelRecipeList) {
				if (recipe.getRecipeOutput().getItem().equals(alchemicalTome)) {
					aludelRecipeList.remove(recipe);
					break;
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
 
开发者ID:Nincodedo,项目名称:Nincrafty-Things,代码行数:18,代码来源:NincraftyEE3Tweaks.java

示例8: getSmallestFlowDecayTo

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
public static int getSmallestFlowDecayTo(BlockDynamicLiquid flowingBlock, World world, int x, int y, int z, int curSmallest, int fromSide)
{
       int flowDecay = Hooks.getFlowDecayTo(flowingBlock, world, x, y, z, fromSide);

       if (flowDecay < 0)
       {
           return curSmallest;
       }
       else
       {
           if (flowDecay == 0)
           {
           	int numAdjacentSources = ReflectionHelper.getPrivateValue(BlockDynamicLiquid.class, flowingBlock, "field_149815_a", "a");
           	ReflectionHelper.setPrivateValue(BlockDynamicLiquid.class, flowingBlock, numAdjacentSources+1, "field_149815_a", "a");
           }

           if (flowDecay >= 8)
           {
           	flowDecay = 0;
           }

           return curSmallest >= 0 && flowDecay >= curSmallest ? curSmallest : flowDecay;
       }
}
 
开发者ID:squeek502,项目名称:EarliestOfGames,代码行数:25,代码来源:Hooks.java

示例9: dump

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
@Override
public Iterable<String[]> dump(int mode) {
    List<String[]> list = new LinkedList<String[]>();
    
    Map<Class, String> classToNameMap = ReflectionHelper.getPrivateValue(TileEntity.class, null, "field_145853_j", "classToNameMap");
    List<Class> classes = new ArrayList<Class>();
    classes.addAll(classToNameMap.keySet());
    Collections.sort(classes, new Comparator<Class>() {
        @Override
        public int compare(Class o1, Class o2) {
            if (o1 == null || o2 == null) {
                return 0;
            }
            return o1.getName().compareTo(o2.getName());
        }
    });
    
    for (Class clazz : classes) {
        if (clazz != null) {
            list.add(new String[] { clazz.getName(), classToNameMap.get(clazz) });
        }
    }
    
    return list;
}
 
开发者ID:Tonius,项目名称:NEI-Integration,代码行数:26,代码来源:TileEntityDumper.java

示例10: dump

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
@Override
public Iterable<String[]> dump(int mode) {
    List<String[]> list = new LinkedList<String[]>();
    
    List<Integer> ids = new ArrayList<Integer>();
    ids.addAll(Arrays.asList(DimensionManager.getStaticDimensionIDs()));
    Collections.sort(ids);
    
    for (int id : ids) {
        int providerId = DimensionManager.getProviderType(id);
        Map<Integer, Class> providers = ReflectionHelper.getPrivateValue(DimensionManager.class, null, "providers");
        Class providerClass = providers.get(providerId);
        list.add(new String[] { String.valueOf(id), String.valueOf(providerId), providerClass.getName() });
    }
    
    return list;
}
 
开发者ID:Tonius,项目名称:NEI-Integration,代码行数:18,代码来源:DimensionDumper.java

示例11: actionPerformed

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
@Override
protected void actionPerformed(GuiButton button) {
	if (!button.enabled) return;
	switch (button.id) {
		case 0:
			if (buttonRegenMode.enabled)
				preset = regenMode;
			break;
		case 3:
			// If going to the more options screen, hide the button.
			// If going back to the main screen, show the button again.
			boolean inMoreOptions = ReflectionHelper.getPrivateValue(GuiCreateWorld.class, this, "field_146344_y");
			buttonRegenMode.visible = inMoreOptions;
			break;
		case 9:
			regenMode = EnumPreset.values()[(regenMode.ordinal() + 1) % EnumPreset.values().length];
			buttonRegenMode.displayString = getRegenButtonString();
			break;
	}
	super.actionPerformed(button);
}
 
开发者ID:copygirl,项目名称:AdvHealthOptions,代码行数:22,代码来源:AHOGuiCreateWorld.java

示例12: dumpOreDict

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
/**
 * Dump ore dictionary
 */
public static void dumpOreDict() {
    Map<Integer, ItemData> idMap = ReflectionHelper.getPrivateValue(GameData.class, null, "idMap");

    List<String> oreNames = Arrays.asList(OreDictionary.getOreNames());
    Collections.sort(oreNames);

    for (String oreName : oreNames) {
        StringBuffer sb = new StringBuffer();

        sb.append("ore: " + oreName + ": ");
        ArrayList<ItemStack> oreItems = OreDictionary.getOres(oreName);
        for (ItemStack oreItem : oreItems) {
            ItemData itemData = idMap.get(oreItem.itemID);
            String modID = itemData.getModId();

            sb.append(oreItem.itemID + ":" + oreItem.getItemDamage() + "=" + modID + ", ");
        }
        System.out.println(sb);
    }
}
 
开发者ID:agaricusb,项目名称:OreDupeFix,代码行数:24,代码来源:OreDupeFix.java

示例13: replaceDungeonLoot

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
public static void replaceDungeonLoot() {
    try {
        HashMap<String, ChestGenHooks> chestInfo = ReflectionHelper.getPrivateValue(ChestGenHooks.class, null, "chestInfo");
        for (Map.Entry<String, ChestGenHooks> entry : chestInfo.entrySet()) {
            ChestGenHooks chestGenHooks = entry.getValue();

            ArrayList<WeightedRandomChestContent> contents = ReflectionHelper.getPrivateValue(ChestGenHooks.class, chestGenHooks, "contents");
            for (WeightedRandomChestContent weightedRandomChestContent : contents) {
                ItemStack output = weightedRandomChestContent.theItemId;
                ItemStack newOutput = getPreferredOre(output);
                if (newOutput == null) {
                    continue;
                }

                log("Modifying dungeon loot in "+entry.getKey()+", replacing "+output.itemID+":"+output.getItemDamage()+" -> "+newOutput.itemID+":"+newOutput.getItemDamage());
                weightedRandomChestContent.theItemId = newOutput;
            }
        }
    } catch (Throwable t) {
        System.out.println("Failed to replace dungeon loot: " + t);
    }
}
 
开发者ID:agaricusb,项目名称:OreDupeFix,代码行数:23,代码来源:OreDupeFix.java

示例14: getDrinkVessels

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
public static LOTRItemMug.Vessel[] getDrinkVessels(LOTRTradeEntries instance) {
	LOTRItemMug.Vessel[] ret = null;
	try {
		ret = ReflectionHelper.getPrivateValue(LOTRTradeEntries.class, instance, "drinkVessels");
	} catch (Exception e) {
		NeiLotr.mod.getLogger()
				.error("Could not get private field value drinkVessels from LOTRTradeEntries via reflection", e);
	}
	return ret;
}
 
开发者ID:CraftedMods,项目名称:nei-lotr,代码行数:11,代码来源:NeiLotrReflection.java

示例15: getStrenghts

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
public static float[] getStrenghts() {
	float[] ret = null;
	try {
		ret = ReflectionHelper.getPrivateValue(LOTRItemMug.class, null, "strengths");
	} catch (Exception e) {
		NeiLotr.mod.getLogger()
				.error("Could not get private field strengths drinkVessels from LOTRItemMug via reflection", e);
	}
	return ret;
}
 
开发者ID:CraftedMods,项目名称:nei-lotr,代码行数:11,代码来源:NeiLotrReflection.java


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