use of com.lowdragmc.lowdraglib.utils.Size in project Multiblocked by Low-Drag-MC.
the class PlayerCapabilityTrait method initSettingDialog.
protected void initSettingDialog(DialogWidget dialog, DraggableWidgetGroup slot) {
ImageWidget imageWidget = (ImageWidget) slot.widgets.get(0);
ButtonWidget setting = (ButtonWidget) slot.widgets.get(1);
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);
((TextTexture) imageWidget.getImage()).setWidth(width);
setting.setSelfPosition(new Position(width - 8, 0));
}).setCurrentString(width + "").setNumbersOnly(10, 180).setHoverTooltips("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);
setting.setSelfPosition(new Position(width - 8, 0));
}).setCurrentString(height + "").setNumbersOnly(10, 180).setHoverTooltips("set height"));
dialog.addWidget(new SelectorWidget(5, 5, 50, 15, Arrays.stream(TextTexture.TextType.values()).map(Enum::name).collect(Collectors.toList()), -1).setValue(textType.name()).setOnChanged(io -> {
textType = TextTexture.TextType.valueOf(io);
((TextTexture) imageWidget.getImage()).setType(textType);
}).setButtonBackground(ResourceBorderTexture.BUTTON_COMMON).setBackground(new ColorRectTexture(0xffaaaaaa)).setHoverTooltips("TextType"));
}
use of com.lowdragmc.lowdraglib.utils.Size in project Multiblocked by Low-Drag-MC.
the class ContentWidget method drawInBackground.
@Override
@OnlyIn(Dist.CLIENT)
public final void drawInBackground(@Nonnull MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
Position position = getPosition();
Size size = getSize();
if (background != null) {
background.draw(stack, mouseX, mouseY, position.x, position.y, size.width, size.height);
}
drawHookBackground(stack, mouseX, mouseY, partialTicks);
super.drawInBackground(stack, mouseX, mouseY, partialTicks);
drawChance(stack);
drawTick(stack);
drawHoverOverlay(stack, mouseX, mouseY);
if (isSelected) {
DrawerHelper.drawBorder(stack, getPosition().x, getPosition().y, getSize().width, getSize().height, 0xff00aa00, 1);
}
}
use of com.lowdragmc.lowdraglib.utils.Size in project Multiblocked by Low-Drag-MC.
the class ContentWidget method drawChance.
@OnlyIn(Dist.CLIENT)
public void drawChance(MatrixStack matrixStack) {
if (chance == 1)
return;
Position pos = getPosition();
Size size = getSize();
matrixStack.pushPose();
matrixStack.translate(0, 0, 170);
matrixStack.scale(0.5f, 0.5f, 1);
String s = chance == 0 ? LocalizationUtils.format("multiblocked.gui.content.chance_0_short") : String.format("%.1f", chance * 100) + "%";
int color = chance == 0 ? 0xff0000 : 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, color);
matrixStack.popPose();
}
use of com.lowdragmc.lowdraglib.utils.Size in project Multiblocked by Low-Drag-MC.
the class ChemicalStackWidget method drawHookBackground.
@Override
public void drawHookBackground(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
if (content != null) {
Position pos = getPosition();
Size size = getSize();
Minecraft minecraft = Minecraft.getInstance();
stack.pushPose();
RenderSystem.enableBlend();
drawChemical(stack, pos.x + 1, pos.y + 1, 18, 18, content);
stack.scale(0.5f, 0.5f, 1);
String s = TextFormattingUtil.formatLongToCompactStringBuckets(content.getAmount(), 3);
FontRenderer fontRenderer = minecraft.font;
fontRenderer.drawShadow(stack, s, (pos.x + (size.width / 3f)) * 2 - fontRenderer.width(s) + 21, (pos.y + (size.height / 3f) + 6) * 2, 0xFFFFFF);
stack.popPose();
}
}
use of com.lowdragmc.lowdraglib.utils.Size 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();
}
Aggregations