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


Java KeyBinding.onTick方法代码示例

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


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

示例1: onClick

import net.minecraft.client.settings.KeyBinding; //导入方法依赖的package包/类
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onClick(MouseInputEvent event)
{
	if(Minecraft.getMinecraft().gameSettings.keyBindAttack.isPressed())
	{
		KeyBinding.onTick(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode());
		RayTraceResult ray = HarshenClientUtils.getMouseOver(Minecraft.getMinecraft().player.getHeldItemMainhand().getItem() instanceof BaseHarshenScythe ?
				((BaseHarshenScythe)Minecraft.getMinecraft().player.getHeldItemMainhand().getItem()).getReach() : AccessoryConfig.reachPendantLength);
		if(Minecraft.getMinecraft().player.getHeldItemMainhand().getItem() instanceof BaseHarshenScythe && HarshenUtils.containsItem(Minecraft.getMinecraft().player, HarshenItems.REACH_PENDANT))
			ray = HarshenClientUtils.getMouseOver(((BaseHarshenScythe)Minecraft.getMinecraft().player.getHeldItemMainhand().getItem()).getReach() + AccessoryConfig.reachPendantLength);
		if(ray != null && (Minecraft.getMinecraft().player.getHeldItemMainhand().getItem() instanceof BaseHarshenScythe || HarshenUtils.containsItem(Minecraft.getMinecraft().player, HarshenItems.REACH_PENDANT)))
			HarshenNetwork.sendToServer(new MessagePacketHitWithRange(ray.entityHit.getEntityId()));
	}
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:16,代码来源:HandlerExtraRange.java

示例2: runTickMouse

import net.minecraft.client.settings.KeyBinding; //导入方法依赖的package包/类
private void runTickMouse() throws IOException
{
    while (Mouse.next())
    {
        int i = Mouse.getEventButton();
        KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState());

        if (Mouse.getEventButtonState())
        {
            if (this.player.isSpectator() && i == 2)
            {
                this.ingameGUI.getSpectatorGui().onMiddleClick();
            }
            else
            {
                KeyBinding.onTick(i - 100);
            }
        }

        long j = getSystemTime() - this.systemTime;

        if (j <= 200L)
        {
            int k = Mouse.getEventDWheel();

            if (k != 0)
            {
                if (this.player.isSpectator())
                {
                    k = k < 0 ? -1 : 1;

                    if (this.ingameGUI.getSpectatorGui().isMenuActive())
                    {
                        this.ingameGUI.getSpectatorGui().onMouseScroll(-k);
                    }
                    else
                    {
                        float f = MathHelper.clamp(this.player.capabilities.getFlySpeed() + (float)k * 0.005F, 0.0F, 0.2F);
                        this.player.capabilities.setFlySpeed(f);
                    }
                }
                else
                {
                    this.player.inventory.changeCurrentItem(k);
                }
            }

            if (this.currentScreen == null)
            {
                if (!this.inGameHasFocus && Mouse.getEventButtonState())
                {
                    this.setIngameFocus();
                }
            }
            else if (this.currentScreen != null)
            {
                this.currentScreen.handleMouseInput();
            }
        }
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:62,代码来源:Minecraft.java

示例3: runTickMouse

import net.minecraft.client.settings.KeyBinding; //导入方法依赖的package包/类
private void runTickMouse() throws IOException
{
    while (Mouse.next())
    {
        if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue;

        int i = Mouse.getEventButton();
        KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState());

        if (Mouse.getEventButtonState())
        {
            if (this.thePlayer.isSpectator() && i == 2)
            {
                this.ingameGUI.getSpectatorGui().onMiddleClick();
            }
            else
            {
                KeyBinding.onTick(i - 100);
            }
        }

        long j = getSystemTime() - this.systemTime;

        if (j <= 200L)
        {
            int k = Mouse.getEventDWheel();

            if (k != 0)
            {
                if (this.thePlayer.isSpectator())
                {
                    k = k < 0 ? -1 : 1;

                    if (this.ingameGUI.getSpectatorGui().isMenuActive())
                    {
                        this.ingameGUI.getSpectatorGui().onMouseScroll(-k);
                    }
                    else
                    {
                        float f = MathHelper.clamp_float(this.thePlayer.capabilities.getFlySpeed() + (float)k * 0.005F, 0.0F, 0.2F);
                        this.thePlayer.capabilities.setFlySpeed(f);
                    }
                }
                else
                {
                    this.thePlayer.inventory.changeCurrentItem(k);
                }
            }

            if (this.currentScreen == null)
            {
                if (!this.inGameHasFocus && Mouse.getEventButtonState())
                {
                    this.setIngameFocus();
                }
            }
            else if (this.currentScreen != null)
            {
                this.currentScreen.handleMouseInput();
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:64,代码来源:Minecraft.java


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