use of net.minecraft.client.gui.widget.Widget in project Chisel by Chisel-Team.
the class GuiChisel method drawButtonTooltips.
protected void drawButtonTooltips(MatrixStack matrixStack, int mx, int my) {
for (Widget button : buttons) {
if (button.isMouseOver(mx, my) && button instanceof ButtonChiselMode) {
String unloc = ((ButtonChiselMode) button).getMode().getUnlocName();
List<ITextComponent> ttLines = Lists.newArrayList(new TranslationTextComponent(unloc), new TranslationTextComponent(unloc + ".desc").mergeStyle(TextFormatting.GRAY));
GuiUtils.drawHoveringText(matrixStack, ttLines, mx - guiLeft, my - guiTop, width - guiLeft, height - guiTop, -1, font);
}
}
}
use of net.minecraft.client.gui.widget.Widget in project pufferfish-minecraft-mod by Jacob1225.
the class ArcadeMachineScreen method render.
@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
this.renderBackground(matrixStack);
super.render(matrixStack, mouseX, mouseY, partialTicks);
this.renderTooltip(matrixStack, mouseX, mouseY);
for (Widget button : buttons) {
button.render(matrixStack, mouseX, mouseY, partialTicks);
}
}
use of net.minecraft.client.gui.widget.Widget in project Telepads2016 by ArtixAllMighty.
the class TeleportScreen method mouseScrolled.
@Override
public boolean mouseScrolled(double mouseX, double mouseY, double mouseScroll) {
int index = buttons.size() > 0 ? buttons.size() - 1 : 0;
Widget last = buttons.get(index);
Widget first = buttons.get(0);
int forsee_bottom_limit = (int) (last.y + last.getHeight() + (mouseScroll * 16));
int bottom_limit = height - START_Y - last.getHeight();
int forsee_top_limit = (int) (first.y - 15 + mouseScroll * 16);
int top_limit = GAP + START_Y;
// scrolling up
if (mouseScroll < 0.0 && forsee_bottom_limit < bottom_limit)
return super.mouseScrolled(mouseX, mouseY, mouseScroll);
// down
if (mouseScroll > 0.0 && forsee_top_limit > top_limit)
return super.mouseScrolled(mouseX, mouseY, mouseScroll);
move(mouseScroll);
return super.mouseScrolled(mouseX, mouseY, mouseScroll);
}
use of net.minecraft.client.gui.widget.Widget in project BoundingBoxOutlineReloaded by irtimaled.
the class MixinOptionsScreen method initGui.
@Inject(method = "init", at = @At("RETURN"))
private void initGui(CallbackInfo ci) {
// shuffle middle buttons up by 12 px to make space
int top = this.height / 6 + 42;
int bottom = this.height / 6 + 168;
for (Widget button : buttons) {
if (button.y >= top && button.y < bottom)
button.y -= 12;
}
SettingsScreenButton button = new SettingsScreenButton(this.width / 2 - 155, top + 84, 150, "BBOR", this);
this.buttons.add(this.buttons.size() - 1, button);
this.children.add(this.children.size() - 1, button);
}
use of net.minecraft.client.gui.widget.Widget in project Mekanism by mekanism.
the class GuiMekanism method renderLabels.
@Override
protected void renderLabels(@Nonnull MatrixStack matrix, int mouseX, int mouseY) {
matrix.translate(0, 0, 300);
RenderSystem.translatef(-leftPos, -topPos, 0);
children().stream().filter(c -> c instanceof GuiElement).forEach(c -> ((GuiElement) c).onDrawBackground(matrix, mouseX, mouseY, MekanismRenderer.getPartialTick()));
RenderSystem.translatef(leftPos, topPos, 0);
drawForegroundText(matrix, mouseX, mouseY);
int xAxis = mouseX - leftPos;
int yAxis = mouseY - topPos;
// first render general foregrounds
maxZOffset = 200;
int zOffset = 200;
for (Widget widget : this.buttons) {
if (widget instanceof GuiElement) {
matrix.pushPose();
((GuiElement) widget).onRenderForeground(matrix, mouseX, mouseY, zOffset, zOffset);
matrix.popPose();
}
}
// now render overlays in reverse-order (i.e. back to front)
zOffset = maxZOffset;
for (LRU<GuiWindow>.LRUIterator iter = getWindowsDescendingIterator(); iter.hasNext(); ) {
GuiWindow overlay = iter.next();
zOffset += 150;
matrix.pushPose();
overlay.onRenderForeground(matrix, mouseX, mouseY, zOffset, zOffset);
if (iter.hasNext()) {
// if this isn't the focused window, render a 'blur' effect over it
overlay.renderBlur(matrix);
}
matrix.popPose();
}
// then render tooltips, translating above max z offset to prevent clashing
GuiElement tooltipElement = getWindowHovering(mouseX, mouseY);
if (tooltipElement == null) {
for (int i = buttons.size() - 1; i >= 0; i--) {
Widget widget = buttons.get(i);
if (widget instanceof GuiElement && widget.isMouseOver(mouseX, mouseY)) {
tooltipElement = (GuiElement) widget;
break;
}
}
}
// translate forwards using RenderSystem. this should never have to happen as we do all the necessary translations with MatrixStacks,
// but Minecraft has decided to not fully adopt MatrixStacks for many crucial ContainerScreen render operations. should be re-evaluated
// when mc updates related logic on their end (IMPORTANT)
RenderSystem.translatef(0, 0, maxZOffset);
if (tooltipElement != null) {
tooltipElement.renderToolTip(matrix, xAxis, yAxis);
}
// render item tooltips
RenderSystem.translatef(-leftPos, -topPos, 0);
renderTooltip(matrix, mouseX, mouseY);
RenderSystem.translatef(leftPos, topPos, 0);
// IMPORTANT: additional hacky translation so held items render okay. re-evaluate as discussed above
RenderSystem.translatef(0, 0, 200);
}
Aggregations