use of net.minecraft.client.network.ClientPlayerEntity in project tanuki by AntiCope.
the class AntiCrystalPhase method onTick.
@EventHandler
private void onTick(TickEvent.Pre event) {
ClientPlayerEntity p = mc.player;
double blocks = clipDistance.get();
if (!p.isOnGround())
return;
if (mc.options.forwardKey.isPressed()) {
Vec3d forward = Vec3d.fromPolar(0, p.getYaw());
p.updatePosition(p.getX() + forward.x * blocks, p.getY(), p.getZ() + forward.z * blocks);
}
if (mc.options.backKey.isPressed()) {
Vec3d forward = Vec3d.fromPolar(0, p.getYaw() - 180);
p.updatePosition(p.getX() + forward.x * blocks, p.getY(), p.getZ() + forward.z * blocks);
}
if (mc.options.leftKey.isPressed()) {
Vec3d forward = Vec3d.fromPolar(0, p.getYaw() - 90);
p.updatePosition(p.getX() + forward.x * blocks, p.getY(), p.getZ() + forward.z * blocks);
}
if (mc.options.rightKey.isPressed()) {
Vec3d forward = Vec3d.fromPolar(0, p.getYaw() - 270);
p.updatePosition(p.getX() + forward.x * blocks, p.getY(), p.getZ() + forward.z * blocks);
}
if (mc.options.jumpKey.isPressed()) {
p.updatePosition(p.getX(), p.getY() + 0.05, p.getZ());
}
if (mc.options.sneakKey.isPressed()) {
p.updatePosition(p.getX(), p.getY() - 0.05, p.getZ());
}
}
use of net.minecraft.client.network.ClientPlayerEntity in project EarthMCEssentials by EarthMC-Stats.
the class EarthMCAPI method getNearby.
public static CompletableFuture<JsonArray> getNearby(int xBlocks, int zBlocks) {
return CompletableFuture.supplyAsync(() -> {
try {
MinecraftClient client = MinecraftClient.getInstance();
ClientPlayerEntity player = client.player;
if (player != null) {
if (!player.getEntityWorld().getDimension().isBedWorking())
return new JsonArray();
JsonArray array = (JsonArray) new JsonParser().parse(getURL(config.api.main.domain() + config.api.routes.nearby + (int) player.getX() + "/" + (int) player.getZ() + "/" + xBlocks + "/" + zBlocks));
for (int i = 0; i < array.size(); i++) {
JsonObject currentObj = (JsonObject) array.get(i);
if (currentObj.get("name").getAsString().equals(client.player.getName().asString()))
array.remove(i);
}
return array;
} else
return EarthMCEssentials.instance().getNearbyPlayers();
} catch (APIException e) {
MsgUtils.sendDebugMessage(e.getMessage(), e);
return EarthMCEssentials.instance().getNearbyPlayers();
}
});
}
use of net.minecraft.client.network.ClientPlayerEntity in project Hypnotic-Client by Hypnotic-Development.
the class RenderUtils method renderGuiItemOverlay.
public static void renderGuiItemOverlay(TextRenderer renderer, ItemStack stack, float x, float y, float scale, @Nullable String countLabel) {
if (!stack.isEmpty()) {
MatrixStack matrixStack = new MatrixStack();
if (stack.getCount() != 1 || countLabel != null) {
String string = countLabel == null ? String.valueOf(stack.getCount()) : countLabel;
matrixStack.translate(0.0D, 0.0D, (double) (mc.getItemRenderer().zOffset + 200.0F));
VertexConsumerProvider.Immediate immediate = VertexConsumerProvider.immediate(Tessellator.getInstance().getBuffer());
renderer.draw(string, (float) (x + 19 - 2 - renderer.getWidth(string)), (float) (y + 6 + 3), 16777215, true, matrixStack.peek().getPositionMatrix(), immediate, false, 0, 15728880);
immediate.draw();
}
if (stack.isItemBarVisible()) {
RenderSystem.disableDepthTest();
RenderSystem.disableTexture();
RenderSystem.disableBlend();
int i = stack.getItemBarStep();
int j = stack.getItemBarColor();
fill(matrixStack, x + 2, y + 13, x + 2 + 13, y + 13 + 2, 0xff000000);
fill(matrixStack, x + 2, y + 13, x + 2 + i, y + 13 + 1, new Color(j >> 16 & 255, j >> 8 & 255, j & 255, 255).getRGB());
RenderSystem.enableBlend();
RenderSystem.enableTexture();
RenderSystem.enableDepthTest();
}
ClientPlayerEntity clientPlayerEntity = mc.player;
float f = clientPlayerEntity == null ? 0.0F : clientPlayerEntity.getItemCooldownManager().getCooldownProgress(stack.getItem(), MinecraftClient.getInstance().getTickDelta());
if (f > 0.0F) {
RenderSystem.disableDepthTest();
RenderSystem.disableTexture();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
Tessellator tessellator2 = Tessellator.getInstance();
BufferBuilder bufferBuilder2 = tessellator2.getBuffer();
renderGuiQuad(bufferBuilder2, x, y + MathHelper.floor(16.0F * (1.0F - f)), 16, MathHelper.ceil(16.0F * f), 255, 255, 255, 127);
RenderSystem.enableTexture();
RenderSystem.enableDepthTest();
}
}
}
use of net.minecraft.client.network.ClientPlayerEntity in project Hypnotic-Client by Hypnotic-Development.
the class RenderUtils method getCrosshairVector.
public static Vec3d getCrosshairVector() {
ClientPlayerEntity player = mc.player;
float f = 0.017453292F;
float pi = (float) Math.PI;
assert player != null;
float f1 = MathHelper.cos(-player.getYaw() * f - pi);
float f2 = MathHelper.sin(-player.getYaw() * f - pi);
float f3 = -MathHelper.cos(-player.getPitch() * f);
float f4 = MathHelper.sin(-player.getPitch() * f);
return new Vec3d(f2 * f3, f4, f1 * f3).add(mc.player.getX(), mc.player.getY() + 1.5, mc.player.getZ());
}
use of net.minecraft.client.network.ClientPlayerEntity in project Hypnotic-Client by Hypnotic-Development.
the class PlayerUtils method getDistanceToGround.
public static float getDistanceToGround() {
if (mc.player.verticalCollision && mc.player.isOnGround()) {
return 0.0F;
}
ClientPlayerEntity e = mc.player;
for (float a = (float) e.getY(); a > 0.0F; a -= 1.0F) {
int[] stairs = { 53, 67, 108, 109, 114, 128, 134, 135, 136, 156, 163, 164, 180 };
int[] exemptIds = { 6, 27, 28, 30, 31, 32, 37, 38, 39, 40, 50, 51, 55, 59, 63, 65, 66, 68, 69, 70, 72, 75, 76, 77, 83, 92, 93, 94, 104, 105, 106, 115, 119, 131, 132, 143, 147, 148, 149, 150, 157, 171, 175, 176, 177 };
BlockState block = mc.world.getBlockState(new BlockPos(e.getX(), a - 1.0F, e.getZ()));
if (!(block.getBlock() instanceof AirBlock)) {
if ((Block.getRawIdFromState(block) == 44) || (Block.getRawIdFromState(block) == 126)) {
return (float) (e.getY() - a - 0.5D) < 0.0F ? 0.0F : (float) (e.getY() - a - 0.5D);
}
int[] arrayOfInt1;
int j = (arrayOfInt1 = stairs).length;
for (int i = 0; i < j; i++) {
int id = arrayOfInt1[i];
if (Block.getRawIdFromState(block) == id) {
return (float) (e.getY() - a - 1.0D) < 0.0F ? 0.0F : (float) (e.getY() - a - 1.0D);
}
}
j = (arrayOfInt1 = exemptIds).length;
for (int i = 0; i < j; i++) {
int id = arrayOfInt1[i];
if (Block.getRawIdFromState(block) == id) {
return (float) (e.getY() - a) < 0.0F ? 0.0F : (float) (e.getY() - a);
}
}
return (float) (e.getY() - a + block.getBlock().getMaxHorizontalModelOffset() - 1.0D);
}
}
return 0.0F;
}
Aggregations