net.minecraft.util.math.Matrix4f Java Examples

The following examples show how to use net.minecraft.util.math.Matrix4f. 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: SpaceRaceScreen.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
private static void fillSolid(Matrix4f matrix, int x1, int y1, int x2, int y2, int color) {
    int j;
    if (x1 < x2) {
        j = x1;
        x1 = x2;
        x2 = j;
    }

    if (y1 < y2) {
        j = y1;
        y1 = y2;
        y2 = j;
    }

    float f = (float) (color >> 24 & 255) / 255.0F;
    float g = (float) (color >> 16 & 255) / 255.0F;
    float h = (float) (color >> 8 & 255) / 255.0F;
    float k = (float) (color & 255) / 255.0F;
    BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
    RenderSystem.disableBlend();
    RenderSystem.disableTexture();
    RenderSystem.defaultBlendFunc();
    bufferBuilder.begin(7, VertexFormats.POSITION_COLOR);
    bufferBuilder.vertex(matrix, (float) x1, (float) y2, 0.0F).color(g, h, k, f).next();
    bufferBuilder.vertex(matrix, (float) x2, (float) y2, 0.0F).color(g, h, k, f).next();
    bufferBuilder.vertex(matrix, (float) x2, (float) y1, 0.0F).color(g, h, k, f).next();
    bufferBuilder.vertex(matrix, (float) x1, (float) y1, 0.0F).color(g, h, k, f).next();
    bufferBuilder.end();
    BufferRenderer.draw(bufferBuilder);
    RenderSystem.enableTexture();
}
 
Example #2
Source File: EntityRendererMixin.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Copy of renderLabelIfPresent() since calling the original would result in
 * an infinite loop. Also makes it easier to modify.
 */
protected void wurstRenderLabelIfPresent(T entity, Text text,
	MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider,
	int i)
{
	double d = this.dispatcher.getSquaredDistanceToCamera(entity);
	
	if(d > 4096)
		return;
	
	NameTagsHack nameTagsHack = WurstClient.INSTANCE.getHax().nameTagsHack;
	
	boolean bl = !entity.isSneaky() || nameTagsHack.isEnabled();
	float f = entity.getHeight() + 0.5F;
	int j = "deadmau5".equals(text.getString()) ? -10 : 0;
	
	matrixStack.push();
	matrixStack.translate(0.0D, f, 0.0D);
	matrixStack.multiply(this.dispatcher.getRotation());
	
	float scale = 0.025F;
	if(nameTagsHack.isEnabled())
	{
		double distance = WurstClient.MC.player.distanceTo(entity);
		
		if(distance > 10)
			scale *= distance / 10;
	}
	
	matrixStack.scale(-scale, -scale, scale);
	
	Matrix4f matrix4f = matrixStack.peek().getModel();
	float g = WurstClient.MC.options.getTextBackgroundOpacity(0.25F);
	int k = (int)(g * 255.0F) << 24;
	
	TextRenderer textRenderer = this.getFontRenderer();
	float h = -textRenderer.getWidth(text) / 2;
	
	textRenderer.draw(text, h, j, 553648127, false, matrix4f,
		vertexConsumerProvider, bl, k, i);
	
	if(bl)
		textRenderer.draw(text, h, j, -1, false, matrix4f,
			vertexConsumerProvider, false, 0, i);
	
	matrixStack.pop();
}
 
Example #3
Source File: FrustrumCheck.java    From MineLittlePony with MIT License 4 votes vote down vote up
public FrustrumCheck(EquineRenderManager<T, ?> render) {
    super(new Matrix4f(), new Matrix4f());
    renderer = render;
}