Search in sources :

Example 6 with CPacketPlayer

use of net.minecraft.network.play.client.CPacketPlayer in project Wurst-MC-1.12 by Wurst-Imperium.

the class FastBowMod method onUpdate.

@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.isNullOrEmpty(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());
}
Also used : CPacketPlayer(net.minecraft.network.play.client.CPacketPlayer) ItemStack(net.minecraft.item.ItemStack) ItemBow(net.minecraft.item.ItemBow)

Example 7 with CPacketPlayer

use of net.minecraft.network.play.client.CPacketPlayer in project Wurst-MC-1.12 by Wurst-Imperium.

the class FlightMod method onUpdate.

@Override
public void onUpdate() {
    switch(mode.getSelected()) {
        case 0:
            // Normal
            WMinecraft.getPlayer().capabilities.isFlying = false;
            WMinecraft.getPlayer().motionX = 0;
            WMinecraft.getPlayer().motionY = 0;
            WMinecraft.getPlayer().motionZ = 0;
            WMinecraft.getPlayer().jumpMovementFactor = speed.getValueF();
            if (mc.gameSettings.keyBindJump.pressed)
                WMinecraft.getPlayer().motionY += speed.getValue();
            if (mc.gameSettings.keyBindSneak.pressed)
                WMinecraft.getPlayer().motionY -= speed.getValue();
            if (flightKickBypass != null && flightKickBypass.isChecked()) {
                updateMS();
                updateFlyHeight();
                WConnection.sendPacket(new CPacketPlayer(true));
                if (flyHeight <= 290 && hasTimePassedM(500) || flyHeight > 290 && hasTimePassedM(100)) {
                    goToGround();
                    updateLastMS();
                }
            }
            break;
        case 1:
            // Mineplex
            updateMS();
            if (!WMinecraft.getPlayer().onGround)
                if (mc.gameSettings.keyBindJump.pressed && hasTimePassedS(2)) {
                    WMinecraft.getPlayer().setPosition(WMinecraft.getPlayer().posX, WMinecraft.getPlayer().posY + 8, WMinecraft.getPlayer().posZ);
                    updateLastMS();
                } else if (mc.gameSettings.keyBindSneak.pressed)
                    WMinecraft.getPlayer().motionY = -0.4;
                else
                    WMinecraft.getPlayer().motionY = -0.02;
            WMinecraft.getPlayer().jumpMovementFactor = 0.04F;
            break;
        case 2:
            // Old NCP
            if (!WMinecraft.getPlayer().onGround)
                if (mc.gameSettings.keyBindJump.pressed && WMinecraft.getPlayer().posY < startY - 1)
                    WMinecraft.getPlayer().motionY = 0.2;
                else
                    WMinecraft.getPlayer().motionY = -0.02;
            break;
    }
}
Also used : CPacketPlayer(net.minecraft.network.play.client.CPacketPlayer)

Aggregations

CPacketPlayer (net.minecraft.network.play.client.CPacketPlayer)7 IMixinEntityPlayerMP (org.spongepowered.common.interfaces.entity.player.IMixinEntityPlayerMP)2 Vector3d (com.flowpowered.math.vector.Vector3d)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1 ItemBow (net.minecraft.item.ItemBow)1 ItemStack (net.minecraft.item.ItemStack)1 NetHandlerPlayServer (net.minecraft.network.NetHandlerPlayServer)1 Packet (net.minecraft.network.Packet)1 CPacketClientSettings (net.minecraft.network.play.client.CPacketClientSettings)1 CPacketClientStatus (net.minecraft.network.play.client.CPacketClientStatus)1 Player (org.spongepowered.api.entity.living.player.Player)1 CauseStackManager (org.spongepowered.api.event.CauseStackManager)1 MoveEntityEvent (org.spongepowered.api.event.entity.MoveEntityEvent)1 ItemStackSnapshot (org.spongepowered.api.item.inventory.ItemStackSnapshot)1 Location (org.spongepowered.api.world.Location)1 World (org.spongepowered.api.world.World)1 Redirect (org.spongepowered.asm.mixin.injection.Redirect)1 PhaseTracker (org.spongepowered.common.event.tracking.PhaseTracker)1 IMixinEntityPlayer (org.spongepowered.common.interfaces.entity.player.IMixinEntityPlayer)1