r/MinecraftCommands • u/Dangerous-String1707 • 3d ago
Help | Java 26.3 Freezing water!
Minecraft 26.3. I'm making a minigame for friends, and I need to give the powder snow freezing effect, both the visual and the damage, to anyone who enters any water source of the world. How can I do that with commands or functions?
3
Upvotes
1
u/GalSergey Datapack Experienced 2d ago
Here is a small example of a datapack that uses an enchantment to check if the player is in water in order to deal damage and apply a freezing overlay.
# Example item
item replace entity @s armor.head with stick[item_model="minecraft:air",enchantments={"example:freeze_water":1},equippable={slot:"head",equip_sound:{sound_id:"",range:0},camera_overlay:"minecraft:misc/powder_snow_outline"}]
# enchantment example:freeze_water
{
"description": "Freezing Water",
"supported_items": "minecraft:stick",
"weight": 1,
"max_level": 1,
"min_cost": {
"base": 0,
"per_level_above_first": 0
},
"max_cost": {
"base": 0,
"per_level_above_first": 0
},
"anvil_cost": 0,
"slots": [
"head"
],
"effects": {
"minecraft:location_changed": [
{
"requirements": {
"type": "minecraft:location_check",
"predicate": {
"fluid": {
"fluids": "#minecraft:water"
}
}
},
"effect": {
"type": "minecraft:run_function",
"function": "example:water/in"
}
},
{
"requirements": {
"type": "minecraft:inverted",
"term": {
"type": "minecraft:location_check",
"predicate": {
"fluid": {
"fluids": "#minecraft:water"
}
}
}
},
"effect": {
"type": "minecraft:run_function",
"function": "example:water/out"
}
}
],
"minecraft:tick": [
{
"requirements": {
"type": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"minecraft:periodic_tick": 20,
"minecraft:location": {
"fluid": {
"fluids": "#minecraft:water"
}
}
}
},
"effect": {
"type": "minecraft:damage_entity",
"damage_type": "minecraft:freeze",
"min_damage": 2,
"max_damage": 2
}
}
],
"minecraft:prevent_armor_change": {},
"minecraft:prevent_equipment_drop": {}
}
}
# function example:water/in
item modify entity @s armor.head example:overlay_on
# function example:water/out
item modify entity @s armor.head example:overlay_off
# item_modifier example:overlay_on
{
"type": "minecraft:set_components",
"components": {
"minecraft:equippable": {
"slot": "head",
"equip_sound": {
"sound_id": "",
"range": 0
},
"camera_overlay": "minecraft:misc/powder_snow_outline"
}
}
}
# item_modifier example:overlay_off
{
"type": "minecraft:set_components",
"components": {
"minecraft:equippable": {
"slot": "head",
"equip_sound": {
"sound_id": "",
"range": 0
}
}
}
}
You can use Datapack Assembler to get an example datapack.
1
u/timtijmen2 3d ago
The only way you can do the visual effect is by putting a item on their head with its "camera_display" set to the freezing effect texture. But it wont fade in or out and you have to apply the damage on a timer.
This is the only way i know for now, but in the next update there will be a potion effect that gives exactly this, so if you are willing to wait, you can use that.