本文整理匯總了Java中cpw.mods.fml.common.ObfuscationReflectionHelper.getPrivateValue方法的典型用法代碼示例。如果您正苦於以下問題:Java ObfuscationReflectionHelper.getPrivateValue方法的具體用法?Java ObfuscationReflectionHelper.getPrivateValue怎麽用?Java ObfuscationReflectionHelper.getPrivateValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cpw.mods.fml.common.ObfuscationReflectionHelper
的用法示例。
在下文中一共展示了ObfuscationReflectionHelper.getPrivateValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getBedrockImage
import cpw.mods.fml.common.ObfuscationReflectionHelper; //導入方法依賴的package包/類
public static BufferedImage getBedrockImage() {
if (TConTextureResourcePackBedrockium.bedrockImage == null) {
final ResourceLocation bedrockLocation = new ResourceLocation("minecraft", "textures/blocks/bedrock.png");
try {
final DefaultResourcePack mcDefaultResourcePack = (DefaultResourcePack)ObfuscationReflectionHelper.getPrivateValue((Class)Minecraft.class, (Object)Minecraft.getMinecraft(), new String[] { "field_110450_ap", "mcDefaultResourcePack" });
InputStream inputStream = mcDefaultResourcePack.getInputStream(bedrockLocation);
final List<ResourcePackRepository.Entry> t = (List<ResourcePackRepository.Entry>)Minecraft.getMinecraft().getResourcePackRepository().getRepositoryEntries();
for (final ResourcePackRepository.Entry entry : t) {
final IResourcePack resourcePack = entry.getResourcePack();
if (resourcePack.resourceExists(bedrockLocation)) {
inputStream = resourcePack.getInputStream(bedrockLocation);
}
}
TConTextureResourcePackBedrockium.bedrockImage = ImageIO.read(inputStream);
}
catch (IOException e) {
throw Throwables.propagate((Throwable)e);
}
}
return TConTextureResourcePackBedrockium.bedrockImage;
}
示例2: drawScreen
import cpw.mods.fml.common.ObfuscationReflectionHelper; //導入方法依賴的package包/類
public void drawScreen(int mouseX, int mouseY, float partalTicks)
{
super.drawScreen(mouseX, mouseY, partalTicks);
List buttonList = ObfuscationReflectionHelper.getPrivateValue(GuiScreen.class, overriddenScreen, "buttonList", "field_146292_n");
List labelList = ObfuscationReflectionHelper.getPrivateValue(GuiScreen.class, overriddenScreen, "labelList", "field_146293_o");
int k1;
for (k1 = 0; k1 < buttonList.size(); ++k1)
{
((GuiButton)buttonList.get(k1)).drawButton(mc, mouseX, mouseY);
}
for (k1 = 0; k1 < labelList.size(); ++k1)
{
((GuiLabel)labelList.get(k1)).func_146159_a(mc, mouseX, mouseY);
}
}
示例3: overwriteTutorialWorld
import cpw.mods.fml.common.ObfuscationReflectionHelper; //導入方法依賴的package包/類
protected void overwriteTutorialWorld()
{
Minecraft mc = Minecraft.getMinecraft();
File mcDataDir = mc.mcDataDir;
String folderName = ObfuscationReflectionHelper.getPrivateValue(BfsrRegenTutorialDimension.class, this, folderNameObfuscated);
try
{
FileUtils.copyDirectory(new File(mcDataDir.getAbsoluteFile() + File.separator + templateName + File.separator + tutorialDimensionFolder),
new File(mcDataDir.getAbsoluteFile() + File.separator + "saves" + File.separator + folderName + File.separator + tutorialDimensionFolder));
}
catch (IOException e)
{
FMLLog.info("The template world does not exist at " + templateName, e);
return;
}
}
示例4: getTesOffsets
import cpw.mods.fml.common.ObfuscationReflectionHelper; //導入方法依賴的package包/類
private double[] getTesOffsets() {
double[] off = new double[3];
int count = 0;
int xoff = 0;
Field[] fields = Tessellator.class.getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
if (fields[i].getType() == double.class) {
count++;
if (count == 3) {
xoff = i - 2;
}
} else {
count = 0;
}
}
off[0] = ObfuscationReflectionHelper.getPrivateValue(Tessellator.class, Tessellator.instance, xoff);
off[1] = ObfuscationReflectionHelper.getPrivateValue(Tessellator.class, Tessellator.instance, xoff + 1);
off[2] = ObfuscationReflectionHelper.getPrivateValue(Tessellator.class, Tessellator.instance, xoff + 2);
return off;
}
示例5: generateDescription
import cpw.mods.fml.common.ObfuscationReflectionHelper; //導入方法依賴的package包/類
@Override
public String generateDescription() {
if(this.description!=null) return this.description;
description = getPrefix()+"!";
int width = (Integer) ObfuscationReflectionHelper.getPrivateValue(ShapedRecipes.class, sr, 0);
int height = (Integer) ObfuscationReflectionHelper.getPrivateValue(ShapedRecipes.class, sr, 1);
ItemStack[] items = (ItemStack[]) ObfuscationReflectionHelper.getPrivateValue(ShapedRecipes.class, sr, 2);
description += Formatter.getWHString(width, height);
for (ItemStack is: items) {
description += Formatter.getISDescription(is);
}
ItemStack result = sr.getRecipeOutput();
description += "->" + Formatter.getISDescription(result);
return this.description;
}
示例6: generateDescription
import cpw.mods.fml.common.ObfuscationReflectionHelper; //導入方法依賴的package包/類
@Override
public String generateDescription() {
if(description!=null) return description;
description = getPrefix()+"!";
int width = (Integer) ObfuscationReflectionHelper.getPrivateValue(ShapedOreRecipe.class, sr, 4);
int height = (Integer) ObfuscationReflectionHelper.getPrivateValue(ShapedOreRecipe.class, sr, 5);
Object[] items = ObfuscationReflectionHelper.getPrivateValue(ShapedOreRecipe.class, sr, 3);
description += Formatter.getWHString(width, height);
for(Object o : items)
{
if(o == null) {
description += "(None)";
} else if (o instanceof ItemStack) {
description+=Formatter.getISDescription((ItemStack) o);
} else {
description+=Formatter.getItemOreDescription(o);
}
}
ItemStack result = sr.getRecipeOutput();
description+="->"+Formatter.getISDescription(result);
return description;
}
示例7: generateDescription
import cpw.mods.fml.common.ObfuscationReflectionHelper; //導入方法依賴的package包/類
@Override
public String generateDescription() {
if(description!=null) return description;
description = getPrefix()+"!";
ArrayList items = ObfuscationReflectionHelper.getPrivateValue(ShapelessOreRecipe.class, sr, 1);
for(Object o : items)
{
if(o instanceof ItemStack)
{
description += Formatter.getISDescription((ItemStack) o);
} else {
description += Formatter.getItemOreDescription(o);
}
}
ItemStack result = sr.getRecipeOutput();
description+="->"+Formatter.getISDescription(result);
return description;
}
示例8: getiResourcePacks
import cpw.mods.fml.common.ObfuscationReflectionHelper; //導入方法依賴的package包/類
public List<IResourcePack> getiResourcePacks() {
List<IResourcePack> packs1 = TConTextureResourcePackBase.packs;
if (packs1 == null) {
packs1 = (List<IResourcePack>)ObfuscationReflectionHelper.getPrivateValue((Class)FMLClientHandler.class, (Object)FMLClientHandler.instance(), new String[] { "resourcePackList" });
}
return packs1;
}
示例9: registerTileEntityWithAlternatives
import cpw.mods.fml.common.ObfuscationReflectionHelper; //導入方法依賴的package包/類
/**
* Register a tile entity, with alternative TileEntity identifiers. Use with caution!
* This method allows for you to "rename" the 'id' of the tile entity.
*
* @param tileEntityClass The tileEntity class to register
* @param id The primary ID, this will be the ID that the tileentity saves as
* @param alternatives A list of alternative IDs that will also map to this class. These will never save, but they will load
*/
public static void registerTileEntityWithAlternatives(Class<? extends TileEntity> tileEntityClass, String id, String... alternatives)
{
TileEntity.func_145826_a(tileEntityClass, id);
Map<String,Class<?>> teMappings = ObfuscationReflectionHelper.getPrivateValue(TileEntity.class, null, "field_" + "145855_i", "nameToClassMap");
for (String s: alternatives)
{
if (!teMappings.containsKey(s))
{
teMappings.put(s, tileEntityClass);
}
}
}
示例10: manipulateTradesForVillager
import cpw.mods.fml.common.ObfuscationReflectionHelper; //導入方法依賴的package包/類
@Override
public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random rand)
{
Calendar calendar = Calendar.getInstance();
if((calendar.get(2) + 1 == 10 && calendar.get(5) >= 28 && calendar.get(5) <= 31) || (calendar.get(2) + 1 == 11 && calendar.get(5) >= 1 && calendar.get(5) <= 2))
{
isHalloween = true;
}
else
{
isHalloween = false;
}
baseChance = ObfuscationReflectionHelper.<Float, EntityVillager>getPrivateValue(EntityVillager.class, villager, "field_82191_bN");
if(!isHalloween)
{
addTrade(recipeList, rand, 0.7F, new Offer(Items.bread, 2), new Offer(Items.emerald, 1));
addTrade(recipeList, rand, 0.7F, new Offer(Items.emerald, 3), new Offer(Items.bread, 2));
addTrade(recipeList, rand, 0.7F, new Offer(Items.bread, 6), new Offer(Items.wheat, 16));
}
else
{
addTrade(recipeList, rand, 0.7F, new Offer(Items.string, 6), new Offer(Items.emerald, 1));
addTrade(recipeList, rand, 0.7F, new Offer(Items.apple, 3), new Offer(Items.emerald, 1));
addTrade(recipeList, rand, 0.7F, new Offer(Item.getItemFromBlock(Blocks.netherrack), 64), new Offer(Item.getItemFromBlock(Blocks.cobblestone), 64));
addTrade(recipeList, rand, 0.7F, new Offer(Item.getItemFromBlock(Blocks.cobblestone), 64), new Offer(Item.getItemFromBlock(Blocks.netherrack), 64));
addTrade(recipeList, rand, 0.7F, new Offer(Item.getItemFromBlock(Blocks.pumpkin), 2), new Offer(Items.emerald, 1));
addTrade(recipeList, rand, 0.7F, new Offer(Item.getItemFromBlock(Blocks.lit_pumpkin), 2), new Offer(Items.emerald, 2));
}
/* addTrade(recipeList, rand, 0.7F, new Offer(Items.fish, 3), new Offer(Items.emerald, 1));
addTrade(recipeList, rand, 0.7F, new Offer(Items.emerald, 5), new Offer(Items.fish, 8));*/
}
示例11: registerTileEntityWithAlternatives
import cpw.mods.fml.common.ObfuscationReflectionHelper; //導入方法依賴的package包/類
/**
* Register a tile entity, with alternative TileEntity identifiers. Use with caution!
* This method allows for you to "rename" the 'id' of the tile entity.
*
* @param tileEntityClass The tileEntity class to register
* @param id The primary ID, this will be the ID that the tileentity saves as
* @param alternatives A list of alternative IDs that will also map to this class. These will never save, but they will load
*/
public static void registerTileEntityWithAlternatives(Class<? extends TileEntity> tileEntityClass, String id, String... alternatives)
{
TileEntity.addMapping(tileEntityClass, id);
Map<String,Class<?>> teMappings = ObfuscationReflectionHelper.getPrivateValue(TileEntity.class, null, "field_" + "145855_i", "nameToClassMap");
for (String s: alternatives)
{
if (!teMappings.containsKey(s))
{
teMappings.put(s, tileEntityClass);
}
}
}
示例12: bakeModel
import cpw.mods.fml.common.ObfuscationReflectionHelper; //導入方法依賴的package包/類
/**
* Use this to convert TechneModel to it's static representation
*/
@SuppressWarnings("unchecked")
public static Map<String, GroupObject> bakeModel(TechneModel model, float scale, Matrix4f m, boolean rotateYFirst) {
Map<String, ModelRenderer> parts = (Map<String, ModelRenderer>) ObfuscationReflectionHelper.getPrivateValue(TechneModel.class, model, "parts");
Map<String, GroupObject> res = Maps.newHashMap();
for (Map.Entry<String, ModelRenderer> e : parts.entrySet()) {
GroupObject obj = bakeModel(e.getValue(), model, scale, m, rotateYFirst).get(0);
res.put(e.getKey(), obj);
}
return res;
}
示例13: loadResearch
import cpw.mods.fml.common.ObfuscationReflectionHelper; //導入方法依賴的package包/類
private void loadResearch(EntityPlayer fakePlayer) {
boolean online = false;
for(String username : MinecraftServer.getServer().getAllUsernames()) {
if(username.equals(player)) {
online = true;
break;
}
}
if(online) {
this.research = ResearchManager.getResearchForPlayer(player);
} else {
if(research == null) {
Thaumcraft.proxy.getCompletedResearch().put(fakePlayer.getCommandSenderName(), new ArrayList<String>());
IPlayerFileData playerNBTManagerObj = MinecraftServer.getServer().worldServerForDimension(0).getSaveHandler().getSaveHandler();
SaveHandler sh = (SaveHandler)playerNBTManagerObj;
File dir = ObfuscationReflectionHelper.getPrivateValue(SaveHandler.class, sh, "playersDirectory", "field_75771_c");
File file1 = new File(dir, player + ".thaum");
File file2 = new File(dir, player + ".thaumbak");
ResearchManager.loadPlayerData(fakePlayer, file1, file2, false);
this.research = ResearchManager.getResearchForPlayerSafe(fakePlayer.getCommandSenderName());
}
}
Thaumcraft.proxy.getCompletedResearch().put(fakePlayer.getCommandSenderName(), research == null ? new ArrayList<String>() : research);
}
示例14: inject
import cpw.mods.fml.common.ObfuscationReflectionHelper; //導入方法依賴的package包/類
public static void inject(HashMap<String, String> map) {
try {
Map<String, String> languageMap = ObfuscationReflectionHelper.getPrivateValue(StringTranslate.class, getInstance(), LANGUAGE_MAP);
languageMap.putAll(map);
ObfuscationReflectionHelper.setPrivateValue(StringTranslate.class, getInstance(), System.currentTimeMillis(), LAST_UPDATE);
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例15: tickStart
import cpw.mods.fml.common.ObfuscationReflectionHelper; //導入方法依賴的package包/類
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData)
{
if (FMLCommonHandler.instance().getEffectiveSide().isClient() && Minecraft.getMinecraft().currentScreen instanceof GuiContainerCreative)
{
GuiContainerCreative gui = (GuiContainerCreative) Minecraft.getMinecraft().currentScreen;
List<GuiButton> buttons = ObfuscationReflectionHelper.<List<GuiButton>, GuiScreen> getPrivateValue(GuiScreen.class, Minecraft.getMinecraft().currentScreen, "buttonList", "field_73887_h");
if (buttons.size() > 2)
buttons.remove(2);
buttons.add(new SmallButton(10, 0, (Integer) ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, gui, "guiLeft", "field_74198_m"), (Integer) ObfuscationReflectionHelper
.getPrivateValue(GuiContainer.class, gui, "guiTop", "field_74197_n")));
}
}