Created
December 24, 2020 13:03
-
-
Save JLChnToZ/aeb3f49bbaab35f15f0087a697dff32a to your computer and use it in GitHub Desktop.
Killer Bunny Virus Datapack for Minecraft Java Edition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This data file extends behaviours of killer bunnies to act like a virus in Minecraft Java Edition. | |
# To convert this file into datapack and usable in saves, use https://www.npmjs.com/package/mcds-convert | |
# Killer bunnies are hostile, they have white fur and with red bloody eyes. | |
# First killer bunny will randomly appears at night and/or thunderstorm weather. | |
# Invisibility potion/effect is also the cause of killer bunnies. | |
# Killer bunnies will randomly infects nearby normal rabbits. | |
# Killer bunnies will randomly breed themselves, even there is only one. | |
# Killer bunnies can be cured with night vision potion. | |
pack: | |
pack_format: 7 # Change to 6 for running in 1.16.2+, and 5 for in 1.15+ | |
description: Killer Bunny Virus | |
predicates: | |
'kbv:infect_random': | |
condition: random_chance | |
chance: 0.001 | |
'kbv:infect_zero_condition': | |
condition: alternative | |
terms: | |
- condition: time_check | |
value: | |
min: 12000 | |
- condition: weather_check | |
thundering: true | |
'kbv:infect_condition': | |
condition: entity_properties | |
entity: this | |
predicate: | |
type: rabbit | |
effects: | |
invisibility: {} | |
'kbv:spawn_random': | |
condition: random_chance | |
chance: 0.02 | |
'kbv:spawn_condition': | |
condition: entity_properties | |
entity: this | |
predicate: | |
type: rabbit | |
flags: | |
is_baby: no | |
'kbv:cure_condition': | |
condition: entity_properties | |
entity: this | |
predicate: | |
type: rabbit | |
effects: | |
night_vision: {} | |
functions: | |
'#load': | |
values: | |
- kbv:init | |
'#tick': | |
values: | |
- kbv:step | |
'kbv:init': | | |
scoreboard objectives add kbv_curetimer dummy | |
scoreboard objectives add kbv_immute dummy | |
scoreboard objectives add kbv_wastype dummy | |
execute as @e[type=rabbit,nbt=!{RabbitType:99}] store result score @s kbv_wastype run data get entity @s RabbitType | |
'kbv:step': | | |
tag @e[type=rabbit,nbt={RabbitType:99}] add kbvcarrier | |
scoreboard players add @e[type=rabbit] kbv_immute 0 | |
scoreboard players remove @e[type=rabbit,scores={kbv_immute=1..}] kbv_immute 1 | |
execute if predicate kbv:infect_zero_condition unless entity @e[type=rabbit,tag=kbvcarrier] as @e[type=rabbit,scores={kbv_immute=0},limit=1,sort=random] at @s if predicate kbv:infect_random run function kbv:infect/do_zero | |
execute as @e[type=rabbit,tag=!kbvcarrier,scores={kbv_immute=0}] at @s run function kbv:infect/detect | |
execute as @e[type=rabbit,tag=kbvbaby] run function kbv:spawn/as_baby | |
execute as @e[type=rabbit,tag=kbvcarrier,tag=!kbvcure,predicate=kbv:spawn_condition,predicate=kbv:spawn_random,limit=10,sort=random] at @s run function kbv:spawn/detect | |
execute as @e[type=rabbit,tag=kbvcarrier,tag=!kbvcure,predicate=kbv:cure_condition] at @s run function kbv:cure/start | |
execute as @e[type=rabbit,tag=kbvcarrier,tag=kbvcure] at @s run function kbv:cure/step | |
tag @e[tag=kbvcarrier] remove kbvcarrier | |
'kbv:infect/detect': | | |
execute if entity @e[type=rabbit,distance=..8,tag=kbvcarrier] if predicate kbv:infect_random run function kbv:infect/do | |
execute if predicate kbv:infect_condition run function kbv:infect/do_alt | |
execute if entity @e[type=rabbit,distance=..2,tag=kbvcarrier] run function kbv:infect/do | |
'kbv:infect/do': | | |
execute store result score @s kbv_wastype run data get entity @s RabbitType | |
data modify entity @s RabbitType set value 99 | |
particle poof ~ ~ ~ 0 1 0 0 25 | |
'kbv:infect/do_alt': | | |
function kbv:infect/do | |
effect clear @s invisibility | |
'kbv:infect/do_zero': | | |
function kbv:infect/do | |
title @a actionbar "Bunnies are cute, aren't they? Beware they gotta kill you. :)" | |
'kbv:spawn/detect': | | |
tag @s add kbvspawn | |
execute unless entity @e[type=rabbit,distance=..5,tag=!kbvspawn] run function kbv:spawn/do | |
tag @s remove kbvspawn | |
'kbv:spawn/do': | | |
summon rabbit ~ ~ ~ {RabbitType:99,Age:-1200,Tags:["kbvbaby"]} | |
particle poof ~ ~ ~ 0 1 0 0 25 | |
'kbv:spawn/as_baby': | | |
scoreboard players set @s kbv_wastype 1 | |
tag @s remove kbvbaby | |
'kbv:cure/start': | | |
tag @s add kbvcure | |
scoreboard players set @s kbv_curetimer 400 | |
'kbv:cure/step': | | |
scoreboard players remove @s kbv_curetimer 1 | |
particle effect ~ ~ ~ 0 0 0 0 1 | |
execute if score @s kbv_curetimer matches ..0 run function kbv:cure/do | |
'kbv:cure/do': | | |
execute store result entity @s RabbitType int 1 run scoreboard players get @s kbv_wastype | |
execute if data entity @s {CustomName:"{\"translate\":\"entity.minecraft.killer_bunny\"}"} run data modify entity @s CustomName set value "" | |
particle poof ~ ~ ~ 0 1 0 0 25 | |
scoreboard players reset @s kbv_curetimer | |
scoreboard players set @s kbv_immute 1200 | |
tag @s remove kbvcure |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment