derpiestone

Make a datapack for 1.21.4 which adds an infection with block and mob infection that spawns immediatly at world spawn, also give the nessacary resourcepack

Kodari AI
KodariJan 4 at 10:36 am 5,084 (v2)

I’ll create an infection data pack with block and mob infection mechanics that starts at world spawn, plus a companion resource pack.

InfectionSpread
A dynamic infection system that spawns at world spawn and spreads through blocks and mobs. Infected blocks transform into corrupted variants with particles, while infected mobs gain poisonous effects and spread the infection to others. The infection gradually expands outward, creating an ever-growing contaminated zone that players must contain or escape from.

Data Pack

Resource Pack


Installation Instructions

Data Pack:

  1. Download and extract infection_datapack into your world’s datapacks folder

  2. Path should be: saves/[WorldName]/datapacks/infection_datapack/

  3. Run /reload in-game

  4. The infection starts automatically at world spawn (0, ~, 0)

Resource Pack:

  1. Download and extract infection_resourcepack into your resourcepacks folder

  2. Enable it in Options > Resource Packs

  3. Move it to the “Selected” side

Features

Block Infection:

  • Grass/Dirt → Crimson Nylium

  • Stone/Cobblestone → Netherrack

  • Logs → Crimson Stems

  • Leaves → Nether Wart Blocks

  • Sand → Red Sand

  • Gravel → Soul Sand

  • Water → Lava

Mob Infection:

  • Infected mobs glow red

  • Gain Speed, Strength, and Poison effects

  • Spread infection to nearby mobs within 3 blocks

  • Continuous particle effects

Spreading:

  • Starts at world spawn (0, 100, 0)

  • Expands every second

  • Red particles mark infected zones

  • Grows gradually over time

Commands

  • /kill @e[tag=infection_core] - Stop the infection spread

  • /tag @e[tag=infected_mob] remove infected_mob - Cure all infected mobs

  • /scoreboard players set #range infect_range <number> - Set infection radius

Kodari can make mistakes. Review important code before using.
Files
infection_datapack
infection_resourcepack
Code
16 120
infection_datapack/data/infection/function/infect_block_area.mcfunction
execute if block ~ ~ ~ grass_block run setblock ~ ~ ~ crimson_nylium
execute if block ~ ~ ~ dirt run setblock ~ ~ ~ crimson_nylium
execute if block ~ ~ ~ stone run setblock ~ ~ ~ netherrack
execute if block ~ ~ ~ cobblestone run setblock ~ ~ ~ netherrack
execute if block ~ ~ ~ oak_log run setblock ~ ~ ~ crimson_stem
execute if block ~ ~ ~ birch_log run setblock ~ ~ ~ crimson_stem
execute if block ~ ~ ~ spruce_log run setblock ~ ~ ~ crimson_stem
execute if block ~ ~ ~ jungle_log run setblock ~ ~ ~ crimson_stem
execute if block ~ ~ ~ acacia_log run setblock ~ ~ ~ crimson_stem
execute if block ~ ~ ~ dark_oak_log run setblock ~ ~ ~ crimson_stem
execute if block ~ ~ ~ oak_leaves run setblock ~ ~ ~ nether_wart_block
execute if block ~ ~ ~ birch_leaves run setblock ~ ~ ~ nether_wart_block
execute if block ~ ~ ~ spruce_leaves run setblock ~ ~ ~ nether_wart_block
execute if block ~ ~ ~ jungle_leaves run setblock ~ ~ ~ nether_wart_block
execute if block ~ ~ ~ acacia_leaves run setblock ~ ~ ~ nether_wart_block
execute if block ~ ~ ~ dark_oak_leaves run setblock ~ ~ ~ nether_wart_block
execute if block ~ ~ ~ sand run setblock ~ ~ ~ red_sand
execute if block ~ ~ ~ gravel run setblock ~ ~ ~ soul_sand
execute if block ~ ~ ~ water run setblock ~ ~ ~ lava