Search in sources :

Example 1 with UpdateRendererEvent

use of com.lowdragmc.multiblocked.api.kubejs.events.UpdateRendererEvent 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();
}
Also used : UpdateRendererEvent(com.lowdragmc.multiblocked.api.kubejs.events.UpdateRendererEvent) IMultiblockedRenderer(com.lowdragmc.multiblocked.client.renderer.IMultiblockedRenderer) IControllerComponent(com.lowdragmc.multiblocked.api.tile.IControllerComponent)

Aggregations

UpdateRendererEvent (com.lowdragmc.multiblocked.api.kubejs.events.UpdateRendererEvent)1 IControllerComponent (com.lowdragmc.multiblocked.api.tile.IControllerComponent)1 IMultiblockedRenderer (com.lowdragmc.multiblocked.client.renderer.IMultiblockedRenderer)1