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


Java ObfuscationReflectionHelper.setPrivateValue方法代码示例

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


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

示例1: changeDimension

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
@Override
public Entity changeDimension(int dimensionIn) {
	if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, dimensionIn)) {
		return this;
	}
	ObfuscationReflectionHelper.setPrivateValue(EntityPlayerMP.class, this, true, "invulnerableDimensionChange", "field_184851_cj");

	if (dimension == 1 && dimensionIn == 1) {
		world.removeEntity(this);

		if (!queuedEndExit) {
			queuedEndExit = true;
			connection.sendPacket(new SPacketChangeGameState(4, 0.0F));
		}

		return this;
	}
	else {
		if (dimension == 0 && dimensionIn == 1) {
			dimensionIn = 1;
		}

		mcServer.getPlayerList().changePlayerDimension(this, dimensionIn);
		return this;
	}
}
 
开发者ID:p455w0rd,项目名称:DankNull,代码行数:27,代码来源:EntityPFakePlayer.java

示例2: onChestPlaced

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

        String chestType = transporter.getTagCompound().getString("VCChestType");

        ObfuscationReflectionHelper.setPrivateValue(clazz, chestTE, chestType, "chestType");
    } catch (ClassNotFoundException e)
    {
        e.printStackTrace();
    }
}
 
开发者ID:cubex2,项目名称:chesttransporter,代码行数:17,代码来源:VariertyChest.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: activateBatch

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
public void activateBatch()
{
    if(batch != null)
    {
        if(OpenGlHelper.shadersSupported)
        {
            try
            {
                ShaderGroup theShaderGroup = batch.toShaderGroup(resManager);
                theShaderGroup.createBindFramebuffers(Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight);
                ObfuscationReflectionHelper.setPrivateValue(EntityRenderer.class, Minecraft.getMinecraft().entityRenderer, theShaderGroup, 51);
                ObfuscationReflectionHelper.setPrivateValue(EntityRenderer.class, Minecraft.getMinecraft().entityRenderer, true, 55);
            }
            catch(JsonException e)
            {
                e.printStackTrace();
            }
        }
    }
}
 
开发者ID:jglrxavpok,项目名称:ShadyMod,代码行数:21,代码来源:ShadyMod.java

