use of com.lowdragmc.multiblocked.client.renderer.IMultiblockedRenderer in project Multiblocked by Low-Drag-MC.
the class CreateKineticSourceTileEntity method getRenderer.
@Override
public IMultiblockedRenderer getRenderer() {
IMultiblockedRenderer lastRenderer = currentRenderer;
currentRenderer = updateCurrentRenderer();
if (lastRenderer != currentRenderer) {
if (lastRenderer != null) {
lastRenderer.onPostAccess(this);
}
if (currentRenderer != null) {
currentRenderer.onPreAccess(this);
}
}
return currentRenderer;
}
use of com.lowdragmc.multiblocked.client.renderer.IMultiblockedRenderer in project Multiblocked by Low-Drag-MC.
the class ComponentTileEntity method updateCurrentRenderer.
public IMultiblockedRenderer updateCurrentRenderer() {
IMultiblockedRenderer renderer;
if (isFormed()) {
renderer = definition.formedRenderer == null ? definition.baseRenderer : definition.formedRenderer;
} else {
renderer = definition.baseRenderer;
}
if (Multiblocked.isKubeJSLoaded()) {
UpdateRendererEvent event = new UpdateRendererEvent(this, renderer);
event.post(ScriptType.CLIENT, UpdateRendererEvent.ID, getSubID());
renderer = event.getRenderer();
}
return renderer;
}
use of com.lowdragmc.multiblocked.client.renderer.IMultiblockedRenderer in project Multiblocked by Low-Drag-MC.
the class ControllerTileEntity method updateCurrentRenderer.
@Override
public IMultiblockedRenderer updateCurrentRenderer() {
IMultiblockedRenderer renderer;
if (definition.workingRenderer != null && isFormed() && (status.equals("working") || status.equals("suspend"))) {
renderer = definition.workingRenderer;
if (Multiblocked.isKubeJSLoaded()) {
UpdateRendererEvent event = new UpdateRendererEvent(this, renderer);
event.post(ScriptType.SERVER, UpdateRendererEvent.ID, getSubID());
renderer = event.getRenderer();
}
} else {
renderer = super.updateCurrentRenderer();
}
return renderer;
}
use of com.lowdragmc.multiblocked.client.renderer.IMultiblockedRenderer in project Multiblocked by Low-Drag-MC.
the class PartTileEntity method updateCurrentRenderer.
@Override
public IMultiblockedRenderer updateCurrentRenderer() {
if (definition.workingRenderer != null) {
for (IControllerComponent controller : getControllers()) {
if (controller.isFormed() && controller.getStatus().equals("working")) {
IMultiblockedRenderer renderer = definition.workingRenderer;
if (Multiblocked.isKubeJSLoaded()) {
UpdateRendererEvent event = new UpdateRendererEvent(this, renderer);
event.post(ScriptType.SERVER, UpdateRendererEvent.ID, getSubID());
renderer = event.getRenderer();
}
return renderer;
}
}
}
return super.updateCurrentRenderer();
}
use of com.lowdragmc.multiblocked.client.renderer.IMultiblockedRenderer in project Multiblocked by Low-Drag-MC.
the class GeoComponentRenderer method createConfigurator.
@Override
public Supplier<IMultiblockedRenderer> createConfigurator(WidgetGroup parent, DraggableScrollableWidgetGroup group, IMultiblockedRenderer current) {
TextFieldWidget tfw = new TextFieldWidget(1, 1, 150, 20, null, null);
File path = new File(Multiblocked.location, "assets/multiblocked/geo");
AtomicBoolean isGlobal = new AtomicBoolean(false);
if (current instanceof GeoComponentRenderer) {
tfw.setCurrentString(((GeoComponentRenderer) current).modelName);
isGlobal.set(((GeoComponentRenderer) current).isGlobal);
}
group.addWidget(new ButtonWidget(155, 1, 20, 20, cd -> DialogWidget.showFileDialog(parent, "select a geo file", path, true, DialogWidget.suffixFilter(".geo.json"), r -> {
if (r != null && r.isFile()) {
tfw.setCurrentString(r.getName().replace(".geo.json", ""));
}
})).setButtonTexture(new ResourceTexture("multiblocked:textures/gui/darkened_slot.png"), new TextTexture("F", -1)).setHoverTooltips("multiblocked.gui.tips.file_selector"));
group.addWidget(tfw);
group.addWidget(createBoolSwitch(1, 25, "isGlobal", "multiblocked.gui.predicate.geo.0", isGlobal.get(), isGlobal::set));
return () -> {
if (tfw.getCurrentString().isEmpty()) {
return null;
} else {
return new GeoComponentRenderer(tfw.getCurrentString(), isGlobal.get());
}
};
}
Aggregations