use of me.shedaniel.math.Color in project BlockMeter by ModProg.
the class ColorButton method init.
@Override
protected void init() {
ModConfig config = BlockMeterClient.getConfigManager().getConfig();
// Create Color Selector
for (int i = 0; i < 4; ++i) {
for (int j = 0; j < 4; ++j) {
final int colorIndex = i * 4 + j;
this.addDrawableChild(new ColorButton(this.width / 2 - 44 + j * 22, this.height / 2 - 88 + i * 22, 20, 20, null, DyeColor.byId(colorIndex).getColorComponents(), config.colorIndex == colorIndex, false, button -> {
ClientMeasureBox.setColorIndex(colorIndex);
final ClientMeasureBox currentBox = BlockMeterClient.getInstance().getCurrentBox();
if (currentBox != null)
currentBox.setColor(DyeColor.byId(colorIndex));
MinecraftClient.getInstance().setScreen((Screen) null);
}));
}
}
this.addDrawableChild(new ButtonWidget(this.width / 2 - BUTTONWIDTH / 2, this.height / 2 + 10, BUTTONWIDTH, 20, new TranslatableText("blockmeter.keepColor", new Object[] { new TranslatableText(config.incrementColor ? "options.off" : "options.on") }), button -> {
config.incrementColor = !config.incrementColor;
MinecraftClient.getInstance().setScreen((Screen) null);
// Todo find a way to increment to a new Color if a box was created while
// incrementColor was disabled
BlockMeterClient.getConfigManager().save();
}));
this.addDrawableChild(new ButtonWidget(this.width / 2 - BUTTONWIDTH / 2, this.height / 2 + 32, BUTTONWIDTH, 20, new TranslatableText("blockmeter.diagonal", new Object[] { new TranslatableText(config.innerDiagonal ? "options.on" : "options.off") }), button -> {
System.err.println("IDK WHAT YOU ARE DOING");
config.innerDiagonal = !config.innerDiagonal;
MinecraftClient.getInstance().setScreen((Screen) null);
BlockMeterClient.getConfigManager().save();
}));
this.addDrawableChild(new ButtonWidget(this.width / 2 - BUTTONWIDTH / 2, this.height / 2 + 54, BUTTONWIDTH, 20, new TranslatableText("blockmeter.showOthers", new Object[] { new TranslatableText(config.showOtherUsersBoxes ? "options.on" : "options.off") }), button -> {
System.err.println("IDK WHAT YOU ARE DOING");
config.showOtherUsersBoxes = !config.showOtherUsersBoxes;
MinecraftClient.getInstance().setScreen((Screen) null);
BlockMeterClient.getConfigManager().save();
}));
}
Aggregations