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


Java ObfuscationReflectionHelper.getPrivateValue方法代码示例

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


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

示例1: preRemoveChest

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
@Override
public void preRemoveChest(World world, BlockPos pos, EntityPlayer player, ItemStack transporter)
{
    try
    {
        TileEntity chestTE = world.getTileEntity(pos);
        Class clazz = Class.forName("factorization.weird.TileEntityDayBarrel");

        Object log = ObfuscationReflectionHelper.getPrivateValue(clazz, chestTE, "woodLog");
        Object slab = ObfuscationReflectionHelper.getPrivateValue(clazz, chestTE, "woodSlab");
        Object type = ObfuscationReflectionHelper.getPrivateValue(clazz, chestTE, "type");

        NBTTagCompound logNbt = new NBTTagCompound();
        ((ItemStack) log).writeToNBT(logNbt);
        NBTTagCompound slabNbt = new NBTTagCompound();
        ((ItemStack) slab).writeToNBT(slabNbt);

        transporter.getTagCompound().setTag("WoodLog", logNbt);
        transporter.getTagCompound().setTag("WoodSlab", slabNbt);
        transporter.getTagCompound().setString("BarrelType", type.toString());
    } catch (ClassNotFoundException e)
    {
        e.printStackTrace();
    }
}
 
开发者ID:cubex2,项目名称:chesttransporter,代码行数:26,代码来源:FzBarrel.java

示例2: getSounds

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
public List<ResourceLocation> getSounds(String filter){
	if(soundCache == null){
		soundCache = Lists.newArrayList();
		
		SoundRegistry reg = null;
		try{
			reg = ObfuscationReflectionHelper.getPrivateValue(SoundHandler.class, Minecraft.getMinecraft().getSoundHandler(), 4);
		} catch(Exception e){}
		
		if(reg == null)return soundCache;
		
		for(ResourceLocation loc : reg.getKeys()){
			if(loc.toString().toLowerCase().contains(filter)){
				soundCache.add(loc);
			}
		}
	}
	return soundCache;
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:20,代码来源:GuiSoundMuffler.java

示例3: preInit

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
@Override
public void preInit( FMLPreInitializationEvent e ){
    super.preInit( e );

    LogHelper.info( "Trying to load CustomAchievements Translation Resource Pack");
    try {
        List packs = (List) ObfuscationReflectionHelper.getPrivateValue( Minecraft.class, Minecraft.getMinecraft(), new String[]{"field_110449_ao"} ); //defaultResourcePacks
        packs.add( new AchievementResourcePack() );
        ObfuscationReflectionHelper.setPrivateValue( Minecraft.class, Minecraft.getMinecraft(), packs, new String[]{"field_110449_ao"} );
    } catch( Exception exception ){
        LogHelper.error( "Loading CustomAchievements Translation Resource Pack failed.");
        exception.printStackTrace();
    }

    ModBlocks.loadTextures();
    ClientRegistry.bindTileEntitySpecialRenderer( TileEntityTrophy.class, new RenderTrophy() );
}
 
开发者ID:davqvist,项目名称:CustomAchievements,代码行数:18,代码来源:ClientProxy.java

示例4: onMouseClicked

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
@SubscribeEvent
public void onMouseClicked(MouseInputEvent.Post event)
{
	if (event.getGui() instanceof GuiContainerCreative)
	{
		GuiContainerCreative guiScreen = (GuiContainerCreative) event.getGui();
		List<GuiButton> buttonList = ObfuscationReflectionHelper.getPrivateValue(GuiScreen.class, (GuiScreen) guiScreen, 7);

		if (previousSelectedTabIndex != guiScreen.getSelectedTabIndex())
		{
			if (guiScreen.getSelectedTabIndex() == CreativeTabs.INVENTORY.getTabIndex() && !buttonList.contains(ACCESSORY_BUTTON))
			{
				int guiLeft = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer)event.getGui(), "guiLeft", "field_147003_i");
				int guiTop = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer)event.getGui(), "guiTop", "field_147009_r");

				buttonList.add(ACCESSORY_BUTTON.setPosition(guiLeft + 73, guiTop + 38));
			}
			else if (previousSelectedTabIndex == CreativeTabs.INVENTORY.getTabIndex())
			{
				buttonList.remove(ACCESSORY_BUTTON);
			}

			previousSelectedTabIndex = guiScreen.getSelectedTabIndex();
		}
	}
}
 
开发者ID:Modding-Legacy,项目名称:Aether-Legacy,代码行数:27,代码来源:AetherClientEvents.java

