Java 类net.minecraft.network.play.client.CPacketEntityAction.Action 实例源码

项目:Wurst-MC-1.12    文件:SneakMod.java   
@Override
public void onDisable()
{
    wurst.events.remove(UpdateListener.class, this);
    wurst.events.remove(PostUpdateListener.class, this);

    switch(mode.getSelected())
    {
        case 0:
        WConnection.sendPacket(new CPacketEntityAction(
            WMinecraft.getPlayer(), Action.STOP_SNEAKING));
        break;

        case 1:
        mc.gameSettings.keyBindSneak.pressed =
            GameSettings.isKeyDown(mc.gameSettings.keyBindSneak);
        break;
    }
}
项目:Wurst-MC-1.12    文件:SneakMod.java   
@Override
public void onUpdate()
{
    switch(mode.getSelected())
    {
        case 0:
        WConnection.sendPacket(new CPacketEntityAction(
            WMinecraft.getPlayer(), Action.START_SNEAKING));
        WConnection.sendPacket(new CPacketEntityAction(
            WMinecraft.getPlayer(), Action.STOP_SNEAKING));
        break;

        case 1:
        mc.gameSettings.keyBindSneak.pressed = true;
        break;
    }
}
项目:CheataClientSrc    文件:Derp.java   
@Override
public void onUpdate() {
    mode = Client.getValueManager().getValueByName("DerpLegit").getValueBoolean();
    Random rand = new Random();
    int yaw = rand.nextInt((1000 - 0) + 1) + 0;
    int pitch = rand.nextInt((1000 - 0) + 1) + 0;
    if(mode){
        mc.thePlayer.rotationYaw = yaw;
        mc.thePlayer.rotationPitch = pitch;
        KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), false);
        KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), true);
    }else{
        mc.thePlayer.sendQueue.addToSendQueue(new C05PacketPlayerLook(yaw, pitch, mc.thePlayer.onGround));
        mc.thePlayer.sendQueue.addToSendQueue(new CPacketEntityAction(mc.thePlayer, Action.STOP_SNEAKING));
        mc.thePlayer.sendQueue.addToSendQueue(new CPacketEntityAction(mc.thePlayer, Action.START_SNEAKING));
    }
}
项目:Alchemy    文件:ExItemElytra.java   
@Hook("net.minecraft.network.NetHandlerPlayServer#func_147357_a")
public static Hook.Result processEntityAction(NetHandlerPlayServer handler, CPacketEntityAction action) {
    if (action.getAction() == Action.START_FALL_FLYING) {
        PacketThreadUtil.checkThreadAndEnqueue(action, handler, handler.player.getServerWorld());
        handler.player.markPlayerActive();
        if (!handler.player.onGround && handler.player.motionY < 0.0D &&
                !handler.player.isElytraFlying() && !handler.player.isInWater()) {
            ItemStack item = getFormLiving0(handler.player);
            if (item.getItem() == Items.ELYTRA && ItemElytra.isUsable(item))
                handler.player.setElytraFlying();
        } else
            handler.player.clearElytraFlying();
        return Hook.Result.NULL;
    }
    return Hook.Result.VOID;
}
项目:ForgeHax    文件:FlyMod.java   
@SubscribeEvent
public void onLocalPlayerUpdate(LocalPlayerUpdateEvent event) {
    try {
        double[] dir = moveLooking(0);
        double xDir = dir[0];
        double zDir = dir[1];

        if ((MC.gameSettings.keyBindForward.isKeyDown() || MC.gameSettings.keyBindLeft.isKeyDown() || MC.gameSettings.keyBindRight.isKeyDown() || MC.gameSettings.keyBindBack.isKeyDown()) && !MC.gameSettings.keyBindJump.isKeyDown()) {
            MC.player.motionX = xDir * 0.26;
            MC.player.motionZ = zDir * 0.26;
        }
        double posX = MC.player.posX + MC.player.motionX;
        double posY = MC.player.posY + (MC.gameSettings.keyBindJump.isKeyDown() ? (zoomies ? 0.0625 : 0.0624) : 0.00000001) - (MC.gameSettings.keyBindSneak.isKeyDown() ? (zoomies ? 0.0625 : 0.0624) : 0.00000002);
        double posZ = MC.player.posZ + MC.player.motionX;
        getNetworkManager().sendPacket(new CPacketPlayer.PositionRotation(MC.player.posX + MC.player.motionX, MC.player.posY + (MC.gameSettings.keyBindJump.isKeyDown() ? (zoomies ? 0.0625 : 0.0624) : 0.00000001) - (MC.gameSettings.keyBindSneak.isKeyDown() ? (zoomies ? 0.0625 : 0.0624) : 0.00000002), MC.player.posZ + MC.player.motionZ, MC.player.rotationYaw, MC.player.rotationPitch, false));
        getNetworkManager().sendPacket(new CPacketPlayer.PositionRotation(MC.player.posX + MC.player.motionX, 1337 + MC.player.posY, MC.player.posZ + MC.player.motionZ, MC.player.rotationYaw, MC.player.rotationPitch, true));
        getNetworkManager().sendPacket(new CPacketEntityAction(MC.player, Action.START_FALL_FLYING));
        MC.player.setPosition(posX, posY, posZ);

        zoomies = !zoomies;

        MC.player.motionX = 0;
        MC.player.motionY = 0;
        MC.player.motionZ = 0;

        MC.player.noClip = true;
    } catch (Exception e) {
        Helper.printStackTrace(e);
    }
}
项目:ForgeHax    文件:ElytraFlight.java   
@Override
protected void onEnabled() {
    if(fly_on_enable.get()) MC.addScheduledTask(() -> {
        if(getLocalPlayer() != null &&
                !getLocalPlayer().isElytraFlying()) getNetworkManager().sendPacket(new CPacketEntityAction(getLocalPlayer(), Action.START_FALL_FLYING));
    });
}
项目:ForgeHax    文件:ElytraFlight.java   
@Override
public void onDisabled() {
    // Are we still here?
    if (getLocalPlayer() != null) {

        // Disable creativeflight.
        getLocalPlayer().capabilities.isFlying = false;

        // Ensure the player starts flying again.
        getNetworkManager().sendPacket(new CPacketEntityAction(getLocalPlayer(), Action.START_FALL_FLYING));
    }
}
项目:Wurst-MC-1.12    文件:SneakMod.java   
@Override
public void afterUpdate()
{
    if(mode.getSelected() == 1)
        return;

    WConnection.sendPacket(new CPacketEntityAction(WMinecraft.getPlayer(),
        Action.STOP_SNEAKING));
    WConnection.sendPacket(new CPacketEntityAction(WMinecraft.getPlayer(),
        Action.START_SNEAKING));
}
项目:Alchemy    文件:ExItemElytra.java   
@Hook(value = "net.minecraft.client.entity.EntityPlayerSP#func_70636_d", type = Type.TAIL)
public static void onLivingUpdate_tail(EntityPlayerSP player) {
    ItemStack item = getFormLiving0(player);
    KeyBinding jump = Minecraft.getMinecraft().gameSettings.keyBindJump;
    boolean flag = Keyboard.isKeyDown(jump.getKeyCode());
    if (item.getItem() == Items.ELYTRA) {
        if (flag && jump.getKeyConflictContext().isActive() && !HookClient.flag &&
                player.motionY < 0.0D && !player.isElytraFlying() && !player.capabilities.isFlying)
            if (ItemElytra.isUsable(item))
                player.connection.sendPacket(new CPacketEntityAction(player, CPacketEntityAction.Action.START_FALL_FLYING));
    }
    HookClient.flag = flag;
}