Przeglądaj źródła

Merge branch 'master' of https://github.com/LTCatt/LTW3

LTCatt 6 lat temu
rodzic
commit
2dc2ab648a

+ 15 - 0
data/item/advancements/special/consume_enchanted_apple.json

@@ -0,0 +1,15 @@
+{
+    "criteria": {
+        "hurt": {
+            "trigger": "minecraft:consume_item",
+            "conditions": {
+                "item": {
+                    "item": "minecraft:enchanted_golden_apple"
+                }
+            }
+        }
+    },
+    "rewards": {
+        "function": "item:special/enchanted_apple"
+    }
+}

+ 15 - 0
data/item/advancements/special/consume_golden_apple.json

@@ -0,0 +1,15 @@
+{
+    "criteria": {
+        "hurt": {
+            "trigger": "minecraft:consume_item",
+            "conditions": {
+                "item": {
+                    "item": "minecraft:golden_apple"
+                }
+            }
+        }
+    },
+    "rewards": {
+        "function": "item:special/golden_apple"
+    }
+}

+ 1 - 1
data/item/functions/bonus_item/tp.mcfunction

@@ -2,5 +2,5 @@
 tp @s @a[tag=item_op,limit=1]
 tag @s add bonus_old
 # 判断是否需要清除nbt tag
-execute if data entity @s Item.tag{"bonus_clear_nbt":true} run data remove entity @s Item.tag
+execute if predicate item:bonus/clear_nbt run data remove entity @s Item.tag
 data modify entity @s PickupDelay set value 0

+ 4 - 0
data/item/functions/special/clear_effect.mcfunction

@@ -0,0 +1,4 @@
+effect clear @a[tag=consume_apple] absorption
+effect clear @a[tag=consume_apple] regeneration
+effect clear @a[tag=consume_apple] fire_resistance
+effect give @a[tag=consume_apple] minecraft:resistance 999999 4 true

+ 9 - 0
data/item/functions/special/enchanted_apple.mcfunction

@@ -0,0 +1,9 @@
+# 去除进度
+advancement revoke @s only item:special/consume_enchanted_apple
+
+# 计算生命值
+execute if score $state mem matches 1.. if score @s mini_heart matches 1.. run scoreboard players operation @s mini_heart += @s mini_heart
+execute if score $state mem matches 1.. if score @s mini_heart matches 1.. run function mini:/player_max_health
+# 去除buff
+execute if score $state mem matches 1.. if score @s mini_heart matches 1.. run tag @s add consume_apple
+schedule function item:special/clear_effect 1t replace

+ 10 - 0
data/item/functions/special/golden_apple.mcfunction

@@ -0,0 +1,10 @@
+# 去除进度
+advancement revoke @s only item:special/consume_golden_apple
+
+# 计算生命值
+execute if score $state mem matches 1.. if score @s mini_heart matches 1.. run scoreboard players add @s mini_heart 1
+execute if score $state mem matches 1.. if score @s mini_heart matches 1.. run function mini:/player_max_health
+
+# 去除buff
+execute if score $state mem matches 1.. if score @s mini_heart matches 1.. run tag @s add consume_apple
+schedule function item:special/clear_effect 1t replace

+ 7 - 0
data/item/predicates/bonus/clear_nbt.json

@@ -0,0 +1,7 @@
+{
+    "condition":"minecraft:entity_properties",
+    "entity": "this",
+    "predicate": {
+        "nbt": "Item.tag{\"bonus_clear_nbt\":true}"
+    }
+}

+ 6 - 0
data/mini/functions/main/player_max_health.mcfunction

@@ -1,5 +1,11 @@
 # 如小游戏有多条命,需在小游戏中设置给玩家mini_heart生命上限并调用此函数
+# 设置生命值上限
+execute if score @s mini_heart matches 13.. run tellraw @a ["",{"text": ">> ","color":"gold","bold": true},"小游戏生命值上限是12哦,请不要太贪心!"]
+execute if score @s mini_heart matches 13.. run scoreboard players set @s mini_heart 12
+
 # 根据玩家mini_heart数量决定生命值上限
+execute if score @s mini_heart matches 12 run attribute @s generic.max_health base set 24
+execute if score @s mini_heart matches 11 run attribute @s generic.max_health base set 22
 execute if score @s mini_heart matches 10 run attribute @s generic.max_health base set 20
 execute if score @s mini_heart matches 9 run attribute @s generic.max_health base set 18
 execute if score @s mini_heart matches 8 run attribute @s generic.max_health base set 16