本文整理汇总了Java中net.minecraft.util.MouseFilter类的典型用法代码示例。如果您正苦于以下问题:Java MouseFilter类的具体用法?Java MouseFilter怎么用?Java MouseFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MouseFilter类属于net.minecraft.util包,在下文中一共展示了MouseFilter类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AimTask
import net.minecraft.util.MouseFilter; //导入依赖的package包/类
/**
* @param aimSpeed
* @param rotations use Float.NaN to not aim for that rotation
*/
public AimTask(float aimSpeed, float[] rotations, ICondition whenToStop) {
running = true;
new Thread(() -> {
while (running) {
try {
Thread.sleep(1);
} catch (InterruptedException e) {
}
running = !whenToStop.check();
if (Wrapper.thePlayer() == null || Wrapper.theWorld() == null || Float.isNaN(Wrapper.player_rotationYaw()) || Float.isNaN(Wrapper.player_rotationPitch())
|| Wrapper.player_rotationYaw() == rotations[0] || Wrapper.player_rotationPitch() == rotations[1]) {
running = false;
return;
}
float targetYaw = (AngleUtil.getIncrementedRotation(Wrapper.player_rotationYaw(), Float.isNaN(rotations[0]) ? Wrapper.player_rotationYaw() : rotations[0], aimSpeed * 2));
float targetPitch = (AngleUtil.getIncrementedRotation(Wrapper.player_rotationPitch(), Float.isNaN(rotations[1]) ? Wrapper.player_rotationPitch() : rotations[1], aimSpeed * 2));
Wrapper.player_setAngles(new MouseFilter().func_76333_a(targetYaw, 0.5f), -(new MouseFilter().func_76333_a(targetPitch, 0.5f)));
}
}).start();
}
示例2: getFOVModifier
import net.minecraft.util.MouseFilter; //导入依赖的package包/类
/**
* Changes the field of view of the player depending on if they are underwater or not
*/
private float getFOVModifier(float partialTicks, boolean p_78481_2_)
{
if (this.debugView)
{
return 90.0F;
}
else
{
Entity entity = this.mc.getRenderViewEntity();
float f = 70.0F;
if (p_78481_2_)
{
f = this.mc.gameSettings.fovSetting;
if (Config.isDynamicFov())
{
f *= this.fovModifierHandPrev + (this.fovModifierHand - this.fovModifierHandPrev) * partialTicks;
}
}
boolean flag = false;
if (this.mc.currentScreen == null)
{
GameSettings gamesettings = this.mc.gameSettings;
flag = GameSettings.isKeyDown(this.mc.gameSettings.ofKeyBindZoom);
}
if (flag)
{
if (!Config.zoomMode)
{
Config.zoomMode = true;
this.mc.gameSettings.smoothCamera = true;
}
if (Config.zoomMode)
{
f /= 4.0F;
}
}
else if (Config.zoomMode)
{
Config.zoomMode = false;
this.mc.gameSettings.smoothCamera = false;
this.mouseFilterXAxis = new MouseFilter();
this.mouseFilterYAxis = new MouseFilter();
this.mc.renderGlobal.displayListEntitiesDirty = true;
}
if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).getHealth() <= 0.0F)
{
float f1 = (float)((EntityLivingBase)entity).deathTime + partialTicks;
f /= (1.0F - 500.0F / (f1 + 500.0F)) * 2.0F + 1.0F;
}
Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks);
if (block.getMaterial() == Material.water)
{
f = f * 60.0F / 70.0F;
}
return f;
}
}
示例3: getFOVModifier
import net.minecraft.util.MouseFilter; //导入依赖的package包/类
/**
* Changes the field of view of the player depending on if they are underwater
* or not
*/
private float getFOVModifier(float partialTicks, boolean p_78481_2_) {
if (this.debugView) {
return 90.0F;
} else {
Entity entity = this.mc.getRenderViewEntity();
float f = 70.0F;
if (p_78481_2_) {
f = this.mc.gameSettings.fovSetting;
f = f * (this.fovModifierHandPrev + (this.fovModifierHand - this.fovModifierHandPrev) * partialTicks);
}
boolean flag = false;
if (this.mc.currentScreen == null) {
GameSettings gamesettings = this.mc.gameSettings;
flag = GameSettings.isKeyDown(this.mc.gameSettings.ofKeyBindZoom);
}
if (flag) {
if (!Config.zoomMode) {
Config.zoomMode = true;
this.mc.gameSettings.smoothCamera = true;
}
if (Config.zoomMode) {
f /= 4.0F;
}
} else if (Config.zoomMode) {
Config.zoomMode = false;
this.mc.gameSettings.smoothCamera = false;
this.mouseFilterXAxis = new MouseFilter();
this.mouseFilterYAxis = new MouseFilter();
this.mc.renderGlobal.displayListEntitiesDirty = true;
}
if (entity instanceof EntityLivingBase && ((EntityLivingBase) entity).getHealth() <= 0.0F) {
float f1 = (float) ((EntityLivingBase) entity).deathTime + partialTicks;
f /= (1.0F - 500.0F / (f1 + 500.0F)) * 2.0F + 1.0F;
}
Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks);
if (block.getMaterial() == Material.water) {
f = f * 60.0F / 70.0F;
}
return f;
}
}
示例4: getFOVModifier
import net.minecraft.util.MouseFilter; //导入依赖的package包/类
/**
* Changes the field of view of the player depending on if they are underwater or not
*/
private float getFOVModifier(float partialTicks, boolean useFOVSetting)
{
if (this.debugView)
{
return 90.0F;
}
else
{
Entity entity = this.mc.getRenderViewEntity();
float f = 70.0F;
if (useFOVSetting)
{
f = this.mc.gameSettings.fovSetting;
if (Config.isDynamicFov())
{
f *= this.fovModifierHandPrev + (this.fovModifierHand - this.fovModifierHandPrev) * partialTicks;
}
}
boolean flag = false;
if (this.mc.currentScreen == null)
{
GameSettings gamesettings = this.mc.gameSettings;
flag = GameSettings.isKeyDown(this.mc.gameSettings.ofKeyBindZoom);
}
if (flag)
{
if (!Config.zoomMode)
{
Config.zoomMode = true;
this.mc.gameSettings.smoothCamera = true;
this.mc.renderGlobal.displayListEntitiesDirty = true;
}
if (Config.zoomMode)
{
f /= 4.0F;
}
}
else if (Config.zoomMode)
{
Config.zoomMode = false;
this.mc.gameSettings.smoothCamera = false;
this.mouseFilterXAxis = new MouseFilter();
this.mouseFilterYAxis = new MouseFilter();
this.mc.renderGlobal.displayListEntitiesDirty = true;
}
if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).getHealth() <= 0.0F)
{
float f1 = (float)((EntityLivingBase)entity).deathTime + partialTicks;
f /= (1.0F - 500.0F / (f1 + 500.0F)) * 2.0F + 1.0F;
}
IBlockState iblockstate = ActiveRenderInfo.getBlockStateAtEntityViewpoint(this.mc.world, entity, partialTicks);
if (iblockstate.getMaterial() == Material.WATER)
{
f = f * 60.0F / 70.0F;
}
return Reflector.ForgeHooksClient_getFOVModifier.exists() ? Reflector.callFloat(Reflector.ForgeHooksClient_getFOVModifier, new Object[] {this, entity, iblockstate, Float.valueOf(partialTicks), Float.valueOf(f)}): f;
}
}
示例5: getFOVModifier
import net.minecraft.util.MouseFilter; //导入依赖的package包/类
/**
* Changes the field of view of the player depending on if they are underwater or not
*/
private float getFOVModifier(float par1, boolean par2)
{
if (this.debugViewDirection > 0)
{
return 90.0F;
}
else
{
EntityLivingBase var3 = this.mc.renderViewEntity;
float var4 = 70.0F;
if (par2)
{
var4 += this.mc.gameSettings.fovSetting * 40.0F;
var4 *= this.fovModifierHandPrev + (this.fovModifierHand - this.fovModifierHandPrev) * par1;
}
boolean zoomActive = false;
if (this.mc.currentScreen == null)
{
if (this.mc.gameSettings.ofKeyBindZoom.getKeyCode() < 0)
{
zoomActive = Mouse.isButtonDown(this.mc.gameSettings.ofKeyBindZoom.getKeyCode() + 100);
}
else
{
zoomActive = Keyboard.isKeyDown(this.mc.gameSettings.ofKeyBindZoom.getKeyCode());
}
}
if (zoomActive)
{
if (!Config.zoomMode)
{
Config.zoomMode = true;
this.mc.gameSettings.smoothCamera = true;
}
if (Config.zoomMode)
{
var4 /= 4.0F;
}
}
else if (Config.zoomMode)
{
Config.zoomMode = false;
this.mc.gameSettings.smoothCamera = false;
this.mouseFilterXAxis = new MouseFilter();
this.mouseFilterYAxis = new MouseFilter();
}
if (var3.getHealth() <= 0.0F)
{
float var6 = (float)var3.deathTime + par1;
var4 /= (1.0F - 500.0F / (var6 + 500.0F)) * 2.0F + 1.0F;
}
Block var61 = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, var3, par1);
if (var61.getMaterial() == Material.water)
{
var4 = var4 * 60.0F / 70.0F;
}
return var4 + this.prevDebugCamFOV + (this.debugCamFOV - this.prevDebugCamFOV) * par1;
}
}