本文整理汇总了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));
}
示例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));
}
示例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;
}
}
示例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);
}
}
}
示例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;
}
}
}
示例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);
}
示例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;
}
}
示例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));
}
示例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;
}
}
}
示例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);
}
}
示例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));
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
}