示例5: serverStopped

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
@EventHandler
public void serverStopped(FMLServerStoppedEvent evt)
{
    Set<IWorldGenerator> worldGens = ObfuscationReflectionHelper.getPrivateValue(GameRegistry.class, null, "worldGenerators");
    Map<IWorldGenerator,Integer> worldGenIdx = ObfuscationReflectionHelper.getPrivateValue(GameRegistry.class, null, "worldGeneratorIndex");

    for (TargetWorldWrapper tww : delegates.values())
    {
        worldGens.remove(tww);
        Integer idx = worldGenIdx.remove(tww);
        worldGens.add(tww.delegate);
        worldGenIdx.put(tww.delegate,idx);
    }

    delegates.clear();
}
 
开发者ID:cpw,项目名称:simpleretrogen,代码行数:17,代码来源:WorldRetrogen.java

示例6: onDataPacket

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
@Override
    public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
        readFromNBT(pkt.getNbtCompound());
        //noinspection unchecked
        Set<String> keys = pkt.getNbtCompound().getKeySet();
        Map tagMap = ObfuscationReflectionHelper.getPrivateValue(NBTTagCompound.class, pkt.getNbtCompound(), "tagMap", "field_74784_a");
        for (String key : keys) {
            try {
                Field f = this.getClass().getDeclaredField(key);
                f.set(tagMap.get(key), this);
            } catch (Exception ignored) {
//                e.printStackTrace();
            }
        }
        readExtraNBTFromPacket(pkt.getNbtCompound());
    }
 
开发者ID:Cazzar,项目名称:CazzarCoreLib,代码行数:17,代码来源:SyncedTileEntity.java

示例7: registerRendering

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
public void registerRendering()
{
	//Entities
	ModEntities.initModels();
       
       //Register animator resource pack, where models and textures are stored, externally from the jar
       List<IResourcePack> resourcePackList = ObfuscationReflectionHelper.getPrivateValue(FMLClientHandler.class, FMLClientHandler.instance(), "resourcePackList");
       resourcePackList.add(new AnimationResourcePack());
}
 
开发者ID:ObsidianSuite,项目名称:ObsidianSuite,代码行数:10,代码来源:ClientProxy.java

示例8: registerTileEntityWithAlternatives

import net.minecraftforge.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);
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:GameRegistry.java

示例9: constructor

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
@SuppressWarnings("unused")
public static void constructor(IBFFontRenderer font, ResourceLocation location)
{
    // Disable for splash font renderer
    if (((FontRenderer) font).getClass() != FontRenderer.class) return;

    if (location.getResourcePath().equalsIgnoreCase("textures/font/ascii.png") && font.getStringRenderer() == null)
    {
        int[] colorCode = ObfuscationReflectionHelper.getPrivateValue(FontRenderer.class, (FontRenderer) font, "colorCode", "field_78285_g", "f");
        StringCache cache = new StringCache();
        StringRenderer renderer = new StringRenderer(cache, colorCode);
        font.setStringRenderer(renderer);
        Config.applyFont(font);
    }
}
 
开发者ID:cubex2,项目名称:BetterFonts,代码行数:16,代码来源:FontRendererCallback.java

示例10: onGuiOpened

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
@SubscribeEvent
public void onGuiOpened(GuiScreenEvent.InitGuiEvent.Post event)
{
	if (event.getGui() instanceof GuiContainer)
	{
		EntityPlayer player = Minecraft.getMinecraft().thePlayer;
		Class<?> clazz = event.getGui().getClass();

		int guiLeft = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer)event.getGui(), "guiLeft", "field_147003_i");
		int guiTop = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer)event.getGui(), "guiTop", "field_147009_r");

		if (player.capabilities.isCreativeMode)
		{
			if (event.getGui() instanceof GuiContainerCreative)
			{
				if (((GuiContainerCreative)event.getGui()).getSelectedTabIndex() == CreativeTabs.INVENTORY.getTabIndex())
				{
					event.getButtonList().add(ACCESSORY_BUTTON.setPosition(guiLeft + 73, guiTop + 38));
					previousSelectedTabIndex = CreativeTabs.INVENTORY.getTabIndex();
				}
			}
		}
		else if (clazz == GuiInventory.class)
		{
			event.getButtonList().add(ACCESSORY_BUTTON.setPosition(guiLeft + 26, guiTop + 65));
		}
	}
}
 
开发者ID:Modding-Legacy,项目名称:Aether-Legacy,代码行数:29,代码来源:AetherClientEvents.java