示例5: onSleepSuccess

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
public void onSleepSuccess(World world, EnumHand hand, ItemStack stack, EntityPlayerMP player, final IPlayerExtendedProperties sleep) {
  sleep.setSleeping(true);
  if (doPotions) {
    player.addPotionEffect(new PotionEffect(MobEffects.MINING_FATIGUE, seconds * Const.TICKS_PER_SEC, Const.Potions.I));
    player.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, seconds * Const.TICKS_PER_SEC, Const.Potions.I));
  }
  this.onUse(stack, player, world, hand);
  //hack because vanilla/forge has that java.lang.IllegalArgumentException: Cannot get property PropertyDirection error with assuming its a bed when its blocks.air
  ObfuscationReflectionHelper.setPrivateValue(EntityPlayer.class, player, true, "sleeping", "field_71083_bS");
  ObfuscationReflectionHelper.setPrivateValue(EntityPlayer.class, player, 0, "sleepTimer", "field_71076_b");
  UtilChat.addChatMessage(player, this.getUnlocalizedName() + ".trying");
  //first set bed location
  player.bedLocation = player.getPosition();
  ModCyclic.network.sendTo(new PacketSleepClient(player.bedLocation), player);
  //then stop player in place
  player.motionX = player.motionZ = player.motionY = 0;
  world.updateAllPlayersSleepingFlag();
  //then trigger vanilla sleep event(s)
  //                world.setBlockState(player.getPosition(), Blocks.BED.getDefaultState());
  SPacketUseBed sleepPacket = new SPacketUseBed(player, player.getPosition());
  player.getServerWorld().getEntityTracker().sendToTracking(player, sleepPacket);
  player.connection.sendPacket(sleepPacket);
  if (this.isOn(stack)) {
    player.setSpawnPoint(player.getPosition(), true);//true means it wont check for bed block
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:27,代码来源:ItemSleepingMat.java

示例6: onOutgoingPacketSent

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
@SubscribeEvent
public void onOutgoingPacketSent(PacketEvent.Incoming.Pre event) {
    if (event.getPacket() instanceof SPacketPlayerPosLook) {
        SPacketPlayerPosLook packet = (SPacketPlayerPosLook) event.getPacket();
        try {
            ObfuscationReflectionHelper.setPrivateValue(SPacketPlayerPosLook.class, packet, MC.player.rotationYaw, "yaw", "field_148936_d", "d");
            ObfuscationReflectionHelper.setPrivateValue(SPacketPlayerPosLook.class, packet, MC.player.rotationPitch, "pitch", "field_148937_e", "e");
        } catch (Exception e) {}
    }
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:11,代码来源:FlyMod.java

示例7: ModelWolfArmor

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
public ModelWolfArmor(float scale) {
    this.wolfHeadMain = new ModelRenderer(this, 0, 0);
    this.wolfHeadMain.addBox(-2, -3, -2, 6, 6, 4, scale);
    this.wolfHeadMain.setRotationPoint(-1, 13.5F, -7);
    this.wolfBody = new ModelRenderer(this, 18, 14);
    this.wolfBody.addBox(-3, -2, -3, 6, 9, 6, scale);
    this.wolfBody.setRotationPoint(0, 14, 2);
    this.wolfLeg1 = new ModelRenderer(this, 0, 18);
    this.wolfLeg1.addBox(0, 0, -1, 2, 8, 2, scale);
    this.wolfLeg1.setRotationPoint(-2.5F, 16, 7);
    this.wolfLeg2 = new ModelRenderer(this, 0, 18);
    this.wolfLeg2.addBox(0, 0, -1, 2, 8, 2, scale);
    this.wolfLeg2.setRotationPoint(0.5F, 16, 7);
    this.wolfLeg3 = new ModelRenderer(this, 0, 18);
    this.wolfLeg3.addBox(0, 0, -1, 2, 8, 2, scale);
    this.wolfLeg3.setRotationPoint(-2.5F, 16, -4);
    this.wolfLeg4 = new ModelRenderer(this, 0, 18);
    this.wolfLeg4.addBox(0, 0, -1, 2, 8, 2, scale);
    this.wolfLeg4.setRotationPoint(0.5F, 16, -4);
    this.wolfHeadMain.setTextureOffset(16, 14).addBox(-2, -5, 0, 2, 2, 1, scale);
    this.wolfHeadMain.setTextureOffset(16, 14).addBox(2, -5, 0, 2, 2, 1, scale);
    this.wolfHeadMain.setTextureOffset(0, 10).addBox(-0.5F, 0, -5, 3, 3, 4, scale);

    ModelRenderer wolfMane = new ModelRenderer(this, 21, 0);
    wolfMane.addBox(-3, -3, -3, 8, 6, 7, scale);
    wolfMane.setRotationPoint(-1, 14, 2);
    ModelRenderer wolfTail = new ModelRenderer(this, 9, 18);
    wolfTail.addBox(0, 0, -1, 2, 8, 2, scale);
    wolfTail.setRotationPoint(-1, 12, 8);

    try {
    	ObfuscationReflectionHelper.setPrivateValue(ModelWolf.class, this, wolfTail, 6);
    	ObfuscationReflectionHelper.setPrivateValue(ModelWolf.class, this, wolfMane, 7);
    } catch(Exception e){
    	ModLogger.error("Error while trying to access the needed fields in the ModelWolf class");
    	e.printStackTrace();
    }
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:39,代码来源:ModelWolfArmor.java

示例8: injectProvider

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
/**
 * Replaces the given world provider with our own.
 * @param world    The world to proxy
 */
public static void injectProvider(World world) {
    // DO NOT PROXY THE WORLD ON THE SERVER AT ALL:
    if(!world.isRemote) return;

    ProxiedWorldProvider provider = new ProxiedWorldProvider(world.provider);
    ObfuscationReflectionHelper.setPrivateValue(World.class, world, provider, "field_73011_w");
}
 
开发者ID:legendblade,项目名称:CraftingHarmonics,代码行数:12,代码来源:ProxiedWorldProvider.java

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

示例10: tickEvent

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
@SubscribeEvent
public void tickEvent(TickEvent.PlayerTickEvent event) {
	EntityPlayer player = event.player;
	if (ItemArmorMod.hasFullSuit(player, WarsItems.knightArmor)) {
		player.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 10, 0));
	} else if (ItemArmorMod.hasFullSuit(player, WarsItems.scoutArmor)) {
		ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, player.capabilities, 0.15F, 6);
		player.fallDistance = 0;
		player.addPotionEffect(new PotionEffect(MobEffects.SPEED, 10, 1));
	} else if (ItemArmorMod.hasFullSuit(player, WarsItems.ninjaArmor)) {
		ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, player.capabilities, 0.18F, 6);
		player.fallDistance = 0;
		player.addPotionEffect(new PotionEffect(MobEffects.SPEED, 10, 1));
		player.addPotionEffect(new PotionEffect(MobEffects.JUMP_BOOST, 10, 1));
		if(player.motionY < 0 && player.motionY > -0.5){
			player.motionY *= 1.5;
		}
	}

	else if (ItemArmorMod.hasFullSuit(player, WarsItems.chaosArmor) || ItemArmorMod.hasFullSuit(player, WarsItems.enderArmor)) {

		player.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 10, 0));

	}

	if (ItemArmorMod.hasFullSuit(player, WarsItems.archerArmor) || ItemArmorMod.hasFullSuit(player, WarsItems.techArmor) || ItemArmorMod.hasFullSuit(player, WarsItems.chaosArmor) || ItemArmorMod.hasFullSuit(player, WarsItems.knightArmor) || ItemArmorMod.hasFullSuit(player, WarsItems.healerArmor)
			|| ItemArmorMod.hasFullSuit(player, WarsItems.guardArmor) || ItemArmorMod.hasFullSuit(player, WarsItems.scoutArmor) || ItemArmorMod.hasFullSuit(player, WarsItems.enderArmor) || ItemArmorMod.hasFullSuit(player, WarsItems.ninjaArmor)) {
		ItemStack boots = player.inventory.armorItemInSlot(0);
		if (!(boots != null)) {
			Random random = new Random();
			player.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 10, 10));
			player.addPotionEffect(new PotionEffect(MobEffects.MINING_FATIGUE, 10, 100));
			player.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, 10, 10));

			int num = random.nextInt(50);

			if (num == 1) {
				player.addChatMessage(new TextComponentTranslation("needteamboots"));
			}
		}
	}

	int killstreakBefore = player.getEntityData().getInteger("warsmod_killstreak");

	if (killstreakBefore > 1) {
		player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 10, 0));

	}
	if (killstreakBefore > 3) {
		player.addPotionEffect(new PotionEffect(MobEffects.JUMP_BOOST, 10, 0));

	}
	if (killstreakBefore > 7) {
		player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, 20 * 15, 0));

	}
	if (killstreakBefore > 11) {
		player.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 10, 0));

	}
	if (killstreakBefore > 19) {
		player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 10, 1));

	}
	if (killstreakBefore > 29) {
		player.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 10, 1));

	}
	if (killstreakBefore > 2) {
		player.addPotionEffect(new PotionEffect(MobEffects.WATER_BREATHING, 10, 0));
	}
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Wars-Mod,代码行数:73,代码来源:CommonEvents.java

