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


Java FOVUpdateEvent类代码示例

本文整理汇总了Java中net.minecraftforge.client.event.FOVUpdateEvent的典型用法代码示例。如果您正苦于以下问题:Java FOVUpdateEvent类的具体用法?Java FOVUpdateEvent怎么用?Java FOVUpdateEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: onFovUpdateEvent

import net.minecraftforge.client.event.FOVUpdateEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onFovUpdateEvent(FOVUpdateEvent fovEvt) {
	ItemStack currentItem = fovEvt.getEntity().getActiveItemStack();
	if (ItemStackTools.isNullStack(currentItem) || currentItem.getItem() != this || fovEvt.getEntity().getItemInUseCount() <= 0) {
		return;
	}

	int drawDuration = getMaxItemUseDuration(currentItem) - fovEvt.getEntity().getItemInUseCount();
	float ratio = drawDuration / (float) 20.0F;

	if (ratio > 1.0F) {
		ratio = 1.0F;
	} else {
		ratio *= ratio;
	}
	fovEvt.setNewfov((1.0F - ratio * 0.35f));
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:19,代码来源:ItemBlowGun.java

示例2: onFovUpdateEvent

import net.minecraftforge.client.event.FOVUpdateEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onFovUpdateEvent(FOVUpdateEvent fovEvt) {
  ItemStack currentItem = fovEvt.getEntity().getActiveItemStack();
  if (ItemStackTools.isNullStack(currentItem) || currentItem.getItem() != this || fovEvt.getEntity().getItemInUseCount() <= 0) {
    return;
  }

  int drawDuration = getMaxItemUseDuration(currentItem) - fovEvt.getEntity().getItemInUseCount();
  float ratio = drawDuration / (float) getDrawTime(currentItem);

  if (ratio > 1.0F) {
    ratio = 1.0F;
  } else {
    ratio *= ratio;
  }
  fovEvt.setNewfov((1.0F - ratio * fovMultiplier));

}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:20,代码来源:ItemDarkIronBow.java

示例3: onFOVUpdate

import net.minecraftforge.client.event.FOVUpdateEvent; //导入依赖的package包/类
@SubscribeEvent
public void onFOVUpdate(FOVUpdateEvent event) {
	EntityPlayer player = event.entity;
	if (!TConfigs.fovAtBowOrSpeed) {
		if (player.isUsingItem()) {
			if (player.getItemInUse().getItem() == TItems.teambattlebow || player.getItemInUse().getItem() == Items.bow) {
				event.newfov = 1.0f;
				return;
			}
		}
		if (player.getActivePotionEffect(Potion.moveSpeed) != null) {
			event.newfov = 1.0f;
			return;
		}
	}
	if (player.isUsingItem() && player.getItemInUse().getItem() == TItems.teambattlebow) {
		int s = player.getItemInUseDuration();
		float f = s * 0.3F;
		if (f > 4.0F) {
			f = 4.0F;
		}
		event.newfov *= 1.0F - f * 0.125F;
	}
}
 
开发者ID:HyCraftHD,项目名称:TeambattleMod,代码行数:25,代码来源:ClientEventHandler.java

示例4: getModelVariation

import net.minecraftforge.client.event.FOVUpdateEvent; //导入依赖的package包/类
/**
	 * Helper function for getModel() that allows subclasses to easily overwrite custom animation
	 * sequences for bow pull
	 * 
	 * @param useTime
	 * @return
	 *//*
	protected int getModelVariation(int useTime) {
    	if(useTime >= 21) {
    		return 2;
        } else if(useTime > 10) {
            return 1;
        } else {
            return 0;
        }
	}
*/
	@SubscribeEvent
	public void fovUpdate(FOVUpdateEvent event) {
		if (event.getEntity() instanceof EntityPlayer) {
			if (event.getEntity().isHandActive() && event.getEntity().getActiveItemStack().getItem() == this) {
				float fovModifier = getNewFovModifier(event.getEntity().getItemInUseMaxCount()); // getItemInUseMaxCount() seems to be mis-named.  functionally, it is like the old getItemUseDuration()
		        float fov = 1.0f;
		        fov *= 1.0F - fovModifier * 0.15F;
//				MEMLogger.info("ItemCustomBow fovUpdate(): itemUseDuration = " + event.entity.getItemInUseDuration() + "; fovModifier = " + fovModifier + "; newfov = " + fov);
	            event.setNewfov(fov);
			}
		}
	}
 
开发者ID:freneticfeline,项目名称:mod_quiver,代码行数:30,代码来源:ItemCustomBow.java

示例5: FOVBowUpdate

import net.minecraftforge.client.event.FOVUpdateEvent; //导入依赖的package包/类
@SubscribeEvent
   public void FOVBowUpdate(FOVUpdateEvent event){
	if(event.entity.getItemInUse() != null){
		if(event.entity.getItemInUse().getItem() instanceof ItemNileBow){
            int i = event.entity.getItemInUseDuration();
            float f1 = (float)i / 20.0F;

            if (f1 > 1.0F)
            {
                f1 = 1.0F;
            }
            else
            {
                f1 *= f1;
            }

            event.newfov *= 1.0F - f1 * 0.15F;
		}
	}
}
 
开发者ID:NovaViper,项目名称:ZeroQuest,代码行数:21,代码来源:FOVEvent.java

示例6: onUpdateFOV

import net.minecraftforge.client.event.FOVUpdateEvent; //导入依赖的package包/类
@SubscribeEvent
public void onUpdateFOV(FOVUpdateEvent event) {
	float fov = event.getFov();

	if( event.getEntity().isHandActive() && event.getEntity().getActiveItemStack() != null
			&& event.getEntity().getActiveItemStack().getItem() == ACItems.coralium_longbow) {
		int duration = event.getEntity().getItemInUseCount();
		float multiplier = duration / 20.0F;

		if( multiplier > 1.0F )
			multiplier = 1.0F;
		else
			multiplier *= multiplier;

		fov *= 1.0F - multiplier * 0.15F;
	}

	event.setNewfov(fov);
}
 
开发者ID:Shinoow,项目名称:AbyssalCraft,代码行数:20,代码来源:AbyssalCraftClientEventHooks.java

示例7: onFOVUpdate

import net.minecraftforge.client.event.FOVUpdateEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onFOVUpdate(FOVUpdateEvent event) {
	IAttributeInstance atinst = event.entity
			.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
	AttributeModifier mod;
	if ((mod = atinst.getModifier(wtvID)) != null) {
		event.newfov = (event.newfov * 2.0f) - 1.0f; // Reversal operation,
														// as seen in
														// EntityPlayerSP
		event.newfov = event.newfov / (float) (1.0 + mod.getAmount()); // Earth
																		// speed
																		// modifier
		event.newfov = (event.newfov + 1.0f) / 2.0f;
	}
}
 
开发者ID:testmad,项目名称:GaiaMod,代码行数:17,代码来源:GaiaModEventHandler.java

示例8: onFovUpdateEvent

import net.minecraftforge.client.event.FOVUpdateEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onFovUpdateEvent(FOVUpdateEvent fovEvt) {
  ItemStack currentItem = fovEvt.getEntity().getHeldItemMainhand();
  if(currentItem == null || currentItem.getItem() != this || fovEvt.getEntity().getItemInUseCount() <= 0) {
    return;
  }

  int drawDuration = getMaxItemUseDuration(currentItem) - fovEvt.getEntity().getItemInUseCount();
  float ratio = drawDuration / (float) getDrawTime();

  if(ratio > 1.0F) {
    ratio = 1.0F;
  } else {
    ratio *= ratio;
  }
  fovEvt.setNewfov((1.0F - ratio * fovMultiplier));

}
 
开发者ID:SleepyTrousers,项目名称:EnderZoo,代码行数:20,代码来源:ItemGuardiansBow.java

示例9: getFOV

import net.minecraftforge.client.event.FOVUpdateEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void getFOV(FOVUpdateEvent event)
{
	if (event.entity.isUsingItem() && event.entity.getItemInUse().getItem() == RandomAdditions.tools)
       {
           int i = event.entity.getItemInUseDuration();
           Tool tool = ItemTool.getTool(event.entity.getItemInUse());
           if(tool == ItemTool.bow)
           {
            float f1 = (float)i / ToolBow.getSpan(event.entity, event.entity.getItemInUse());

            if (f1 > 1.0F)
            {
                f1 = 1.0F;
            }
            else
            {
                f1 *= f1;
            }

            event.newfov *= 1.0F - f1 * 0.3F;
           }
       }
}
 
开发者ID:CreativeMD,项目名称:RandomAdditions,代码行数:26,代码来源:EventHandlerRandom.java

示例10: handleFovUpdate

import net.minecraftforge.client.event.FOVUpdateEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public static void handleFovUpdate(@Nonnull FOVUpdateEvent evt) {

  if (ignoreFovEvent) {
    return;
  }

  EntityPlayer player = NullHelper.notnullF(evt.getEntity(), "FOVUpdateEvent has no player");

  if (clearModifiers(player)) {
    // set the same as vanilla does without our speed buff
    evt.setNewfov(getVanillaFovModifier(player));
    setModifiers(player);
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:17,代码来源:SpeedController.java

示例11: onFovUpdateEvent

import net.minecraftforge.client.event.FOVUpdateEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onFovUpdateEvent(FOVUpdateEvent fovEvt) {
  ItemStack currentItem = fovEvt.getEntity().getHeldItemMainhand();
  if (currentItem.getItem() != this || fovEvt.getEntity().getItemInUseCount() <= 0) {
    return;
  }

  int drawDuration = getMaxItemUseDuration(currentItem) - fovEvt.getEntity().getItemInUseCount();
  float ratio = drawDuration / (float) getDrawTime(currentItem);

  if (ratio > 1.0F) {
    ratio = 1.0F;
  } else {
    ratio *= ratio;
  }

  float mult = (float) Config.darkSteelBowFovMultipliers[0];
  EnergyUpgradeHolder upgrade = EnergyUpgradeManager.loadFromItem(currentItem);
  if (upgrade != null && upgrade.getEnergy() > 0) {
    mult = (float) Config.darkSteelBowFovMultipliers[upgrade.getUpgrade().getLevel() + 1];
  }
  fovEvt.setNewfov((1.0F - ratio * mult));
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:25,代码来源:ItemDarkSteelBow.java

示例12: updateFOV

import net.minecraftforge.client.event.FOVUpdateEvent; //导入依赖的package包/类
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void updateFOV(FOVUpdateEvent event) {
	if (event.getEntity().getActivePotionEffect(Thermionics.POTION_EFFORTLESS_SPEED)!=null) {
		event.setNewfov(1.0f);
	}
}
 
开发者ID:elytra,项目名称:Thermionics,代码行数:8,代码来源:Thermionics.java

示例13: getFov

import net.minecraftforge.client.event.FOVUpdateEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void getFov(FOVUpdateEvent event) {
	if (!event.getEntity().getHeldItem(EnumHand.MAIN_HAND).isEmpty()
			&& event.getEntity().getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof TNTCannon)
		if (!event.getEntity().getActiveItemStack().isEmpty()
				&& ((TNTCannon) event.getEntity().getHeldItem(EnumHand.MAIN_HAND).getItem())
						.getType(event.getEntity().getHeldItem(EnumHand.MAIN_HAND)) == 5)
			event.setNewfov(event.getNewfov() * 0.4f);
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:11,代码来源:BlockEventBus.java

示例14: getFov

import net.minecraftforge.client.event.FOVUpdateEvent; //导入依赖的package包/类
@SubscribeEvent
public void getFov(FOVUpdateEvent event) {
	if (event.getEntity().getHeldItem(EnumHand.MAIN_HAND) != null && event.getEntity().getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof ItemUsable)
		if (event.getEntity().getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof ItemSniperRifle && event.getEntity().getCapability(TF2weapons.WEAPONS_CAP, null).isCharging()) {
			event.setNewfov(event.getFov() * 0.55f);
		} else if (event.getEntity().getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getModifier(ItemMinigun.slowdownUUID) != null) {
			event.setNewfov(event.getFov() * 1.4f);
		}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:10,代码来源:TF2EventsClient.java

示例15: onBowPulled

import net.minecraftforge.client.event.FOVUpdateEvent; //导入依赖的package包/类
@SubscribeEvent
public void onBowPulled(FOVUpdateEvent event)
{
	EntityPlayer player = Minecraft.getMinecraft().thePlayer;

	if (player == null || (player != null && player.getActiveItemStack() == null))
	{
		return;
	}

	Item item = player.getActiveItemStack().getItem();

	if (item == ItemsAether.phoenix_bow)
	{
        int i = player.getItemInUseMaxCount();
        float f1 = (float)i / 20.0F;

        if (f1 > 1.0F)
        {
            f1 = 1.0F;
        }
        else
        {
            f1 = f1 * f1;
        }

        float original = event.getFov();

        original *= 1.0F - f1 * 0.15F;

        event.setNewfov(original);
	}
}
 
开发者ID:Modding-Legacy,项目名称:Aether-Legacy,代码行数:34,代码来源:AetherClientEvents.java


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