Changes

392 bytes removed ,  19:04, 12 October 2022
m
Missed one
Line 6: Line 6:  
Only one BER exists for a given <code>BlockEntityType</code>. Therefore, values that are specific to a single instance in the world should be stored in the block entity being passed to the renderer rather than in the BER itself. For example, an integer that increments every frame, if stored in the BER, will increment every frame for every block entity of this type in the world.
 
Only one BER exists for a given <code>BlockEntityType</code>. Therefore, values that are specific to a single instance in the world should be stored in the block entity being passed to the renderer rather than in the BER itself. For example, an integer that increments every frame, if stored in the BER, will increment every frame for every block entity of this type in the world.
   −
=== <code> render </code> ===
+
=== <code>render</code> ===
 
   
This method is called every frame in order to render the block entity.
 
This method is called every frame in order to render the block entity.
    
=== Parameters ===
 
=== Parameters ===
 +
 
* <code>blockEntity</code>: This is the instance of the block entity being rendered.
 
* <code>blockEntity</code>: This is the instance of the block entity being rendered.
* <code>partialTicks</code>: The amount of time, in fractions of a tick, that has passed since the last full tick.
+
* <code>partialTick</code>: The amount of time, in a fraction of a tick, that has passed since the last full tick.
 
* <code>poseStack</code>: A stack holding four-dimensional matrix entries offset to the current position of the block entity.
 
* <code>poseStack</code>: A stack holding four-dimensional matrix entries offset to the current position of the block entity.
 
* <code>bufferSource</code>: A rendering buffer able to access a vertex consumer.
 
* <code>bufferSource</code>: A rendering buffer able to access a vertex consumer.
Line 19: Line 19:     
== Registering a BER ==
 
== Registering a BER ==
In order to register a BER, call <code>BlockEntityRenderers#register</code> passing the <code>BlockEntityType</code> to be rendered with this BER and a <code>BlockEntityRendererProvider</code>, or BERP, that's used to construct the BER. BERPs can be a method reference that takes in a <code>BlockEntityRendererProvider$Context</code> and returns a BER.
+
In order to register a BER, you must subscribe to the <code>EntityRenderersEvent$RegisterRenderers</code> event on the mod event bus and call <code>#registerBlockEntityRenderer</code>.
 
  −
{{Tip/Important|<code>BlockEntityRenderers#register</code> should be registered within the synchronous work queue (<code>#enqueueWork</code>) of the <code>FMLClientSetupEvent</code> since the method is not thread-safe.}}