{
    "format_version": "1.20.0",
    "minecraft:entity": {
        "description": {
            "identifier": "lv_te:pipe_dummy",
            "is_spawnable": false,
            "is_summonable": true,
            "is_experimental": false,
            "properties": {
                "lv_te:output": {
                    "client_sync": true,
                    "default": false,
                    "type": "bool"
                },
                "lv_te:input": {
                    "client_sync": true,
                    "default": false,
                    "type": "bool"
                },
                //0 = Copper Pipe and 1 = Advanced Pipe
                "lv_te:type": {
                    "client_sync": true,
                    "default": 0,
                    "range": [
                        0,
                        1
                    ],
                    "type": "int"
                },
                //Oxidization levels only matter on type id 0, 0 = no oxidization, 1 = semi oxidized, 2 = oxidized
                "lv_te:oxidization": {
                    "client_sync": true,
                    "default": 0,
                    "range": [
                        0,
                        2
                    ],
                    "type": "int"
                },
                //Only matters on type id 0, false meaning it can still oxidize, true meaning it can't further oxidize
                "lv_te:waxed": {
                    "client_sync": true,
                    "default": false,
                    "type": "bool"
                }
            }
        },
        "component_groups": {
            "lv_te:despawn": {
                "minecraft:instant_despawn": {
                    "remove_child_entities": false
                }
            },
            "oxidization": {
                "minecraft:timer": {
                    "time": [
                        100,
                        200
                    ],
                    "looping": true,
                    "time_down_event": {
                        "event": "lv_te:oxidization_add",
                        "target": "self"
                    }
                }
            }
        },
        "components": {
            "minecraft:type_family": {
                "family": [
                    "lv.te.machine",
                    "lv.te.pipe",
                    "inanimate"
                ]
            },
            "minecraft:nameable": {
                "allow_name_tag_renaming": false
            },
            "minecraft:damage_sensor": {
                "triggers": [
                    {
                        "on_damage": {
                            "filters": [
                                {
                                    "test": "is_family",
                                    "value": "player",
                                    "subject": "other"
                                }
                            ],
                            "target": "self",
                            "event": "lv_te:break_pipe"
                        },
                        "deals_damage": false
                    },
                    {
                        "cause": "all",
                        "deals_damage": false
                    }
                ]
            },
            "minecraft:health": {
                "min": 1,
                "value": 1,
                "max": 1
            },
            "minecraft:collision_box": {
                "height": 0.01,
                "width": 0.01
            },
            "minecraft:breathable": {
                "total_supply": 15,
                "suffocate_time": 0
            },
            "minecraft:physics": {
                "has_gravity": false,
                "has_collision": false
            },
            "minecraft:pushable": {
                "is_pushable": false,
                "is_pushable_by_piston": false
            },
            "minecraft:inventory": {
                "can_be_siphoned_from": false,
                "container_type": "hopper",
                "inventory_size": 1,
                "private": true,
                "restrict_to_owner": true
            },
            "minecraft:knockback_resistance": {
                "value": 1
            },
            "minecraft:fire_immune": {},
            "minecraft:conditional_bandwidth_optimization": {}
        },
        "events": {
            "minecraft:entity_spawned": {},
            "lv_te:despawn": {
                "add": {
                    "component_groups": [
                        "lv_te:despawn"
                    ]
                }
            },
            "lv_te:spawn_copper_pipe": {
                "sequence": [
                    {
                        "set_property": {
                            "lv_te:oxidization": 0
                        }
                    },
                    {
                        "set_property": {
                            "lv_te:type": 0
                        }
                    },
                    {
                        "add": {
                            "component_groups": [
                                "oxidization"
                            ]
                        }
                    }
                ]
            },
            "lv_te:spawn_advanced_pipe": {
                "sequence": [
                    {
                        "set_property": {
                            "lv_te:type": 1
                        }
                    }
                ]
            },
            "lv_te:break_pipe": {
                "queue_command": {
                    "command": [
                        "scriptevent lv_te:break.pipe"
                    ]
                }
            },
            "lv_te:oxidization_add": {
                "sequence": [
                    {
                        "filters": {
                            "all_of": [
                                {
                                    "test": "int_property",
                                    "domain": "lv_te:oxidization",
                                    "value": 1
                                },
                                {
                                    "test": "bool_property",
                                    "domain": "lv_te:waxed",
                                    "value": false
                                }
                            ]
                        },
                        "set_property": {
                            "lv_te:oxidization": 2
                        },
                        "queue_command": {
                            "command": [
                                "scriptevent lv_te:pipe.oxidization.changed"
                            ]
                        }
                    },
                    {
                        "filters": {
                            "all_of": [
                                {
                                    "test": "int_property",
                                    "domain": "lv_te:oxidization",
                                    "value": 0
                                },
                                {
                                    "test": "bool_property",
                                    "domain": "lv_te:waxed",
                                    "value": false
                                }
                            ]
                        },
                        "set_property": {
                            "lv_te:oxidization": 1
                        },
                        "queue_command": {
                            "command": [
                                "scriptevent lv_te:pipe.oxidization.changed"
                            ]
                        }
                    }
                ]
            },
            "lv_te:oxidization_remove": {
                "sequence": [
                    {
                        "filters": {
                            "all_of": [
                                {
                                    "test": "int_property",
                                    "domain": "lv_te:oxidization",
                                    "value": 1
                                },
                                {
                                    "test": "bool_property",
                                    "domain": "lv_te:waxed",
                                    "value": false
                                }
                            ]
                        },
                        "set_property": {
                            "lv_te:oxidization": 0
                        },
                        "queue_command": {
                            "command": [
                                "particle lv_te:pipe_wax_off ~~0.1~",
                                "playsound copper.wax.off @a ~~~ 1 1.5",
                                "scriptevent lv_te:pipe.oxidization.changed"
                            ]
                        }
                    },
                    {
                        "filters": {
                            "all_of": [
                                {
                                    "test": "int_property",
                                    "domain": "lv_te:oxidization",
                                    "value": 2
                                },
                                {
                                    "test": "bool_property",
                                    "domain": "lv_te:waxed",
                                    "value": false
                                }
                            ]
                        },
                        "set_property": {
                            "lv_te:oxidization": 1
                        },
                        "queue_command": {
                            "command": [
                                "particle lv_te:pipe_wax_off ~~0.1~",
                                "playsound copper.wax.off @a ~~~ 1 1.5",
                                "scriptevent lv_te:pipe.oxidization.changed"
                            ]
                        }
                    }
                ]
            },
            "lv_te:wax_machine": {
                "set_property": {
                    "lv_te:waxed": true
                },
                "queue_command": {
                    "command": [
                        "particle lv_te:pipe_wax_on ~~0.1~",
                        "playsound copper.wax.on @a ~~~ 1 1.5"
                    ]
                }
            },
            "lv_te:remove_wax": {
                "set_property": {
                    "lv_te:waxed": false
                },
                "queue_command": {
                    "command": [
                        "particle lv_te:pipe_wax_white ~~0.1~",
                        "playsound copper.wax.off @a ~~~ 1 1.5"
                    ]
                }
            }
        }
    }
}