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

项目:Wurst-MC-1.12    文件:LeaveCmd.java   
private void disconnectWithMode(int mode)
{
    switch(mode)
    {
        case 0:
        WMinecraft.getWorld().sendQuittingDisconnectingPacket();
        break;

        case 1:
        WConnection.sendPacket(new CPacketChatMessage("�"));
        break;

        case 2:
        WConnection.sendPacket(
            new CPacketPlayer.Position(3.1e7d, 100, 3.1e7d, false));
        break;

        case 3:
        WPlayer.sendAttackPacket(WMinecraft.getPlayer());
        break;

        default:
        break;
    }
}
项目:Wurst-MC-1.12    文件:AntiFireMod.java   
@Override
public void onUpdate()
{
    // check gamemode
    if(WMinecraft.getPlayer().capabilities.isCreativeMode)
        return;

    // check onGround
    if(!WMinecraft.getPlayer().onGround)
        return;

    // check if burning
    if(!WMinecraft.getPlayer().isBurning())
        return;

    // send updates
    for(int i = 0; i < 100; i++)
        WConnection.sendPacket(new CPacketPlayer());
}
项目:Wurst-MC-1.12    文件:AntiPotionMod.java   
@Override
public void onUpdate()
{
    // check gamemode
    if(WMinecraft.getPlayer().capabilities.isCreativeMode)
        return;

    // check onGround
    if(!WMinecraft.getPlayer().onGround)
        return;

    // check effects
    if(!hasBadEffect())
        return;

    // send packets
    for(int i = 0; i < 1000; i++)
        WConnection.sendPacket(new CPacketPlayer());
}
项目:Wurst-MC-1.12    文件:RegenMod.java   
@Override
public void onUpdate()
{
    if(WMinecraft.getPlayer().capabilities.isCreativeMode
        || WMinecraft.getPlayer().getHealth() == 0)
        return;

    if(pauseInMidAir.isChecked() && !WMinecraft.getPlayer().onGround)
        return;

    if(WMinecraft.getPlayer().getFoodStats().getFoodLevel() < 18)
        return;

    if(WMinecraft.getPlayer().getHealth() >= WMinecraft.getPlayer()
        .getMaxHealth())
        return;

    for(int i = 0; i < speed.getValueI(); i++)
        WConnection.sendPacket(new CPacketPlayer());
}
项目:Wurst-MC-1.12    文件:FlightMod.java   
@Override
public void onEnable()
{
    wurst.mods.jetpackMod.setEnabled(false);

    if(mode.getSelected() > 0)
    {
        double startX = WMinecraft.getPlayer().posX;
        startY = WMinecraft.getPlayer().posY;
        double startZ = WMinecraft.getPlayer().posZ;

        for(int i = 0; i < 4; i++)
        {
            WConnection.sendPacket(new CPacketPlayer.Position(startX,
                startY + 1.01, startZ, false));
            WConnection.sendPacket(
                new CPacketPlayer.Position(startX, startY, startZ, false));
        }

        WMinecraft.getPlayer().jump();
    }

    wurst.events.add(UpdateListener.class, this);
}
项目:Wurst-MC-1.12    文件:JetpackMod.java   
@Override
public void onUpdate()
{
    if(mc.gameSettings.keyBindJump.pressed)
        WMinecraft.getPlayer().jump();

    if(flightKickBypass != null && flightKickBypass.isChecked())
    {
        updateMS();

        updateFlyHeight();
        WConnection.sendPacket(new CPacketPlayer(true));

        if(flyHeight <= 290 && hasTimePassedM(500)
            || flyHeight > 290 && hasTimePassedM(100))
        {
            goToGround();
            updateLastMS();
        }
    }
}
项目:Wurst-MC-1.12    文件:BlinkMod.java   
@Override
public void onSentPacket(PacketOutputEvent event)
{
    Packet packet = event.getPacket();

    // check for player packets
    if(!(packet instanceof CPacketPlayer))
        return;

    // cancel player packets
    event.cancel();

    // check for movement packets
    if(!(packet instanceof CPacketPlayer.Position)
        && !(packet instanceof CPacketPlayer.PositionRotation))
        return;

    // save movement packets
    packets.add(packet);
    blinkTime += 50;
}
项目:CustomWorldGen    文件:EntityPlayerSP.java   
/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
    if (this.worldObj.isBlockLoaded(new BlockPos(this.posX, 0.0D, this.posZ)))
    {
        super.onUpdate();

        if (this.isRiding())
        {
            this.connection.sendPacket(new CPacketPlayer.Rotation(this.rotationYaw, this.rotationPitch, this.onGround));
            this.connection.sendPacket(new CPacketInput(this.moveStrafing, this.moveForward, this.movementInput.jump, this.movementInput.sneak));
            Entity entity = this.getLowestRidingEntity();

            if (entity != this && entity.canPassengerSteer())
            {
                this.connection.sendPacket(new CPacketVehicleMove(entity));
            }
        }
        else
        {
            this.onUpdateWalkingPlayer();
        }
    }
}
项目:CheataClientSrc    文件:WaterWalk.java   
@Override
public void onUpdate() {
    legit = Client.getValueManager().getValueByName("WaterWalkLegit").getValueBoolean();
    PacketUtils.sendPacket(new CPacketPlayer(true));
    if(legit){
        if(mc.thePlayer.isInWater()){
            mc.gameSettings.keyBindJump.pressed = true;
        }else{
            mc.gameSettings.keyBindJump.pressed = false;
        }
    }else{
        if(mc.theWorld.getBlockState(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 0.1, mc.thePlayer.posZ)).getBlock() == Blocks.water){
            mc.thePlayer.motionY = 0;
            mc.thePlayer.onGround = true;
        }
        if(mc.thePlayer.isInWater() || mc.thePlayer.isInLava()){
            mc.thePlayer.motionY = 0.1;
            mc.thePlayer.onGround = true;
        }
    }
}
项目:ExpandedRailsMod    文件:EntityPlayerSP.java   
/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
    if (this.worldObj.isBlockLoaded(new BlockPos(this.posX, 0.0D, this.posZ)))
    {
        super.onUpdate();

        if (this.isRiding())
        {
            this.connection.sendPacket(new CPacketPlayer.Rotation(this.rotationYaw, this.rotationPitch, this.onGround));
            this.connection.sendPacket(new CPacketInput(this.moveStrafing, this.moveForward, this.movementInput.jump, this.movementInput.sneak));
            Entity entity = this.getLowestRidingEntity();

            if (entity != this && entity.canPassengerSteer())
            {
                this.connection.sendPacket(new CPacketVehicleMove(entity));
            }
        }
        else
        {
            this.onUpdateWalkingPlayer();
        }
    }
}
项目: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    文件:SchematicaPrinterBypass.java   
@SubscribeEvent
public void onPrinterBlockPlace(SchematicaPlaceBlockEvent event) {
    Angle lookAngle = Utils.getLookAtAngles(event.getVec());
    getNetworkManager().sendPacket(new CPacketPlayer.Rotation((float)lookAngle.getYaw(), (float)lookAngle.getPitch(), getLocalPlayer().onGround));
    //getLocalPlayer().rotationYaw = getLocalPlayer().prevRotationYaw = (float)lookAngle.getYaw();
    //getLocalPlayer().rotationPitch = getLocalPlayer().prevRotationPitch = (float)lookAngle.getPitch();
    printMessage("Placed Block");
}
项目:ForgeHax    文件:Jesus.java   
@SubscribeEvent
public void onPacketSending(PacketEvent.Outgoing.Pre event) {
    if (event.getPacket() instanceof CPacketPlayer) {
        if (isAboveWater(getLocalPlayer(), true) && !isInWater(getLocalPlayer()) && !isAboveLand(getLocalPlayer())) {
            int ticks = getLocalPlayer().ticksExisted % 2;
            double y = FastReflection.Fields.CPacketPlayer_Y.get(event.getPacket());
            if (ticks == 0) FastReflection.Fields.CPacketPlayer_Y.set(event.getPacket(), y + 0.02D );
        }
    }

}
项目:ForgeHax    文件:AutoBucketFallMod.java   
@SubscribeEvent
public void onClientTick(TickEvent.ClientTickEvent event) {
    if (getLocalPlayer() == null
            || getLocalPlayer().fallDistance < settingFallHeight.getAsDouble()
            || !getLocalPlayer().inventory.hasItemStack(WATER_BUCKET)
            || isInWater(getLocalPlayer())
            || isAboveWater(getLocalPlayer())) return;

    Vec3d playerPos = getLocalPlayer().getPositionVector();
    Vec3d rayTraceBucket = new Vec3d(playerPos.x, playerPos.y-5, playerPos.z);
    Vec3d rayTracePre = new Vec3d(playerPos.x, playerPos.y-preHeight.getAsDouble(), playerPos.z); // find the ground before the player is ready to water bucket

    RayTraceResult result = MC.world.rayTraceBlocks(playerPos, rayTraceBucket, true);
    RayTraceResult resultPre = MC.world.rayTraceBlocks(playerPos, rayTracePre, true);

    if (resultPre != null && resultPre.typeOfHit.equals(Type.BLOCK) && !(getWorld().getBlockState(resultPre.getBlockPos()).getBlock() instanceof BlockLiquid)) { // set the pitch early to not get cucked by ncp
        getLocalPlayer().prevRotationPitch = 90f;
        getLocalPlayer().rotationPitch = 90f;

        int bucketSlot = findBucketHotbar();
        if (bucketSlot == -1) bucketSlot = findBucketInv();
        if (bucketSlot > 8) {
            swap(bucketSlot, getLocalPlayer().inventory.currentItem); // move bucket from inventory to hotbar
        }
        else {
            MC.player.inventory.currentItem = bucketSlot;
        }
    }

    if (result != null && result.typeOfHit.equals(Type.BLOCK) && !(getWorld().getBlockState(result.getBlockPos()).getBlock() instanceof BlockLiquid)) {
        getNetworkManager().sendPacket(new CPacketPlayer.Rotation(getLocalPlayer().rotationYaw, 90, getLocalPlayer().onGround)); // probably unnecessary but doing it anyways
        getLocalPlayer().prevRotationPitch = 90f;
        getLocalPlayer().rotationPitch = 90f;

        //printMessage("Attempted to place water bucket");
        MC.playerController.processRightClick(getLocalPlayer(), getWorld(), EnumHand.MAIN_HAND);
    }
}
项目:ForgeHax    文件:NoFallMod.java   
@SubscribeEvent
public void onPacketSend(PacketEvent.Outgoing.Pre event) {
    if(event.getPacket() instanceof CPacketPlayer && !(event.getPacket() instanceof CPacketPlayer.Rotation) &&
            !PacketHelper.isIgnored(event.getPacket())) {
        CPacketPlayer packetPlayer = (CPacketPlayer)event.getPacket();
        if(FastReflection.Fields.CPacketPlayer_onGround.get(packetPlayer) && lastFallDistance >= 4) {
            CPacketPlayer packet = new CPacketPlayer.PositionRotation(
                    ((CPacketPlayer) event.getPacket()).getX(0),
                    1337 + ((CPacketPlayer) event.getPacket()).getY(0),
                    ((CPacketPlayer) event.getPacket()).getZ(0),
                    ((CPacketPlayer) event.getPacket()).getYaw(0),
                    ((CPacketPlayer) event.getPacket()).getPitch(0),
                    true
            );
            CPacketPlayer reposition = new CPacketPlayer.PositionRotation(
                    ((CPacketPlayer) event.getPacket()).getX(0),
                    ((CPacketPlayer) event.getPacket()).getY(0),
                    ((CPacketPlayer) event.getPacket()).getZ(0),
                    ((CPacketPlayer) event.getPacket()).getYaw(0),
                    ((CPacketPlayer) event.getPacket()).getPitch(0),
                    true
            );
            PacketHelper.ignore(packet);
            PacketHelper.ignore(reposition);
            getNetworkManager().sendPacket(packet);
            getNetworkManager().sendPacket(reposition);
            lastFallDistance = 0;
        } else {
            lastFallDistance = getLocalPlayer().fallDistance;
        }
    }
}
项目:ForgeHax    文件:LocalPlayerUtils.java   
public static void sendRotatePacket(double pitch, double yaw) {
    if(lastAngle.getPitch() != pitch ||
            lastAngle.getYaw() != yaw) {
        FMLClientHandler.instance().getClientToServerNetworkManager().sendPacket(new CPacketPlayer.Rotation(
                (float)yaw,
                (float)pitch,
                MC.player.onGround
        ));
        lastAngle.setPitch(pitch);
        lastAngle.setYaw(yaw);
    }
}
项目:Wurst-MC-1.12    文件:DamageCmd.java   
@Override
public void call(String[] args) throws CmdException
{
    if(args.length == 0)
        throw new CmdSyntaxError();

    // check amount
    if(!MiscUtils.isInteger(args[0]))
        throw new CmdSyntaxError("Amount must be a number.");
    int dmg = Integer.parseInt(args[0]);
    if(dmg < 1)
        throw new CmdError("Amount must be at least 1.");
    if(dmg > 40)
        throw new CmdError("Amount must be at most 20.");

    // check gamemode
    if(WMinecraft.getPlayer().capabilities.isCreativeMode)
        throw new CmdError("Cannot damage in creative mode.");

    double posX = WMinecraft.getPlayer().posX;
    double posY = WMinecraft.getPlayer().posY;
    double posZ = WMinecraft.getPlayer().posZ;

    // apply damage
    for(int i = 0; i < 80 + 20 * (dmg - 1D); ++i)
    {
        WConnection.sendPacket(
            new CPacketPlayer.Position(posX, posY + 0.049D, posZ, false));
        WConnection.sendPacket(
            new CPacketPlayer.Position(posX, posY, posZ, false));
    }
    WConnection
        .sendPacket(new CPacketPlayer.Position(posX, posY, posZ, true));
}
项目:Wurst-MC-1.12    文件:FastBowMod.java   
@Override
public void onUpdate()
{
    // check if right-clicking
    if(!mc.gameSettings.keyBindUseItem.pressed)
        return;

    // check fly-kick
    if(!WMinecraft.getPlayer().onGround
        && !WMinecraft.getPlayer().capabilities.isCreativeMode)
        return;

    // check health
    if(WMinecraft.getPlayer().getHealth() <= 0)
        return;

    // check held item
    ItemStack stack = WMinecraft.getPlayer().inventory.getCurrentItem();
    if(WItem.isNull(stack) || !(stack.getItem() instanceof ItemBow))
        return;

    WPlayerController.processRightClick();

    for(int i = 0; i < 20; i++)
        WConnection.sendPacket(new CPacketPlayer(false));

    mc.playerController.onStoppedUsingItem(WMinecraft.getPlayer());
}
项目:Wurst-MC-1.12    文件:FastEatMod.java   
@Override
public void onUpdate()
{
    // check if alive
    if(WMinecraft.getPlayer().getHealth() <= 0)
        return;

    // check onGround
    if(!WMinecraft.getPlayer().onGround)
        return;

    // check if eating
    if(!mc.gameSettings.keyBindUseItem.pressed)
        return;

    // check hunger level
    if(!WMinecraft.getPlayer().getFoodStats().needFood())
        return;

    // check held item
    if(!InventoryUtils.checkHeldItem((item) -> item instanceof ItemFood))
        return;

    // send packets
    for(int i = 0; i < 100; i++)
        WConnection.sendPacket(new CPacketPlayer(false));
}
项目:Wurst-MC-1.12    文件:ForcePushMod.java   
@Override
public void onUpdate()
{
    if(WMinecraft.getPlayer().onGround
        && EntityUtils.getClosestEntity(targetSettings) != null)
        for(int i = 0; i < 1000; i++)
            WConnection.sendPacket(new CPacketPlayer(true));
}
项目:Wurst-MC-1.12    文件:CriticalsMod.java   
public void doCritical()
{
    if(!isActive())
        return;

    if(!WMinecraft.getPlayer().onGround)
        return;

    if(WMinecraft.getPlayer().isInWater()
        || WMinecraft.getPlayer().isInLava())
        return;

    switch(mode.getSelected())
    {
        case 0:
        WMinecraft.getPlayer().motionY = 0.1F;
        WMinecraft.getPlayer().fallDistance = 0.1F;
        WMinecraft.getPlayer().onGround = false;
        break;

        case 1:
        double posX = WMinecraft.getPlayer().posX;
        double posY = WMinecraft.getPlayer().posY;
        double posZ = WMinecraft.getPlayer().posZ;
        WConnection.sendPacket(
            new CPacketPlayer.Position(posX, posY + 0.0625D, posZ, true));
        WConnection.sendPacket(
            new CPacketPlayer.Position(posX, posY, posZ, false));
        WConnection.sendPacket(
            new CPacketPlayer.Position(posX, posY + 1.1E-5D, posZ, false));
        WConnection.sendPacket(
            new CPacketPlayer.Position(posX, posY, posZ, false));
        break;
    }
}
项目:Wurst-MC-1.12    文件:AutoLeaveMod.java   
@Override
public void onUpdate()
{
    // check gamemode
    if(WMinecraft.getPlayer().capabilities.isCreativeMode)
        return;

    // check for other players
    if(mc.isSingleplayer()
        || WMinecraft.getConnection().getPlayerInfoMap().size() == 1)
        return;

    // check health
    if(WMinecraft.getPlayer().getHealth() > health.getValueF() * 2F)
        return;

    // leave server
    switch(mode.getSelected())
    {
        case 0:
        WMinecraft.getWorld().sendQuittingDisconnectingPacket();
        break;

        case 1:
        WConnection.sendPacket(new CPacketChatMessage("�"));
        break;

        case 2:
        WConnection.sendPacket(
            new CPacketPlayer.Position(3.1e7, 100, 3.1e7, false));
        break;

        case 3:
        WPlayer.sendAttackPacket(WMinecraft.getPlayer());
        break;
    }

    // disable
    setEnabled(false);
}
项目:Wurst-MC-1.12    文件:HeadRollMod.java   
@Override
public void onUpdate()
{
    float timer = WMinecraft.getPlayer().ticksExisted % 20 / 10F;
    float pitch = WMath.sin(timer * (float)Math.PI) * 90F;

    WConnection.sendPacket(
        new CPacketPlayer.Rotation(WMinecraft.getPlayer().rotationYaw,
            pitch, WMinecraft.getPlayer().onGround));
}
项目:Wurst-MC-1.12    文件:DerpMod.java   
@Override
public void onUpdate()
{
    float yaw = WMinecraft.getPlayer().rotationYaw
        + random.nextFloat() * 360F - 180F;
    float pitch = random.nextFloat() * 180F - 90F;

    WConnection.sendPacket(new CPacketPlayer.Rotation(yaw, pitch,
        WMinecraft.getPlayer().onGround));
}
项目:Wurst-MC-1.12    文件:HeadlessMod.java   
@Override
public void onUpdate()
{
    WConnection.sendPacket(
        new CPacketPlayer.Rotation(WMinecraft.getPlayer().rotationYaw, 180F,
            WMinecraft.getPlayer().onGround));
}
项目:Wurst-MC-1.12    文件:TiredMod.java   
@Override
public void onUpdate()
{
    WConnection.sendPacket(
        new CPacketPlayer.Rotation(WMinecraft.getPlayer().rotationYaw,
            WMinecraft.getPlayer().ticksExisted % 100,
            WMinecraft.getPlayer().onGround));
}
项目:Wurst-MC-1.12    文件:RotationUtils.java   
public static void faceVectorPacketInstant(Vec3d vec)
{
    float[] rotations = getNeededRotations2(vec);

    WConnection.sendPacket(new CPacketPlayer.Rotation(rotations[0],
        rotations[1], WMinecraft.getPlayer().onGround));
}
项目:Zombe-Modpack    文件:EntityPlayerSP.java   
/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
    if (this.world.isBlockLoaded(new BlockPos(this.posX, 0.0D, this.posZ)))
    {
        //-ZMod-----------------------------------------------------------
        ZHandle.handle("onClientUpdate",this);
        //----------------------------------------------------------------
        super.onUpdate();

        if (this.isRiding())
        {
            this.connection.sendPacket(new CPacketPlayer.Rotation(this.rotationYaw, this.rotationPitch, this.onGround));
            this.connection.sendPacket(new CPacketInput(this.moveStrafing, this.moveForward, this.movementInput.jump, this.movementInput.sneak));
            Entity entity = this.getLowestRidingEntity();

            if (entity != this && entity.canPassengerSteer())
            {
                this.connection.sendPacket(new CPacketVehicleMove(entity));
            }
        }
        else
        {
            //-ZMod-------------------------------------------------------
            ZHandle.handle("beforeSendMotion", this);
            this.onUpdateWalkingPlayer();
            ZHandle.handle("afterSendMotion", this);
            //------------------------------------------------------------
        }
    }
}
项目:EMC    文件:EventPacketSend.java   
public IPacket getIPacket() {
    if (packet instanceof CPacketPlayer) {
        return new ICPacketPlayer(packet);
    } else if (packet instanceof CPacketPlayer.PositionRotation) {
        return new ICPacketPositionRotation(packet);
    } else if (packet instanceof CPacketPlayer.Rotation) {
        return new ICPacketRotation(packet);
    } else if (packet instanceof CPacketPlayer.Position) {
        return new ICPacketPosition(packet);
    } else if (packet instanceof CPacketCloseWindow) {
        return new ICPacketCloseWindow(packet);
    }
    return new IPacket(packet);
}
项目:Backmemed    文件:NoFall.java   
@Override
public void onUpdate(EntityPlayerSP player) {
    if(isEnabled()) {
        if (player.fallDistance > 1) {
            player.connection.sendPacket(new CPacketPlayer(true));
        }
    }
}
项目:Backmemed    文件:Jesus.java   
@Override
public Packet<?> onPacketSend(Packet<?> packet) {
    if (isEnabled() && packet instanceof CPacketPlayer) {
        if (isAboveWater(Wrapper.getPlayer()) && !isInWater(Wrapper.getPlayer()) && !isAboveLand(Wrapper.getPlayer())) {
            int ticks = Wrapper.getPlayer().ticksExisted % 2;

            if (ticks == 0) ((CPacketPlayer) packet).y += 0.02;
        }
    }
    return packet;
}
项目:Backmemed    文件:Criticals.java   
public static void doCrit() {
    if(!Wrapper.getPlayer().isInWater() && !Wrapper.getPlayer().isInsideOfMaterial(Material.LAVA) && Wrapper.getPlayer().onGround) {
        double posX = Wrapper.getPlayer().posX;
        double posY = Wrapper.getPlayer().posY;
        double posZ = Wrapper.getPlayer().posZ;

        Wrapper.getPlayer().connection.sendPacket(new CPacketPlayer.Position(posX, posY + 0.0625D, posZ, true));
        Wrapper.getPlayer().connection.sendPacket(new CPacketPlayer.Position(posX, posY, posZ, false));
        Wrapper.getPlayer().connection.sendPacket(new CPacketPlayer.Position(posX, posY + 1.1E-5D, posZ, false));
        Wrapper.getPlayer().connection.sendPacket(new CPacketPlayer.Position(posX, posY, posZ, false));
    }
}
项目:CheataClientSrc    文件:NerdPole.java   
@Override
public void onUpdate() {
    fast = Client.getValueManager().getValueByName("NerdPoleFast").getValueBoolean();
    if(mc.inGameHasFocus){
        if(!isHeldItem(Blocks.ladder) && 
                !isHeldItem(Blocks.vine)){
            mc.thePlayer.sendQueue.addToSendQueue(new CPacketPlayer(true));
            mc.thePlayer.setAngles(mc.thePlayer.cameraYaw, -90);
            if(fast){
                mc.rightClickDelayTimer = 0;
                mc.thePlayer.jump();
                if(isInteractable()){
                    KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), true);
                }
                KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.getKeyCode(), true);
                KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), false);
            }else if(mc.thePlayer.onGround){
                if(!Client.getModManager().getMod(FastPlace.class).isEnabled()){
                    mc.rightClickDelayTimer = 4;
                }
                mc.thePlayer.jump();
                if(isInteractable()){
                    KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), true);
                }
                KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.getKeyCode(), true);
                KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), false);
            }
        }
    }
}
项目:CheataClientSrc    文件:Flight.java   
@Override
public void onUpdate() {
    flySpeed = Client.getValueManager().getValueByName("FlightSpeed").getValueDouble();
    mc.thePlayer.sendQueue.addToSendQueue(new CPacketPlayer(true));
    mc.thePlayer.motionY = 0;
    mc.thePlayer.isAirBorne = false;
    if(mc.gameSettings.keyBindJump.isKeyDown()){
        mc.thePlayer.motionY += (flySpeed / 25);
    }
    if(mc.gameSettings.keyBindSneak.isKeyDown()){
        mc.thePlayer.motionY -= (flySpeed / 25);
    }
    mc.thePlayer.capabilities.setFlySpeed((float) (flySpeed/75));
    mc.thePlayer.jumpMovementFactor = ((float) (flySpeed/75));
}
项目:CheataClientSrc    文件:AntiFire.java   
@Override
public void onUpdate() {
    if(!mc.thePlayer.capabilities.isCreativeMode){
        if(mc.thePlayer.isBurning() && mc.thePlayer.onGround){
            PacketUtils.sendPacket(new CPacketPlayer());
        }
    }
}
项目:morecommands    文件:PatchNetHandlerPlayServer.java   
@Override
public void processPlayer(CPacketPlayer packet) {
    PacketThreadUtil.checkThreadAndEnqueue(packet, this, this.player.getServerWorld());

    if (this.enabled && this.overrideNoclip) {
        handleNoclip(packet);
    } else {
        super.processPlayer(packet);
    }
}
项目:ClientAPI    文件:MixinEntityPlayerSP.java   
/**
 * @reason In addition to firing pre and post events, we also want to override some position values (prefixed with p).
 * @author Brady
 */