示例11: init

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
@EventHandler
public void init(FMLInitializationEvent event)
{
    if (exempleEnabled)
    {
        logger.info("Registering ISBRH Block Exemple...");
        testId = RenderRegistry.getNextAvailableRenderId();
        GameRegistry.registerBlock(test, "test");
        RenderRegistry.registerBlockHandler(new RenderExample());
        RenderRegistry.registerTextureHandler((ITextureHandler) test);
    }

    Minecraft mc = Minecraft.getMinecraft();

    // Prerequisite
    ModelManager modelManager = ObfuscationReflectionHelper
            .getPrivateValue(Minecraft.class, mc, "aL", "field_175617_aL",
                    "modelManager");
    RenderManager renderManager = mc.getRenderManager();
    IReloadableResourceManager resourceManager = ((IReloadableResourceManager) mc
            .getResourceManager());

    // Render Item Hook
    RenderItem item = new RenderItemISBRH(mc.getTextureManager(),
            modelManager, mc.getRenderItem());
    ObfuscationReflectionHelper.setPrivateValue(Minecraft.class, mc, item,
            "X", "field_175621_X", "renderItem");
    ObfuscationReflectionHelper.setPrivateValue(Minecraft.class, mc,
            new ItemRenderer(mc), "Y", "field_175620_Y", "itemRenderer");
    renderManager.entityRenderMap.remove(EntityItem.class);
    renderManager.entityRenderMap.put(EntityItem.class,
            new RenderEntityItem(renderManager, item));
    renderManager.entityRenderMap.remove(EntityItemFrame.class);
    renderManager.entityRenderMap.put(EntityItemFrame.class,
            new RenderItemFrame(renderManager, item));
    mc.entityRenderer = new EntityRenderer(mc, resourceManager);

    // Render Block Dispatcher Hook
    BlockRendererDispatcher rendererDispatcher = new ISBRHDispatcher(
            mc.getBlockRendererDispatcher(), modelManager.getBlockModelShapes(), mc.gameSettings);
    ObfuscationReflectionHelper.setPrivateValue(Minecraft.class, mc,
            rendererDispatcher, "aM", "field_175618_aM",
            "blockRenderDispatcher");

    // Register Reload Listeners
    resourceManager.registerReloadListener(rendererDispatcher);
    resourceManager.registerReloadListener(item);
    resourceManager.registerReloadListener(mc.entityRenderer);

}
 
