2025-11-24 22:52:51 +03:00

43 lines
1.6 KiB
Java

/*
* Decompiled with CFR 0.152.
*/
package net.minecraft.client.renderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.CubeMap;
import net.minecraft.client.renderer.RenderPipelines;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.resources.Identifier;
public class PanoramaRenderer {
public static final Identifier PANORAMA_OVERLAY = Identifier.withDefaultNamespace("textures/gui/title/background/panorama_overlay.png");
private final Minecraft minecraft;
private final CubeMap cubeMap;
private float spin;
public PanoramaRenderer(CubeMap cubeMap) {
this.cubeMap = cubeMap;
this.minecraft = Minecraft.getInstance();
}
public void render(GuiGraphics graphics, int width, int height, boolean shouldSpin) {
if (shouldSpin) {
float a = this.minecraft.getDeltaTracker().getRealtimeDeltaTicks();
float delta = (float)((double)a * this.minecraft.options.panoramaSpeed().get());
this.spin = PanoramaRenderer.wrap(this.spin + delta * 0.1f, 360.0f);
}
this.cubeMap.render(this.minecraft, 10.0f, -this.spin);
graphics.blit(RenderPipelines.GUI_TEXTURED, PANORAMA_OVERLAY, 0, 0, 0.0f, 0.0f, width, height, 16, 128, 16, 128);
}
private static float wrap(float value, float limit) {
return value > limit ? value - limit : value;
}
public void registerTextures(TextureManager textureManager) {
this.cubeMap.registerTextures(textureManager);
}
}