GM4_Datapacks icon indicating copy to clipboard operation
GM4_Datapacks copied to clipboard

Update to 1.20.5

Open misode opened this issue 1 year ago • 0 comments

Preview download for testing: https://github.com/Gamemode4Dev/GM4_Datapacks/actions/runs/9099290404/artifacts/1505990608

Continued from #978

Steps taken

Initial steps:

  • Apply overlays with script
  • Update version numbers and pack formats
  • Update test functions (manually)
  • Disable player head logic in plugins

Fixing JSON resource load errors:

  • Turtle scute: Replace minecraft:scute -> minecraft:turtle_scute
  • Location predicates
    • Search for "biome" and "structure" -> "biomes" and "structures"
  • Nested loot tables
    • Replace ("type": ?"(?:minecraft:)?loot_table",\n\s+(?:"weight": \d+,\n\s+)?)"name" -> $1"value"
    • Fix gm4_end_fishing:gameplay/fish/scattered_treasure and gm4_end_fishing:gameplay/fish/valuables manually
  • Set lore function
    • Note down the 4 replace true cases in files lore.json, copy.json and update_sips.json
    • Replace ,\n\s+"replace": (false|true) -> (empty replacement)
    • Replace ("function": "(?:minecraft:)?set_lore",(\n\s+)) -> $1"mode": "append",$2
    • Switch in previous 4 cases append -> replace_all
  • Block and item predicates
    • Replace ("block": \{\n\s+)"tag": "([a-z]) -> $1"blocks": "#$2
    • Replace ("fluid": \{\n\s+)"tag": "([a-z]) -> $1"fluids": "#$2
    • Replace ("(?:mainhand|offhand|head|chest|legs|feet)": \{\n\s+)"tag": "([a-z]) -> $1"items": "#$2
    • Search for "tag": "[a-z] and manually fix the 3 item predicates in advancements + 1 in match tool predicate
    • Replace all "tag" -> "blocks" in has_beam.json
  • Attribute operations
    • Replace "addition" -> "add_value"
    • Replace "multiply_base" -> "add_multiplied_base"
    • Replace "multiply" -> "add_multiplied_total"` (doesn't appear in our repo)
  • Item sub predicates
    • Search "potion" and fix the 2 cases manually
    • Replace \n(\s+)"enchantments": \[\n(\s+)\{\n(\s+)"enchantment": "([a-z_:]+)"\n(\s+)\}\n(\s+)\] -> \n$1"predicates": {\n$2"minecraft:enchantments": [\n$2 {\n$3 "enchantment": "$4"\n$5 }\n$6 ]\n$1}
    • Replace \n(\s+)"enchantments": \[\n(\s+)\{\n(\s+)"enchantment": "([a-z_:]+)",\n(\s+)"levels": (\d+)\n(\s+)\}\n(\s+)\] -> \n$1"predicates": {\n$2"minecraft:enchantments": [\n$2 {\n$3 "enchantment": "$4",\n$5 "levels": $6\n$7 }\n$8 ]\n$1}
    • Search "enchantments": \[\n\s+\{ and fix the remaining 10 cases manually
    • Search "durability", we don't have any in our repo
  • Advancement icons
    • Replace "icon": \{\n(\s+)"item" -> "icon": {\n$1"id"
  • Sweeping edge: Replace minecraft:sweeping -> minecraft:sweeping_edge
  • Update yellow shulker box
  • set_nbt
    • Replace set_nbt",\n(\s+)"tag": "\{StoredEnchantments:\[\{lvl:(\d+)s,id:\\"([a-z_:]+)\\"\}\]\}" -> set_components",\n$1"components": {\n$1 "minecraft:stored_enchantments": {\n$1 "$3": $2\n$1 }\n$1}
    • Replace set_nbt",\n(\s+)"tag": "\{CustomModelData:'([a-z0-9_/]+)'\}" -> set_components",\n$1"components": {\n$1 "minecraft:custom_model_data": "$2"\n$1}
    • A lot of manual work!
  • copy_nbt TODO
    • A lot of manual work!

Fixing mcfunction files:

  • Attribute operations
    • Replace (attribute .*) add$ -> $1 add_value
    • Replace (attribute .*) multiply_base$ -> $1 add_multiplied_base
    • Replace (attribute .*) multiply$ -> $1 add_multiplied_total
  • Item stack NBT
    • Replace Count:(\d+)b? -> count:$1
    • Replace \.Count -> .count
  • Particle syntax
    • (^particle| run particle) (minecraft:)?(block|block_marker|falling_dust|dust_pillar) (minecraft:)?([a-z0-9_:]+) -> $1 minecraft:$3{block_state:"minecraft:$5"}
    • (^particle| run particle) (minecraft:)?(dust) ([\d.]+) ([\d.]+) ([\d.]+) ([\d.]+) -> $1 minecraft:$3{color:[$4,$5,$6],scale:$7}
    • (^particle| run particle) (minecraft:)?(entity_effect) ([\d~^.-]+ [\d~^.-]+ [\d~^.-]+) ([\d.]+) ([\d.]+) ([\d.]+) -> $1 minecraft:$3{color:[$5,$6,$7,$8]} $4 0 0 0 $8
    • Manually fix the remaining particles (^particle| run particle) (minecraft:)?(dust_color_transition|sculk_charge|vibration|shriek)
  • Manual work
    • Search for \.tag|tag\.|tag:\{

Issues found while updating

  • gm4_trapped_signs.json needs to be moved into a gm4_recipes folder
  • lingering_bottle_of_lightning.json tried to set tags Particle and RadiusOnUse, were these ever applied?
  • spore.json and malachite_lump.json use raw custom model data
  • mountaineering new_skis used the existing data of the first iron nugget, instead of the iron boots
  • beehive inspector lists and schedules a main function that doesn't exist
  • phantom scarecrows allowed the curse enchantment on other armor slots than the chest
  • smelteries and tinkering compressors place_down uses raw custom model data

Notes

  • better armour stands no longer matches books with multiple pages
  • crossbow cartridges no longer works with multishot or tipped arrows due to matching exact charged_projectiles component
  • crossbow cartridges beehive predicate no longer checks that there are bees inside
  • orb of ankou shoot_crossbow advancement no longer works with multishot

Possible feature changes

  • Should hypexperia also be applicable to hoes?

misode avatar Apr 12 '24 20:04 misode