use of com.lowdragmc.lowdraglib.utils.Position in project Multiblocked by Low-Drag-MC.
the class NumberContentWidget method drawHookBackground.
@Override
public void drawHookBackground(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
Position position = getPosition();
Size size = getSize();
if (contentTexture != null) {
contentTexture.draw(matrixStack, mouseX, mouseY, position.x + 1, position.y + 1, size.width - 2, size.height - 2);
}
matrixStack.pushPose();
matrixStack.scale(0.5f, 0.5f, 1);
RenderSystem.disableDepthTest();
String s = TextFormattingUtil.formatLongToCompactString(content.intValue(), 4);
FontRenderer fontRenderer = Minecraft.getInstance().font;
fontRenderer.drawShadow(matrixStack, s, (position.x + (size.width / 3f)) * 2 - fontRenderer.width(s) + 21, (position.y + (size.height / 3f) + 6) * 2, 0xFFFFFF);
matrixStack.popPose();
}
use of com.lowdragmc.lowdraglib.utils.Position in project Multiblocked by Low-Drag-MC.
the class ContentWidget method drawTick.
@OnlyIn(Dist.CLIENT)
public void drawTick(MatrixStack matrixStack) {
if (perTick) {
Position pos = getPosition();
Size size = getSize();
matrixStack.pushPose();
RenderSystem.disableDepthTest();
matrixStack.translate(0, 0, 400);
matrixStack.scale(0.5f, 0.5f, 1);
String s = LocalizationUtils.format("multiblocked.gui.content.tips.per_tick_short");
int color = 0xFFFF00;
FontRenderer fontRenderer = Minecraft.getInstance().font;
fontRenderer.drawShadow(matrixStack, s, (pos.x + (size.width / 3f)) * 2 - fontRenderer.width(s) + 23, (pos.y + (size.height / 3f) + 6) * 2 - size.height + (chance == 1 ? 0 : 10), color);
matrixStack.popPose();
}
}
use of com.lowdragmc.lowdraglib.utils.Position in project Multiblocked by Low-Drag-MC.
the class ProgressWidget method drawInBackground.
@Override
@OnlyIn(Dist.CLIENT)
public void drawInBackground(@Nonnull MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
Position pos = getPosition();
Size size = getSize();
if (emptyBarArea != null) {
emptyBarArea.draw(matrixStack, mouseX, mouseY, pos.x, pos.y, size.width, size.height);
}
if (filledBarArea != null) {
if (progressSupplier == JEIProgress) {
lastProgressValue = progressSupplier.getAsDouble();
if (dynamicHoverTips != null) {
setHoverTooltips(dynamicHoverTips.apply(lastProgressValue));
}
}
filledBarArea.drawSubArea(matrixStack, pos.x, pos.y, (int) (size.width * (lastProgressValue < 0 ? 0 : lastProgressValue)), size.height, 0, 0, ((int) (size.width * (lastProgressValue < 0 ? 0 : lastProgressValue))) / (size.width * 1f), 1);
}
}
use of com.lowdragmc.lowdraglib.utils.Position in project Multiblocked by Low-Drag-MC.
the class ProgressCapabilityTrait method initSettingDialog.
@Override
protected void initSettingDialog(DialogWidget dialog, DraggableWidgetGroup slot) {
ImageWidget imageWidget = (ImageWidget) slot.widgets.get(0);
ButtonWidget setting = (ButtonWidget) slot.widgets.get(1);
ButtonWidget imageSelector = (ButtonWidget) new ButtonWidget(5, 65, width, height, new GuiTextureGroup(new ColorBorderTexture(1, -1), new ResourceTexture(texture).getSubTexture(0, 0, 1, 0.5)), null).setHoverTooltips("multiblocked.gui.tips.select_image");
dialog.addWidget(new TextFieldWidget(5, 25, 50, 15, null, s -> {
width = Integer.parseInt(s);
Size size = new Size(width, height);
slot.setSize(size);
imageWidget.setSize(size);
imageSelector.setSize(size);
setting.setSelfPosition(new Position(width - 8, 0));
}).setCurrentString(width + "").setNumbersOnly(1, 180).setHoverTooltips("multiblocked.gui.trait.set_width"));
dialog.addWidget(new TextFieldWidget(5, 45, 50, 15, null, s -> {
height = Integer.parseInt(s);
Size size = new Size(width, height);
slot.setSize(size);
imageWidget.setSize(size);
imageSelector.setSize(size);
setting.setSelfPosition(new Position(width - 8, 0));
}).setCurrentString(height + "").setNumbersOnly(1, 180).setHoverTooltips("multiblocked.gui.trait.set_height"));
dialog.addWidget(new SelectorWidget(5, 5, 50, 15, Arrays.stream(IO.VALUES).map(Enum::name).collect(Collectors.toList()), -1).setValue(capabilityIO.name()).setOnChanged(io -> {
capabilityIO = IO.valueOf(io);
imageWidget.setImage(new GuiTextureGroup(new ResourceTexture(texture).getSubTexture(0, 0, 1, 0.5), new ColorBorderTexture(1, getColorByIO(capabilityIO))));
}).setButtonBackground(ResourceBorderTexture.BUTTON_COMMON).setBackground(new ColorRectTexture(0xffaaaaaa)).setHoverTooltips("multiblocked.gui.trait.capability_io"));
dialog.addWidget(imageSelector);
imageSelector.setOnPressCallback(cd -> new ResourceTextureWidget(dialog.getParent().getGui().mainGroup, texture1 -> {
if (texture1 != null) {
texture = texture1.imageLocation.toString();
ResourceTexture resourceTexture = new ResourceTexture(texture).getSubTexture(0, 0, 1, 0.5);
imageSelector.setButtonTexture(new GuiTextureGroup(new ColorBorderTexture(1, -1), resourceTexture));
imageWidget.setImage(new GuiTextureGroup(resourceTexture, new ColorBorderTexture(1, getColorByIO(capabilityIO))));
}
}));
}
Aggregations