Skip to content

Connected Textures

Soaryn edited this page Sep 1, 2022 · 3 revisions

Summary

If you would like to make a connected texture when XyCraft is installed you have a few options. The simplest is making XyCraft Core a dependency and then not worry about the code at all and merely worry about the resource packs.

Model Json

This is an example of what the glass block model json file in XyCraft Override looks like

model/block/glass.json

{
  "parent": "minecraft:block/block",
  "connection_handler": "same_block",
  "loader": "xycraft_core:connected_textures",
  "render_type": "minecraft:cutout",
  "textures": {
    "texture_connected": "xycraft_override:block/connected/glass",
    "texture_single": "xycraft_override:block/connected/glass_single"
  }
}

The important components of this are the loader, connection_handler and textures.

Render type is up to your block.

The loader should always target "xycraft_core:connected_textures" as it is what determines what the model should be built as:

    "loader": "xycraft_core:connected_textures"

The connection handler has a few options: "same_block", "delegate" or some block tag. Note, most of the time you will likely specify same_block:

    "connection_handler": "same_block"

Optionally you can use a block tag, and any block with a matching tag the block will try to connect to. The third option is internal code at the moment and will hopefully be exposed in the future, but to explain it: it delegates the block connection logic to the block itself giving a runtime code option, albeit less performantly all things considered.

Assets to create

Connected Texture:

textures/block/glass.png image

Single Texture:

textures/block/glass_single.png image

Break down of the sprite sheet:

image

Understandably though, you may want to decouple the mod from the dependency chain, and in which case the recommended to make a Resource pack that is turned on when XyCraft Core is installed and don't add it when not installed. This, however, is up to you how you wish to handle it. IF you choose the non-dependency route, do be sure that you don't load the connected_texture loader while not having XyCraft Core installed! Otherwise you will crash. Hence the dependency on Core is a simpler route.

Current Known Issues:

  • Unfortunately if you want a multi layered connected texture, this is to be supported soon. This was intended to be working initially, but there was a problem found in the Forge composite model that doesn't actually call the getModelData from the children models correctly. Once that PR is submitted by Amadornes this should be fixed and an example will be provided.
  • Model based connected textures (walls, carpet, etc.) is a planned feature, but may not work out of the gate for you. This is definitely something we are looking into, but until then I appreciate your patience 😊
Clone this wiki locally