當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。