net.minecraft.network.play.client.CPacketPlayer Java Examples
The following examples show how to use
net.minecraft.network.play.client.CPacketPlayer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PhaseModule.java From seppuku with GNU General Public License v3.0 | 6 votes |
@Listener public void onWalkingUpdate(EventUpdateWalkingPlayer event) { if (event.getStage() == EventStageable.EventStage.PRE) { final Minecraft mc = Minecraft.getMinecraft(); if (this.mode.getValue() == Mode.NOCLIP) { mc.player.setVelocity(0, 0, 0); if (mc.gameSettings.keyBindForward.isKeyDown() || mc.gameSettings.keyBindBack.isKeyDown() || mc.gameSettings.keyBindLeft.isKeyDown() || mc.gameSettings.keyBindRight.isKeyDown()) { final double[] speed = MathUtil.directionSpeed(0.06f); mc.player.connection.sendPacket(new CPacketPlayer.Position(mc.player.posX + speed[0], mc.player.posY, mc.player.posZ + speed[1], mc.player.onGround)); mc.player.connection.sendPacket(new CPacketPlayer.Position(mc.player.posX, 0, mc.player.posZ, mc.player.onGround)); } if (mc.gameSettings.keyBindSneak.isKeyDown()) { mc.player.connection.sendPacket(new CPacketPlayer.Position(mc.player.posX, mc.player.posY - 0.06f, mc.player.posZ, mc.player.onGround)); mc.player.connection.sendPacket(new CPacketPlayer.Position(mc.player.posX, 0, mc.player.posZ, mc.player.onGround)); } if (mc.gameSettings.keyBindJump.isKeyDown()) { mc.player.connection.sendPacket(new CPacketPlayer.Position(mc.player.posX, mc.player.posY + 0.06f, mc.player.posZ, mc.player.onGround)); mc.player.connection.sendPacket(new CPacketPlayer.Position(mc.player.posX, 0, mc.player.posZ, mc.player.onGround)); } } } }
Example #2
Source File: CriticalsModule.java From seppuku with GNU General Public License v3.0 | 6 votes |
@Listener public void sendPacket(EventSendPacket event) { if (event.getStage() == EventStageable.EventStage.PRE) { if (event.getPacket() instanceof CPacketUseEntity) { final CPacketUseEntity packet = (CPacketUseEntity) event.getPacket(); if (packet.getAction() == CPacketUseEntity.Action.ATTACK) { final Minecraft mc = Minecraft.getMinecraft(); if (mc.player.onGround && !mc.gameSettings.keyBindJump.isKeyDown() && packet.getEntityFromWorld(mc.world) instanceof EntityLivingBase) { switch (this.mode.getValue()) { case JUMP: mc.player.jump(); break; case PACKET: //TODO make sure u can actually go there mc.player.connection.sendPacket(new CPacketPlayer.Position(mc.player.posX, mc.player.posY + 0.1f, mc.player.posZ, false)); mc.player.connection.sendPacket(new CPacketPlayer.Position(mc.player.posX, mc.player.posY, mc.player.posZ, false)); break; } } } } } }
Example #3
Source File: BowBombModule.java From seppuku with GNU General Public License v3.0 | 6 votes |
@Listener public void sendPacket(EventSendPacket event) { if (event.getStage() == EventStageable.EventStage.PRE) { if (event.getPacket() instanceof CPacketPlayerDigging) { final Minecraft mc = Minecraft.getMinecraft(); final CPacketPlayerDigging packet = (CPacketPlayerDigging) event.getPacket(); if (packet.getAction() == CPacketPlayerDigging.Action.RELEASE_USE_ITEM) { if (mc.player.inventory.getCurrentItem().getItem() instanceof ItemBow && mc.player.getItemInUseMaxCount() >= 20) { if (!mc.player.onGround) { mc.player.connection.sendPacket(new CPacketPlayer.Position(mc.player.posX, mc.player.posY - 0.1f, mc.player.posZ, false)); mc.player.connection.sendPacket(new CPacketPlayer.Position(mc.player.posX, mc.player.posY - 10000f, mc.player.posZ, true)); } } } } } }
Example #4
Source File: FlightModule.java From seppuku with GNU General Public License v3.0 | 6 votes |
@Listener public void sendPacket(EventSendPacket event) { if (event.getStage() == EventStageable.EventStage.PRE) { if (this.mode.getValue() == Mode.PACKET) { if (event.getPacket() instanceof CPacketPlayer && !(event.getPacket() instanceof CPacketPlayer.Position)) { event.setCanceled(true); } if (event.getPacket() instanceof CPacketPlayer) { final CPacketPlayer packet = (CPacketPlayer) event.getPacket(); if (packets.contains(packet)) { packets.remove(packet); return; } event.setCanceled(true); } } } }
Example #5
Source File: VanillaFlyMod.java From ForgeHax with MIT License | 6 votes |
@SubscribeEvent public void onPacketSending(PacketEvent.Outgoing.Pre event) { EntityPlayer player = getLocalPlayer(); if (isNull(player)) { return; } if (!groundSpoof.get() || !(event.getPacket() instanceof CPacketPlayer) || !player.capabilities.isFlying) { return; } CPacketPlayer packet = event.getPacket(); if (!Fields.CPacketPlayer_moving.get(packet)) { return; } AxisAlignedBB range = player.getEntityBoundingBox().expand(0, -player.posY, 0) .contract(0, -player.height, 0); List<AxisAlignedBB> collisionBoxes = player.world.getCollisionBoxes(player, range); AtomicReference<Double> newHeight = new AtomicReference<>(0D); collisionBoxes.forEach(box -> newHeight.set(Math.max(newHeight.get(), box.maxY))); Fields.CPacketPlayer_y.set(packet, newHeight.get()); Fields.CPacketPlayer_onGround.set(packet, true); }
Example #6
Source File: BlinkHack.java From ForgeWurst with GNU General Public License v3.0 | 6 votes |
@SubscribeEvent public void onPacketOutput(WPacketOutputEvent event) { if(!(event.getPacket() instanceof CPacketPlayer)) return; event.setCanceled(true); CPacketPlayer packet = (CPacketPlayer)event.getPacket(); CPacketPlayer prevPacket = packets.peekLast(); if(prevPacket != null && packet.isOnGround() == prevPacket.isOnGround() && packet.getYaw(-1) == prevPacket.getYaw(-1) && packet.getPitch(-1) == prevPacket.getPitch(-1) && packet.getX(-1) == prevPacket.getX(-1) && packet.getY(-1) == prevPacket.getY(-1) && packet.getZ(-1) == prevPacket.getZ(-1)) return; packets.addLast(packet); }
Example #7
Source File: SchematicaPrinterBypass.java From ForgeHax with MIT License | 5 votes |
@SubscribeEvent public void onPrinterBlockPlace(SchematicaPlaceBlockEvent event) { final BlockPos lookpos = event.getPos().offset(event.getSide()); final Vec3d newvec = new Vec3d(lookpos.getX() + 0.5, lookpos.getY() + 0.5, lookpos.getZ() + 0.5); Angle lookAngle = Utils.getLookAtAngles(newvec); getNetworkManager() .sendPacket( new CPacketPlayer.Rotation( lookAngle.getYaw(), lookAngle.getPitch(), getLocalPlayer().onGround)); }
Example #8
Source File: Jesus.java From ForgeHax with MIT License | 5 votes |
@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); } } } }
Example #9
Source File: ClipCommand.java From ForgeHax with MIT License | 5 votes |
private void setPosition(double x, double y, double z) { final Entity local = Helper.getRidingOrPlayer(); local.setPositionAndUpdate(x, y, z); if (local instanceof EntityPlayerSP) { getNetworkManager() .sendPacket( new CPacketPlayer.Position(local.posX, local.posY, local.posZ, MC.player.onGround)); } else { getNetworkManager().sendPacket(new CPacketVehicleMove(local)); } }
Example #10
Source File: StepMod.java From ForgeHax with MIT License | 5 votes |
@SubscribeEvent public void onPacketSending(PacketEvent.Outgoing.Pre event) { if (event.getPacket() instanceof CPacketPlayer.Position || event.getPacket() instanceof CPacketPlayer.PositionRotation) { CPacketPlayer packetPlayer = event.getPacket(); if (previousPositionPacket != null && !PacketHelper.isIgnored(event.getPacket())) { double diffY = packetPlayer.getY(0.f) - previousPositionPacket.getY(0.f); // y difference must be positive // greater than 1, but less than 1.5 if (diffY > DEFAULT_STEP_HEIGHT && diffY <= 1.2491870787) { List<Packet> sendList = Lists.newArrayList(); // if this is true, this must be a step // now to send additional packets to get around NCP double x = previousPositionPacket.getX(0.D); double y = previousPositionPacket.getY(0.D); double z = previousPositionPacket.getZ(0.D); sendList.add(new CPacketPlayer.Position(x, y + 0.4199999869D, z, true)); sendList.add(new CPacketPlayer.Position(x, y + 0.7531999805D, z, true)); sendList.add( new CPacketPlayer.Position( packetPlayer.getX(0.f), packetPlayer.getY(0.f), packetPlayer.getZ(0.f), packetPlayer.isOnGround())); for (Packet toSend : sendList) { PacketHelper.ignore(toSend); getNetworkManager().sendPacket(toSend); } event.setCanceled(true); } } previousPositionPacket = event.getPacket(); } }
Example #11
Source File: NoFallMod.java From ForgeHax with MIT License | 5 votes |
@SubscribeEvent public void onPacketSend(PacketEvent.Outgoing.Pre event) { if (event.getPacket() instanceof CPacketPlayer && !(event.getPacket() instanceof CPacketPlayer.Rotation) && !PacketHelper.isIgnored(event.getPacket())) { CPacketPlayer packetPlayer = 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; } } }
Example #12
Source File: PhaseModule.java From seppuku with GNU General Public License v3.0 | 5 votes |
@Listener public void sendPacket(EventSendPacket event) { if (event.getStage() == EventStageable.EventStage.PRE) { if (this.mode.getValue() == Mode.NOCLIP) { if (event.getPacket() instanceof CPacketPlayer && !(event.getPacket() instanceof CPacketPlayer.Position)) { event.setCanceled(true); } } } }
Example #13
Source File: NoAfkModule.java From seppuku with GNU General Public License v3.0 | 5 votes |
@Listener public void sendPacket(EventSendPacket event) { if (event.getStage() == EventStageable.EventStage.PRE) { if (event.getPacket() instanceof CPacketPlayer.Rotation) { if (Minecraft.getMinecraft().player.getRidingEntity() != null) { final CPacketPlayer.Rotation packet = (CPacketPlayer.Rotation) event.getPacket(); packet.yaw += (1 * Math.sin(Minecraft.getMinecraft().player.ticksExisted / Math.PI)); } } } }
Example #14
Source File: JesusModule.java From seppuku with GNU General Public License v3.0 | 5 votes |
@Listener public void sendPacket(EventSendPacket event) { if (event.getStage() == EventStageable.EventStage.PRE) { if (event.getPacket() instanceof CPacketPlayer) { if (this.mode.getValue() != Mode.VANILLA && Minecraft.getMinecraft().player.getRidingEntity() == null && !Minecraft.getMinecraft().gameSettings.keyBindJump.isKeyDown()) { final CPacketPlayer packet = (CPacketPlayer) event.getPacket(); if (!isInLiquid() && isOnLiquid(this.offset.getValue()) && checkCollide() && Minecraft.getMinecraft().player.ticksExisted % 3 == 0) { packet.y -= this.offset.getValue(); } } } } }
Example #15
Source File: StepModule.java From seppuku with GNU General Public License v3.0 | 5 votes |
@Listener public void onWalkingUpdate(EventUpdateWalkingPlayer event) { if (event.getStage() == EventStageable.EventStage.PRE) { final Minecraft mc = Minecraft.getMinecraft(); switch (this.mode.getValue()) { case ONE: this.selectedPositions = this.oneblockPositions; break; case TWO: this.selectedPositions = this.twoblockPositions; break; } if (mc.player.collidedHorizontally && mc.player.onGround) { this.packets++; } //check if there is a block above our head final AxisAlignedBB bb = mc.player.getEntityBoundingBox(); for (int x = MathHelper.floor(bb.minX); x < MathHelper.floor(bb.maxX + 1.0D); x++) { for (int z = MathHelper.floor(bb.minZ); z < MathHelper.floor(bb.maxZ + 1.0D); z++) { final Block block = mc.world.getBlockState(new BlockPos(x, bb.maxY + 1, z)).getBlock(); if (!(block instanceof BlockAir)) { return; } } } if (mc.player.onGround && !mc.player.isInsideOfMaterial(Material.WATER) && !mc.player.isInsideOfMaterial(Material.LAVA) && !mc.player.isInWeb && mc.player.collidedVertically && mc.player.fallDistance == 0 && !mc.gameSettings.keyBindJump.pressed && mc.player.collidedHorizontally && !mc.player.isOnLadder() && this.packets > this.selectedPositions.length - 2) { for (double position : this.selectedPositions) { mc.player.connection.sendPacket(new CPacketPlayer.Position(mc.player.posX, mc.player.posY + position, mc.player.posZ, true)); } mc.player.setPosition(mc.player.posX, mc.player.posY + this.selectedPositions[this.selectedPositions.length - 1], mc.player.posZ); this.packets = 0; } } }
Example #16
Source File: FlightModule.java From seppuku with GNU General Public License v3.0 | 5 votes |
private void move(double x, double y, double z) { final Minecraft mc = Minecraft.getMinecraft(); final CPacketPlayer pos = new CPacketPlayer.Position(mc.player.posX + x, mc.player.posY + y, mc.player.posZ + z, mc.player.onGround); this.packets.add(pos); mc.player.connection.sendPacket(pos); final CPacketPlayer bounds = new CPacketPlayer.Position(mc.player.posX + x, 0, mc.player.posZ + z, mc.player.onGround); this.packets.add(bounds); mc.player.connection.sendPacket(bounds); this.teleportId++; mc.player.connection.sendPacket(new CPacketConfirmTeleport(this.teleportId - 1)); mc.player.connection.sendPacket(new CPacketConfirmTeleport(this.teleportId)); mc.player.connection.sendPacket(new CPacketConfirmTeleport(this.teleportId + 1)); }
Example #17
Source File: FlightModule.java From seppuku with GNU General Public License v3.0 | 5 votes |
@Override public void onEnable() { super.onEnable(); if (this.mode.getValue() == Mode.PACKET) { final Minecraft mc = Minecraft.getMinecraft(); if (mc.world != null) { this.teleportId = 0; this.packets.clear(); final CPacketPlayer bounds = new CPacketPlayer.Position(mc.player.posX, 0, mc.player.posZ, mc.player.onGround); this.packets.add(bounds); mc.player.connection.sendPacket(bounds); } } }
Example #18
Source File: NoFallModule.java From seppuku with GNU General Public License v3.0 | 5 votes |
@Listener public void sendPacket(EventSendPacket event) { if (event.getStage() == EventStageable.EventStage.PRE) { if (event.getPacket() instanceof CPacketPlayer && Minecraft.getMinecraft().player.fallDistance >= 3.0f) { final CPacketPlayer packet = (CPacketPlayer) event.getPacket(); packet.onGround = true; } } }
Example #19
Source File: AutoBucketFallMod.java From ForgeHax with MIT License | 4 votes |
@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); } }
Example #20
Source File: MixinEntityPlayerSP.java From Valkyrien-Skies with Apache License 2.0 | 4 votes |
/** * @reason is because we need to ensure the CPacketPlayer is always sent no matter what. * @author thebest108 */ @Overwrite private void onUpdateWalkingPlayer() { // ===== Injection code starts here ===== IDraggable draggable = (IDraggable) this; if (draggable.getWorldBelowFeet() != null) { draggable.getWorldBelowFeet().getPhysicsObject().getSubspace() .snapshotSubspacedEntity(thisAsSubspaced); ISubspacedEntityRecord entityRecord = draggable.getWorldBelowFeet().getPhysicsObject() .getSubspace() .getRecordForSubspacedEntity(thisAsSubspaced); SubspacedEntityRecordMessage recordMessage = new SubspacedEntityRecordMessage( entityRecord); ValkyrienSkiesMod.physWrapperNetwork.sendToServer(recordMessage); } // ===== Injection code ends here ===== boolean flag = player.isSprinting(); if (flag != serverSprintState) { if (flag) { player.connection.sendPacket( new CPacketEntityAction(player, CPacketEntityAction.Action.START_SPRINTING)); } else { player.connection.sendPacket( new CPacketEntityAction(player, CPacketEntityAction.Action.STOP_SPRINTING)); } serverSprintState = flag; } boolean flag1 = player.isSneaking(); if (flag1 != serverSneakState) { if (flag1) { player.connection.sendPacket( new CPacketEntityAction(player, CPacketEntityAction.Action.START_SNEAKING)); } else { player.connection.sendPacket( new CPacketEntityAction(player, CPacketEntityAction.Action.STOP_SNEAKING)); } serverSneakState = flag1; } if (isCurrentViewEntity()) { AxisAlignedBB axisalignedbb = player.getEntityBoundingBox(); double d0 = player.posX - lastReportedPosX; double d1 = axisalignedbb.minY - lastReportedPosY; double d2 = player.posZ - lastReportedPosZ; double d3 = (double) (player.rotationYaw - lastReportedYaw); double d4 = (double) (player.rotationPitch - lastReportedPitch); ++positionUpdateTicks; // Always true because why not. boolean flag2 = true; // d0 * d0 + d1 * d1 + d2 * d2 > 9.0E-4D || positionUpdateTicks >= 20; boolean flag3 = true; // d3 != 0.0D || d4 != 0.0D; if (player.isRiding()) { player.connection.sendPacket( new CPacketPlayer.PositionRotation(player.motionX, -999.0D, player.motionZ, player.rotationYaw, player.rotationPitch, player.onGround)); flag2 = false; } else if (flag2 && flag3) { player.connection.sendPacket( new CPacketPlayer.PositionRotation(player.posX, axisalignedbb.minY, player.posZ, player.rotationYaw, player.rotationPitch, player.onGround)); } else if (flag2) { player.connection.sendPacket( new CPacketPlayer.Position(player.posX, axisalignedbb.minY, player.posZ, player.onGround)); } else if (flag3) { player.connection.sendPacket( new CPacketPlayer.Rotation(player.rotationYaw, player.rotationPitch, player.onGround)); } if (flag2) { lastReportedPosX = player.posX; lastReportedPosY = axisalignedbb.minY; lastReportedPosZ = player.posZ; positionUpdateTicks = 0; } if (flag3) { lastReportedYaw = player.rotationYaw; lastReportedPitch = player.rotationPitch; } prevOnGround = player.onGround; autoJumpEnabled = mc.gameSettings.autoJump; } }
Example #21
Source File: FlyMod.java From ForgeHax with MIT License | 4 votes |
@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); } }
Example #22
Source File: FreecamMod.java From ForgeHax with MIT License | 4 votes |
@SubscribeEvent public void onPacketSend(PacketEvent.Outgoing.Pre event) { if (event.getPacket() instanceof CPacketPlayer || event.getPacket() instanceof CPacketInput) { event.setCanceled(true); } }
Example #23
Source File: JesusHack.java From ForgeWurst with GNU General Public License v3.0 | 4 votes |
@SubscribeEvent public void onPacketOutput(WPacketOutputEvent event) { // check packet type if(!(event.getPacket() instanceof CPacketPlayer)) return; EntityPlayerSP player = WMinecraft.getPlayer(); CPacketPlayer packet = (CPacketPlayer)event.getPacket(); // check if packet contains a position if(!(packet instanceof CPacketPlayer.Position || packet instanceof CPacketPlayer.PositionRotation)) return; if(!isStandingOnLiquid(player)) return; // if not actually moving, cancel packet if(player.movementInput == null) { event.setCanceled(true); return; } // get position double x = packet.getX(0); double y = packet.getY(0); double z = packet.getZ(0); // offset y if(player.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 event.setPacket(newPacket); }
Example #24
Source File: FreecamHack.java From ForgeWurst with GNU General Public License v3.0 | 4 votes |
@SubscribeEvent public void onPacketOutput(WPacketOutputEvent event) { if(event.getPacket() instanceof CPacketPlayer) event.setCanceled(true); }
Example #25
Source File: NoFallHack.java From ForgeWurst with GNU General Public License v3.0 | 4 votes |
@SubscribeEvent public void onUpdate(WUpdateEvent event) { if(event.getPlayer().fallDistance > 2) mc.getConnection().sendPacket(new CPacketPlayer(true)); }