πŸ”§ ServosΒΆ

Servos are custom block parts of a network that can input/output items from/to containers.

Place/destroy function callΒΆ

  • On place : function #itemio:calls/servos/init

  • On destroy : function #itemio:calls/servos/destroy

TagsΒΆ

To declare a block as a servos you need to add the tag itemio.servo to the block. Additionally you can add these tags to the block:

  • itemio.servo.insert : To declare the servo as an insert servo

  • itemio.servo.extract : To declare the servo as an extract servo

Cable update function eventΒΆ

This function tag is trigger when a servo connection is updated.

function #itemio:event/network_update

Servos’ itemio.math value is a boolean indicating if the servo is connected to a network or not.

1 -> connected
0 -> not connected

NBT handlingΒΆ

Servos has their own filters config data.itemio.ioconfig.filters.

ScoresΒΆ

  • itemio.servo.stack_limit : Define the number of items that can be process (range 0…64)

  • itemio.servo.retry_limit : Define how many times tranfer are call when process


Visual exampleΒΆ

Servos

An animation of all possible states of a cable, generated using Isometric renders fabric mod. (This example use a different model for insert and extract servo)

#itemio:event/network_update
# @public

execute 
    if entity @s[tag=transportduct.servo] 
    run function transportduct:impl/servo/update:     
        scoreboard players set #model transportduct.math 1430117
        scoreboard players operation #model transportduct.math += @s itemio.math
        execute 
            if entity @s[tag=itemio.servo.extract]
            run scoreboard players add #model transportduct.math 2
        item modify entity @s container.0 {
            "function": "minecraft:set_custom_model_data",
            "value": {
                "type": "minecraft:score",
                "target": {
                "type": "minecraft:fixed",
                "name": "#model"
                },
                "score": "transportduct.math",
                "scale": 1
            }
        }
minecraft:item/furnace.json

The modified structure void model. All references are here

{
    "parent": "minecraft:block/furnace",
    "overrides":[
      {"predicate": {"custom_model_data": 1430117},"model": "transportduct:block/servo/insert"},
      {"predicate": {"custom_model_data": 1430118},"model": "transportduct:block/servo/insert_connected"},
      {"predicate": {"custom_model_data": 1430119},"model": "transportduct:block/servo/extract"},
      {"predicate": {"custom_model_data": 1430120},"model": "transportduct:block/servo/extract_connected"}
      
  
    ]
  }
  

The example datapack, that implement a simple cable system.