开发者ID:Thog,项目名称:ISBRH,代码行数:51,代码来源:ISBRH.java

示例12: setItemAge

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
public static void setItemAge(EntityItem item, int age) {
    ObfuscationReflectionHelper.setPrivateValue(EntityItem.class, item, age, "age", "field_70292_b", "c");
}
 
开发者ID:AdlyTempleton,项目名称:Aura-Cascade,代码行数:4,代码来源:AuraUtil.java

示例13: setItemDelay

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
public static void setItemDelay(EntityItem item, int age) {
    ObfuscationReflectionHelper.setPrivateValue(EntityItem.class, item, age, "delayBeforeCanPickup", "field_145804_b", "d");
}
 
开发者ID:AdlyTempleton,项目名称:Aura-Cascade,代码行数:4,代码来源:AuraUtil.java

示例14: BlockReinforcedIronBars

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
public BlockReinforcedIronBars(Material par1Material, boolean par2) {
	super(par1Material, par2);
	ObfuscationReflectionHelper.setPrivateValue(Block.class, this, SoundType.METAL, 16);
}
 
开发者ID:Geforce132,项目名称:SecurityCraft,代码行数:5,代码来源:BlockReinforcedIronBars.java

示例15: BlockReinforcedFenceGate

import net.minecraftforge.fml.common.ObfuscationReflectionHelper; //导入方法依赖的package包/类
public BlockReinforcedFenceGate(){
	super(BlockPlanks.EnumType.OAK);
	ObfuscationReflectionHelper.setPrivateValue(Block.class, this, Material.IRON, 18);
	setSoundType(SoundType.METAL);
}
 
开发者ID:Geforce132,项目名称:SecurityCraft,代码行数:6,代码来源:BlockReinforcedFenceGate.java


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