mooshroom

{
  "format_version": "1.16.0",
  "minecraft:entity": {
    "description": {
      "identifier": "minecraft:mooshroom",
      "is_spawnable": true,
      "is_summonable": true,
      "is_experimental": false
    },

    "component_groups": {
      "minecraft:mooshroom_become_cow": {
        "minecraft:transformation": {
          "into": "minecraft:cow"
        }
      },
      "minecraft:cow_baby": {
        "minecraft:is_baby": {
        },
        "minecraft:scale": {
          "value":0.5
        },
        "minecraft:ageable": {
          "duration": 1200,
          "feed_items": "wheat",
          "grow_up": {
            "event": "minecraft:ageable_grow_up",
            "target": "self"
          }
        },
        "minecraft:behavior.follow_parent": {
          "priority": 6,
          "speed_multiplier": 1.1
        }
      },

      "minecraft:cow_adult": {
        "minecraft:experience_reward": {
          "on_bred": "Math.Random(1,7)",
          "on_death": "query.last_hit_by_player ? Math.Random(1,3) : 0"
        },
        "minecraft:loot": {
          "table": "loot_tables/entities/mooshroom.json"
        },
        "minecraft:behavior.breed": {
          "priority": 3,
          "speed_multiplier": 1.0
        },
        "minecraft:breedable": {
          "require_tame": false,
          "breed_items": "wheat",
          "breeds_with": {
            "mate_type": "minecraft:mooshroom",
            "baby_type": "minecraft:mooshroom",
            "breed_event": {
              "event": "minecraft:entity_born",
              "target": "baby"
            }
          },
          "deny_parents_variant": {
            "chance": 0.00098, // Roughly 1/1024
            "min_variant": 0,
            "max_variant": 1
          }
        },

        "minecraft:interact": {
          "interactions": [
            {
              "on_interact": {
                "filters": {
                  "all_of": [
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "bowl"},
                    { "test" :  "is_family", "subject" : "other", "value" :  "player"},
                    { "test" :  "has_component", "operator": "!=", "value" :  "minecraft:transformation"}
                  ]
                },
                "event": "minecraft:flowerless",
                "target": "self"
              },
              "add_items": {
                "table": "loot_tables/gameplay/entities/mooshroom_milking.json"
              },
              "use_item": true,
              "play_sounds": "milk_suspiciously",
              "interact_text": "action.interact.moostew"
            },
            {
              "on_interact": {
                "filters": { // allium
                  "all_of": [
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "red_flower:2"},
                    { "test" :  "is_family", "subject" : "other", "value" :  "player"},
                    { "test": "is_variant", "subject": "self", "operator": "==", "value": 1},
                    { "test": "is_mark_variant", "subject": "self", "operator": "!=", "value": 7}
                  ]
                },
                "event": "minecraft:ate_allium",
                "target": "self"
              },
              "use_item": true,
              "play_sounds": "eat",
              "particle_on_start": { "particle_type": "smoke", "particle_y_offset": 0.25, "particle_offset_towards_interactor": true },
              "interact_text": "action.interact.feed"
            },
            {
              "on_interact": {
                "filters": { // bluet
                  "all_of": [
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "red_flower:3"},
                    { "test" :  "is_family", "subject" : "other", "value" :  "player"},
                    { "test": "is_variant", "subject": "self", "operator": "==", "value": 1},
                    { "test": "is_mark_variant", "subject": "self", "operator": "!=", "value": 3}
                  ]
                },
                "event": "minecraft:ate_bluet",
                "target": "self"
              },
              "use_item": true,
              "play_sounds": "eat",
              "particle_on_start": { "particle_type": "smoke", "particle_y_offset": 0.25, "particle_offset_towards_interactor": true },
              "interact_text": "action.interact.feed"
            },
            {
              "on_interact": {
                "filters": { // orchid
                  "all_of": [
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "red_flower:1"},
                    { "test" :  "is_family", "subject" : "other", "value" :  "player"},
                    { "test": "is_variant", "subject": "self", "operator": "==", "value": 1},
                    { "test": "is_mark_variant", "subject": "self", "operator": "!=", "value": 6}
                  ]
                },
                "event": "minecraft:ate_orchid",
                "target": "self"
              },
              "use_item": true,
              "play_sounds": "eat",
              "particle_on_start": { "particle_type": "smoke", "particle_y_offset": 0.25, "particle_offset_towards_interactor": true },
              "interact_text": "action.interact.feed"
            },
            {
              "on_interact": {
                "filters": { // cornflower
                  "all_of": [
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "red_flower:9"},
                    { "test" :  "is_family", "subject" : "other", "value" :  "player"},
                    { "test": "is_variant", "subject": "self", "operator": "==", "value": 1},
                    { "test": "is_mark_variant", "subject": "self", "operator": "!=", "value": 1}
                  ]
                },
                "event": "minecraft:ate_cornflower",
                "target": "self"
              },
              "use_item": true,
              "play_sounds": "eat",
              "particle_on_start": { "particle_type": "smoke", "particle_y_offset": 0.25, "particle_offset_towards_interactor": true },
              "interact_text": "action.interact.feed"
            },
            {
              "on_interact": {
                "filters": { // Dandelion
                  "all_of": [
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "yellow_flower"},
                    { "test" :  "is_family", "subject" : "other", "value" :  "player"},
                    { "test": "is_variant", "subject": "self", "operator": "==", "value": 1},
                    { "test": "is_mark_variant", "subject": "self", "operator": "!=", "value": 5}
                  ]
                },
                "event": "minecraft:ate_dandelion",
                "target": "self"
              },
              "use_item": true,
              "play_sounds": "eat",
              "particle_on_start": { "particle_type": "smoke", "particle_y_offset": 0.25, "particle_offset_towards_interactor": true },
              "interact_text": "action.interact.feed"
            },
            {
              "on_interact": {
                "filters": { // lily of the valley
                  "all_of": [
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "red_flower:10"},
                    { "test" :  "is_family", "subject" : "other", "value" :  "player"},
                    { "test": "is_variant", "subject": "self", "operator": "==", "value": 1},
                    { "test": "is_mark_variant", "subject": "self", "operator": "!=", "value": 4}
                  ]
                },
                "event": "minecraft:ate_lily",
                "target": "self"
              },
              "use_item": true,
              "play_sounds": "eat",
              "particle_on_start": { "particle_type": "smoke", "particle_y_offset": 0.25, "particle_offset_towards_interactor": true },
              "interact_text": "action.interact.feed"
            },
            {
              "on_interact": {
                "filters": { // daisy
                  "all_of": [
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "red_flower:8"},
                    { "test" :  "is_family", "subject" : "other", "value" :  "player"},
                    { "test": "is_variant", "subject": "self", "operator": "==", "value": 1},
                    { "test": "is_mark_variant", "subject": "self", "operator": "!=", "value": 8}
                  ]
                },
                "event": "minecraft:ate_daisy",
                "target": "self"
              },
              "use_item": true,
              "play_sounds": "eat",
              "particle_on_start": { "particle_type": "smoke", "particle_y_offset": 0.25, "particle_offset_towards_interactor": true },
              "interact_text": "action.interact.feed"
            },
            {
              "on_interact": {
                "filters": { // poppy
                  "all_of": [
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "red_flower:0"},
                    { "test" :  "is_family", "subject" : "other", "value" :  "player"},
                    { "test": "is_variant", "subject": "self", "operator": "==", "value": 1},
                    { "test": "is_mark_variant", "subject": "self", "operator": "!=", "value": 0}
                  ]
                },
                "event": "minecraft:ate_poppy",
                "target": "self"
              },
              "use_item": true,
              "play_sounds": "eat",
              "particle_on_start": { "particle_type": "smoke", "particle_y_offset": 0.25, "particle_offset_towards_interactor": true },
              "interact_text": "action.interact.feed"
            },
            {
              "on_interact": {
                "filters": { // tulips
                  "any_of": [
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "red_flower:4"},
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "red_flower:5"},
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "red_flower:6"},
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "red_flower:7"}
                  ],
                  "all_of": [
                    { "test" :  "is_family", "subject" : "other", "value" :  "player"},
                    { "test": "is_variant", "subject": "self", "operator": "==", "value": 1},
                    { "test": "is_mark_variant", "subject": "self", "operator": "!=", "value": 2}
                  ]
                },
                "event": "minecraft:ate_tulip",
                "target": "self"
              },
              "use_item": true,
              "play_sounds": "eat",
              "particle_on_start": { "particle_type": "smoke", "particle_y_offset": 0.25, "particle_offset_towards_interactor": true },
              "interact_text": "action.interact.feed"
            },
            {
              "on_interact": {
                "filters": { // rose
                  "all_of": [
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "wither_rose"},
                    { "test" :  "is_family", "subject" : "other", "value" :  "player"},
                    { "test": "is_variant", "subject": "self", "operator": "==", "value": 1},
                    { "test": "is_mark_variant", "subject": "self", "operator": "!=", "value": 9}
                  ]
                },
                "event": "minecraft:ate_rose",
                "target": "self"
              },
              "use_item": true,
              "play_sounds": "eat",
              "particle_on_start": { "particle_type": "smoke", "particle_y_offset": 0.25, "particle_offset_towards_interactor": true },
              "interact_text": "action.interact.feed"
            },
            {
              "on_interact": {
                "filters": {
                  "all_of": [
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "shears"},
                    { "test" :  "has_component", "operator": "!=", "value" :  "minecraft:transformation"},
                    { "test": "is_variant", "subject": "self", "operator": "==", "value": 0}
                  ]
                },
                "event": "become_cow",
                "target": "self"
              },
              "use_item": false,
              "hurt_item": 1,
              "play_sounds": "shear",
              "spawn_items": { "table": "loot_tables/entities/mooshroom_shear.json" },
              "particle_on_start": { "particle_type": "largeexplode", "particle_y_offset": 0.25, "particle_offset_towards_interactor": true },
              "interact_text": "action.interact.mooshear",
              "vibration": "shear"
            },
            {
              "on_interact": {
                "filters": {
                  "all_of": [
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "shears"},
                    { "test" :  "has_component", "operator": "!=", "value" :  "minecraft:transformation"},
                    { "test": "is_variant", "subject": "self", "operator": "==", "value": 1}
                  ]
                },
                "event": "become_cow",
                "target": "self"
              },
              "use_item": false,
              "hurt_item": 1,
              "play_sounds": "shear",
              "spawn_items": { "table": "loot_tables/entities/brown_mooshroom_shear.json" },
              "particle_on_start": { "particle_type": "largeexplode", "particle_y_offset": 0.25, "particle_offset_towards_interactor": true },
              "interact_text": "action.interact.mooshear",
              "vibration": "shear"
            },
            {
              "on_interact": {
                "filters": {
                  "all_of": [
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "bucket:0"},
                    { "test" :  "is_family", "subject" : "other", "value" :  "player"}
                  ]
                }
              },
              "use_item": true,
              "transform_to_item": "bucket:1",
              "play_sounds": "milk",
              "interact_text": "action.interact.milk"
            }
          ]
        }
      },

      "minecraft:mooshroom_fed_nothing": {
        "minecraft:mark_variant": {
          "value": -1
        }
      },

      "minecraft:mooshroom_brown_fed_poppy": {
        "minecraft:mark_variant": {
          "value": 0
        }
      },

      "minecraft:mooshroom_brown_fed_cornflower": {
        "minecraft:mark_variant": {
          "value": 1
        }
      },

      "minecraft:mooshroom_brown_fed_tulips": {
        "minecraft:mark_variant": {
          "value": 2
        }
      },

      "minecraft:mooshroom_brown_fed_azure_bluet": {
        "minecraft:mark_variant": {
          "value": 3
        }
      },

      "minecraft:mooshroom_brown_fed_lily_of_the_valley": {
        "minecraft:mark_variant": {
          "value": 4
        }
      },

      "minecraft:mooshroom_brown_fed_dandelion": {
        "minecraft:mark_variant": {
          "value": 5
        }
      },

      "minecraft:mooshroom_brown_fed_blue_orchid": {
        "minecraft:mark_variant": {
          "value": 6
        }
      },

      "minecraft:mooshroom_brown_fed_allium": {
        "minecraft:mark_variant": {
          "value": 7
        }
      },

      "minecraft:mooshroom_brown_fed_oxeye_daisy": {
        "minecraft:mark_variant": {
          "value": 8
        }
      },

      "minecraft:mooshroom_brown_fed_wither_rose": {
        "minecraft:mark_variant": {
          "value": 9
        }
      },
       
      "minecraft:mooshroom_red": {
        "minecraft:variant": {
          "value": 0
        }
      },

      "minecraft:mooshroom_brown": {
        "minecraft:variant": {
          "value": 1
        }
      }
    },

    "components": {
      "minecraft:is_hidden_when_invisible": {
      },
      "minecraft:type_family": {
        "family": [ "mushroomcow", "mob" ]
      },
      "minecraft:mark_variant": {
        "value": -1
      },
      "minecraft:breathable": {
        "total_supply": 15,
        "suffocate_time": 0
      },
      "minecraft:collision_box": {
        "width": 0.9,
        "height": 1.3
      },
      "minecraft:nameable": {
      },
      "minecraft:health": {
        "value": 10,
        "max": 10
      },
      "minecraft:hurt_on_condition": {
        "damage_conditions": [
          {
            "filters": { "test": "in_lava", "subject": "self", "operator": "==", "value": true },
            "cause": "lava",
            "damage_per_tick": 4
          }
        ]
      },
      "minecraft:movement": {
        "value": 0.25
      },
      "minecraft:navigation.walk": {
        "can_path_over_water": true,
        "avoid_water": true,
        "avoid_damage_blocks": true
      },
      "minecraft:movement.basic": {
      },
      "minecraft:jump.static": {
      },
      "minecraft:can_climb": {
      },
      "minecraft:leashable": {
        "soft_distance": 4.0,
        "hard_distance": 6.0,
        "max_distance": 10.0
      },
      "minecraft:balloonable": {
      },
      "minecraft:rideable": {
        "seat_count": 1,
        "family_types": [
          "zombie"
        ],
        "seats": {
          "position": [ 0.0, 1.105, 0.0 ]
        }
      },
      "minecraft:despawn": {
        "despawn_from_distance": {}
      },
      "minecraft:behavior.float": {
        "priority": 0
      },
      "minecraft:behavior.panic": {
        "priority": 1,
        "speed_multiplier": 1.25
      },
      "minecraft:behavior.mount_pathing": {
        "priority": 2,
        "speed_multiplier": 1.5,
        "target_dist": 0.0,
        "track_target": true
      },
      "minecraft:behavior.breed": {
        "priority": 3,
        "speed_multiplier": 1.0
      },
      "minecraft:behavior.tempt": {
        "priority": 4,
        "speed_multiplier": 1.25,
        "items": [
          "wheat"
        ]
      },
      "minecraft:behavior.follow_parent": {
        "priority": 5,
        "speed_multiplier": 1.1
      },
      "minecraft:behavior.random_stroll": {
        "priority": 6,
        "speed_multiplier": 0.8
      },
      "minecraft:behavior.look_at_player": {
        "priority": 7,
        "look_distance": 6.0,
        "probability": 0.02
      },
      "minecraft:behavior.random_look_around": {
        "priority": 9
      },
      "minecraft:physics": {
      },
      "minecraft:pushable": {
        "is_pushable": true,
        "is_pushable_by_piston": true
      },
      "minecraft:conditional_bandwidth_optimization": {
      },
      "minecraft:damage_sensor": {
        "triggers": [
          {
            "on_damage": {
              "filters": {
                "all_of": [
                  { "test": "is_family", "subject": "other", "value": "lightning" },
                  { "test": "is_variant", "subject": "self", "operator": "==", "value": 0 }
                ]
              },
              "event": "minecraft:become_brown"
            },
            "deals_damage": false,
            "on_damage_sound_event": "convert_mooshroom"
          },
          {
            "on_damage": {
              "filters": {
                "all_of": [
                  { "test": "is_family", "subject": "other", "value": "lightning" },
                  { "test": "is_variant", "subject": "self", "operator": "==", "value": 1 }
                ]
              },
              "event": "minecraft:become_red"
            },
            "deals_damage": false,
            "on_damage_sound_event": "convert_mooshroom"
          }
        ]
      }
    },

    "events": {
      "become_cow": {
        "remove": {
        },
        "add": {
          "component_groups": [
            "minecraft:mooshroom_become_cow"
          ]
        }
      },
      "minecraft:entity_spawned": {
        "randomize": [
          {
            "weight": 95,
            "remove": {
            },
            "add": {
              "component_groups": [
                "minecraft:cow_adult",
                "minecraft:mooshroom_red"
              ]
            }
          },
          {
            "weight": 5,
            "remove": {
            },
            "add": {
              "component_groups": [
                "minecraft:cow_baby",
                "minecraft:mooshroom_red"
              ]
            }
          }
        ]
      },

      "minecraft:entity_born": {
        "remove": {
        },
        "add": {
          "component_groups": [
            "minecraft:cow_baby"
          ]
        }
      },

      "minecraft:ageable_grow_up": {
        "remove": {
          "component_groups": [
            "minecraft:cow_baby"
          ]
        },
        "add": {
          "component_groups": [
            "minecraft:cow_adult"
          ]
        }
      },

      "minecraft:flowerless": {
        "add": {
          "component_groups": [
            "minecraft:mooshroom_fed_nothing"
          ]
        }
      },

      "minecraft:ate_allium": {
        "add": {
          "component_groups": [
            "minecraft:mooshroom_brown_fed_allium"
          ]
        }
      },

      "minecraft:ate_cornflower": {
        "add": {
          "component_groups": [
            "minecraft:mooshroom_brown_fed_cornflower"
          ]
        }
      },

      "minecraft:ate_lily": {
        "add": {
          "component_groups": [
            "minecraft:mooshroom_brown_fed_lily_of_the_valley"
          ]
        }
      },

      "minecraft:ate_rose": {
        "add": {
          "component_groups": [
            "minecraft:mooshroom_brown_fed_wither_rose"
          ]
        }
      },

      "minecraft:ate_orchid": {
        "add": {
          "component_groups": [
            "minecraft:mooshroom_brown_fed_blue_orchid"
          ]
        }
      },

      "minecraft:ate_daisy": {
        "add": {
          "component_groups": [
            "minecraft:mooshroom_brown_fed_oxeye_daisy"
          ]
        }
      },

      "minecraft:ate_tulip": {
        "add": {
          "component_groups": [
            "minecraft:mooshroom_brown_fed_tulips"
          ]
        }
      },

      "minecraft:ate_bluet": {
        "add": {
          "component_groups": [
            "minecraft:mooshroom_brown_fed_azure_bluet"
          ]
        }
      },

      "minecraft:ate_poppy": {
        "add": {
          "component_groups": [
            "minecraft:mooshroom_brown_fed_poppy"
          ]
        }
      },

      "minecraft:ate_dandelion": {
        "add": {
          "component_groups": [
            "minecraft:mooshroom_brown_fed_dandelion"
          ]
        }
      },

      "minecraft:become_red": {
        "remove": {
          "component_groups": [
            "minecraft:mooshroom_brown"
          ]
        },
        "add": {
          "component_groups": [
            "minecraft:mooshroom_red",
            "minecraft:mooshroom_fed_nothing"
          ]
        }
      },

      "minecraft:become_brown": {
        "remove": {
          "component_groups": [
            "minecraft:mooshroom_red"
          ]
        },
        "add": {
          "component_groups": [
            "minecraft:mooshroom_brown",
            "minecraft:mooshroom_fed_nothing"
          ]
        }
      },

      "minecraft:become_brown_adult": {
        "remove": {
          "component_groups": [
            "minecraft:mooshroom_red"
          ]
        },
        "add": {
          "component_groups": [
            "minecraft:mooshroom_brown",
            "minecraft:cow_adult",
            "minecraft:mooshroom_fed_nothing"
          ]
        }
      },

      "minecraft:become_red_adult": {
        "remove": {
          "component_groups": [
            "minecraft:mooshroom_brown",
            "minecraft:cow_baby"
          ]
        },
        "add": {
          "component_groups": [
            "minecraft:mooshroom_red",
            "minecraft:cow_adult"
          ]
        }
      }
    }
  }
}