use of com.lowdragmc.multiblocked.api.tile.IControllerComponent 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.api.tile.IControllerComponent in project Multiblocked by Low-Drag-MC.
the class GTRenderer method renderModel.
@Override
@OnlyIn(Dist.CLIENT)
public List<BakedQuad> renderModel(IBlockDisplayReader level, BlockPos pos, BlockState state, Direction side, Random rand, IModelData modelData) {
TileEntity te = level.getBlockEntity(pos);
if (formedAsController && te instanceof IPartComponent) {
IPartComponent part = (IPartComponent) te;
for (IControllerComponent controller : part.getControllers()) {
if (controller.isFormed() && controller.getRenderer() instanceof GTRenderer) {
IBakedModel model = getModel(((GTRenderer) controller.getRenderer()).baseTexture).bake(ModelLoader.instance(), ModelLoader.defaultTextureGetter(), ModelFactory.getRotation(part.getFrontFacing()), modelLocation);
if (model == null)
return Collections.emptyList();
model = new CustomBakedModel(model);
if (!((CustomBakedModel) model).shouldRenderInLayer(state, rand))
return Collections.emptyList();
return model.getQuads(state, side, rand, modelData);
}
}
}
return super.renderModel(level, pos, state, side, rand, modelData);
}
Aggregations