use of com.lowdragmc.lowdraglib.client.renderer.impl.IModelRenderer in project Multiblocked by Low-Drag-MC.
the class MBDIModelRenderer method createConfigurator.
@Override
public Supplier<IMultiblockedRenderer> createConfigurator(WidgetGroup parent, DraggableScrollableWidgetGroup group, IMultiblockedRenderer current) {
TextFieldWidget tfw = new TextFieldWidget(1, 1, 150, 20, null, null);
group.addWidget(tfw);
File path = new File(Multiblocked.location, "assets/multiblocked/models");
group.addWidget(new ButtonWidget(155, 1, 20, 20, cd -> DialogWidget.showFileDialog(parent, "select a java model", path, true, DialogWidget.suffixFilter(".json"), r -> {
if (r != null && r.isFile()) {
tfw.setCurrentString("multiblocked:" + r.getPath().replace(path.getPath(), "").substring(1).replace(".json", "").replace('\\', '/'));
}
})).setButtonTexture(new ResourceTexture("multiblocked:textures/gui/darkened_slot.png"), new TextTexture("F", -1)).setHoverTooltips("multiblocked.gui.tips.file_selector"));
if (current instanceof IModelRenderer && ((IModelRenderer) current).modelLocation != null) {
tfw.setCurrentString(((IModelRenderer) current).modelLocation.toString());
}
return () -> {
if (tfw.getCurrentString().isEmpty()) {
return null;
} else {
return new MBDIModelRenderer(new ResourceLocation(tfw.getCurrentString()));
}
};
}
Aggregations