{
  "format_version": "1.16.0",
  "minecraft:entity": {
    "description": {
      "identifier": "nicothekid:prismarine_clam",
      "is_spawnable": true,
      "is_summonable": true,
      "is_experimental": false
    },
    "component_groups": {
      "component:prismarine_clam_close": {
        "minecraft:is_sheared": {},
        "minecraft:interact": {
          "interactions": [
            {
              "cooldown": 2.5,
              "cooldown_after_being_attacked": 2.5,
              "health_amount": 0,
              "hurt_item": 0,
              "swing": false,
              "use_item": true,
              "interact_text": "action.interact.capture",
              "play_sounds": "bucket.fill_water",
              "transform_to_item": "nicothekid:bucket_of_prismarine_clam",
              "on_interact": {
                "filters": {
                  "all_of": [
                    {
                      "test": "is_family",
                      "subject": "other",
                      "value": "player"
                    },
                    {
                      "test": "has_equipment",
                      "domain": "hand",
                      "subject": "other",
                      "value": "water_bucket"
                    }
                  ]
                },
                "event": "event:prismarine_clam_catched",
                "target": "self"
              }
            }
          ]
        },
        "minecraft:timer": {
          "looping": false,
          "time": [ 60, 120 ],
          "time_down_event": {
            "event": "event:prismarine_clam_open"
          }
        },
        
        "minecraft:loot": {
          "table": "loot_tables/nicos_mobs/entities/nicothekid_prismarine_clam_empty.json"
        }
      },
      "component:prismarine_clam_open": {
        "minecraft:interact": {
          "interactions": [
            {
              "cooldown": 2.5,
              "cooldown_after_being_attacked": 2.5,
              "health_amount": 0,
              "hurt_item": 1,
              "swing": false,
              "use_item": false,
              "interact_text": "action.interact.harvest_pearl",
              "play_sounds": "shear",
              "vibration": "shear",
              "add_items": {
                "table": "loot_tables/nicos_mobs/interact/nicothekid_prismarine_clam_harvested.json"
              },
              "on_interact": {
                "filters": {
                  "all_of": [
                    {
                      "test" : "is_family",
                      "subject" : "other",
                      "value" : "player"
                    },
                    {
                      "test": "has_equipment",
                      "subject": "other",
                      "domain": "hand",
                      "value": "shears"
                    }
                  ]
                },
                "event": "event:prismarine_clam_harvested",
                "target": "self"
              }
            },
            {
              "cooldown": 2.5,
              "cooldown_after_being_attacked": 2.5,
              "health_amount": 0,
              "hurt_item": 0,
              "swing": false,
              "use_item": true,
              "interact_text": "action.interact.capture",
              "play_sounds": "bucket.fill_water",
              "transform_to_item": "nicothekid:bucket_of_prismarine_clam",
              "on_interact": {
                "filters": {
                  "all_of": [
                    {
                      "test": "is_family",
                      "subject": "other",
                      "value": "player"
                    },
                    {
                      "test": "has_equipment",
                      "domain": "hand",
                      "subject": "other",
                      "value": "water_bucket"
                    }
                  ]
                },
                "event": "event:prismarine_clam_catched"
              }
            }
          ]
        },
        "minecraft:loot": {
          "table": "loot_tables/nicos_mobs/entities/nicothekid_prismarine_clam_pearl.json"
        }
      },
      "component:prismarine_clam_despawn": {
				"minecraft:instant_despawn": {
				  "remove_child_entities": false
				}
			},
      "component:prismarine_clam_variant_0": {
        "minecraft:variant": {
          "value": 0
        }
      },
      "component:prismarine_clam_variant_1": {
        "minecraft:variant": {
          "value": 1
        }
      },
      "component:prismarine_clam_variant_2": {
        "minecraft:variant": {
          "value": 2
        }
      },
      "component:prismarine_clam_variant_3": {
        "minecraft:variant": {
          "value": 3
        }
      },
      "component:prismarine_clam_in_nether": {
				"minecraft:environment_sensor": {
				  "triggers": [
            {
              "filters": {
                "any_of": [
                  {
                    "test": "in_nether",
                    "subject": "self",
                    "operator": "==",
                    "value": true
                  }
                ]
              },
              "event": "event:remove_water_in_nether"
            }
          ]
        }
			}
    },
    "components": {
      "minecraft:balloonable": {
        "mass": 1.0
      },
      "minecraft:collision_box": {
        "width": 0.75,
        "height": 0.65
      },
      "minecraft:health": {
        "value": 12,
        "max": 12
      },
      "minecraft:is_hidden_when_invisible": {},
      "minecraft:knockback_resistance": {
        "value": 1.0
      },
      "minecraft:scale": {
        "value": 1.0
      },
      "minecraft:type_family": {
        "family": [
          "prismarine_clam",
          "clam",
          "mob"
        ]
      },

      "minecraft:breathable":{
        "breathes_air": false,
        "breathes_lava": false,
        "breathes_solids": false,
        "breathes_water": true,
        "generates_bubbles": false,
        "inhale_time": 0,
        "suffocate_time": 0,
        "total_supply": 30
      },
      "minecraft:hurt_on_condition": {
        "damage_conditions": [
          {
            "filters": {
              "test": "in_lava",
              "subject": "self",
              "operator": "==",
              "value": true
            },
            "cause": "lava",
            "damage_per_tick": 4
          }
        ]
      },
      "minecraft:nameable": {
        "allow_name_tag_renaming": true,
        "always_show": false
      },
      "minecraft:persistent": {},
      "minecraft:physics": {
        "has_collision": true,
        "has_gravity": true
      },
      "minecraft:pushable": {
        "is_pushable": true,
        "is_pushable_by_piston": true
      },

      "minecraft:experience_reward": {
        "on_death": "query.last_hit_by_player ? Math.Random(1,3) : 0"
      },
      "minecraft:conditional_bandwidth_optimization": {
      }
    },
    "events": {
      "minecraft:entity_spawned": {
        "randomize": [
          {
            "weight": 100,
            "add": {
              "component_groups": [
                "component:prismarine_clam_variant_0",
                "component:prismarine_clam_close",
                "component:prismarine_clam_in_nether"
              ]
            }
          },
          {
            "weight": 100,
            "add": {
              "component_groups": [
                "component:prismarine_clam_variant_1",
                "component:prismarine_clam_close",
                "component:prismarine_clam_in_nether"
              ]
            }
          },
          {
            "weight": 100,
            "add": {
              "component_groups": [
                "component:prismarine_clam_variant_2",
                "component:prismarine_clam_close",
                "component:prismarine_clam_in_nether"
              ]
            }
          },
          {
            "weight": 100,
            "add": {
              "component_groups": [
                "component:prismarine_clam_variant_3",
                "component:prismarine_clam_close",
                "component:prismarine_clam_in_nether"
              ]
            }
          }
        ]
      },
      "event:prismarine_clam_open": {
        "remove": {
          "component_groups": [
            "component:prismarine_clam_close"
          ]
        },
        "add": {
          "component_groups": [
            "component:prismarine_clam_open"
          ]
        }
      },
      "event:prismarine_clam_harvested": {
        "remove": {
          "component_groups": [
            "component:prismarine_clam_open"
          ]
        },
        "add": {
          "component_groups": [
            "component:prismarine_clam_close"
          ]
        }
      },
      "event:prismarine_clam_catched": {
				"add": {
					"component_groups": [
						"component:prismarine_clam_despawn"
					]
				}
			},
			"event:remove_water_in_nether": {
				"sequence": [
          {
            "run_command": {
              "command": [
                "playsound random.fizz @a[r=5]",
                "fill ~ ~ ~ ~ ~ ~ air replace flowing_water",
                "fill ~ ~ ~ ~ ~ ~ air replace water"
              ]
            },
            "remove": {
              "component_groups": [
                "component:prismarine_clam_in_nether"
              ]
            }
          }
        ]
			}
    }
  }
}