示例11: arePrivateFieldValuesEqual

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
private static boolean arePrivateFieldValuesEqual(ItemStack stackA, ItemStack stackB, String[] fieldNames)
{
	Object oA = ObfuscationReflectionHelper.getPrivateValue(ItemStack.class, stackA, fieldNames);
	Object oB = ObfuscationReflectionHelper.getPrivateValue(ItemStack.class, stackB, fieldNames);

	return oA.equals(oB);
}
 
开发者ID:crazysnailboy,项目名称:UncraftingTable,代码行数:8,代码来源:UncraftingManager.java

示例12: init

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
/**
 * Called to initialize the set
 *
 * @throws OperationException If something went wrong
 */
@Override
public void init() throws OperationException {
    if(lightLevel < 0.0 || 1.0 < lightLevel) throw new OperationException("setLightLevel can only have a light level between 0.0 and 1.0.");
    if(what.getBlock() == null || what.getBlock() == air) throw new OperationException("setLightLevel could not find a valid block to adjust.");

    prevLevel = ((int)ObfuscationReflectionHelper.getPrivateValue(Block.class, what.getBlock(), "field_149784_t"))/15.0F;
}
 
开发者ID:legendblade,项目名称:CraftingHarmonics,代码行数:13,代码来源:SetLightLevelOperation.java

示例13: init

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
/**
 * Called to initialize the set
 *
 * @throws OperationException If something went wrong
 */
@Override
public void init() throws OperationException {
    if(hardness < 0.0) throw new OperationException("setBlockHardness must have a hardness at least 0.0");
    if(what.getBlock() == null || what.getBlock() == air) throw new OperationException("setBlockHardness could not find a valid block to adjust.");

    prevLevel = ObfuscationReflectionHelper.getPrivateValue(Block.class, what.getBlock(), "field_149782_v");
}
 
开发者ID:legendblade,项目名称:CraftingHarmonics,代码行数:13,代码来源:SetBlockHardnessOperation.java

示例14: startConverting

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
private void startConverting(EntityZombieVillager v, int t) {
  //      v.conversionTime = t;
  ObfuscationReflectionHelper.setPrivateValue(EntityZombieVillager.class, v, t, "conversionTime", "field_82234_d");
  v.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, t, Math.min(v.world.getDifficulty().getDifficultyId() - 1, 0)));
  v.world.setEntityState(v, (byte) 16);
  try {
    //       v.getDataManager().set(CONVERTING, Boolean.valueOf(true));
    DataParameter<Boolean> CONVERTING = ObfuscationReflectionHelper.getPrivateValue(EntityZombieVillager.class, v, "CONVERTING", "field_184739_bx");
    v.getDataManager().set(CONVERTING, Boolean.valueOf(true));
  }
  catch (Exception e) {}
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:13,代码来源:ItemAppleEmerald.java

示例15: loadCoreModules

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
@Override
public void loadCoreModules() {

	List<IResourcePack> defaultResourcePacks = ObfuscationReflectionHelper.getPrivateValue(Minecraft.class,
			Minecraft.getMinecraft(), "defaultResourcePacks", "field_110449_ao");
	defaultResourcePacks.add(new FolderResourcePack(new File(Minecraft.getMinecraft().mcDataDir, "/RLM")));
	File screenshots = new File(Minecraft.getMinecraft().mcDataDir, "screenshots");
	if (!screenshots.exists()) {
		screenshots.mkdirs();
	}
	for (File f : screenshots.listFiles()) {
		Screenshotspack.filenames.add(f.getName());
	}
	defaultResourcePacks.add(new Screenshotspack());
	Minecraft.getMinecraft().refreshResources();

	File RLMDirectory = new File(Minecraft.getMinecraft().mcDataDir, "RLM/texts");
	if (RLMDirectory.exists()) {
		File jobfile = new File(RLMDirectory, "Jobs.txt");
		File newjobfile = null;
		try {
			FileUtils.copyURLToFile(new URL("http://themoddingparadise.de/RealLifeMod/Jobs.txt"), jobfile);
			jobfile.setLastModified(System.currentTimeMillis());
		} catch (Exception e) {
			e.printStackTrace();
		}

		if (jobfile.exists()) {
			System.out.println("Succesfully downloaded Resources");
		}
	} else

	{
		RLMDirectory.mkdirs();
	}

}
 
开发者ID:ItsAMysterious,项目名称:Real-Life-Mod-1.8,代码行数:38,代码来源:ClientProxy.java


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