@Overwrite
private void onUpdateWalkingPlayer() {
    EntityPlayerSP _this = (EntityPlayerSP) (Object) this;

    MotionUpdateEvent pre = new MotionUpdateEvent(EventState.PRE);
    ClientAPI.EVENT_BUS.post(pre);

    boolean clientSprintState = this.isSprinting();
    if (clientSprintState != this.serverSprintState) {
        this.connection.sendPacket(new CPacketEntityAction(_this, clientSprintState ? CPacketEntityAction.Action.START_SPRINTING : CPacketEntityAction.Action.STOP_SPRINTING));
        this.serverSprintState = clientSprintState;
    }

    boolean clientSneakState = this.isSneaking();
    if (clientSneakState != this.serverSneakState) {
        this.connection.sendPacket(new CPacketEntityAction(_this, clientSneakState ? CPacketEntityAction.Action.START_SNEAKING : CPacketEntityAction.Action.STOP_SNEAKING));
        this.serverSneakState = clientSneakState;
    }

    if (this.isCurrentViewEntity()) {

        // Override vanilla defaults of this.posX, this.posY, etc.
        // This is why we need to overwrite the method body.
        double pX = pre.getX();
        double pY = pre.getY();
        double pZ = pre.getZ();
        float pYaw = pre.getYaw();
        float pPitch = pre.getPitch();
        boolean pGround = pre.isOnGround();

        double d0 = pX - this.lastReportedPosX;
        double d1 = pY - this.lastReportedPosY;
        double d2 = pZ - this.lastReportedPosZ;
        double d3 = pYaw - this.lastReportedYaw;
        double d4 = pPitch - this.lastReportedPitch;

        boolean position = d0 * d0 + d1 * d1 + d2 * d2 > 9.0E-4D || ++this.positionUpdateTicks >= 20;
        boolean rotation = d3 != 0.0D || d4 != 0.0D;

        if (this.isRiding()) {
            this.connection.sendPacket(new CPacketPlayer.PositionRotation(this.motionX, -999.0D, this.motionZ, this.rotationYaw, this.rotationPitch, this.onGround));
            position = false;
        } else if (position && rotation) {
            this.connection.sendPacket(new CPacketPlayer.PositionRotation(pX, pY, pZ, pYaw, pPitch, pGround));
        } else if (position) {
            this.connection.sendPacket(new CPacketPlayer.Position(pX, pY, pZ, pGround));
        } else if (rotation) {
            this.connection.sendPacket(new CPacketPlayer.Rotation(pYaw, pPitch, pGround));
        } else if (this.prevOnGround != pGround) {
            this.connection.sendPacket(new CPacketPlayer(pGround));
        }

        if (position) {
            this.lastReportedPosX = pX;
            this.lastReportedPosY = pY;
            this.lastReportedPosZ = pZ;
            this.positionUpdateTicks = 0;
        }

        if (rotation) {
            this.lastReportedYaw = pYaw;
            this.lastReportedPitch = pPitch;
        }

        this.prevOnGround = pGround;
        this.autoJumpEnabled = this.mc.gameSettings.autoJump;
    }

    ClientAPI.EVENT_BUS.post(new MotionUpdateEvent(EventState.POST));
}
项目:ForgeHax    文件:FreecamMod.java   
@SubscribeEvent
public void onPacketSend(PacketEvent.Outgoing.Pre event) {
    if(event.getPacket() instanceof CPacketPlayer || event.getPacket() instanceof CPacketInput) {
        event.setCanceled(true);
    }
}
项目:Wurst-MC-1.12    文件:AutoSplashPotMod.java   
@Override
public void onUpdate()
{
    // search potion in hotbar
    int potionInHotbar = findPotion(0, 9);

    // check if any potion was found
    if(potionInHotbar != -1)
    {
        // check timer
        if(timer > 0)
        {
            timer--;
            return;
        }

        // check health
        if(WMinecraft.getPlayer().getHealth() > health.getValueF() * 2F)
            return;

        // check screen
        if(!ignoreScreen.isChecked() && mc.currentScreen != null)
            return;

        // save old slot
        int oldSlot = WMinecraft.getPlayer().inventory.currentItem;

        // throw potion in hotbar
        WMinecraft.getPlayer().inventory.currentItem = potionInHotbar;
        WConnection.sendPacket(
            new CPacketPlayer.Rotation(WMinecraft.getPlayer().rotationYaw,
                90.0F, WMinecraft.getPlayer().onGround));
        WPlayerController.processRightClick();

        // reset slot and rotation
        WMinecraft.getPlayer().inventory.currentItem = oldSlot;
        WConnection.sendPacket(
            new CPacketPlayer.Rotation(WMinecraft.getPlayer().rotationYaw,
                WMinecraft.getPlayer().rotationPitch,
                WMinecraft.getPlayer().onGround));

        // reset timer
        timer = 10;

        return;
    }

    // search potion in inventory
    int potionInInventory = findPotion(9, 36);

    // move potion in inventory to hotbar
    if(potionInInventory != -1)
        WPlayerController.windowClick_QUICK_MOVE(potionInInventory);
}
项目:Wurst-MC-1.12    文件:JesusMod.java   
@Override
public void onSentPacket(PacketOutputEvent event)
{
    // check packet type
    if(!(event.getPacket() instanceof CPacketPlayer))
        return;

    CPacketPlayer packet = (CPacketPlayer)event.getPacket();

    // check if packet contains a position
    if(!(packet instanceof CPacketPlayer.Position
        || packet instanceof CPacketPlayer.PositionRotation))
        return;

    // check inWater
    if(WMinecraft.getPlayer().isInWater())
        return;

    // check fall distance
    if(WMinecraft.getPlayer().fallDistance > 3F)
        return;

    if(!isOverLiquid())
        return;

    // if not actually moving, cancel packet
    if(WMinecraft.getPlayer().movementInput == null)
    {
        event.cancel();
        return;
    }

    // wait for timer
    packetTimer++;
    if(packetTimer < 4)
        return;

    // cancel old packet
    event.cancel();

    // get position
    double x = packet.getX(0);
    double y = packet.getY(0);
    double z = packet.getZ(0);

    // offset y
    if(WMinecraft.getPlayer().ticksExisted % 2 == 0)
        y -= 0.05;
    else
        y += 0.05;

    // create new packet
    Packet newPacket;
    if(packet instanceof CPacketPlayer.Position)
        newPacket = new CPacketPlayer.Position(x, y, z, true);
    else
        newPacket = new CPacketPlayer.PositionRotation(x, y, z,
            packet.getYaw(0), packet.getPitch(0), true);

    // send new packet
    WConnection.sendPacketBypass(newPacket);
}