### Entity Rendering System Setup (Java) Source: https://context7.com/tt432/eyelib/llms.txt Explains how the EntityRenderSystem manages automatic entity rendering by replacing vanilla methods. It covers setting up client entities for a given entity, including manual setup and setup with a specific client entity definition. It also shows how to set up Molang variables and disable built-in rendering for custom solutions. ```java import io.github.tt432.eyelib.client.EntityRenderSystem; import io.github.tt432.eyelib.capability.RenderData; import io.github.tt432.eyelib.client.entity.BrClientEntity; import net.minecraft.world.entity.Entity; import java.util.List; // Setup client entity for an entity (typically done automatically) Entity entity = /* your entity */; RenderData renderData = RenderData.getComponent(entity); // Manual setup if needed List syncActions = EntityRenderSystem.setupClientEntity(entity, renderData); syncActions.forEach(Runnable::run); // Or setup with a specific client entity definition // BrClientEntity clientEntity = Eyelib.getClientEntityLoader().get(entityId); // Assuming entityId is defined // EntityRenderSystem.setupClientEntity(clientEntity, renderData); // Setup Molang variables for entity float partialTick = /* from render event */; EntityRenderSystem.setupExtraMolang(entity, renderData.getScope(), partialTick); // Disable built-in rendering to use custom rendering renderData.setUseBuiltInRenderSystem(false); ``` -------------------------------- ### Loading and Accessing Client Entity Definitions (Java) Source: https://context7.com/tt432/eyelib/llms.txt Demonstrates how to retrieve client entity definitions using BrClientEntityLoader. It shows how to get a specific entity by its ID, access its properties like identifier, textures, geometry, animations, and render controllers, and how to evaluate associated scripts. It also includes searching for entities by a keyword. ```java import io.github.tt432.eyelib.Eyelib; import io.github.tt432.eyelib.client.loader.BrClientEntityLoader; import io.github.tt432.eyelib.client.entity.BrClientEntity; import net.minecraft.resources.ResourceLocation; import java.util.Map; import java.util.List; // Get client entity definition ResourceLocation entityId = ResourceLocation.fromNamespaceAndPath("minecraft", "pig"); BrClientEntity clientEntity = Eyelib.getClientEntityLoader().get(entityId); if (clientEntity != null) { // Access entity configuration String identifier = clientEntity.identifier(); Map textures = clientEntity.textures(); Map geometry = clientEntity.geometry(); Map animations = clientEntity.animations(); List renderControllers = clientEntity.render_controllers(); // Access scripts for initialization and pre-animation clientEntity.scripts().ifPresent(scripts -> { scripts.initialize().eval(scope); // Assuming 'scope' is defined elsewhere scripts.pre_animation().eval(scope); // Assuming 'scope' is defined elsewhere }); } // Search for entities Eyelib.getClientEntityLoader().search("pig").forEach(entry -> { System.out.println("Found entity: " + entry.getKey()); }); ``` -------------------------------- ### Accessing and Managing Resources via Managers (Java) Source: https://context7.com/tt432/eyelib/llms.txt Details how to use singleton managers provided by Eyelib to access loaded resources such as models, animations, materials, particles, and render controllers. It shows how to get specific resources by name, retrieve all loaded resources, and programmatically register custom resources. ```java import io.github.tt432.eyelib.Eyelib; import io.github.tt432.eyelib.client.manager.ModelManager; import io.github.tt432.eyelib.client.manager.AnimationManager; import io.github.tt432.eyelib.client.manager.MaterialManager; import io.github.tt432.eyelib.client.manager.ParticleManager; import io.github.tt432.eyelib.client.manager.RenderControllerManager; import io.github.tt432.eyelib.client.model.Model; import io.github.tt432.eyelib.client.animation.Animation; import java.util.Map; // Access managers via Eyelib facade ModelManager modelManager = Eyelib.getModelManager(); AnimationManager animManager = Eyelib.getAnimationManager(); MaterialManager materialManager = Eyelib.getMaterialManager(); ParticleManager particleManager = Eyelib.getParticleManager(); RenderControllerManager rcManager = Eyelib.getRenderControllerManager(); // Get resources by name Model model = modelManager.get("geometry.mymod.custom"); Animation animation = animManager.get("animation.mymod.walk"); // Get all loaded resources Map allModels = modelManager.getAllData(); Map> allAnimations = animManager.getAllData(); // Register custom resources programmatically // modelManager.put("geometry.custom.runtime", customModel); // Assuming customModel is defined // animManager.put("animation.custom.runtime", customAnimation); // Assuming customAnimation is defined ``` -------------------------------- ### Configure MolangScope Scripting Context Source: https://context7.com/tt432/eyelib/llms.txt Illustrates creating a MolangScope, setting static and dynamic variables, and evaluating expressions for animation logic. ```java import io.github.tt432.eyelib.molang.MolangScope; import io.github.tt432.eyelib.molang.MolangValue; MolangScope scope = new MolangScope(); scope.set("variable.scale", 1.5f); scope.set("variable.is_attacking", true); scope.set("variable.health_percent", 0.75); scope.set("variable.time", () -> ClientTickHandler.getTick() / 20f); if (scope.contains("variable.scale")) { var value = scope.get("variable.scale"); float scale = value.asFloat(); } MolangValue expression = new MolangValue("variable.scale * query.anim_time"); float result = expression.eval(scope); scope.setOwner(entity); scope.setOwner(renderData); ``` -------------------------------- ### Utilize RenderHelper for Fluent Model Rendering (Java) Source: https://context7.com/tt432/eyelib/llms.txt Shows how to use the RenderHelper's fluent API for efficient model rendering, including GPU acceleration, animation data integration, and rendering on attachment locators. Also covers accessing collected locator positions. ```java import io.github.tt432.eyelib.Eyelib; import io.github.tt432.eyelib.client.render.RenderHelper; import io.github.tt432.eyelib.client.render.RenderParams; import io.github.tt432.eyelib.client.model.Model; import io.github.tt432.eyelib.client.model.ModelRuntimeData; // Get render helper instance RenderHelper helper = Eyelib.getRenderHelper(); // Render a model with animation data Model model = modelComponent.getModel(); ModelRuntimeData runtimeData = animComponent.tickedInfos; helper.openHighSpeedRender(params, bufferSource) // Enable GPU acceleration if available .render(params, model, runtimeData) // Render the model .collectLocators(model, runtimeData); // Collect bone positions for attachments // Render items or effects on locators (attachment points) helper.renderOnLocator(params, "rightitem", itemModel, itemRuntimeData); // Access collected locator positions Map locators = helper.getContext().get("locators"); if (locators != null) { Matrix4f rightHandMatrix = locators.get("rightitem"); // Use matrix for custom positioning } ``` -------------------------------- ### Direct Model Rendering with ModelRenderer (Java) Source: https://context7.com/tt432/eyelib/llms.txt Explains how to use ModelRenderer for direct model rendering via a visitor pattern. This includes setting up render parameters, obtaining model and animation data, and configuring a list of render visitors for custom rendering pipelines. ```java import io.github.tt432.eyelib.client.render.ModelRenderer; import io.github.tt432.eyelib.client.render.RenderParams; import io.github.tt432.eyelib.client.render.visitor.ModelRenderVisitorList; import io.github.tt432.eyelib.client.render.visitor.BuiltInBrModelRenderVisitors; // Prepare render parameters RenderParams params = RenderParams.builder(poseStack, bufferSource, modelComponent) .entity(entity) .light(packedLight) .overlay(packedOverlay) .build(); // Get model and animation data Model model = Eyelib.getModelManager().get("geometry.mymod.custom"); ModelRuntimeData runtimeData = animComponent.tickedInfos; // Create visitor list with built-in renderers ModelRenderVisitorList visitors = new ModelRenderVisitorList( List.of(BuiltInBrModelRenderVisitors.HIGH_SPEED_RENDER.get()) ); // Render the model ModelRenderer.render(params, model, runtimeData, visitors); ``` -------------------------------- ### Configure ModelComponent for Entity Rendering (Java) Source: https://context7.com/tt432/eyelib/llms.txt Demonstrates how to create and configure a ModelComponent to specify the model, texture, and render type for an entity. It also shows how to add it to the entity's render data and check rendering readiness. ```java import io.github.tt432.eyelib.capability.component.ModelComponent; import io.github.tt432.eyelib.Eyelib; import net.minecraft.resources.ResourceLocation; // Create and configure a model component ModelComponent modelComponent = new ModelComponent(); ModelComponent.SerializableInfo info = new ModelComponent.SerializableInfo( "geometry.mymod.custom_entity", // Model name from ModelManager ResourceLocation.fromNamespaceAndPath("mymod", "textures/entity/custom.png"), ResourceLocation.fromNamespaceAndPath("minecraft", "entity_solid") // Render type ); modelComponent.setInfo(info); // Add to entity's render data RenderData renderData = RenderData.getComponent(entity); renderData.getModelComponents().add(modelComponent); // Check if ready for rendering if (modelComponent.readyForRendering()) { Model model = modelComponent.getModel(); ResourceLocation texture = modelComponent.getTexture(); RenderType renderType = modelComponent.getRenderType(texture); } // Control part visibility modelComponent.getPartVisibility().put(boneId, false); // Hide specific bone ``` -------------------------------- ### Build RenderParams for Model Rendering (Java) Source: https://context7.com/tt432/eyelib/llms.txt Illustrates how to construct RenderParams objects, which encapsulate all necessary data for rendering models, including pose stack, buffer source, entity, lighting, and texture information. Supports both builder pattern and manual construction. ```java import io.github.tt432.eyelib.client.render.RenderParams; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; // Build render params using the builder pattern PoseStack poseStack = /* from render event */; MultiBufferSource bufferSource = /* from render event */; ModelComponent modelComponent = /* configured model component */; RenderParams params = RenderParams.builder(poseStack, bufferSource, modelComponent) .entity(entity) .light(packedLight) .overlay(packedOverlay) .build(); // Or build manually for custom rendering ResourceLocation texture = ResourceLocation.fromNamespaceAndPath("mymod", "textures/entity/custom.png"); RenderType renderType = RenderType.entitySolid(texture); VertexConsumer consumer = bufferSource.getBuffer(renderType); RenderParams customParams = RenderParams.builder(poseStack, renderType, true, texture, consumer) .entity(entity) .light(LightTexture.FULL_BRIGHT) .overlay(OverlayTexture.NO_OVERLAY) .build(); // Create emissive variant for glow textures RenderParams emissiveParams = params.asEmissive(bufferSource, modelComponent); ``` -------------------------------- ### RenderHelper - Fluent Rendering API Source: https://context7.com/tt432/eyelib/llms.txt RenderHelper provides a fluent API for rendering models, supporting high-speed GPU rendering and locator-based attachments. ```APIDOC ## RenderHelper - Fluent Rendering API RenderHelper provides a fluent API for rendering models with support for high-speed GPU rendering and locator-based attachments. ### Description This class offers a streamlined way to render models, optimize performance with GPU acceleration, and attach other models or effects to specific points (locators) on a rendered model. ### Method Fluent API for rendering and managing render contexts. ### Endpoint N/A (Client-side rendering utility) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java import io.github.tt432.eyelib.Eyelib; import io.github.tt432.eyelib.client.render.RenderHelper; import io.github.tt432.eyelib.client.render.RenderParams; import io.github.tt432.eyelib.client.model.Model; import io.github.tt432.eyelib.client.model.ModelRuntimeData; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.renderer.MultiBufferSource; import java.util.Map; import org.joml.Matrix4f; // Assuming 'modelComponent', 'animComponent', 'entity', 'bufferSource', 'itemModel', 'itemRuntimeData' are available // Get render helper instance // RenderHelper helper = Eyelib.getRenderHelper(); // Render a model with animation data // Model model = modelComponent.getModel(); // ModelRuntimeData runtimeData = animComponent.tickedInfos; // helper.openHighSpeedRender(params, bufferSource) // Enable GPU acceleration if available // .render(params, model, runtimeData) // Render the model // .collectLocators(model, runtimeData); // Collect bone positions for attachments // Render items or effects on locators (attachment points) // helper.renderOnLocator(params, "rightitem", itemModel, itemRuntimeData); // Access collected locator positions // Map locators = helper.getContext().get("locators"); // if (locators != null) { // Matrix4f rightHandMatrix = locators.get("rightitem"); // // Use matrix for custom positioning // } ``` ### Response N/A (Client-side rendering utility) #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Load Bedrock Models Source: https://context7.com/tt432/eyelib/llms.txt Utilize BrModelLoader to retrieve Bedrock model files by ResourceLocation or search for models using name patterns. ```java import io.github.tt432.eyelib.client.loader.BrModelLoader; import io.github.tt432.eyelib.client.model.bedrock.BrModel; import net.minecraft.resources.ResourceLocation; ResourceLocation modelLocation = ResourceLocation.fromNamespaceAndPath("mymod", "entity/custom_mob"); BrModel model = BrModelLoader.getModel(modelLocation); BrModelLoader.INSTANCE.search("custom").forEach(entry -> { System.out.println("Found model: " + entry.getKey()); BrModel foundModel = entry.getValue(); }); ``` -------------------------------- ### AnimationComponent - Managing Animation State Source: https://context7.com/tt432/eyelib/llms.txt This section explains how to retrieve and set up animation states using the AnimationComponent, mapping animation names to Molang expressions for dynamic control. ```APIDOC ## AnimationComponent - Managing Animation State The AnimationComponent tracks animation state for entities including current animations, animation data, and the results of animation ticks. ### Description Manages animation states for entities, including current animations, animation data, and animation tick results. ### Method N/A (Code example demonstrates usage) ### Endpoint N/A ### Parameters N/A ### Request Example ```java import io.github.tt432.eyelib.capability.component.AnimationComponent; import io.github.tt432.eyelib.capability.RenderData; import io.github.tt432.eyelib.molang.MolangValue; import java.util.Map; import java.util.HashMap; // Get animation component from entity Entity entity = /* your entity */; RenderData renderData = RenderData.getComponent(entity); AnimationComponent animComponent = renderData.getAnimationComponent(); // Setup animations with name mappings and multipliers Map animations = new HashMap<>(); animations.put("walk", "animation.mymod.walk"); animations.put("idle", "animation.mymod.idle"); Map animate = new HashMap<>(); animate.put("walk", new MolangValue("query.is_moving")); animate.put("idle", new MolangValue("1.0")); animComponent.setup(animations, animate); ``` ### Response N/A ``` -------------------------------- ### Render Custom Entity with Bedrock Models and Animations (Java) Source: https://context7.com/tt432/eyelib/llms.txt This Java code snippet shows a complete implementation of a custom entity renderer using Eyelib. It covers setting up Molang variables, configuring animation components, ticking animations, setting up model components, and finally rendering the entity with Eyelib's RenderHelper. Dependencies include Eyelib, Minecraft client rendering classes, and custom entity classes. ```java import io.github.tt432.eyelib.Eyelib; import io.github.tt432.eyelib.capability.RenderData; import io.github.tt432.eyelib.capability.component.AnimationComponent; import io.github.tt432.eyelib.capability.component.ModelComponent; import io.github.tt432.eyelib.client.animation.BrAnimator; import io.github.tt432.eyelib.client.animation.AnimationEffects; import io.github.tt432.eyelib.client.model.Model; import io.github.tt432.eyelib.client.model.ModelRuntimeData; import io.github.tt432.eyelib.client.render.RenderHelper; import io.github.tt432.eyelib.client.render.RenderParams; import io.github.tt432.eyelib.client.ClientTickHandler; import io.github.tt432.eyelib.molang.MolangScope; import io.github.tt432.eyelib.molang.MolangValue; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.LivingEntity; import java.util.Map; import java.util.HashMap; public class CustomEntityRenderer extends EntityRenderer { private static final ResourceLocation MODEL_LOCATION = ResourceLocation.fromNamespaceAndPath("mymod", "entity/custom"); private static final ResourceLocation TEXTURE = ResourceLocation.fromNamespaceAndPath("mymod", "textures/entity/custom.png"); @Override public void render(CustomEntity entity, float yaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) { // Get render data RenderData renderData = RenderData.getComponent(entity); MolangScope scope = renderData.getScope(); // Setup Molang variables scope.set("variable.is_attacking", entity.isAttacking()); scope.set("variable.health", entity.getHealth() / entity.getMaxHealth()); // Setup animation component if needed AnimationComponent animComponent = renderData.getAnimationComponent(); if (!animComponent.serializable()) { Map animations = new HashMap<>(); animations.put("walk", "animation.mymod.custom.walk"); animations.put("idle", "animation.mymod.custom.idle"); animations.put("attack", "animation.mymod.custom.attack"); Map animate = new HashMap<>(); animate.put("walk", new MolangValue("query.is_moving")); animate.put("idle", new MolangValue("!query.is_moving")); animate.put("attack", new MolangValue("variable.is_attacking")); animComponent.setup(animations, animate); } // Tick animation float ticks = (ClientTickHandler.getTick() + partialTick) / 20f; AnimationEffects effects = new AnimationEffects(); ModelRuntimeData runtimeData = BrAnimator.tickAnimation( animComponent, scope, effects, ticks, () -> {} ); // Setup model component ModelComponent modelComponent = new ModelComponent(); modelComponent.setInfo(new ModelComponent.SerializableInfo( "geometry.mymod.custom", TEXTURE, ResourceLocation.fromNamespaceAndPath("minecraft", "entity_cutout") )); // Build render params RenderParams params = RenderParams.builder(poseStack, bufferSource, modelComponent) .entity(entity) .light(packedLight) .overlay(getOverlayCoords(entity, 0)) .build(); // Render with RenderHelper Model model = modelComponent.getModel(); if (model != null) { poseStack.pushPose(); poseStack.scale(-1, -1, 1); poseStack.translate(0, -1.501, 0); Eyelib.getRenderHelper() .openHighSpeedRender(params, bufferSource) .render(params, model, runtimeData) .collectLocators(model, runtimeData); poseStack.popPose(); } super.render(entity, yaw, partialTick, poseStack, bufferSource, packedLight); } @Override public ResourceLocation getTextureLocation(CustomEntity entity) { return TEXTURE; } } ``` -------------------------------- ### Process Animations with BrAnimator Source: https://context7.com/tt432/eyelib/llms.txt Shows how to tick animations using BrAnimator to generate bone transformation data and handle animation effects based on partial ticks. ```java import io.github.tt432.eyelib.client.animation.BrAnimator; import io.github.tt432.eyelib.client.animation.AnimationEffects; import io.github.tt432.eyelib.client.model.ModelRuntimeData; import io.github.tt432.eyelib.client.ClientTickHandler; import io.github.tt432.eyelib.molang.MolangScope; RenderData renderData = RenderData.getComponent(entity); AnimationComponent animComponent = renderData.getAnimationComponent(); MolangScope scope = renderData.getScope(); float partialTick = /* from render event */; float ticks = (ClientTickHandler.getTick() + partialTick) / 20f; AnimationEffects effects = new AnimationEffects(); ModelRuntimeData runtimeData = BrAnimator.tickAnimation( animComponent, scope, effects, ticks, () -> { } ); ``` -------------------------------- ### Load Animation Controllers Source: https://context7.com/tt432/eyelib/llms.txt Load animation state machine controllers using BrAnimationControllerLoader to manage complex animation transitions. ```java import io.github.tt432.eyelib.client.loader.BrAnimationControllerLoader; import io.github.tt432.eyelib.client.animation.bedrock.controller.BrAnimationControllers; import net.minecraft.resources.ResourceLocation; import io.github.tt432.eyelib.Eyelib; ResourceLocation controllerLoc = ResourceLocation.fromNamespaceAndPath("mymod", "entity/main"); BrAnimationControllers controllers = BrAnimationControllerLoader.getController(controllerLoc); var controller = Eyelib.getAnimationManager().get("controller.animation.mymod.main"); ``` -------------------------------- ### MolangScope - Scripting Context Source: https://context7.com/tt432/eyelib/llms.txt Explains how MolangScope provides the necessary context for evaluating Molang expressions, including setting and retrieving variables and owner objects. ```APIDOC ## MolangScope - Scripting Context MolangScope provides the variable context for Molang expression evaluation, supporting Bedrock's query and variable systems. ### Description Manages the context for Molang expression evaluation, including variables, dynamic variables, and owner objects for queries. ### Method N/A (Code example demonstrates usage) ### Endpoint N/A ### Parameters N/A ### Request Example ```java import io.github.tt432.eyelib.molang.MolangScope; import io.github.tt432.eyelib.molang.MolangValue; // Create a new scope MolangScope scope = new MolangScope(); // Set variables for Molang expressions scope.set("variable.scale", 1.5f); scope.set("variable.is_attacking", true); scope.set("variable.health_percent", 0.75); // Set dynamic variables with suppliers scope.set("variable.time", () -> ClientTickHandler.getTick() / 20f); // Check and get variables if (scope.contains("variable.scale")) { var value = scope.get("variable.scale"); float scale = value.asFloat(); } // Evaluate Molang expressions MolangValue expression = new MolangValue("variable.scale * query.anim_time"); float result = expression.eval(scope); // Set owner objects for query functions scope.setOwner(entity); scope.setOwner(renderData); ``` ### Response N/A ``` -------------------------------- ### Manage Animation State with AnimationComponent Source: https://context7.com/tt432/eyelib/llms.txt Demonstrates how to retrieve the AnimationComponent from an entity's RenderData and configure animation mappings and Molang-based triggers. ```java import io.github.tt432.eyelib.capability.component.AnimationComponent; import io.github.tt432.eyelib.capability.RenderData; import io.github.tt432.eyelib.molang.MolangValue; import java.util.Map; import java.util.HashMap; Entity entity = /* your entity */; RenderData renderData = RenderData.getComponent(entity); AnimationComponent animComponent = renderData.getAnimationComponent(); Map animations = new HashMap<>(); animations.put("walk", "animation.mymod.walk"); animations.put("idle", "animation.mymod.idle"); Map animate = new HashMap<>(); animate.put("walk", new MolangValue("query.is_moving")); animate.put("idle", new MolangValue("1.0")); animComponent.setup(animations, animate); ``` -------------------------------- ### RenderParams - Render Configuration Source: https://context7.com/tt432/eyelib/llms.txt RenderParams encapsulates all parameters required for rendering, including the pose stack, render type, texture, and lighting information. ```APIDOC ## RenderParams - Render Configuration RenderParams encapsulates all parameters needed for model rendering including pose stack, render type, texture, and lighting. ### Description This class holds all the necessary data for rendering a model, such as transformation matrices, buffer sources, lighting, and overlay information. It can be built using a builder pattern for convenience. ### Method Builder pattern for creating RenderParams instances. ### Endpoint N/A (Client-side rendering utility) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java import io.github.tt432.eyelib.client.render.RenderParams; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.texture.OverlayTexture; import io.github.tt432.eyelib.capability.component.ModelComponent; // Assuming 'entity', 'poseStack', 'bufferSource', 'packedLight', 'packedOverlay', 'animComponent' are available // Build render params using the builder pattern with ModelComponent // PoseStack poseStack = /* from render event */; // MultiBufferSource bufferSource = /* from render event */; // ModelComponent modelComponent = /* configured model component */; // RenderParams params = RenderParams.builder(poseStack, bufferSource, modelComponent) // .entity(entity) // .light(packedLight) // .overlay(packedOverlay) // .build(); // Or build manually for custom rendering // ResourceLocation texture = ResourceLocation.fromNamespaceAndPath("mymod", "textures/entity/custom.png"); // RenderType renderType = RenderType.entitySolid(texture); // VertexConsumer consumer = bufferSource.getBuffer(renderType); // RenderParams customParams = RenderParams.builder(poseStack, renderType, true, texture, consumer) // .entity(entity) // .light(LightTexture.FULL_BRIGHT) // .overlay(OverlayTexture.NO_OVERLAY) // .build(); // Create emissive variant for glow textures // RenderParams emissiveParams = params.asEmissive(bufferSource, modelComponent); ``` ### Response N/A (Client-side rendering utility) #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Load Bedrock Animations Source: https://context7.com/tt432/eyelib/llms.txt Load animation files from assets and retrieve them via BrAnimationLoader or the global AnimationManager. ```java import io.github.tt432.eyelib.client.loader.BrAnimationLoader; import io.github.tt432.eyelib.client.animation.bedrock.BrAnimation; import net.minecraft.resources.ResourceLocation; import io.github.tt432.eyelib.Eyelib; ResourceLocation animLocation = ResourceLocation.fromNamespaceAndPath("mymod", "entity/walk"); BrAnimation animation = BrAnimationLoader.getAnimation(animLocation); var walkAnim = Eyelib.getAnimationManager().get("animation.mymod.walk"); ``` -------------------------------- ### Configure Eyelib Dependency Source: https://context7.com/tt432/eyelib/llms.txt Add Eyelib to your project dependencies using Gradle to enable library access. ```groovy dependencies { implementation "io.github.tt432:eyelib:${eyelib_version}" } ``` -------------------------------- ### ModelRenderer - Direct Model Rendering Source: https://context7.com/tt432/eyelib/llms.txt ModelRenderer offers a direct API for rendering models, supporting the visitor pattern for extensibility. ```APIDOC ## ModelRenderer - Direct Model Rendering ModelRenderer provides a straightforward API for rendering models with visitor pattern support. ### Description This class allows for direct rendering of a model using a specified set of visitors. It's useful for custom rendering pipelines or when integrating with other rendering systems. ### Method Static method for rendering models with visitor support. ### Endpoint N/A (Client-side rendering utility) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java import io.github.tt432.eyelib.client.render.ModelRenderer; import io.github.tt432.eyelib.client.render.RenderParams; import io.github.tt432.eyelib.client.render.visitor.ModelRenderVisitorList; import io.github.tt432.eyelib.client.render.visitor.BuiltInBrModelRenderVisitors; import io.github.tt432.eyelib.Eyelib; import io.github.tt432.eyelib.client.model.Model; import io.github.tt432.eyelib.client.model.ModelRuntimeData; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.renderer.MultiBufferSource; import java.util.List; // Assuming 'poseStack', 'bufferSource', 'modelComponent', 'entity', 'packedLight', 'packedOverlay', 'animComponent' are available // Prepare render parameters // RenderParams params = RenderParams.builder(poseStack, bufferSource, modelComponent) // .entity(entity) // .light(packedLight) // .overlay(packedOverlay) // .build(); // Get model and animation data // Model model = Eyelib.getModelManager().get("geometry.mymod.custom"); // ModelRuntimeData runtimeData = animComponent.tickedInfos; // Create visitor list with built-in renderers // ModelRenderVisitorList visitors = new ModelRenderVisitorList( // List.of(BuiltInBrModelRenderVisitors.HIGH_SPEED_RENDER.get()) // ); // Render the model // ModelRenderer.render(params, model, runtimeData, visitors); ``` ### Response N/A (Client-side rendering utility) #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Access Entity RenderData Capability Source: https://context7.com/tt432/eyelib/llms.txt Explains how to interact with the RenderData capability to manage entity models, animation components, and synchronization settings. ```java import io.github.tt432.eyelib.capability.RenderData; import io.github.tt432.eyelib.capability.component.ModelComponent; import io.github.tt432.eyelib.capability.component.AnimationComponent; import net.minecraft.world.entity.Entity; Entity entity = /* your entity */; RenderData renderData = RenderData.getComponent(entity); renderData.init(entity); MolangScope scope = renderData.getScope(); AnimationComponent animComponent = renderData.getAnimationComponent(); List modelComponents = renderData.getModelComponents(); renderData.setUseBuiltInRenderSystem(true); renderData.sync(); ``` -------------------------------- ### BrAnimator - Ticking Animations Source: https://context7.com/tt432/eyelib/llms.txt Details on how to use BrAnimator to process animation components and generate ModelRuntimeData, which contains bone transformations for rendering. ```APIDOC ## BrAnimator - Ticking Animations The BrAnimator processes animation components and produces ModelRuntimeData containing bone transformations for rendering. ### Description Processes animation components to generate bone transformations for rendering and handles animation events. ### Method N/A (Code example demonstrates usage) ### Endpoint N/A ### Parameters N/A ### Request Example ```java import io.github.tt432.eyelib.client.animation.BrAnimator; import io.github.tt432.eyelib.client.animation.AnimationEffects; import io.github.tt432.eyelib.client.model.ModelRuntimeData; import io.github.tt432.eyelib.client.ClientTickHandler; import io.github.tt432.eyelib.molang.MolangScope; // Get components from entity RenderData renderData = RenderData.getComponent(entity); AnimationComponent animComponent = renderData.getAnimationComponent(); MolangScope scope = renderData.getScope(); // Calculate current tick with partial tick for smooth animation float partialTick = /* from render event */; float ticks = (ClientTickHandler.getTick() + partialTick) / 20f; // Tick animations and get bone transformation data AnimationEffects effects = new AnimationEffects(); ModelRuntimeData runtimeData = BrAnimator.tickAnimation( animComponent, scope, effects, ticks, () -> { // Animation start callback - run pre_animation scripts } ); // runtimeData now contains all bone transformations for rendering // effects contains particle and sound events triggered by the animation ``` ### Response N/A ``` -------------------------------- ### Configure Block Bedrock Model Loader Source: https://context7.com/tt432/eyelib/llms.txt Define a custom geometry loader in your block model JSON file to integrate Bedrock models into the Minecraft block rendering system. ```json { "parent": "block/block", "loader": "eyelib:bedrock_model", "textures": { "texture": "mymod:block/custom_texture", "particle": "mymod:block/custom_texture" } } ``` -------------------------------- ### ModelComponent - Model Configuration Source: https://context7.com/tt432/eyelib/llms.txt ModelComponent defines the model, texture, and render type for an entity. It allows for configuration and control over rendering aspects. ```APIDOC ## ModelComponent - Model Configuration ModelComponent defines which model, texture, and render type to use for rendering an entity. ### Description This component is used to configure the visual aspects of an entity, specifying the 3D model geometry, the texture to be applied, and the rendering technique. ### Method Instantiation and configuration of ModelComponent. ### Endpoint N/A (Client-side component) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java import io.github.tt432.eyelib.capability.component.ModelComponent; import io.github.tt432.eyelib.Eyelib; import net.minecraft.resources.ResourceLocation; // Create and configure a model component ModelComponent modelComponent = new ModelComponent(); ModelComponent.SerializableInfo info = new ModelComponent.SerializableInfo( "geometry.mymod.custom_entity", // Model name from ModelManager ResourceLocation.fromNamespaceAndPath("mymod", "textures/entity/custom.png"), ResourceLocation.fromNamespaceAndPath("minecraft", "entity_solid") // Render type ); modelComponent.setInfo(info); // Add to entity's render data // Assuming 'entity' is a valid entity object // RenderData renderData = RenderData.getComponent(entity); // renderData.getModelComponents().add(modelComponent); // Check if ready for rendering // if (modelComponent.readyForRendering()) { // Model model = modelComponent.getModel(); // ResourceLocation texture = modelComponent.getTexture(); // RenderType renderType = modelComponent.getRenderType(texture); // } // Control part visibility // modelComponent.getPartVisibility().put(boneId, false); // Hide specific bone ``` ### Response N/A (Client-side component configuration) #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### RenderData - Entity Render State Source: https://context7.com/tt432/eyelib/llms.txt Details on RenderData, the primary capability attached to entities that stores all rendering-related information, including models, animations, and Molang scope. ```APIDOC ## RenderData - Entity Render State RenderData is the main capability attached to entities that holds all rendering-related state including models, animations, and Molang scope. ### Description Manages the rendering state for an entity, including its model components, animation component, Molang scope, and controls the built-in rendering system. ### Method N/A (Code example demonstrates usage) ### Endpoint N/A ### Parameters N/A ### Request Example ```java import io.github.tt432.eyelib.capability.RenderData; import io.github.tt432.eyelib.capability.component.ModelComponent; import io.github.tt432.eyelib.capability.component.AnimationComponent; import net.minecraft.world.entity.Entity; // Get render data for an entity Entity entity = /* your entity */; RenderData renderData = RenderData.getComponent(entity); // Initialize render data (done automatically on entity join) renderData.init(entity); // Access components MolangScope scope = renderData.getScope(); AnimationComponent animComponent = renderData.getAnimationComponent(); List modelComponents = renderData.getModelComponents(); // Control built-in rendering renderData.setUseBuiltInRenderSystem(true); // Enable automatic entity rendering // Sync render state to clients renderData.sync(); ``` ### Response N/A ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.