@Override public void monitorIncoming( INetHandler net, net.minecraft.network.Packet packet ) { if ( !( net instanceof NetHandlerPlayServer ) || !( packet instanceof C0BPacketEntityAction ) ) { return; } NetHandlerPlayServer server = ( NetHandlerPlayServer ) net; C0BPacketEntityAction action = ( C0BPacketEntityAction ) packet; if ( action.func_149513_d() != 6 || !( server.playerEntity.ridingEntity instanceof PetEntity ) ) { return; } PetEntity pet = ( PetEntity ) server.playerEntity.ridingEntity; pet.setJumpingState( action.func_149512_e() ); }
@EventTarget private void onPreUpdate(UpdateEvent event) { if (event.state == Event.State.PRE) { if (this.mc.thePlayer.isSneaking() || this.mc.thePlayer.movementInput.moveForward == 0.0f && this.mc.thePlayer.movementInput.moveStrafe == 0.0f) { return; } this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C0BPacketEntityAction((Entity)this.mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING)); } else if (event.state == Event.State.POST) { this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C0BPacketEntityAction((Entity)this.mc.thePlayer, C0BPacketEntityAction.Action.START_SNEAKING)); } }
@EventTarget private void onPacketSend(PacketSendEvent event) { if (event.packet instanceof C0BPacketEntityAction || event.packet instanceof C03PacketPlayer || event.packet instanceof C02PacketUseEntity || event.packet instanceof C0APacketAnimation || event.packet instanceof C08PacketPlayerBlockPlacement) { this.packetList.add(event.packet); event.setCancelled(true); } }
@EventTarget private void onPacketSend(PacketSendEvent event) { C0BPacketEntityAction packet; if (this.fake && event.packet instanceof C0BPacketEntityAction && ((packet = (C0BPacketEntityAction)event.packet).getAction() == C0BPacketEntityAction.Action.START_SPRINTING || packet.getAction() == C0BPacketEntityAction.Action.STOP_SPRINTING)) { event.setCancelled(true); } }
@Override protected void onDisable() { if (!Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode())) { KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), false); if (this.sneaking) { mc.thePlayer.sendQueue.addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING)); this.sneaking = false; } } this.sneaking = false; }
public static void damage(int hearts) { mc.getNetHandler().getNetworkManager().sendPacket(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SPRINTING)); double[] d = {0.2D, 0.26D}; for (int a = 0; a < hearts; a++) { for (int i = 0; i < d.length; i++) { addPlayerOffsetPacket(0, d[i], 0, false); } } mc.getNetHandler().getNetworkManager().sendPacket(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING)); }
@Override public void onUpdate() { if (WurstClient.INSTANCE.mods.getModByClass(YesCheatMod.class).isActive()) { NetHandlerPlayClient sendQueue = Minecraft.getMinecraft().thePlayer.sendQueue; sendQueue.addToSendQueue( new C0BPacketEntityAction(Minecraft.getMinecraft().thePlayer, Action.START_SNEAKING)); sendQueue.addToSendQueue( new C0BPacketEntityAction(Minecraft.getMinecraft().thePlayer, Action.STOP_SNEAKING)); } else { Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue( new C0BPacketEntityAction(Minecraft.getMinecraft().thePlayer, Action.START_SNEAKING)); } }
@Override public void onDisable() { WurstClient.INSTANCE.events.remove(UpdateListener.class, this); Minecraft.getMinecraft().gameSettings.keyBindSneak.pressed = false; Minecraft.getMinecraft().thePlayer.sendQueue .addToSendQueue(new C0BPacketEntityAction(Minecraft.getMinecraft().thePlayer, Action.STOP_SNEAKING)); }
/** * Processes a range of action-types: sneaking, sprinting, waking from sleep, opening the inventory or setting jump * height of the horse the player is riding */ public void processEntityAction(C0BPacketEntityAction p_147357_1_) { this.playerEntity.func_143004_u(); if (p_147357_1_.func_149513_d() == 1) { this.playerEntity.setSneaking(true); } else if (p_147357_1_.func_149513_d() == 2) { this.playerEntity.setSneaking(false); } else if (p_147357_1_.func_149513_d() == 4) { this.playerEntity.setSprinting(true); } else if (p_147357_1_.func_149513_d() == 5) { this.playerEntity.setSprinting(false); } else if (p_147357_1_.func_149513_d() == 3) { this.playerEntity.wakeUpPlayer(false, true, true); this.hasMoved = false; } else if (p_147357_1_.func_149513_d() == 6) { if (this.playerEntity.ridingEntity != null && this.playerEntity.ridingEntity instanceof EntityHorse) { ((EntityHorse)this.playerEntity.ridingEntity).setJumpPower(p_147357_1_.func_149512_e()); } } else if (p_147357_1_.func_149513_d() == 7 && this.playerEntity.ridingEntity != null && this.playerEntity.ridingEntity instanceof EntityHorse) { ((EntityHorse)this.playerEntity.ridingEntity).openGUI(this.playerEntity); } }
public void processEntityAction(C0BPacketEntityAction p_147357_1_) { this.playerEntity.func_143004_u(); if (p_147357_1_.func_149513_d() == 1) { this.playerEntity.setSneaking(true); } else if (p_147357_1_.func_149513_d() == 2) { this.playerEntity.setSneaking(false); } else if (p_147357_1_.func_149513_d() == 4) { this.playerEntity.setSprinting(true); } else if (p_147357_1_.func_149513_d() == 5) { this.playerEntity.setSprinting(false); } else if (p_147357_1_.func_149513_d() == 3) { this.playerEntity.wakeUpPlayer(false, true, true); this.hasMoved = false; } else if (p_147357_1_.func_149513_d() == 6) { if (this.playerEntity.ridingEntity != null && this.playerEntity.ridingEntity instanceof EntityHorse) { ((EntityHorse)this.playerEntity.ridingEntity).setJumpPower(p_147357_1_.func_149512_e()); } } else if (p_147357_1_.func_149513_d() == 7 && this.playerEntity.ridingEntity != null && this.playerEntity.ridingEntity instanceof EntityHorse) { ((EntityHorse)this.playerEntity.ridingEntity).openGUI(this.playerEntity); } }
/** * Processes a range of action-types: sneaking, sprinting, waking from sleep, opening the inventory or setting jump * height of the horse the player is riding */ public void processEntityAction(C0BPacketEntityAction packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); this.playerEntity.markPlayerActive(); switch (packetIn.getAction()) { case START_SNEAKING: this.playerEntity.setSneaking(true); break; case STOP_SNEAKING: this.playerEntity.setSneaking(false); break; case START_SPRINTING: this.playerEntity.setSprinting(true); break; case STOP_SPRINTING: this.playerEntity.setSprinting(false); break; case STOP_SLEEPING: this.playerEntity.wakeUpPlayer(false, true, true); this.hasMoved = false; break; case RIDING_JUMP: if (this.playerEntity.ridingEntity instanceof EntityHorse) { ((EntityHorse)this.playerEntity.ridingEntity).setJumpPower(packetIn.getAuxData()); } break; case OPEN_INVENTORY: if (this.playerEntity.ridingEntity instanceof EntityHorse) { ((EntityHorse)this.playerEntity.ridingEntity).openGUI(this.playerEntity); } break; default: throw new IllegalArgumentException("Invalid client command!"); } }
protected void sendHorseJump() { this.sendQueue.addToSendQueue(new C0BPacketEntityAction(this, C0BPacketEntityAction.Action.RIDING_JUMP, (int)(this.getHorseJumpPower() * 100.0F))); }
public void sendHorseInventory() { this.sendQueue.addToSendQueue(new C0BPacketEntityAction(this, C0BPacketEntityAction.Action.OPEN_INVENTORY)); }
private void wakeFromSleep() { NetHandlerPlayClient nethandlerplayclient = this.mc.thePlayer.sendQueue; nethandlerplayclient.addToSendQueue(new C0BPacketEntityAction(this.mc.thePlayer, C0BPacketEntityAction.Action.STOP_SLEEPING)); }
@Override public void onDisable() { this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C0BPacketEntityAction((Entity)this.mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING)); super.onDisable(); }
protected void sendHorseJump() { this.sendQueue.addToSendQueue(new C0BPacketEntityAction(this, C0BPacketEntityAction.Action.RIDING_JUMP, (int) (this.getHorseJumpPower() * 100.0F))); }
protected void func_110318_g() { this.sendQueue.addToSendQueue(new C0BPacketEntityAction(this, 6, (int)(this.getHorseJumpPower() * 100.0F))); }
public void func_110322_i() { this.sendQueue.addToSendQueue(new C0BPacketEntityAction(this, 7)); }
private void func_146418_g() { NetHandlerPlayClient var1 = this.mc.thePlayer.sendQueue; var1.addToSendQueue(new C0BPacketEntityAction(this.mc.thePlayer, 3)); }
@SubscribeEvent public void tick( TickEvent.ClientTickEvent event ) { /* if ( !type.contains( TickType.CLIENT ) ) { return; } //*/ Minecraft mc = Minecraft.getMinecraft(); EntityPlayerSP player = mc.thePlayer; if ( player == null || player.movementInput == null ) { return; } // Lazy hack - hope this makes it work outside MCP try { // TODO SEVERE FIXME BUG ETC. // Check each update to make sure it works :P Class c = EntityPlayerSP.class; for ( int i = 0; i < c.getDeclaredFields().length; ++i ) { c.getDeclaredFields()[ i ].setAccessible( true ); } for ( int i = 0; i < c.getDeclaredMethods().length; ++i ) { c.getDeclaredMethods()[ i ].setAccessible( true ); } } catch ( Exception exception ) { exception.printStackTrace(); } // Copied from EntityPlayerSP.onLivingUpdate boolean flag = player.movementInput.jump; if ( player.ridingEntity instanceof PetEntity ) { if (jumpPowerCounter < 0) { ++jumpPowerCounter; if (jumpPowerCounter == 0) { jumpPower = 0.0F; } } if (prevJump && !player.movementInput.jump) { jumpPowerCounter = -10; // Originally func_110318_g ( ( EntityClientPlayerMP ) player ).sendQueue.addToSendQueue(new C0BPacketEntityAction(player, 6, (int)(jumpPower * 100.0F))); } else if (!prevJump && player.movementInput.jump) { jumpPowerCounter = 0; jumpPower = 0.0F; } else if (prevJump) { ++jumpPowerCounter; if (jumpPowerCounter < 10) { jumpPower = (float)jumpPowerCounter * 0.1F; } else { jumpPower = 0.8F + 2.0F / (float)(jumpPowerCounter - 9) * 0.1F; } } } prevJump = player.movementInput.jump; }
@Override public void processEntityAction(C0BPacketEntityAction p_147357_1_) { }
private void func_146418_g() { NetHandlerPlayClient nethandlerplayclient = this.mc.thePlayer.sendQueue; nethandlerplayclient.addToSendQueue(new C0BPacketEntityAction(this.mc.thePlayer, 3)); }
/** * Processes a range of action-types: sneaking, sprinting, waking from sleep, opening the inventory or setting jump * height of the horse the player is riding */ void processEntityAction(C0BPacketEntityAction packetIn);
/** * Processes a range of action-types: sneaking, sprinting, waking from sleep, opening the inventory or setting jump * height of the horse the player is riding */ void processEntityAction(C0BPacketEntityAction var1);