本文整理汇总了Java中cpw.mods.fml.common.ObfuscationReflectionHelper类的典型用法代码示例。如果您正苦于以下问题:Java ObfuscationReflectionHelper类的具体用法?Java ObfuscationReflectionHelper怎么用?Java ObfuscationReflectionHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ObfuscationReflectionHelper类属于cpw.mods.fml.common包,在下文中一共展示了ObfuscationReflectionHelper类的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: setPrivateFinalWithValue
import cpw.mods.fml.common.ObfuscationReflectionHelper; //导入依赖的package包/类
public static <T, E> void setPrivateFinalWithValue(Class<? super T> c, T obj, E value, String... fieldNames)
{
Field field = cpw.mods.fml.relauncher.ReflectionHelper.findField(c, ObfuscationReflectionHelper.remapFieldNames(c.getName(), fieldNames));
try
{
Field e = Field.class.getDeclaredField("modifiers");
e.setAccessible(true);
e.setInt(field, field.getModifiers() & -17);
field.set(obj, value);
} catch (Exception var6)
{
var6.printStackTrace();
}
}
示例5: 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;
}
示例6: 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;
}
示例7: preInit
import cpw.mods.fml.common.ObfuscationReflectionHelper; //导入依赖的package包/类
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
LogHandler.setLog(event.getModLog());
ConfigHandler.setFile(event.getSuggestedConfigurationFile());
Object value = ObfuscationReflectionHelper.getPrivateValue(Loader.class, Loader.instance(), "canonicalModsDir");
if (value instanceof File)
{
this.modsFolder = (File) value;
}
Configs.init();
BlockList.init();
ItemList.init();
BucketsHandler.instance.init();
initTabs();
Integration.preinit(event);
}
示例8: controlClient
import cpw.mods.fml.common.ObfuscationReflectionHelper; //导入依赖的package包/类
@Override
public void controlClient(EntityPlayerCustom playerCustom, EntityPlayer player) {
if (keyPressedSlow && !playerCustom.slow) {
ObfuscationReflectionHelper.setPrivateValue(Timer.class,
((Timer) ObfuscationReflectionHelper.getPrivateValue(
Minecraft.class, Minecraft.getMinecraft(), 16)),
5F, 0);
playerCustom.slow = true;
}
if (playerCustom.slow) {
playerCustom.slowTime++;
}
if (playerCustom.slowTime == 25 && playerCustom.slow) {
ObfuscationReflectionHelper.setPrivateValue(Timer.class,
((Timer) ObfuscationReflectionHelper.getPrivateValue(
Minecraft.class, Minecraft.getMinecraft(), 16)),
20F, 0);
playerCustom.slowTime = 0;
Minecraft.getMinecraft().gameSettings.mouseSensitivity = defaultSensitivity;
keyPressedSlow = false;
playerCustom.slow = false;
}
}
示例9: 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;
}
示例10: getAllRecipes
import cpw.mods.fml.common.ObfuscationReflectionHelper; //导入依赖的package包/类
@Override
public IRecipeData[] getAllRecipes() {
ArrayList<IRecipeData> list = new ArrayList<IRecipeData>();
Map<Integer, ItemStack> smeltingList = ObfuscationReflectionHelper.getPrivateValue(FurnaceRecipes.class, FurnaceRecipes.smelting(), 1);
for(int id : smeltingList.keySet()) {
ItemStack source = new ItemStack(id, 1, -1);
ItemStack target = smeltingList.get(id);
list.add(new RecipeData(source, target));
}
for(Entry<List<Integer>, ItemStack> smEntry: FurnaceRecipes.smelting().getMetaSmeltingList().entrySet()) {
List<Integer> sourceItemIDandMeta = smEntry.getKey();
ItemStack targetItemstack = smEntry.getValue();
if (sourceItemIDandMeta.size() == 2) {
list.add(new RecipeData(
new ItemStack(sourceItemIDandMeta.get(0), 1, sourceItemIDandMeta.get(1))
, targetItemstack));
}
}
return list.toArray(new IRecipeData[0]);
}
示例11: 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;
}
示例12: 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;
}
示例13: onGui
import cpw.mods.fml.common.ObfuscationReflectionHelper; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onGui(GuiOpenEvent event)
{
if (event.gui instanceof GuiMainMenu)
{
if (shouldLoadGUI && ConfigurationHandler.showIRCGui)
{
event.gui = new IRCGui();
shouldLoadGUI = false;
}
else
{
ObfuscationReflectionHelper.setPrivateValue(GuiMainMenu.class, (GuiMainMenu) event.gui, getRandTPPISplash(), "splashText", "field_73975_c");
}
}
}
示例14: 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;
}
示例15: serverStopped
import cpw.mods.fml.common.ObfuscationReflectionHelper; //导入依赖的package包/类
@Override
public void serverStopped()
{
// If the server crashes during startup, it might hang the client- reset the client so it can abend properly.
MinecraftServer server = getServer();
if (server != null && !server.func_71200_ad())
{
ObfuscationReflectionHelper.setPrivateValue(MinecraftServer.class, server, true, "field_71296"+"_Q","serverIs"+"Running");
}
}