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


Java ReflectionHelper.setPrivateValue方法代码示例

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


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

示例1: EntityRabbit

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
public EntityRabbit(World world) {
	super(world);
	moveType = EntityRabbit.EnumMoveType.HOP;
	carrotTicks = 0;
	setSize(0.4F, 0.5F);
	ReflectionHelper.setPrivateValue(EntityLiving.class, this, new EntityRabbit.RabbitJumpHelper(this), "jumpHelper", "field_70767_i");
	ReflectionHelper.setPrivateValue(EntityLiving.class, this, new EntityRabbit.RabbitMoveHelper(), "moveHelper", "field_70765_h");
	getNavigator().setAvoidsWater(true);
	//		navigator.func_179678_a(2.5F);
	tasks.addTask(1, new EntityAISwimming(this));
	tasks.addTask(1, new EntityRabbit.AIPanic(1.33D));
	tasks.addTask(2, new EntityAIMate(this, 0.8D));
	tasks.addTask(3, new EntityAITempt(this, 1.0D, Items.carrot, false));
	tasks.addTask(5, new EntityRabbit.AIRaidFarm());
	tasks.addTask(5, new EntityAIWander(this, 0.6D));
	tasks.addTask(11, new EntityAIWatchClosest(this, EntityPlayer.class, 10.0F));
	tasks.addTask(4, new EntityAIAvoidEntity(this, EntityWolf.class, 16.0F, 1.33D, 1.33D));
	tasks.addTask(4, new EntityAIAvoidEntity(this, EntityPlayer.class, 16.0F, 0.8D, 1.33D));
	setMovementSpeed(0.0D);
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:21,代码来源:EntityRabbit.java

示例2: itemStackMatches

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
@Override
public boolean itemStackMatches(ItemStack stack) {
	if (stack == item) return true;
	if (stack == null) return false;
	goat.func_150996_a(stack.getItem());
	ReflectionHelper.setPrivateValue(ItemStack.class, goat, item.getItemDamage() == OreDictionary.WILDCARD_VALUE ? OreDictionary.WILDCARD_VALUE : stack.getItemDamage(), 5);
	goat.setTagCompound(item.hasTagCompound() && stack.hasTagCompound() ? (NBTTagCompound)stack.getTagCompound().copy() : null);
	ItemStack comp = goat;
	if (lenientTag && item.hasTagCompound() && comp.hasTagCompound()) {
		NBTTagCompound tag = comp.getTagCompound();
		List<String> toRemove = Lists.newArrayList();
		for (String key : (Set<String>)tag.func_150296_c()) {
			if (item.getTagCompound().hasKey(key)) continue;
			toRemove.add(key);
		}
		for (String s : toRemove) {
			tag.removeTag(s);
		}
	}
	comp.stackSize = item.stackSize;
	return ItemStack.areItemStacksEqual(item, comp);
}
 
开发者ID:unascribed,项目名称:Farrago,代码行数:23,代码来源:ItemSelector.java

示例3: 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

示例4: setCraftingRecipeOutput

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
public static void setCraftingRecipeOutput(IRecipe iRecipe, ItemStack output) {
    if (iRecipe instanceof ShapedRecipes) {
        ReflectionHelper.setPrivateValue(ShapedRecipes.class,(ShapedRecipes)iRecipe, output, "field_77575_e"); // recipeOutput
    } else if (iRecipe instanceof ShapelessRecipes) {
        ReflectionHelper.setPrivateValue(ShapelessRecipes.class,(ShapelessRecipes)iRecipe, output, "field_77580_a"); // recipeOutput
    } else if (iRecipe instanceof ShapelessOreRecipe) {
        ReflectionHelper.setPrivateValue(ShapelessOreRecipe.class,(ShapelessOreRecipe)iRecipe, output, "output");
    } else if (iRecipe instanceof ShapedOreRecipe) {
        ReflectionHelper.setPrivateValue(ShapedOreRecipe.class,(ShapedOreRecipe)iRecipe, output, "output");

        // IndustrialCraft^2
    } else if (iRecipe instanceof AdvRecipe) {
        // thanks IC2 for making this field public.. even if recipes aren't in the API
        ((AdvRecipe)iRecipe).output = output;
    } else if (iRecipe instanceof AdvShapelessRecipe) {
        ((AdvShapelessRecipe)iRecipe).output = output;
    }
}
 
开发者ID:agaricusb,项目名称:OreDupeFix,代码行数:19,代码来源:OreDupeFix.java

示例5: GuiAnvil

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
public GuiAnvil(EntityPlayer player, World world, int x, int y, int z) {
	super(player.inventory, world, x, y, z);

	ContainerAnvil container = new ContainerAnvil(player, world, x, y, z);
	ReflectionHelper.setPrivateValue(GuiRepair.class, this, container, "field_147092_v");
	inventorySlots = container;
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:8,代码来源:GuiAnvil.java

示例6: registerEntityRenderers

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void registerEntityRenderers() {
	if (EtFuturum.enableArmourStand)
		RenderingRegistry.registerEntityRenderingHandler(EntityArmourStand.class, new ArmourStandRenderer());
	if (EtFuturum.enableEndermite)
		RenderingRegistry.registerEntityRenderingHandler(EntityEndermite.class, new EndermiteRenderer());
	if (EtFuturum.enableRabbit)
		RenderingRegistry.registerEntityRenderingHandler(EntityRabbit.class, new RabbitRenderer());
	if (EtFuturum.enableLingeringPotions) {
		RenderingRegistry.registerEntityRenderingHandler(EntityLingeringPotion.class, new LingeringPotionRenderer());
		RenderingRegistry.registerEntityRenderingHandler(EntityLingeringEffect.class, new LingeringEffectRenderer());
	}
	if (EtFuturum.enableVillagerZombies)
		RenderingRegistry.registerEntityRenderingHandler(EntityZombieVillager.class, new VillagerZombieRenderer());
	if (EtFuturum.enableDragonRespawn)
		RenderingRegistry.registerEntityRenderingHandler(EntityPlacedEndCrystal.class, new PlacedEndCrystalRenderer());
	if (EtFuturum.enablePlayerSkinOverlay) {
		TextureManager texManager = Minecraft.getMinecraft().renderEngine;
		File fileAssets = ReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(), "fileAssets", "field_110446_Y", " field_110607_c");
		File skinFolder = new File(fileAssets, "skins");
		MinecraftSessionService sessionService = Minecraft.getMinecraft().func_152347_ac();
		ReflectionHelper.setPrivateValue(Minecraft.class, Minecraft.getMinecraft(), new NewSkinManager(Minecraft.getMinecraft().func_152342_ad(), texManager, skinFolder, sessionService), "field_152350_aA");

		RenderManager.instance.entityRenderMap.put(EntityPlayer.class, new NewRenderPlayer());
	}
	if (EtFuturum.enableShearableGolems)
		RenderingRegistry.registerEntityRenderingHandler(EntityNewSnowGolem.class, new NewSnowGolemRenderer());
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:29,代码来源:ClientProxy.java

示例7: setPrivateValue

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
public static <T, E> void setPrivateValue(Class<? super T> classToAccess, T instance, E value, int fieldIndex)
{
    try
    {
        ReflectionHelper.setPrivateValue(classToAccess, instance, value, fieldIndex);
    }
    catch (UnableToAccessFieldException e)
    {
        FMLLog.log(Level.ERROR, e, "There was a problem setting field index %d on type %s", fieldIndex, classToAccess.getName());
        throw e;
    }
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:13,代码来源:ObfuscationReflectionHelper.java

示例8: doTheMagic

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
public static void doTheMagic()
{
    if (magic) throw new IllegalStateException("You can't magic twice.");
    magic = true;

    // do the hack
    if (makeAllWaterFTCWater)
    {
        Helper.setFinalStatic(ReflectionHelper.findField(FluidRegistry.class, "WATER"), TFCFluids.FRESHWATER);
        Helper.setFinalStatic(ReflectionHelper.findField(Blocks.class, "field_150355_j", "water"), TFCBlocks.freshWaterStationary);
        Helper.setFinalStatic(ReflectionHelper.findField(Blocks.class, "field_150358_i", "flowing_water"), TFCBlocks.freshWater);

        FluidContainerRegistry.registerFluidContainer(TFCFluids.FRESHWATER, new ItemStack(Items.water_bucket), FluidContainerRegistry.EMPTY_BUCKET);
        FluidContainerRegistry.registerFluidContainer(TFCFluids.FRESHWATER, new ItemStack(Items.potionitem), FluidContainerRegistry.EMPTY_BOTTLE);
    }
    else
    {
        FluidRegistry.registerFluid(OLD_WATER_FLUID);
        FluidContainerRegistry.registerFluidContainer(FluidRegistry.WATER, new ItemStack(Items.water_bucket), FluidContainerRegistry.EMPTY_BUCKET);
        FluidContainerRegistry.registerFluidContainer(FluidRegistry.WATER, new ItemStack(Items.potionitem), FluidContainerRegistry.EMPTY_BOTTLE);
    }

    if (makeAllLavaFTCLava)
    {
        Helper.setFinalStatic(ReflectionHelper.findField(FluidRegistry.class, "LAVA"), TFCFluids.LAVA);
        Helper.setFinalStatic(ReflectionHelper.findField(Blocks.class, "field_150353_l", "lava"), TFCBlocks.lavaStationary);
        Helper.setFinalStatic(ReflectionHelper.findField(Blocks.class, "field_150356_k", "flowing_lava"), TFCBlocks.lava);
        FluidContainerRegistry.registerFluidContainer(TFCFluids.LAVA, new ItemStack(Items.lava_bucket),  FluidContainerRegistry.EMPTY_BUCKET);
    }
    else
    {
        FluidRegistry.registerFluid(OLD_LAVA_FLUID);
        FluidContainerRegistry.registerFluidContainer(FluidRegistry.LAVA, new ItemStack(Items.lava_bucket), FluidContainerRegistry.EMPTY_BUCKET);
    }

    ReflectionHelper.setPrivateValue(FluidRegistry.class, null, null, "fluidBlocks");
}
 
开发者ID:dries007,项目名称:TFC-Tweaks,代码行数:38,代码来源:FluidHacks.java

示例9: JakanHacks

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
public JakanHacks(EntityJakanPrime dragon) {
    super(dragon);
    
    // override EntityBodyHelper field, which is private and has no setter
    // required to fixate body while sitting. also slows down rotation while standing.
    try {
        int fieldIndex = UnsafeReflectionHelper.findFieldIndex(EntityLiving.class, EntityBodyHelper.class);
        ReflectionHelper.setPrivateValue(EntityLiving.class, dragon, new JakanBodyHelper(dragon), fieldIndex);
    } catch (Exception ex) {
        L.log(Level.WARNING, "Can't override EntityBodyHelper", ex);
    }
}
 
开发者ID:NovaViper,项目名称:ZeroQuest,代码行数:13,代码来源:JakanHacks.java

示例10: setBlockIcon

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
public void setBlockIcon(Block block, Icon icon)
{
	if (block == null || icon == null)
		return;

	try
	{
		ReflectionHelper.setPrivateValue(Block.class, block, icon, ObfuscationReflectionHelper.remapFieldNames(Block.class.getName(), "blockIcon", "field_94336_cN", "cW"));
	}
	catch (Exception e)
	{
		e.printStackTrace();
	}
}
 
开发者ID:squeek502,项目名称:HarvestCraftWaila,代码行数:15,代码来源:IconFixer.java

示例11: setPrivateValue

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
public static <T, E> void setPrivateValue(Class<? super T> classToAccess, T instance, E value, int fieldIndex)
{
    try
    {
        ReflectionHelper.setPrivateValue(classToAccess, instance, value, fieldIndex);
    }
    catch (UnableToAccessFieldException e)
    {
        FMLLog.log(Level.SEVERE, e, "There was a problem setting field index %d on type %s", fieldIndex, classToAccess.getName());
        throw e;
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:13,代码来源:ObfuscationReflectionHelper.java

示例12: update

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
@Override
public void update(EntityLivingBase entity, EntityStats stats, LivingUpdateEvent event) {
	// Workaround for creepers still exploding while having their attack disabled:
	if (!stats.canAttack() && entity instanceof EntityCreeper) {
		EntityCreeper creeper = (EntityCreeper) entity;
		Integer timeSinceIgnited = ReflectionHelper.getPrivateValue(EntityCreeper.class, creeper, timeSinceIgnitedObfFields);
		ReflectionHelper.setPrivateValue(EntityCreeper.class, creeper, timeSinceIgnited.intValue()-1, timeSinceIgnitedObfFields);
	}
}
 
开发者ID:Hunternif,项目名称:Dota2Items,代码行数:10,代码来源:AttackHandler.java

示例13: EntityDrone

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
public EntityDrone(World world){
    super(world);
    setSize(0.7F, 0.35F);
    ReflectionHelper.setPrivateValue(EntityLiving.class, this, new EntityPathNavigateDrone(this, world), "navigator", "field_70699_by");
    ReflectionHelper.setPrivateValue(EntityLiving.class, this, new DroneMoveHelper(this), "moveHelper", "field_70765_h");
    tasks.addTask(1, chargeAI = new DroneGoToChargingStation(this));
}
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:8,代码来源:EntityDrone.java

示例14: applyUpgradeItem

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
@Override
public TileEntityIronChest applyUpgradeItem(ItemChestChanger itemChestChanger)
{
    if ((Integer) ReflectionHelper.getPrivateValue(TileEntityIronChest.class, this, "numUsingPlayers") > 0)
    {
        return null;
    }
    if (!itemChestChanger.getType().canUpgrade(this.getType()))
    {
        return null;
    }
    TileSortingIronChest newEntity = new TileSortingIronChest(IronChestType.values()[itemChestChanger.getTargetChestOrdinal(getType().ordinal())]);

    //Copy stacks and remove old stacks
    int newSize = newEntity.chestContents.length;
    System.arraycopy(chestContents, 0, newEntity.chestContents, 0, Math.min(newSize, chestContents.length));
    BlockSortingIronChest block = ModBlocks.sortingIronChest;
    block.dropContent(newSize, this, this.worldObj, this.xCoord, this.yCoord, this.zCoord);

    //Copy filter settings
    NBTTagCompound filterTag = new NBTTagCompound();
    filter.writeToNBT(filterTag);
    newEntity.filter.readFromNBT(filterTag);

    //Set facing, sort and reset syncTick
    newEntity.setFacing(getFacing());
    newEntity.sortTopStacks();
    ReflectionHelper.setPrivateValue(TileEntityIronChest.class, this, -1, "ticksSinceSync");
    return newEntity;
}
 
开发者ID:Dynious,项目名称:RefinedRelocation,代码行数:31,代码来源:TileSortingIronChest.java

示例15: fixType

import cpw.mods.fml.relauncher.ReflectionHelper; //导入方法依赖的package包/类
public void fixType(IronChestType type)
{
    if (type != getType())
    {
        ReflectionHelper.setPrivateValue(TileEntityIronChest.class, this, type, "type");
    }
    this.chestContents = new ItemStack[getSizeInventory()];
}
 
开发者ID:Dynious,项目名称:RefinedRelocation,代码行数:9,代码来源:TileSortingIronChest.java


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