Jump to content

Recommended Posts

Posted

Sorry, I am using an old version (1.10.2), but I've seen this issue in other mods, 1.12 is similar in many ways, and I'm too lazy to update at the moment so... If it's absolutely required then let me know, I guess.

Using DrawHoveringText makes items drawn afterward appear darker, despite the use of push/pop matrices. Github for my mod is here: https://github.com/zane49er2/VMC but the relevant code is likely here:

// Page links/items
		for (int i = 0; i < bItems.size(); i++) {
			BookItem b = bItems.get(i);
			int Tx = (int) (b.x) + xScroll;
			int Ty = (int) (b.y) + yScroll;
			float selSpeed = 0.05f;

			// draw
			GlStateManager.pushMatrix();
			if (Tx >= left && Ty >= top && Tx <= left + GUIWidth - 36 * b.scale && (float) Ty <= top + GUIHeight - 36 * b.scale) {
				// selection detection
				if (mouseX > Tx && mouseY > Ty && mouseX < Tx + 36 * b.scale && mouseY < Ty + 36 * b.scale) {
					b.hovering = true;
					b.r += selSpeed * (b.rSel - b.r);
					b.g += selSpeed * (b.gSel - b.g);
					b.b += selSpeed * (b.bSel - b.b);
				} else {
					b.hovering = false;
					b.r += selSpeed * (b.rn - b.r);
					b.g += selSpeed * (b.gn - b.g);
					b.b += selSpeed * (b.bn - b.b);
				}

				this.mc.getTextureManager().bindTexture(texture);

				GlStateManager.enableBlend();
				GlStateManager.translate(Tx, Ty, 0);
				GlStateManager.color(b.r, b.g, b.b, 1.0F);
				float borderSize = 1f;
				switch (b.bgType) {
				case 0:
					borderSize = 2f;
					break;
				case 1:
					borderSize = 1.3f;
					break;
				case 2:
					borderSize = 1f;
					break;
				case 3:
					borderSize = 1.5f;
					break;
				}

				GlStateManager.scale(b.scale, b.scale, b.scale);
				this.drawTexturedModalRect(0, 0, 36 * b.bgType, GUIHeight, 36, 36);

				GlStateManager.disableLighting();
				GlStateManager.enableCull();

				GlStateManager.translate(36 / 2, 36 / 2, 0);
				GlStateManager.scale(borderSize, borderSize, borderSize);
				GlStateManager.translate(-16 / 2, -16 / 2, 0);

				this.itemRender.renderItemAndEffectIntoGUI(new ItemStack(b.item), 0, 0);
				GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
				GlStateManager.disableLighting();

			} else {
				b.hovering = false;
				// explode		
				int Px = (int) (b.x) + pxScroll;
				int Py = (int) (b.y) + pyScroll;

				if (Px >= left && Py >= top && Px <= left + GUIWidth - 36 * b.scale && (float) Py <= top + GUIHeight - 36 * b.scale) {
					for (int j = 0; j < (random.nextInt(100) + 15) * b.scale; j++) {
						BookSymbol s = new BookSymbol();
						s.u = (random.nextInt(5) * 16) + 170;
						s.v = random.nextInt(3) * 16;
						s.xv = (xScroll - pxScroll) * 10 + random.nextInt(50) - 25;
						s.yv = (yScroll - pyScroll) * 10 + random.nextInt(50) - 25;

						s.x = Px + random.nextInt((int) (36 * b.scale));
						s.y = Py + random.nextInt((int) (36 * b.scale));

						s.r = b.r;
						s.g = b.g;
						s.b = b.b;
						s.age = 1;
						s.noFadeIn = true;
						particles.add(s);
					}
				}
			}
			GlStateManager.popMatrix();
			// tooltip
			if (b.hovering) {
				List<String> j = new ArrayList<String>();
				j.add(b.name);
				GlStateManager.pushMatrix();
				drawHoveringText(j, mouseX, mouseY, fontRendererObj);
				GlStateManager.popMatrix();
			}

			// update previous scroll
			this.pxScroll = xScroll;
			this.pyScroll = yScroll;

		}

 

Lord Volkihar has requested that I send the following message to everyone who is gifted, intellectually or artistically:

We hope that some people could help us share an epic tale of lord Volkihar's achievements and magnificent life. we plan to do this through modern media such as books, games, and mods.

For lost details, we are looking for around 5 gallons of Cortexiphan, and some N.Z.T.(around 50 pills) also, if you happen to know how to create a gel with the same density as human flesh, but low viscosity and adhesion, recipes would be appreciated.

Posted

I'm not certain, but I think the matrix only applies to transformations (like translations, scaling, rotations). I'm not sure that the blending, colors and lighting are part of the matrix.

 

I would try to save all the blending, color and lighting settings before you change them, then restore them at the end and see if that fixes is.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Wow, that was the entire problem. I moved the lighting, cull, and blendfunction lines to the top and now it works.

Lord Volkihar has requested that I send the following message to everyone who is gifted, intellectually or artistically:

We hope that some people could help us share an epic tale of lord Volkihar's achievements and magnificent life. we plan to do this through modern media such as books, games, and mods.

For lost details, we are looking for around 5 gallons of Cortexiphan, and some N.Z.T.(around 50 pills) also, if you happen to know how to create a gel with the same density as human flesh, but low viscosity and adhesion, recipes would be appreciated.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.