Procházet zdrojové kódy

交易列表测试

HerobrineXia před 5 roky
rodič
revize
8914b56084

+ 7 - 0
data/mini/functions/trade/game/new_trade_s.mcfunction

@@ -0,0 +1,7 @@
+loot spawn ~ ~ ~ loot mini:trade_s
+data modify entity @s Offers.Recipes append value {rewardExp:false,xp:20}
+data modify entity @s Offers.Recipes[-1].buy set from entity @e[type=item,nbt={Item:{tag:{TradeItem:1b}}},limit=1] Item.tag.buy
+data modify entity @s Offers.Recipes[-1].buyB set from entity @e[type=item,nbt={Item:{tag:{TradeItem:1b}}},limit=1] Item.tag.buyB
+data modify entity @s Offers.Recipes[-1].maxUses set from entity @e[type=item,nbt={Item:{tag:{TradeItem:1b}}},limit=1] Item.tag.maxUses
+data modify entity @s Offers.Recipes[-1].sell set from entity @e[type=item,nbt={Item:{tag:{TradeItem:1b}}},limit=1] Item.tag.sell
+kill @e[type=item,nbt={Item:{tag:{TradeItem:1b}}}]

+ 169 - 7
data/mini/loot_tables/trade_s.json

@@ -1,5 +1,11 @@
 {
-    "type": "generic",
+    "type": "entity",
+    "functions": [
+        {
+            "function": "set_nbt",
+            "tag": "{TradeItem:1b}"
+        }
+    ],
     "pools": [
         {
             "rolls": 1,
@@ -9,27 +15,183 @@
                     "children": [
                         {
                             "type": "item",
-                            "name": "spider_spawn_egg"
+                            "name": "stone",
+                            "functions": [
+                                {
+                                    "function": "set_nbt",
+                                    "tag": "{buy:{id:\"emerald\",Count:4}}"
+                                },
+                                {
+                                    "function": "set_nbt",
+                                    "tag":"{sell:{id:\"spider_spawn_egg\",Count:1}}"
+                                },
+                                {
+                                    "function": "set_nbt",
+                                    "tag":"{maxUses:999999}"
+                                }
+                            ],
+                            "conditions": [
+                                {
+                                    "condition": "inverted",
+                                    "term": {
+                                        "condition": "minecraft:entity_properties",
+                                        "entity": "this",
+                                        "predicate": {
+                                            "nbt": "{Offers:{Recipes:[{sell:{id:\"minecraft:spider_spawn_egg\"}}]}}"
+                                        }
+                                    }
+                                }
+                            ]
                         },
                         {
                             "type": "item",
-                            "name": "skeleton_spawn_egg"
+                            "name": "stone",
+                            "functions": [
+                                {
+                                    "function": "set_nbt",
+                                    "tag": "{buy:{id:\"emerald\",Count:5}}"
+                                },
+                                {
+                                    "function": "set_nbt",
+                                    "tag":"{sell:{id:\"skeleton_spawn_egg\",Count:1}}"
+                                },
+                                {
+                                    "function": "set_nbt",
+                                    "tag":"{maxUses:999999}"
+                                }
+                            ],
+                            "conditions": [
+                                {
+                                    "condition": "inverted",
+                                    "term": {
+                                        "condition": "minecraft:entity_properties",
+                                        "entity": "this",
+                                        "predicate": {
+                                            "nbt": "{Offers:{Recipes:[{sell:{id:\"minecraft:skeleton_spawn_egg\"}}]}}"
+                                        }
+                                    }
+                                }
+                            ]
                         },
                         {
                             "type": "item",
-                            "name": "iron_ingot"
+                            "name": "stone",
+                            "functions": [
+                                {
+                                    "function": "set_nbt",
+                                    "tag": "{buy:{id:\"emerald\",Count:6}}"
+                                },
+                                {
+                                    "function": "set_nbt",
+                                    "tag":"{sell:{id:\"iron_ingot\",Count:2}}"
+                                },
+                                {
+                                    "function": "set_nbt",
+                                    "tag":"{maxUses:999999}"
+                                }
+                            ],
+                            "conditions": [
+                                {
+                                    "condition": "inverted",
+                                    "term": {
+                                        "condition": "minecraft:entity_properties",
+                                        "entity": "this",
+                                        "predicate": {
+                                            "nbt": "{Offers:{Recipes:[{sell:{id:\"minecraft:iron_ingot\"}}]}}"
+                                        }
+                                    }
+                                }
+                            ]
                         },
                         {
                             "type": "item",
-                            "name": "stone"
+                            "name": "stone",
+                            "functions": [
+                                {
+                                    "function": "set_nbt",
+                                    "tag": "{buy:{id:\"emerald\",Count:6}}"
+                                },
+                                {
+                                    "function": "set_nbt",
+                                    "tag":"{sell:{id:\"stone\",Count:4}}"
+                                },
+                                {
+                                    "function": "set_nbt",
+                                    "tag":"{maxUses:999999}"
+                                }
+                            ],
+                            "conditions": [
+                                {
+                                    "condition": "inverted",
+                                    "term": {
+                                        "condition": "minecraft:entity_properties",
+                                        "entity": "this",
+                                        "predicate": {
+                                            "nbt": "{Offers:{Recipes:[{sell:{id:\"minecraft:stone\"}}]}}"
+                                        }
+                                    }
+                                }
+                            ]
                         },
                         {
                             "type": "item",
-                            "name": "oak_planks"
+                            "name": "stone",
+                            "functions": [
+                                {
+                                    "function": "set_nbt",
+                                    "tag": "{buy:{id:\"emerald\",Count:5}}"
+                                },
+                                {
+                                    "function": "set_nbt",
+                                    "tag":"{sell:{id:\"oak_planks\",Count:12}}"
+                                },
+                                {
+                                    "function": "set_nbt",
+                                    "tag":"{maxUses:999999}"
+                                }
+                            ],
+                            "conditions": [
+                                {
+                                    "condition": "inverted",
+                                    "term": {
+                                        "condition": "minecraft:entity_properties",
+                                        "entity": "this",
+                                        "predicate": {
+                                            "nbt": "{Offers:{Recipes:[{sell:{id:\"minecraft:oak_planks\"}}]}}"
+                                        }
+                                    }
+                                }
+                            ]
                         },
                         {
                             "type": "item",
-                            "name": "nether_star"
+                            "name": "stone",
+                            "functions": [
+                                {
+                                    "function": "set_nbt",
+                                    "tag": "{buy:{id:\"emerald\",Count:18}}"
+                                },
+                                {
+                                    "function": "set_nbt",
+                                    "tag":"{sell:{id:\"nether_star\",Count:1}}"
+                                },
+                                {
+                                    "function": "set_nbt",
+                                    "tag":"{maxUses:999999}"
+                                }
+                            ],
+                            "conditions": [
+                                {
+                                    "condition": "inverted",
+                                    "term": {
+                                        "condition": "minecraft:entity_properties",
+                                        "entity": "this",
+                                        "predicate": {
+                                            "nbt": "{Offers:{Recipes:[{sell:{id:\"minecraft:nether_star\"}}]}}"
+                                        }
+                                    }
+                                }
+                            ]
                         }
                     ]
                 }