Search in sources :

Example 6 with CPacketEntityAction

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

the class SneakMod method onUpdate.

@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;
    }
}
Also used : CPacketEntityAction(net.minecraft.network.play.client.CPacketEntityAction)

Example 7 with CPacketEntityAction

use of net.minecraft.network.play.client.CPacketEntityAction in project ChatTweaks by blay09.

the class GuiSleepMPExt method wakeFromSleep.

private void wakeFromSleep() {
    EntityPlayerSP player = FMLClientHandler.instance().getClientPlayerEntity();
    NetHandlerPlayClient netHandler = player.connection;
    netHandler.sendPacket(new CPacketEntityAction(player, CPacketEntityAction.Action.STOP_SLEEPING));
    Minecraft.getMinecraft().displayGuiScreen(null);
}
Also used : CPacketEntityAction(net.minecraft.network.play.client.CPacketEntityAction) NetHandlerPlayClient(net.minecraft.client.network.NetHandlerPlayClient) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP)

Example 8 with CPacketEntityAction

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

the class SneakMod method onDisable.

@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;
    }
}
Also used : CPacketEntityAction(net.minecraft.network.play.client.CPacketEntityAction)

Example 9 with CPacketEntityAction

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

the class ExtraElytraMod method onUpdate.

@Override
public void onUpdate() {
    updateMS();
    ItemStack chest = WMinecraft.getPlayer().getItemStackFromSlot(EntityEquipmentSlot.CHEST);
    if (chest == null || chest.getItem() != Items.ELYTRA)
        return;
    if (WMinecraft.getPlayer().isElytraFlying()) {
        if (stopInWater.isChecked() && WMinecraft.getPlayer().isInWater()) {
            WConnection.sendPacket(new CPacketEntityAction(WMinecraft.getPlayer(), CPacketEntityAction.Action.START_FALL_FLYING));
            return;
        }
        if (easyFly.isChecked()) {
            if (mc.gameSettings.keyBindJump.pressed)
                WMinecraft.getPlayer().motionY += 0.08;
            else if (mc.gameSettings.keyBindSneak.pressed)
                WMinecraft.getPlayer().motionY -= 0.04;
            if (mc.gameSettings.keyBindForward.pressed && WMinecraft.getPlayer().getPosition().getY() < 256) {
                float yaw = (float) Math.toRadians(WMinecraft.getPlayer().rotationYaw);
                WMinecraft.getPlayer().motionX -= WMath.sin(yaw) * 0.05F;
                WMinecraft.getPlayer().motionZ += WMath.cos(yaw) * 0.05F;
            } else if (mc.gameSettings.keyBindBack.pressed && WMinecraft.getPlayer().getPosition().getY() < 256) {
                float yaw = (float) Math.toRadians(WMinecraft.getPlayer().rotationYaw);
                WMinecraft.getPlayer().motionX += WMath.sin(yaw) * 0.05F;
                WMinecraft.getPlayer().motionZ -= WMath.cos(yaw) * 0.05F;
            }
        }
    } else if (instantFly.isChecked() && ItemElytra.isBroken(chest) && mc.gameSettings.keyBindJump.pressed) {
        if (hasTimePassedM(1000)) {
            updateLastMS();
            WMinecraft.getPlayer().setJumping(false);
            WMinecraft.getPlayer().setSprinting(true);
            WMinecraft.getPlayer().jump();
        }
        WConnection.sendPacket(new CPacketEntityAction(WMinecraft.getPlayer(), CPacketEntityAction.Action.START_FALL_FLYING));
    }
}
Also used : CPacketEntityAction(net.minecraft.network.play.client.CPacketEntityAction) ItemStack(net.minecraft.item.ItemStack)

Example 10 with CPacketEntityAction

use of net.minecraft.network.play.client.CPacketEntityAction in project Wurst-MC-1.11 by Wurst-Imperium.

the class ExtraElytraMod method onUpdate.

@Override
public void onUpdate() {
    updateMS();
    ItemStack chest = WMinecraft.getPlayer().getItemStackFromSlot(EntityEquipmentSlot.CHEST);
    if (chest == null || chest.getItem() != Items.ELYTRA)
        return;
    if (WMinecraft.getPlayer().isElytraFlying()) {
        if (stopInWater.isChecked() && WMinecraft.getPlayer().isInWater()) {
            WConnection.sendPacket(new CPacketEntityAction(WMinecraft.getPlayer(), CPacketEntityAction.Action.START_FALL_FLYING));
            return;
        }
        if (easyFly.isChecked()) {
            if (mc.gameSettings.keyBindJump.pressed)
                WMinecraft.getPlayer().motionY += 0.08;
            else if (mc.gameSettings.keyBindSneak.pressed)
                WMinecraft.getPlayer().motionY -= 0.04;
            if (mc.gameSettings.keyBindForward.pressed && WMinecraft.getPlayer().getPosition().getY() < 256) {
                float yaw = (float) Math.toRadians(WMinecraft.getPlayer().rotationYaw);
                WMinecraft.getPlayer().motionX -= WMath.sin(yaw) * 0.05F;
                WMinecraft.getPlayer().motionZ += WMath.cos(yaw) * 0.05F;
            } else if (mc.gameSettings.keyBindBack.pressed && WMinecraft.getPlayer().getPosition().getY() < 256) {
                float yaw = (float) Math.toRadians(WMinecraft.getPlayer().rotationYaw);
                WMinecraft.getPlayer().motionX += WMath.sin(yaw) * 0.05F;
                WMinecraft.getPlayer().motionZ -= WMath.cos(yaw) * 0.05F;
            }
        }
    } else if (instantFly.isChecked() && ItemElytra.isBroken(chest) && mc.gameSettings.keyBindJump.pressed) {
        if (hasTimePassedM(1000)) {
            updateLastMS();
            WMinecraft.getPlayer().setJumping(false);
            WMinecraft.getPlayer().setSprinting(true);
            WMinecraft.getPlayer().jump();
        }
        WConnection.sendPacket(new CPacketEntityAction(WMinecraft.getPlayer(), CPacketEntityAction.Action.START_FALL_FLYING));
    }
}
Also used : CPacketEntityAction(net.minecraft.network.play.client.CPacketEntityAction) ItemStack(net.minecraft.item.ItemStack)

Aggregations

CPacketEntityAction (net.minecraft.network.play.client.CPacketEntityAction)10 ItemStack (net.minecraft.item.ItemStack)5 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)1 NetHandlerPlayClient (net.minecraft.client.network.NetHandlerPlayClient)1 CPacketClickWindow (net.minecraft.network.play.client.CPacketClickWindow)1 CPacketClientStatus (net.minecraft.network.play.client.CPacketClientStatus)1 CPacketPlayer (net.minecraft.network.play.client.CPacketPlayer)1 CPacketPlayerDigging (net.minecraft.network.play.client.CPacketPlayerDigging)1 CPacketPlayerTryUseItemOnBlock (net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock)1 CPacketUseEntity (net.minecraft.network.play.client.CPacketUseEntity)1 MinecraftServer (net.minecraft.server.MinecraftServer)1 EnumFacing (net.minecraft.util.EnumFacing)1 BlockPos (net.minecraft.util.math.BlockPos)1