net.minecraft.util.shape.VoxelShape#net.minecraft.client.network.ClientPlayerEntity源码实例Demo

下面列出了net.minecraft.util.shape.VoxelShape#net.minecraft.client.network.ClientPlayerEntity 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Wurst7   文件: FreecamHack.java
@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;
}
 
源代码2 项目: Wurst7   文件: FreecamHack.java
@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));
}
 
源代码3 项目: Wurst7   文件: TriggerBotHack.java
@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);
}
 
源代码4 项目: Wurst7   文件: TunnellerHack.java
@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();
}
 
源代码5 项目: Wurst7   文件: NoClipHack.java
@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);
}
 
源代码6 项目: Wurst7   文件: FlightHack.java
@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));
}
 
源代码7 项目: Wurst7   文件: AutoArmorHack.java
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;
}
 
源代码8 项目: Wurst7   文件: ViewNbtCmd.java
@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();
	}
}
 
源代码9 项目: Wurst7   文件: RepairCmd.java
@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.");
}
 
源代码10 项目: multiconnect   文件: MixinMerchantContainer.java
@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);
}
 
源代码11 项目: Wurst7   文件: DolphinHack.java
@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);
}
 
源代码12 项目: Wurst7   文件: FastLadderHack.java
@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);
}
 
源代码13 项目: Wurst7   文件: AutoToolHack.java
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;
}
 
源代码14 项目: Wurst7   文件: AutoToolHack.java
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;
}
 
源代码15 项目: Wurst7   文件: NoFallHack.java
@Override
public void onUpdate()
{
	ClientPlayerEntity player = MC.player;
	if(player.fallDistance <= 2)
		return;
	
	player.networkHandler.sendPacket(new PlayerMoveC2SPacket(true));
}
 
源代码16 项目: Wurst7   文件: GlideHack.java
@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();
}
 
源代码17 项目: Wurst7   文件: AutoFishHack.java
@Override
public void onReceivedPacket(PacketInputEvent event)
{
	ClientPlayerEntity player = MC.player;
	if(player == null || player.fishHook == null)
		return;
	
	if(!(event.getPacket() instanceof PlaySoundS2CPacket))
		return;
	
	// check sound type
	PlaySoundS2CPacket sound = (PlaySoundS2CPacket)event.getPacket();
	if(!SoundEvents.ENTITY_FISHING_BOBBER_SPLASH.equals(sound.getSound()))
		return;
	
	if(debugDraw.isChecked())
		lastSoundPos = new Vec3d(sound.getX(), sound.getY(), sound.getZ());
	
	// check position
	FishingBobberEntity bobber = player.fishHook;
	if(Math.abs(sound.getX() - bobber.getX()) > validRange.getValue()
		|| Math.abs(sound.getZ() - bobber.getZ()) > validRange.getValue())
		return;
	
	// catch fish
	rightClick();
	castRodTimer = 15;
}
 
源代码18 项目: Wurst7   文件: BunnyHopHack.java
@Override
public void onUpdate()
{
	ClientPlayerEntity player = MC.player;
	if(!player.isOnGround() || player.isSneaking())
		return;
	
	if(jumpIf.getSelected().condition.test(player))
		player.jump();
}
 
源代码19 项目: Wurst7   文件: FishHack.java
@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.005, velocity.z);
}
 
源代码20 项目: Wurst7   文件: RadarHack.java
@Override
public void onUpdate()
{
	ClientPlayerEntity player = MC.player;
	ClientWorld world = MC.world;
	
	entities.clear();
	Stream<Entity> stream =
		StreamSupport.stream(world.getEntities().spliterator(), true)
			.filter(e -> !e.removed && e != player)
			.filter(e -> !(e instanceof FakePlayerEntity))
			.filter(e -> e instanceof LivingEntity)
			.filter(e -> ((LivingEntity)e).getHealth() > 0);
	
	if(filterPlayers.isChecked())
		stream = stream.filter(e -> !(e instanceof PlayerEntity));
	
	if(filterSleeping.isChecked())
		stream = stream.filter(e -> !(e instanceof PlayerEntity
			&& ((PlayerEntity)e).isSleeping()));
	
	if(filterMonsters.isChecked())
		stream = stream.filter(e -> !(e instanceof Monster));
	
	if(filterAnimals.isChecked())
		stream = stream.filter(
			e -> !(e instanceof AnimalEntity || e instanceof AmbientEntity
				|| e instanceof WaterCreatureEntity));
	
	if(filterInvisible.isChecked())
		stream = stream.filter(e -> !e.isInvisible());
	
	entities.addAll(stream.collect(Collectors.toList()));
}
 
源代码21 项目: Wurst7   文件: AutoSwimHack.java
@Override
public void onUpdate()
{
	ClientPlayerEntity player = MC.player;
	
	if(player.horizontalCollision || player.isSneaking())
		return;
	
	if(!player.isTouchingWater())
		return;
	
	if(player.forwardSpeed > 0)
		player.setSprinting(true);
}
 
源代码22 项目: Wurst7   文件: AutoSprintHack.java
@Override
public void onUpdate()
{
	ClientPlayerEntity player = MC.player;
	
	if(player.horizontalCollision || player.isSneaking())
		return;
	
	if(player.isWet() || player.isSubmergedInWater())
		return;
	
	if(player.forwardSpeed > 0)
		player.setSprinting(true);
}
 
源代码23 项目: Wurst7   文件: KillauraHack.java
@Override
public void onPostMotion()
{
	if(target == null)
		return;
	
	ClientPlayerEntity player = MC.player;
	MC.interactionManager.attackEntity(player, target);
	player.swingHand(Hand.MAIN_HAND);
	
	target = null;
}
 
源代码24 项目: Wurst7   文件: SneakHack.java
private void sendSneakPacket(Mode mode)
{
	ClientPlayerEntity player = MC.player;
	ClientCommandC2SPacket packet =
		new ClientCommandC2SPacket(player, mode);
	player.networkHandler.sendPacket(packet);
}
 
源代码25 项目: Wurst7   文件: SpiderHack.java
@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);
}
 
源代码26 项目: Wurst7   文件: ModifyCmd.java
@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.");
}
 
源代码27 项目: Wurst7   文件: VClipCmd.java
@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());
}
 
源代码28 项目: Wurst7   文件: TpCmd.java
@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);
}
 
源代码29 项目: Wurst7   文件: RepairCmd.java
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;
}
 
源代码30 项目: Wurst7   文件: AnnoyCmd.java
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;
}