Java Code Examples for net.minecraft.client.font.TextRenderer#drawWithShadow()

The following examples show how to use net.minecraft.client.font.TextRenderer#drawWithShadow() . 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: EditBlockScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
private void renderQuestionMark(MatrixStack matrixStack, int x, int y,
	boolean large)
{
	GL11.glPushMatrix();
	
	GL11.glTranslated(x, y, 0);
	if(large)
		GL11.glScaled(2, 2, 2);
	
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	TextRenderer tr = WurstClient.MC.textRenderer;
	tr.drawWithShadow(matrixStack, "?", 3, 2, 0xf0f0f0);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	
	GL11.glPopMatrix();
}
 
Example 2
Source File: BlockComponent.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
private void renderQuestionMark(MatrixStack matrixStack, int x, int y,
	boolean large)
{
	GL11.glPushMatrix();
	
	GL11.glTranslated(x, y, 0);
	if(large)
		GL11.glScaled(2, 2, 2);
	
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	TextRenderer tr = WurstClient.MC.textRenderer;
	tr.drawWithShadow(matrixStack, "?", 3, 2, 0xf0f0f0);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_BLEND);
	
	GL11.glPopMatrix();
}
 
Example 3
Source File: Window.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void render(int mX, int mY) {
	TextRenderer textRend = MinecraftClient.getInstance().textRenderer;
	
	if (dragging) {
		x2 = (x2 - x1) + mX - dragOffX;
		y2 = (y2 - y1) + mY - dragOffY;
		x1 = mX - dragOffX;
		y1 = mY - dragOffY;
	}
	
	drawBar(mX, mY, textRend);
	
	for (WindowButton w: buttons) {
		int bx1 = x1 + w.x1;
		int by1 = y1 + w.y1;
		int bx2 = x1 + w.x2;
		int by2 = y1 + w.y2;
		
		Screen.fill(bx1, by1, bx2 - 1, by2 - 1, 0xffb0b0b0);
		Screen.fill(bx1 + 1, by1 + 1, bx2, by2, 0xff000000);
		Screen.fill(bx1 + 1, by1 + 1, bx2 - 1, by2 - 1,
				selected && mX >= bx1 && mX <= bx2 && mY >= by1 && mY <= by2 ? 0xff959595 : 0xff858585);
		textRend.drawWithShadow(w.text, bx1 + (bx2 - bx1) / 2 - textRend.getStringWidth(w.text) / 2, by1 + (by2 - by1) / 2 - 4, -1);
	}
	
	/* window icon */
	if (icon != null && selected) {
		GL11.glPushMatrix();
		GL11.glScaled(0.55, 0.55, 1);
		GuiLighting.enable();
		MinecraftClient.getInstance().getItemRenderer().renderGuiItem(icon, (int)((x1 + 3) * 1/0.55), (int)((y1 + 3) * 1/0.55));
		GL11.glPopMatrix();
	}
	
	/* window title */
	textRend.drawWithShadow(title, x1 + (icon == null  || !selected ? 4 : 15), y1 + 3, -1);
}
 
Example 4
Source File: Window.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void render(MatrixStack matrix, int mX, int mY) {
	TextRenderer textRend = MinecraftClient.getInstance().textRenderer;
	
	if (dragging) {
		x2 = (x2 - x1) + mX - dragOffX;
		y2 = (y2 - y1) + mY - dragOffY;
		x1 = mX - dragOffX;
		y1 = mY - dragOffY;
	}
	
	drawBar(matrix, mX, mY, textRend);
	
	for (WindowButton w: buttons) {
		int bx1 = x1 + w.x1;
		int by1 = y1 + w.y1;
		int bx2 = x1 + w.x2;
		int by2 = y1 + w.y2;
		
		Screen.fill(matrix, bx1, by1, bx2 - 1, by2 - 1, 0xffb0b0b0);
		Screen.fill(matrix, bx1 + 1, by1 + 1, bx2, by2, 0xff000000);
		Screen.fill(matrix, bx1 + 1, by1 + 1, bx2 - 1, by2 - 1,
				selected && mX >= bx1 && mX <= bx2 && mY >= by1 && mY <= by2 ? 0xff959595 : 0xff858585);
		textRend.drawWithShadow(matrix, w.text, bx1 + (bx2 - bx1) / 2 - textRend.getWidth(w.text) / 2, by1 + (by2 - by1) / 2 - 4, -1);
	}
	
	/* window icon */
	if (icon != null && selected) {
		GL11.glPushMatrix();
		GL11.glScaled(0.55, 0.55, 1);
		DiffuseLighting.enableGuiDepthLighting();
		MinecraftClient.getInstance().getItemRenderer().renderGuiItemIcon(icon, (int)((x1 + 3) * 1/0.55), (int)((y1 + 3) * 1/0.55));
		GL11.glPopMatrix();
	}
	
	/* window title */
	textRend.drawWithShadow(matrix, title, x1 + (icon == null || !selected || icon.getItem() == Items.AIR ? 4 : 15), y1 + 3, -1);
}
 
