use of net.minecraft.client.MinecraftClient in project sodium-fabric by CaffeineMC.
the class ChunkGraph method init.
private boolean init(BlockPos blockPos, Camera camera, Vec3d cameraPos, Frustum frustum, int frame, boolean spectator) {
MinecraftClient client = MinecraftClient.getInstance();
ObjectArrayFIFOQueue<ChunkGraphNode<T>> queue = this.iterationQueue;
boolean cull = client.chunkCullingEnabled;
ChunkGraphNode<T> node = this.getOrCreateNode(blockPos);
if (node != null) {
node.reset();
// Player is within bounds and inside a node
Set<Direction> openFaces = this.getOpenChunkFaces(blockPos);
if (openFaces.size() == 1) {
Vector3f vector3f = camera.getHorizontalPlane();
Direction direction = Direction.getFacing(vector3f.getX(), vector3f.getY(), vector3f.getZ()).getOpposite();
openFaces.remove(direction);
}
if (openFaces.isEmpty() && !spectator) {
this.visibleNodes.add(node);
} else {
if (spectator && this.world.getBlockState(blockPos).isFullOpaque(this.world, blockPos)) {
cull = false;
}
node.setRebuildFrame(frame);
queue.enqueue(node);
}
} else {
// Player is out-of-bounds
int y = blockPos.getY() > 0 ? 248 : 8;
int x = MathHelper.floor(cameraPos.x / 16.0D) * 16;
int z = MathHelper.floor(cameraPos.z / 16.0D) * 16;
List<ChunkGraphNode<T>> list = Lists.newArrayList();
for (int x2 = -this.renderDistance; x2 <= this.renderDistance; ++x2) {
for (int z2 = -this.renderDistance; z2 <= this.renderDistance; ++z2) {
ChunkGraphNode<T> chunk = this.getOrCreateNode(new BlockPos(x + (x2 << 4) + 8, y, z + (z2 << 4) + 8));
if (chunk == null) {
continue;
}
if (frustum.isVisible(chunk.getBoundingBox())) {
chunk.setRebuildFrame(frame);
chunk.reset();
list.add(chunk);
}
}
}
list.sort(Comparator.comparingDouble(o -> blockPos.getSquaredDistance(o.chunk.getOrigin().add(8, 8, 8))));
for (ChunkGraphNode<T> n : list) {
queue.enqueue(n);
}
}
return cull;
}
use of net.minecraft.client.MinecraftClient in project SeedcrackerX by 19MisterX98.
the class TimeMachine method poke.
public void poke(Phase phase) {
if (this.worldSeeds.size() == 1)
return;
this.isRunning = true;
while (phase != null && !this.shouldTerminate) {
if (phase != Phase.BIOMES && pokeStructureReduce()) {
phase = Phase.BIOMES;
continue;
} else if (phase == Phase.STRUCTURES) {
if (!pokeStructures())
break;
} else if (phase == Phase.LIFTING) {
if (!pokeStructures() && !pokeLifting())
break;
} else if (phase == Phase.PILLARS) {
if (!this.pokePillars())
break;
} else if (phase == Phase.BIOMES) {
if (!this.pokeBiomes())
break;
}
phase = phase.nextPhase();
}
if (this.worldSeeds.size() == 1 && !this.shouldTerminate) {
long seed = worldSeeds.stream().findFirst().get();
SeedCracker.entrypoints.forEach(entrypoint -> entrypoint.pushWorldSeed(seed));
MinecraftClient client = MinecraftClient.getInstance();
if (Config.get().databaseSubmits && client.getNetworkHandler().getPlayerList().size() > 10 && !client.getNetworkHandler().getConnection().isLocal()) {
Text text = Database.joinFakeServerForAuth();
if (text == null) {
Database.handleDatabaseCall(seed);
} else {
Log.error(text.getString());
}
}
}
}
use of net.minecraft.client.MinecraftClient in project canvas by vram-guild.
the class CanvasGlHelper method logMachineInfo.
private static void logMachineInfo(GLCapabilities caps) {
final Logger log = CanvasMod.LOG;
final MinecraftClient client = MinecraftClient.getInstance();
log.info("================== CANVAS RENDERER DEBUG INFORMATION ==================");
log.info(String.format(" Java: %s %dbit", System.getProperty("java.version"), client.is64Bit() ? 64 : 32));
log.info(String.format(" CPU: %s", GLX._getCpuInfo()));
log.info(String.format(" GPU: %s %s", GLX._getCapsString()), GLX._getLWJGLVersion());
log.info(String.format(" OpenGL: %s", GLX.getOpenGLVersionString()));
log.info(String.format(" GpuShader4: %s VboArb: %s VaoEnabled: %s VaoArb: %s", useGpuShader4 ? "Y" : "N", useVboArb ? "Y" : "N", vaoEnabled ? "Y" : "N", useVaoArb ? "Y" : "N"));
log.info(" (This message can be disabled by configuring logMachineInfo = false.)");
log.info("========================================================================");
}
use of net.minecraft.client.MinecraftClient in project canvas by vram-guild.
the class WorldDataManager method updateLight.
public static void updateLight(float tick, float flicker) {
final MinecraftClient client = MinecraftClient.getInstance();
final ClientWorld world = client.world;
if (world != null) {
final boolean hasSkyLight = world.dimension.hasSkyLight();
final boolean nightVision = client.player.hasStatusEffect(StatusEffects.NIGHT_VISION);
UNIFORM_DATA[DIMENSION_ID] = world.dimension.getType().getRawId();
UNIFORM_DATA[HAS_SKYLIGHT] = hasSkyLight ? 1 : 0;
UNIFORM_DATA[AMBIENT_INTENSITY] = world.method_23783(1.0F);
UNIFORM_DATA[EFFECTIVE_INTENSITY] = hasSkyLight && !nightVision ? UNIFORM_DATA[AMBIENT_INTENSITY] : 1;
UNIFORM_DATA[MOON_SIZE] = world.getMoonSize();
UNIFORM_DATA[NIGHT_VISION_ACTIVE] = nightVision ? 1 : 0;
final float fluidModifier = client.player.method_3140();
if (nightVision) {
UNIFORM_DATA[WORLD_EFFECT_MODIFIER] = GameRenderer.getNightVisionStrength(client.player, tick);
} else if (fluidModifier > 0.0F && client.player.hasStatusEffect(StatusEffects.CONDUIT_POWER)) {
UNIFORM_DATA[WORLD_EFFECT_MODIFIER] = fluidModifier;
} else {
UNIFORM_DATA[WORLD_EFFECT_MODIFIER] = 0.0F;
}
}
}
use of net.minecraft.client.MinecraftClient in project meteor-client by MeteorDevelopment.
the class PlayerListHudMixin method renderLatencyIcon.
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;renderLatencyIcon(Lnet/minecraft/client/util/math/MatrixStack;IIILnet/minecraft/client/network/PlayerListEntry;)V"))
protected void renderLatencyIcon(PlayerListHud self, MatrixStack matrices, int width, int x, int y, PlayerListEntry entry) {
BetterTab betterTab = Modules.get().get(BetterTab.class);
if (betterTab.isActive() && betterTab.accurateLatency.get()) {
MinecraftClient mc = MinecraftClient.getInstance();
TextRenderer textRenderer = mc.textRenderer;
int latency = Utils.clamp(entry.getLatency(), 0, 9999);
int color = latency < 150 ? 0x00E970 : latency < 300 ? 0xE7D020 : 0xD74238;
String text = latency + "ms";
textRenderer.drawWithShadow(matrices, text, (float) x + width - textRenderer.getWidth(text), (float) y, color);
} else {
renderLatencyIcon(matrices, width, x, y, entry);
}
}
Aggregations