-
Notifications
You must be signed in to change notification settings - Fork 4
Adding support for modded blocks using behavior
Important
Make sure to familiarize yourself with the library's syntax: Attribute‐based Matching
Note
If your mod is purely content or your block uses VariantGroups for rotations, then skip to JSON part below.
Click here to see tutorial for code part
If block implements custom Block class, it should inherit from BlockGeneric, otherwise collisions, selections and decals won't work properly.
For example:
public class MyBlock : BlockGenericBlockEntity class shouldn't override OnTesselation at all, or at least should do it the same way as BlockEntityDisplay does, which means, it should always call the following method in the end:
return base.OnTesselation(mesher, tessThreadTesselator);[!Warning] For blocks with custom rotation that doesn't rotate shape with
Shape.rotateY, you need to create your own behavior that inheritsBlockBehaviorShapeTexturesFromAttributes, then overrideGetRotation(e.g. if your block has rotation like MeshAngle from BlockEntityGroundStorage).
For all possible properties/attributes that can be used in the JSON part, see Attributes and properties.
Set the following class if you need custom hitboxes and proper rendering of decal mesh:
"class": "BlockGeneric"Important
Make sure to add the following block entity behavior:
"entityBehaviors": [
{ "name": "AttributeRenderingLibrary.ShapeTexturesFromAttributes" }
]Also add the following behavior:
Warning
If block uses the following vanilla behaviors, you need to replace them with modded behaviors:
-
HorizontalOrientable=>AttributeRenderingLibrary.HorizontalOrientable -
HorizontalAttachable=>AttributeRenderingLibrary.HorizontalAttachable -
NWOrientable=>AttributeRenderingLibrary.NWOrientable
They should be added before AttributeRenderingLibrary.BlockShapeTexturesFromAttributes, not after!