Search in sources :

Example 1 with AbstractClientPlayerEntity

use of net.minecraft.client.network.AbstractClientPlayerEntity in project meteor-crash-addon by AntiCope.

the class MessageLagger method sendLagWhisper.

private void sendLagWhisper() {
    List<AbstractClientPlayerEntity> players = mc.world.getPlayers();
    PlayerEntity player = players.get(new Random().nextInt(players.size()));
    String message = generateLagMessage();
    mc.player.sendChatMessage("/msg " + player.getGameProfile().getName() + " " + message);
}
Also used : Random(java.util.Random) AbstractClientPlayerEntity(net.minecraft.client.network.AbstractClientPlayerEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) AbstractClientPlayerEntity(net.minecraft.client.network.AbstractClientPlayerEntity)

Example 2 with AbstractClientPlayerEntity

use of net.minecraft.client.network.AbstractClientPlayerEntity in project canvas by vram-guild.

the class MixinFirstPersonRenderer method onApplyLightmap.

@Inject(at = @At("HEAD"), method = "applyLightmap")
private void onApplyLightmap(CallbackInfo ci) {
    final AbstractClientPlayerEntity player = client.player;
    ItemRenderContext.playerLightmap(client.world.getLightmapIndex(new BlockPos(player.x, player.y + (double) player.getStandingEyeHeight(), player.z), 0));
}
Also used : AbstractClientPlayerEntity(net.minecraft.client.network.AbstractClientPlayerEntity) BlockPos(net.minecraft.util.math.BlockPos) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 3 with AbstractClientPlayerEntity

use of net.minecraft.client.network.AbstractClientPlayerEntity in project ThonkUtil by LimeAppleBoat.

the class CustomElytraEntityModel method setAngles.

@Override
public void setAngles(T livingEntity, float f, float g, float h, float i, float j) {
    float k = 0.2617994F;
    float l = -0.2617994F;
    float m = 0.0F;
    float n = 0.0F;
    if (livingEntity.isFallFlying()) {
        float o = 1.0F;
        Vec3d vec3d = livingEntity.getVelocity();
        if (vec3d.y < 0.0D) {
            Vec3d vec3d2 = vec3d.normalize();
            o = 1.0F - (float) Math.pow(-vec3d2.y, 1.5D);
        }
        k = o * 0.34906584F + (1.0F - o) * k;
        l = o * -1.5707964F + (1.0F - o) * l;
    } else if (livingEntity.isInSneakingPose()) {
        k = 0.6981317F;
        l = -0.7853982F;
        m = 3.0F;
        n = 0.08726646F;
    }
    this.leftWing.pivotY = m;
    if (livingEntity instanceof AbstractClientPlayerEntity) {
        AbstractClientPlayerEntity o = (AbstractClientPlayerEntity) livingEntity;
        o.elytraPitch = (float) ((double) o.elytraPitch + (double) (k - o.elytraPitch) * 0.1D);
        o.elytraYaw = (float) ((double) o.elytraYaw + (double) (n - o.elytraYaw) * 0.1D);
        o.elytraRoll = (float) ((double) o.elytraRoll + (double) (l - o.elytraRoll) * 0.1D);
        this.leftWing.pitch = o.elytraPitch;
        this.leftWing.yaw = o.elytraYaw;
        this.leftWing.roll = o.elytraRoll;
    } else {
        this.leftWing.pitch = k;
        this.leftWing.roll = l;
        this.leftWing.yaw = n;
    }
    this.rightWing.yaw = -this.leftWing.yaw;
    this.rightWing.pivotY = this.leftWing.pivotY;
    this.rightWing.pitch = this.leftWing.pitch;
    this.rightWing.roll = -this.leftWing.roll;
}
Also used : AbstractClientPlayerEntity(net.minecraft.client.network.AbstractClientPlayerEntity) Vec3d(net.minecraft.util.math.Vec3d)

Example 4 with AbstractClientPlayerEntity

use of net.minecraft.client.network.AbstractClientPlayerEntity in project Client by MatHax.

the class Surround method onTick.

