net.minecraft.client.render.Camera Java Examples

The following examples show how to use net.minecraft.client.render.Camera. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RenderUtils.java    From bleachhack-1.14 with GNU General Public License v3.0 6 votes vote down vote up
public static void offsetRender() {
	Camera camera = BlockEntityRenderDispatcher.INSTANCE.camera;
	Vec3d camPos = camera.getPos();
	GL11.glRotated(MathHelper.wrapDegrees(camera.getPitch()), 1, 0, 0);
	GL11.glRotated(MathHelper.wrapDegrees(camera.getYaw() + 180.0), 0, 1, 0);
	GL11.glTranslated(-camPos.x, -camPos.y, -camPos.z);
}
 
Example #2
Source File: RenderUtils.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public static void offsetRender() {
	Camera camera = BlockEntityRenderDispatcher.INSTANCE.camera;
	Vec3d camPos = camera.getPos();
	GL11.glRotated(MathHelper.wrapDegrees(camera.getPitch()), 1, 0, 0);
	GL11.glRotated(MathHelper.wrapDegrees(camera.getYaw() + 180.0), 0, 1, 0);
	GL11.glTranslated(-camPos.x, -camPos.y, -camPos.z);
}
 
Example #3
Source File: MixinGameRenderer.java    From bleachhack-1.14 with GNU General Public License v3.0 4 votes vote down vote up
@Inject(at = @At("HEAD"), method = "renderHand(Lnet/minecraft/client/render/Camera;F)V", cancellable = true)
private void renderHand(Camera camera_1, float float_1, CallbackInfo info) {
	Event3DRender event = new Event3DRender();
	BleachHack.eventBus.post(event);
	if (event.isCancelled()) info.cancel();
}
 
Example #4
Source File: MixinGameRenderer.java    From bleachhack-1.14 with GNU General Public License v3.0 4 votes vote down vote up
@Inject(at = @At("HEAD"), method = "renderHand(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/Camera;F)V", cancellable = true)
private void renderHand(MatrixStack matrixStack_1, Camera camera_1, float float_1, CallbackInfo info) {
	Event3DRender event = new Event3DRender();
	BleachHack.eventBus.post(event);
	if (event.isCancelled()) info.cancel();
}
 
Example #5
Source File: MixinGameRenderer.java    From bleachhack-1.14 with GNU General Public License v3.0 4 votes vote down vote up
@Inject(at = @At("HEAD"), method = "renderHand(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/Camera;F)V", cancellable = true)
private void renderHand(MatrixStack matrixStack_1, Camera camera_1, float float_1, CallbackInfo info) {
	Event3DRender event = new Event3DRender();
	BleachHack.eventBus.post(event);
	if (event.isCancelled()) info.cancel();
}
 
Example #6
Source File: ShapesRenderer.java    From fabric-carpet with MIT License 4 votes vote down vote up
public void render(Camera camera, float partialTick)
{
    IWorld iWorld = this.client.world;
    DimensionType dimensionType = iWorld.getDimension().getType();
    if (shapes.get(dimensionType) == null || shapes.get(dimensionType).isEmpty()) return;
    long currentTime = client.world.getTime();
    RenderSystem.disableTexture();
    RenderSystem.enableDepthTest();
    RenderSystem.depthFunc(515);
    RenderSystem.enableBlend();
    RenderSystem.defaultBlendFunc();
    //RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ZERO);
    //RenderSystem.shadeModel(7425);
    RenderSystem.shadeModel(GL11.GL_FLAT);
    RenderSystem.enableAlphaTest();
    RenderSystem.alphaFunc(GL11.GL_GREATER, 0.003f);
    RenderSystem.disableCull();
    RenderSystem.disableLighting();
    RenderSystem.depthMask(false);
    //RenderSystem.polygonOffset(-3f, -3f);
    //RenderSystem.enablePolygonOffset();
    //Entity entity = this.client.gameRenderer.getCamera().getFocusedEntity();

    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferBuilder = tessellator.getBuffer();

    // render
    double cameraX = camera.getPos().x;
    double cameraY = camera.getPos().y;
    double cameraZ = camera.getPos().z;

    synchronized (shapes)
    {
        shapes.get(dimensionType).long2ObjectEntrySet().removeIf(
                entry -> entry.getValue().isExpired(currentTime)
        );
        shapes.get(dimensionType).values().forEach(
                s ->
                {
                    if ( s.shouldRender(dimensionType))
                        s.renderFaces(tessellator, bufferBuilder, cameraX, cameraY, cameraZ, partialTick);
                }
        );
        //lines
        shapes.get(dimensionType).values().forEach(

                s -> {
                    if ( s.shouldRender(dimensionType))
                        s.renderLines(tessellator, bufferBuilder, cameraX, cameraY, cameraZ, partialTick);
                }
        );
    }
    RenderSystem.enableCull();
    RenderSystem.depthMask(true);
    RenderSystem.lineWidth(1.0F);
    RenderSystem.enableBlend();
    RenderSystem.defaultBlendFunc();
    RenderSystem.enableTexture();
    RenderSystem.shadeModel(7424);
}
 
Example #7
Source File: WorldRenderer_scarpetRenderMixin.java    From fabric-carpet with MIT License 4 votes vote down vote up
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/debug/DebugRenderer;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider$Immediate;DDD)V"))
private void renderScarpetThings(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, CallbackInfo ci)
{
    if (CarpetClient.shapes != null) CarpetClient.shapes.render(camera, tickDelta);
}