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;
}
}
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);
}
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;
}
}
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));
}
}
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));
}
}
Aggregations