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);
}
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));
}
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;
}
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;
}
}
}
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);
}
Aggregations