net.minecraft.client.network.ClientPlayerEntity Java Examples
The following examples show how to use
net.minecraft.client.network.ClientPlayerEntity.
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: FlightHack.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
@Override public void onUpdate() { ClientPlayerEntity player = MC.player; player.abilities.flying = false; player.flyingSpeed = speed.getValueF(); player.setVelocity(0, 0, 0); Vec3d velcity = player.getVelocity(); if(MC.options.keyJump.isPressed()) player.setVelocity(velcity.add(0, speed.getValue(), 0)); if(MC.options.keySneak.isPressed()) player.setVelocity(velcity.subtract(0, speed.getValue(), 0)); }
Example #2
Source File: NoClipHack.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
@Override public void onUpdate() { ClientPlayerEntity player = MC.player; player.noClip = true; player.fallDistance = 0; player.setOnGround(false); player.abilities.flying = false; player.setVelocity(0, 0, 0); float speed = 0.2F; player.flyingSpeed = speed; if(MC.options.keyJump.isPressed()) player.addVelocity(0, speed, 0); if(MC.options.keySneak.isPressed()) player.addVelocity(0, -speed, 0); }
Example #3
Source File: MixinMerchantContainer.java From multiconnect with MIT License | 6 votes |
@Unique private void autofill(ClientPlayerInteractionManager interactionManager, ClientPlayerEntity player, int inputSlot, ItemStack stackNeeded) { if (stackNeeded.isEmpty()) return; int slot; for (slot = 3; slot < 39; slot++) { ItemStack stack = slots.get(slot).getStack(); if (stack.getItem() == stackNeeded.getItem() && ItemStack.areTagsEqual(stack, stackNeeded)) { break; } } if (slot == 39) return; boolean wasHoldingItem = !player.inventory.getCursorStack().isEmpty(); interactionManager.clickSlot(syncId, slot, 0, SlotActionType.PICKUP, player); interactionManager.clickSlot(syncId, slot, 0, SlotActionType.PICKUP_ALL, player); interactionManager.clickSlot(syncId, inputSlot, 0, SlotActionType.PICKUP, player); if (wasHoldingItem) interactionManager.clickSlot(syncId, slot, 0, SlotActionType.PICKUP, player); }
Example #4
Source File: RepairCmd.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
@Override public void call(String[] args) throws CmdException { if(args.length > 0) throw new CmdSyntaxError(); ClientPlayerEntity player = MC.player; if(!player.abilities.creativeMode) throw new CmdError("Creative mode only."); ItemStack stack = getHeldStack(player); stack.setDamage(0); MC.player.networkHandler .sendPacket(new CreativeInventoryActionC2SPacket( 36 + player.inventory.selectedSlot, stack)); ChatUtils.message("Item repaired."); }
Example #5
Source File: ViewNbtCmd.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
@Override public void call(String[] args) throws CmdException { ClientPlayerEntity player = MC.player; ItemStack stack = player.inventory.getMainHandStack(); if(stack.isEmpty()) throw new CmdError("You must hold an item in your main hand."); CompoundTag tag = stack.getTag(); String nbt = tag == null ? "" : tag.asString(); switch(String.join(" ", args).toLowerCase()) { case "": ChatUtils.message("NBT: " + nbt); break; case "copy": MC.keyboard.setClipboard(nbt); ChatUtils.message("NBT data copied to clipboard."); break; default: throw new CmdSyntaxError(); } }
Example #6
Source File: FreecamHack.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
@Override public void onDisable() { EVENTS.remove(UpdateListener.class, this); EVENTS.remove(PacketOutputListener.class, this); EVENTS.remove(IsPlayerInWaterListener.class, this); EVENTS.remove(PlayerMoveListener.class, this); EVENTS.remove(CameraTransformViewBobbingListener.class, this); EVENTS.remove(IsNormalCubeListener.class, this); EVENTS.remove(SetOpaqueCubeListener.class, this); EVENTS.remove(RenderListener.class, this); fakePlayer.resetPlayerPosition(); fakePlayer.despawn(); ClientPlayerEntity player = MC.player; player.setVelocity(Vec3d.ZERO); MC.worldRenderer.reload(); GL11.glDeleteLists(playerBox, 1); playerBox = 0; }
Example #7
Source File: FreecamHack.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
@Override public void onUpdate() { ClientPlayerEntity player = MC.player; player.setVelocity(Vec3d.ZERO); player.setOnGround(false); player.flyingSpeed = speed.getValueF(); Vec3d velcity = player.getVelocity(); if(MC.options.keyJump.isPressed()) player.setVelocity(velcity.add(0, speed.getValue(), 0)); if(MC.options.keySneak.isPressed()) player.setVelocity(velcity.subtract(0, speed.getValue(), 0)); }
Example #8
Source File: TriggerBotHack.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
@Override public void onUpdate() { ClientPlayerEntity player = MC.player; if(player.getAttackCooldownProgress(0) < 1) return; if(MC.crosshairTarget == null || !(MC.crosshairTarget instanceof EntityHitResult)) return; Entity target = ((EntityHitResult)MC.crosshairTarget).getEntity(); if(!isCorrectEntity(target)) return; WURST.getHax().autoSwordHack.setSlot(); MC.interactionManager.attackEntity(player, target); player.swingHand(Hand.MAIN_HAND); }
Example #9
Source File: TunnellerHack.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
@Override public void onEnable() { WURST.getHax().autoMineHack.setEnabled(false); WURST.getHax().excavatorHack.setEnabled(false); WURST.getHax().nukerHack.setEnabled(false); WURST.getHax().nukerLegitHack.setEnabled(false); WURST.getHax().speedNukerHack.setEnabled(false); // add listeners EVENTS.add(UpdateListener.class, this); EVENTS.add(RenderListener.class, this); for(int i = 0; i < displayLists.length; i++) displayLists[i] = GL11.glGenLists(1); ClientPlayerEntity player = MC.player; start = new BlockPos(player.getPos()); direction = player.getHorizontalFacing(); length = 0; tasks = new Task[]{new DodgeLiquidTask(), new FillInFloorTask(), new PlaceTorchTask(), new DigTunnelTask(), new WalkForwardTask()}; updateCyanList(); }
Example #10
Source File: MixinClientPlayerEntity.java From multiconnect with MIT License | 5 votes |
@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isTouchingWater()Z")) private boolean allowSprintingInWater(ClientPlayerEntity self) { if (ConnectionInfo.protocolVersion <= Protocols.V1_12_2) { return false; // disable all water related movement } return self.isTouchingWater(); }
Example #11
Source File: MixinClientPlayerEntity.java From multiconnect with MIT License | 5 votes |
@Redirect(method = "tickMovement", slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isWalking()Z")), at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isSwimming()Z", ordinal = 0)) public boolean redirectIsSneakingWhileSwimming(ClientPlayerEntity _this) { if (ConnectionInfo.protocolVersion <= Protocols.V1_14_1) return false; else return _this.isSwimming(); }
Example #12
Source File: DolphinHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
@Override public void onUpdate() { ClientPlayerEntity player = MC.player; if(!player.isWet() || player.isSneaking()) return; Vec3d velocity = player.getVelocity(); player.setVelocity(velocity.x, velocity.y + 0.04, velocity.z); }
Example #13
Source File: KillauraHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
@Override public void onPostMotion() { if(target == null) return; ClientPlayerEntity player = MC.player; MC.interactionManager.attackEntity(player, target); player.swingHand(Hand.MAIN_HAND); target = null; }
Example #14
Source File: SneakHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
private void sendSneakPacket(Mode mode) { ClientPlayerEntity player = MC.player; ClientCommandC2SPacket packet = new ClientCommandC2SPacket(player, mode); player.networkHandler.sendPacket(packet); }
Example #15
Source File: SpiderHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
@Override public void onUpdate() { ClientPlayerEntity player = MC.player; if(!player.horizontalCollision) return; Vec3d velocity = player.getVelocity(); if(velocity.y >= 0.2) return; player.setVelocity(velocity.x, 0.2, velocity.z); }
Example #16
Source File: ModifyCmd.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
@Override public void call(String[] args) throws CmdException { ClientPlayerEntity player = MC.player; if(!player.abilities.creativeMode) throw new CmdError("Creative mode only."); if(args.length < 2) throw new CmdSyntaxError(); ItemStack stack = player.inventory.getMainHandStack(); if(stack == null) throw new CmdError("You must hold an item in your main hand."); switch(args[0].toLowerCase()) { case "add": add(stack, args); break; case "set": set(stack, args); break; case "remove": remove(stack, args); break; default: throw new CmdSyntaxError(); } MC.player.networkHandler .sendPacket(new CreativeInventoryActionC2SPacket( 36 + player.inventory.selectedSlot, stack)); ChatUtils.message("Item modified."); }
Example #17
Source File: VClipCmd.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
@Override public void call(String[] args) throws CmdException { if(args.length != 1) throw new CmdSyntaxError(); if(!MathUtils.isInteger(args[0])) throw new CmdSyntaxError(); ClientPlayerEntity player = MC.player; player.updatePosition(player.getX(), player.getY() + Integer.parseInt(args[0]), player.getZ()); }
Example #18
Source File: TpCmd.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
@Override public void call(String[] args) throws CmdException { BlockPos pos = argsToPos(args); ClientPlayerEntity player = MC.player; player.updatePosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5); }
Example #19
Source File: RepairCmd.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
private ItemStack getHeldStack(ClientPlayerEntity player) throws CmdError { ItemStack stack = player.inventory.getMainHandStack(); if(stack.isEmpty()) throw new CmdError("You need an item in your hand."); if(!stack.isDamageable()) throw new CmdError("This item can't take damage."); if(!stack.isDamaged()) throw new CmdError("This item is not damaged."); return stack; }
Example #20
Source File: AnnoyCmd.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
private void enable(String[] args) throws CmdException { if(args.length < 1) throw new CmdSyntaxError(); target = String.join(" ", args); ChatUtils.message("Now annoying " + target + "."); ClientPlayerEntity player = MC.player; if(player != null && target.equals(player.getName().getString())) ChatUtils.warning("Annoying yourself is a bad idea!"); EVENTS.add(ChatInputListener.class, this); enabled = true; }
Example #21
Source File: RotationFaker.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
@Override public void onPreMotion() { if(!fakeRotation) return; ClientPlayerEntity player = WurstClient.MC.player; realYaw = player.yaw; realPitch = player.pitch; player.yaw = serverYaw; player.pitch = serverPitch; }
Example #22
Source File: RotationFaker.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
@Override public void onPostMotion() { if(!fakeRotation) return; ClientPlayerEntity player = WurstClient.MC.player; player.yaw = realYaw; player.pitch = realPitch; fakeRotation = false; }
Example #23
Source File: ClientPlayerEntityMixin.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isUsingItem()Z", ordinal = 0), method = "tickMovement()V") private boolean wurstIsUsingItem(ClientPlayerEntity player) { if(WurstClient.INSTANCE.getHax().noSlowdownHack.isEnabled()) return false; return player.isUsingItem(); }
Example #24
Source File: AutoArmorHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
private int getArmorValue(ArmorItem item, ItemStack stack) { int armorPoints = item.getProtection(); int prtPoints = 0; int armorToughness = (int)((IArmorItem)item).getToughness(); int armorType = item.getMaterial().getProtectionAmount(EquipmentSlot.LEGS); if(useEnchantments.isChecked()) { Enchantment protection = Enchantments.PROTECTION; int prtLvl = EnchantmentHelper.getLevel(protection, stack); ClientPlayerEntity player = MC.player; DamageSource dmgSource = DamageSource.player(player); prtPoints = protection.getProtectionAmount(prtLvl, dmgSource); } return armorPoints * 5 + prtPoints * 3 + armorToughness + armorType; }
Example #25
Source File: ClientPlayerEntity_clientCommandMixin.java From fabric-carpet with MIT License | 5 votes |
@Inject(method = "sendChatMessage", at = @At("HEAD")) private void inspectMessage(String string, CallbackInfo ci) { if (string.startsWith("/call")) { String command = string.substring(6); CarpetClient.sendClientCommand(command); } if (CarpetServer.minecraft_server == null && !CarpetClient.isCarpet()) { ClientPlayerEntity playerSource = (ClientPlayerEntity)(Object) this; CarpetServer.settingsManager.inspectClientsideCommand(playerSource.getCommandSource(), string); } }
Example #26
Source File: FastLadderHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
@Override public void onUpdate() { ClientPlayerEntity player = MC.player; if(!player.isClimbing() || !player.horizontalCollision) return; if(player.input.movementForward == 0 && player.input.movementSideways == 0) return; Vec3d velocity = player.getVelocity(); player.setVelocity(velocity.x, 0.2872, velocity.z); }
Example #27
Source File: AutoToolHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
public void equipBestTool(BlockPos pos, boolean useSwords, boolean useHands, boolean repairMode) { ClientPlayerEntity player = MC.player; if(player.abilities.creativeMode) return; int bestSlot = getBestSlot(pos, useSwords, repairMode); if(bestSlot == -1) { ItemStack heldItem = player.getMainHandStack(); if(!isDamageable(heldItem)) return; if(repairMode && isTooDamaged(heldItem)) { selectFallbackSlot(); return; } if(useHands && isWrongTool(heldItem, pos)) { selectFallbackSlot(); return; } return; } player.inventory.selectedSlot = bestSlot; }
Example #28
Source File: AutoToolHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
private int getBestSlot(BlockPos pos, boolean useSwords, boolean repairMode) { ClientPlayerEntity player = MC.player; PlayerInventory inventory = player.inventory; ItemStack heldItem = MC.player.getMainHandStack(); BlockState state = BlockUtils.getState(pos); float bestSpeed = getMiningSpeed(heldItem, state); int bestSlot = -1; for(int slot = 0; slot < 9; slot++) { if(slot == inventory.selectedSlot) continue; ItemStack stack = inventory.getStack(slot); float speed = getMiningSpeed(stack, state); if(speed <= bestSpeed) continue; if(!useSwords && stack.getItem() instanceof SwordItem) continue; if(repairMode && isTooDamaged(stack)) continue; bestSpeed = speed; bestSlot = slot; } return bestSlot; }
Example #29
Source File: GlideHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
@Override public void onUpdate() { ClientPlayerEntity player = MC.player; Vec3d v = player.getVelocity(); if(player.isOnGround() || player.isTouchingWater() || player.isInLava() || player.isClimbing() || v.y >= 0) return; if(minHeight.getValue() > 0) { Box box = player.getBoundingBox(); box = box.union(box.offset(0, -minHeight.getValue(), 0)); if(!MC.world.doesNotCollide(box)) return; BlockPos min = new BlockPos(new Vec3d(box.minX, box.minY, box.minZ)); BlockPos max = new BlockPos(new Vec3d(box.maxX, box.maxY, box.maxZ)); Stream<BlockPos> stream = StreamSupport .stream(BlockUtils.getAllInBox(min, max).spliterator(), true); // manual collision check, since liquids don't have bounding boxes if(stream.map(BlockUtils::getState).map(BlockState::getMaterial) .anyMatch(Material::isLiquid)) return; } player.setVelocity(v.x, Math.max(v.y, -fallSpeed.getValue()), v.z); player.flyingSpeed *= moveSpeed.getValueF(); }
Example #30
Source File: ClientNetworkHandler.java From fabric-carpet with MIT License | 5 votes |
private static void onSyncData(PacketByteBuf data, ClientPlayerEntity player) { CompoundTag compound = data.readCompoundTag(); if (compound == null) return; for (String key: compound.getKeys()) { if (dataHandlers.containsKey(key)) dataHandlers.get(key).accept(player, compound.get(key)); else CarpetSettings.LOG.error("Unknown carpet data: "+key); } }