Example 5
Source File: Window.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void render(int mX, int mY) {
	TextRenderer textRend = MinecraftClient.getInstance().textRenderer;
	
	if (dragging) {
		x2 = (x2 - x1) + mX - dragOffX;
		y2 = (y2 - y1) + mY - dragOffY;
		x1 = mX - dragOffX;
		y1 = mY - dragOffY;
	}
	
	drawBar(mX, mY, textRend);
	
	for (WindowButton w: buttons) {
		int bx1 = x1 + w.x1;
		int by1 = y1 + w.y1;
		int bx2 = x1 + w.x2;
		int by2 = y1 + w.y2;
		
		Screen.fill(bx1, by1, bx2 - 1, by2 - 1, 0xffb0b0b0);
		Screen.fill(bx1 + 1, by1 + 1, bx2, by2, 0xff000000);
		Screen.fill(bx1 + 1, by1 + 1, bx2 - 1, by2 - 1,
				selected && mX >= bx1 && mX <= bx2 && mY >= by1 && mY <= by2 ? 0xff959595 : 0xff858585);
		textRend.drawWithShadow(w.text, bx1 + (bx2 - bx1) / 2 - textRend.getStringWidth(w.text) / 2, by1 + (by2 - by1) / 2 - 4, -1);
	}
	
	/* window icon */
	if (icon != null && selected) {
		GL11.glPushMatrix();
		GL11.glScaled(0.55, 0.55, 1);
		DiffuseLighting.enableGuiDepthLighting();
		MinecraftClient.getInstance().getItemRenderer().renderGuiItem(icon, (int)((x1 + 3) * 1/0.55), (int)((y1 + 3) * 1/0.55));
		GL11.glPopMatrix();
	}
	
	/* window title */
	textRend.drawWithShadow(title, x1 + (icon == null || !selected || icon.getItem() == Items.AIR ? 4 : 15), y1 + 3, -1);
}
 
Example 6
Source File: EditBlockListScreen.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
private String renderIconAndGetName(MatrixStack matrixStack,
	ItemStack stack, int x, int y, boolean large)
{
	if(stack.isEmpty())
	{
		GL11.glPushMatrix();
		GL11.glTranslated(x, y, 0);
		if(large)
			GL11.glScaled(1.5, 1.5, 1.5);
		else
			GL11.glScaled(0.75, 0.75, 0.75);
		
		DiffuseLighting.enable();
		mc.getItemRenderer().renderInGuiWithOverrides(
			new ItemStack(Blocks.GRASS_BLOCK), 0, 0);
		DiffuseLighting.disable();
		GL11.glPopMatrix();
		
		GL11.glPushMatrix();
		GL11.glTranslated(x, y, 0);
		if(large)
			GL11.glScaled(2, 2, 2);
		GL11.glDisable(GL11.GL_DEPTH_TEST);
		TextRenderer fr = mc.textRenderer;
		fr.drawWithShadow(matrixStack, "?", 3, 2, 0xf0f0f0);
		GL11.glEnable(GL11.GL_DEPTH_TEST);
		GL11.glPopMatrix();
		
		return "\u00a7ounknown block\u00a7r";
		
	}else
	{
		GL11.glPushMatrix();
		GL11.glTranslated(x, y, 0);
		if(large)
			GL11.glScaled(1.5, 1.5, 1.5);
		else
			GL11.glScaled(0.75, 0.75, 0.75);
		
		DiffuseLighting.enable();
		mc.getItemRenderer().renderInGuiWithOverrides(stack, 0, 0);
		DiffuseLighting.disable();
		
		GL11.glPopMatrix();
		
		return stack.getName().getString();
	}
}
 
Example 7
Source File: EditItemListScreen.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
private String renderIconAndGetName(MatrixStack matrixStack,
	ItemStack stack, int x, int y, boolean large)
{
	if(stack.isEmpty())
	{
		GL11.glPushMatrix();
		GL11.glTranslated(x, y, 0);
		if(large)
			GL11.glScaled(1.5, 1.5, 1.5);
		else
			GL11.glScaled(0.75, 0.75, 0.75);
		
		DiffuseLighting.enable();
		mc.getItemRenderer().renderInGuiWithOverrides(
			new ItemStack(Blocks.GRASS_BLOCK), 0, 0);
		DiffuseLighting.disable();
		GL11.glPopMatrix();
		
		GL11.glPushMatrix();
		GL11.glTranslated(x, y, 0);
		if(large)
			GL11.glScaled(2, 2, 2);
		GL11.glDisable(GL11.GL_DEPTH_TEST);
		TextRenderer fr = mc.textRenderer;
		fr.drawWithShadow(matrixStack, "?", 3, 2, 0xf0f0f0);
		GL11.glEnable(GL11.GL_DEPTH_TEST);
		GL11.glPopMatrix();
		
		return "\u00a7ounknown item\u00a7r";
		
	}else
	{
		GL11.glPushMatrix();
		GL11.glTranslated(x, y, 0);
		if(large)
			GL11.glScaled(1.5, 1.5, 1.5);
		else
			GL11.glScaled(0.75, 0.75, 0.75);
		
		DiffuseLighting.enable();
		mc.getItemRenderer().renderInGuiWithOverrides(stack, 0, 0);
		DiffuseLighting.disable();
		
		GL11.glPopMatrix();
		
		return stack.getName().getString();
	}
}