@EventHandler
private void onTick(TickEvent.Pre event) {
    renderBlocks.forEach(Scaffold.RenderBlock::tick);
    renderBlocks.removeIf(renderBlock -> renderBlock.ticks <= 0);
    if ((disableOnJump.get() && (mc.options.jumpKey.isPressed() || mc.player.input.jumping)) || (disableOnYChange.get() && mc.player.prevY < mc.player.getY())) {
        ChatUtils.sendMsg(hashCode(), "Surround", Formatting.DARK_RED, "You jumped, disabling...", Formatting.GRAY);
        toggle();
        return;
    }
    if ((centerKeyBind.get()).isPressed())
        PlayerUtils.centerPlayer();
    final BlockPos roundedPos = PlayerUtils.roundBlockPos(mc.player.getPos());
    if (onlyOnGround.get() && !mc.player.isOnGround() && roundedPos.getY() <= lastPos.getY())
        lastPos = PlayerUtils.roundBlockPos(mc.player.getPos());
    if (surroundInstanceDelay.passedMillis(timeToStart) && (mc.player.isOnGround() || !onlyOnGround.get())) {
        if (delay.get() != 0 && ticks++ % delay.get() != 0)
            return;
        if (!(Modules.get().get(Blink.class)).isActive() || !stayOnBlink.get()) {
            final AbstractClientPlayerEntity loc = mc.player;
            final BlockPos locRounded = PlayerUtils.roundBlockPos(loc.getPos());
            if (!lastPos.equals(loc.isOnGround() ? locRounded : loc.getBlockPos())) {
                if (onlyOnGround.get() || loc.getPos().y > lastPos.getY() + 1.5 || ((Math.floor(loc.getPos().x) != lastPos.getX() || Math.floor(loc.getPos().z) != lastPos.getZ()) && loc.getPos().y > lastPos.getY() + 0.75) || (!mc.world.getBlockState(lastPos).getMaterial().isReplaceable() && loc.getBlockPos() != lastPos)) {
                    toggle();
                    return;
                }
                if (!onlyOnGround.get() && locRounded.getY() <= lastPos.getY())
                    lastPos = locRounded;
            }
        }
        int blockIndex = getInvBlock().slot();
        if (blockIndex == -1)
            return;
        int prevSlot = mc.player.getInventory().selectedSlot;
        if (needsToPlace()) {
            for (BlockPos pos : getPositions()) {
                if (mc.world.getBlockState(pos).getMaterial().isReplaceable())
                    mc.player.getInventory().selectedSlot = blockIndex;
                if (!mc.world.isOutOfHeightLimit(pos.getY()) && canPlace(pos))
                    renderBlocks.add(renderBlockPool.get().set(pos));
                if (PlayerUtils.placeBlockMainHand(pos, oldPlacement.get(), blockIndex, rotate.get(), swing.get(), !onlyOnGround.get(), placeOnCrystal.get()) && delay.get() != 0) {
                    mc.player.getInventory().selectedSlot = prevSlot;
                    return;
                }
            }
            mc.player.getInventory().selectedSlot = prevSlot;
        }
    }
}
Also used : AbstractClientPlayerEntity(net.minecraft.client.network.AbstractClientPlayerEntity) BlockPos(net.minecraft.util.math.BlockPos) EventHandler(mathax.client.eventbus.EventHandler)

Example 5 with AbstractClientPlayerEntity

use of net.minecraft.client.network.AbstractClientPlayerEntity in project Enchanted-Bionics by Bubblie01.

the class FunnyItem method use.

@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
    if (world.isClient) {
        MinecraftClient client = MinecraftClient.getInstance();
        EntityRenderer<? super AbstractClientPlayerEntity> renderer = client.getEntityRenderDispatcher().getRenderer(client.player);
        PlayerEntityModel<AbstractClientPlayerEntity> playerEntityModel = ((PlayerEntityRenderer) (renderer)).getModel();
        this.playerEntityModel = playerEntityModel;
        (((PlayerLimbInterface) playerEntityModel)).setSpecificVisible(false, EntityModelPartNames.LEFT_ARM);
    }
    return super.use(world, user, hand);
}
Also used : PlayerEntityRenderer(net.minecraft.client.render.entity.PlayerEntityRenderer) MinecraftClient(net.minecraft.client.MinecraftClient) AbstractClientPlayerEntity(net.minecraft.client.network.AbstractClientPlayerEntity)

Aggregations

AbstractClientPlayerEntity (net.minecraft.client.network.AbstractClientPlayerEntity)11 PlayerEntity (net.minecraft.entity.player.PlayerEntity)4 ItemStack (net.minecraft.item.ItemStack)3 Identifier (net.minecraft.util.Identifier)3 CapeItem (com.jab125.thonkutil.api.CapeItem)2 MinecraftClient (net.minecraft.client.MinecraftClient)2 VertexConsumer (net.minecraft.client.render.VertexConsumer)2 PlayerEntityRenderer (net.minecraft.client.render.entity.PlayerEntityRenderer)2 MatrixStack (net.minecraft.client.util.math.MatrixStack)2 BlockPos (net.minecraft.util.math.BlockPos)2 SlotReference (dev.emi.trinkets.api.SlotReference)1 TrinketRenderer (dev.emi.trinkets.api.client.TrinketRenderer)1 BufferedImage (java.awt.image.BufferedImage)1 File (java.io.File)1 IOException (java.io.IOException)1 Random (java.util.Random)1 EventHandler (mathax.client.eventbus.EventHandler)1 BroomEntityModel (moriyashiine.bewitchment.api.client.model.BroomEntityModel)1 BroomEntity (moriyashiine.bewitchment.api.entity.BroomEntity)1 ContributorHornsModel (moriyashiine.bewitchment.client.model.ContributorHornsModel)1