From 0830374c78bbb397d3a0ccd02bce2d36766e4e5b Mon Sep 17 00:00:00 2001 From: LocusAzzurro Date: Wed, 21 Jun 2023 01:15:02 +0200 Subject: [PATCH] :arrow_up: 1.19.4 port --- gradle.properties | 12 +++---- .../0b2490ac2ed8d7430e91056c2e409f9d08dee345 | 2 +- .../24a897d8e510b37ca8ad971abdfca77ebe562389 | 2 +- .../2dbe3afb3f90910fbe5ca72e90d59dd0378ba87b | 2 +- .../59eb3dbb5f86130e09b3c62d89b9525ee01cf52d | 2 +- .../9f764f6a48fad7efa1e12bbe43f82e8f02bfa43c | 2 +- .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 32 +++++++++---------- .../recipes/burst_explosion_pattern.json | 3 +- .../recipes/extended_fuse.json | 3 +- .../pyrotechnicraft/recipes/firecracker.json | 3 +- .../recipes/firework_homing_module.json | 3 +- .../recipes/firework_launcher.json | 3 +- .../firework_missile_crafting_table.json | 3 +- .../recipes/firework_orb_crafting_table.json | 3 +- .../recipes/firework_orb_shooter.json | 3 +- .../recipes/firework_wrapping_paper.json | 3 +- .../recipes/flicker_stick.json | 3 +- .../pyrotechnicraft/recipes/homing_array.json | 3 +- .../pyrotechnicraft/recipes/instant_fuse.json | 3 +- .../pyrotechnicraft/recipes/regular_fuse.json | 3 +- .../recipes/ring_explosion_pattern.json | 3 +- .../recipes/sphere_explosion_pattern.json | 3 +- .../data/DamageTypeRegistry.java | 17 ++++++++++ .../datagen/DataGenerators.java | 7 ++++ .../datagen/ModDamageTypes.java | 12 +++++++ .../datagen/ModItemTagsProvider.java | 2 +- .../event/ModCommonEventHandler.java | 4 +-- .../world/data/damage/DamageSources.java | 11 ------- .../data/damage/FireworkMissileDamage.java | 18 ----------- .../world/entity/FireworkStarter.java | 13 ++++++-- .../assets/pyrotechnicraft/lang/en_us.json | 4 +-- .../assets/pyrotechnicraft/lang/zh_cn.json | 4 +-- 32 files changed, 109 insertions(+), 82 deletions(-) create mode 100644 src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/data/DamageTypeRegistry.java create mode 100644 src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/datagen/ModDamageTypes.java delete mode 100644 src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/world/data/damage/DamageSources.java delete mode 100644 src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/world/data/damage/FireworkMissileDamage.java diff --git a/gradle.properties b/gradle.properties index 249b7bc..49160ab 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,13 +1,13 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false -minecraft_version=1.19.3 -minecraft_version_range=[1.19.3] -forge_version=44.1.0 -forge_version_range=[44,) -loader_version_range=[44,) +minecraft_version=1.19.4 +minecraft_version_range=[1.19.4] +forge_version=45.1.0 +forge_version_range=[45,) +loader_version_range=[45,) mappings_channel=official -mappings_version=1.19.3 +mappings_version=1.19.4 mod_id=pyrotechnicraft mod_name=Pyrotechnicraft diff --git a/src/generated/resources/.cache/0b2490ac2ed8d7430e91056c2e409f9d08dee345 b/src/generated/resources/.cache/0b2490ac2ed8d7430e91056c2e409f9d08dee345 index 28f32c9..04bc566 100644 --- a/src/generated/resources/.cache/0b2490ac2ed8d7430e91056c2e409f9d08dee345 +++ b/src/generated/resources/.cache/0b2490ac2ed8d7430e91056c2e409f9d08dee345 @@ -1,4 +1,4 @@ -// 1.19.3 2023-06-21T00:29:39.0726577 Block States: pyrotechnicraft +// 1.19.4 2023-06-21T01:11:42.3099359 Block States: pyrotechnicraft 1b2704a1f88f054bfbe0f5efe83f296bc6a9f5d7 assets/pyrotechnicraft/blockstates/composite_firework_orb_launcher_stand.json 0f8af74078302a356965c663d796ead70437ee56 assets/pyrotechnicraft/blockstates/firework_launcher_stand.json 3b2bff2975eccc0c42f772f6999bbbc36ccc4c45 assets/pyrotechnicraft/blockstates/firework_missile_crafting_table.json diff --git a/src/generated/resources/.cache/24a897d8e510b37ca8ad971abdfca77ebe562389 b/src/generated/resources/.cache/24a897d8e510b37ca8ad971abdfca77ebe562389 index 820cf50..e9938fe 100644 --- a/src/generated/resources/.cache/24a897d8e510b37ca8ad971abdfca77ebe562389 +++ b/src/generated/resources/.cache/24a897d8e510b37ca8ad971abdfca77ebe562389 @@ -1,4 +1,4 @@ -// 1.19.3 2023-06-21T00:29:39.0746577 pyrotechnicraft Item Tags +// 1.19.4 2023-06-21T01:11:42.3109363 pyrotechnicraft Item Tags 1b2b2d7ade8bc1d9416753e0cda18cc7cf9ebca8 data/forge/tags/items/dusts/coal.json 35133e95f1c8fdd7a1c21afcc231fc0bffefb9a8 data/forge/tags/items/dusts/diamond.json 35133e95f1c8fdd7a1c21afcc231fc0bffefb9a8 data/forge/tags/items/dusts/iron.json diff --git a/src/generated/resources/.cache/2dbe3afb3f90910fbe5ca72e90d59dd0378ba87b b/src/generated/resources/.cache/2dbe3afb3f90910fbe5ca72e90d59dd0378ba87b index 53a7741..797502a 100644 --- a/src/generated/resources/.cache/2dbe3afb3f90910fbe5ca72e90d59dd0378ba87b +++ b/src/generated/resources/.cache/2dbe3afb3f90910fbe5ca72e90d59dd0378ba87b @@ -1,4 +1,4 @@ -// 1.19.3 2023-06-21T00:29:39.0766584 pyrotechnicraft Item Models +// 1.19.4 2023-06-21T01:11:42.3129367 pyrotechnicraft Item Models e7f248b2d2667c34a23694dbf868a93f3dba915e assets/pyrotechnicraft/models/item/2d_explosion_pattern.json fa19194798f1dd31d7d6fcadade9458997c754a2 assets/pyrotechnicraft/models/item/3d_explosion_pattern.json 002be3c6f48046a16cfd6162a787c7bc7bf07c57 assets/pyrotechnicraft/models/item/burst_explosion_pattern.json diff --git a/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d b/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d index d4c43a5..cb11afa 100644 --- a/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d +++ b/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d @@ -1,4 +1,4 @@ -// 1.19.3 2023-06-21T00:29:39.0746577 Loot Tables +// 1.19.4 2023-06-21T01:11:42.3109363 Loot Tables 0252994caec71ff7612f432051aaac2cc156847b data/pyrotechnicraft/loot_tables/blocks/composite_firework_orb_launcher_stand.json 12d520c81b5c58ad6e4e6daf6459ab5292c8700c data/pyrotechnicraft/loot_tables/blocks/firework_launcher_stand.json c8996ce9edfaa445382a2a0a96bc585e663a32a1 data/pyrotechnicraft/loot_tables/blocks/firework_missile_crafting_table.json diff --git a/src/generated/resources/.cache/9f764f6a48fad7efa1e12bbe43f82e8f02bfa43c b/src/generated/resources/.cache/9f764f6a48fad7efa1e12bbe43f82e8f02bfa43c index 804e10d..f16b1a4 100644 --- a/src/generated/resources/.cache/9f764f6a48fad7efa1e12bbe43f82e8f02bfa43c +++ b/src/generated/resources/.cache/9f764f6a48fad7efa1e12bbe43f82e8f02bfa43c @@ -1,3 +1,3 @@ -// 1.19.3 2023-06-21T00:29:39.0746577 pyrotechnicraft Block Tags +// 1.19.4 2023-06-21T01:11:42.3109363 pyrotechnicraft Block Tags 2c5103cafd2498b05d247b84469869ccf9b57ef3 data/minecraft/tags/blocks/mineable/axe.json e57dda9981b976cd6e50d607a435479c669e2958 data/minecraft/tags/blocks/mineable/pickaxe.json diff --git a/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e index 8787269..75afe24 100644 --- a/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.19.3 2023-06-21T00:29:39.075658 Recipes +// 1.19.4 2023-06-21T01:11:42.3119366 Recipes c2544c3a5070819f7156b1aa346a0dff03d51013 data/pyrotechnicraft/advancements/recipes/combat/firecracker.json 4f0d62a9014762cee6d7de5a05ba082de1f531ab data/pyrotechnicraft/advancements/recipes/combat/homing_array.json 950240db635ca89da99950e7ead8e82a4a2dd748 data/pyrotechnicraft/advancements/recipes/combat/homing_array_script.json @@ -20,24 +20,24 @@ b594a22e3d4253ba484bd5a074f915470b14bfb2 data/pyrotechnicraft/advancements/recip c3bc17c5a972fd77e9fccc3e32d9bc709147646f data/pyrotechnicraft/advancements/recipes/tools/firework_missile_crafting_table.json 4573136b7c71f0002a3c6f04ad7e5e0dc7b7b418 data/pyrotechnicraft/advancements/recipes/tools/firework_orb_crafting_table.json 94fc30831805eb39ed85477b5f567b73415abf1c data/pyrotechnicraft/advancements/recipes/tools/firework_orb_shooter.json -69fc0d20f71fab44abba8d28073b6fc23ba379ca data/pyrotechnicraft/recipes/burst_explosion_pattern.json -90f4b1f942d83cc5e2fd9afaf1179b72b6321310 data/pyrotechnicraft/recipes/extended_fuse.json -31e4d20289fea4fa79d9adba35571bc62a1e3a38 data/pyrotechnicraft/recipes/firecracker.json -eef638dde38e7450d9c1ca86a9bc68aca3536192 data/pyrotechnicraft/recipes/firework_homing_module.json -ed78b90aadd93efcf9118bf9be6c0f856abda1f0 data/pyrotechnicraft/recipes/firework_launcher.json -38e4529e427dc5226acec77e90a8625effc51f88 data/pyrotechnicraft/recipes/firework_missile_crafting_table.json +b2500703565a53af347baf4f2bdda05ab12c3073 data/pyrotechnicraft/recipes/burst_explosion_pattern.json +0db92e6b67f2e20e37003b272309f2f1a09e06cf data/pyrotechnicraft/recipes/extended_fuse.json +0099faafd288489a75a726faf2495dbfd2ae9915 data/pyrotechnicraft/recipes/firecracker.json +04a831198757e3c4c6387a87f486a8573f83168d data/pyrotechnicraft/recipes/firework_homing_module.json +784e6d576a90e83e9b46f8582849f62f35c1d20a data/pyrotechnicraft/recipes/firework_launcher.json +61031eee380956c7cc363fd13c6f64b2065bcbe8 data/pyrotechnicraft/recipes/firework_missile_crafting_table.json 9d403ae6609313670513f293d90d5ca7fcee9f1a data/pyrotechnicraft/recipes/firework_mixture.json d07b5837515be6c6e74bd5c1608314001b2a4d26 data/pyrotechnicraft/recipes/firework_mixture_with_gunpowder.json 4c52f58510d5b8de450dda070beef49274647cb1 data/pyrotechnicraft/recipes/firework_orb_core.json 6f5df8ea244b2f9d469b6879a078d9ccc057a53b data/pyrotechnicraft/recipes/firework_orb_core_with_firework_mixture.json 89d25b06dd02a3efce6470601beeb751aba45031 data/pyrotechnicraft/recipes/firework_orb_core_with_gunpowder.json -f0baea4f5c71cac201c2482f99721198ca9d8e94 data/pyrotechnicraft/recipes/firework_orb_crafting_table.json -3d3c6bdc6ae872fe87dd3098c202d3b058daab03 data/pyrotechnicraft/recipes/firework_orb_shooter.json -521899b15eb2382dceaa7f10122ee4a3998e2c93 data/pyrotechnicraft/recipes/firework_wrapping_paper.json -98b7faa44d42a9f842ec8bc5de73e8d6a9a2b57d data/pyrotechnicraft/recipes/flicker_stick.json -b1b1338e2c6b5783faa60f173c7eb32607a60916 data/pyrotechnicraft/recipes/homing_array.json +3cdb20e2a4dbc17b8469f0068be42207b9aec7fd data/pyrotechnicraft/recipes/firework_orb_crafting_table.json +f25c48ce5aa8df0c39ca6e802f8314748cd2e9ad data/pyrotechnicraft/recipes/firework_orb_shooter.json +ab2a75585cdd3f61dda573f9bc860d2d50962dfa data/pyrotechnicraft/recipes/firework_wrapping_paper.json +0660232c3c3b7c2c42755354b4506e856eb326e6 data/pyrotechnicraft/recipes/flicker_stick.json +5b12a6086b609196a0ebdda47078726b1746180d data/pyrotechnicraft/recipes/homing_array.json fe54a5da711b3fe029c6e6ceaf14554cd3bcaf10 data/pyrotechnicraft/recipes/homing_array_script.json -2e8d3e297a8f0ba18b98817903d5623e16da2cf5 data/pyrotechnicraft/recipes/instant_fuse.json -38471fe7ca3e72c37e9d6780e2bef1d4b7d958de data/pyrotechnicraft/recipes/regular_fuse.json -000f8407b463a5a296931417cdcd6c7ccf5a7af0 data/pyrotechnicraft/recipes/ring_explosion_pattern.json -48d9c90844bc97b5a15ff95743127cb6f75d3584 data/pyrotechnicraft/recipes/sphere_explosion_pattern.json +f919ea7ce476d40824672c0900e64742519ebc21 data/pyrotechnicraft/recipes/instant_fuse.json +f359a19976e64b95397e4146b69ca41aae1c5f2a data/pyrotechnicraft/recipes/regular_fuse.json +f5b3431b7a830c3fceaef850f1d09fb454ac5ff4 data/pyrotechnicraft/recipes/ring_explosion_pattern.json +23be91d473744464779a5cbc3e85e52c24127086 data/pyrotechnicraft/recipes/sphere_explosion_pattern.json diff --git a/src/generated/resources/data/pyrotechnicraft/recipes/burst_explosion_pattern.json b/src/generated/resources/data/pyrotechnicraft/recipes/burst_explosion_pattern.json index 16d6d19..d7e8161 100644 --- a/src/generated/resources/data/pyrotechnicraft/recipes/burst_explosion_pattern.json +++ b/src/generated/resources/data/pyrotechnicraft/recipes/burst_explosion_pattern.json @@ -16,5 +16,6 @@ ], "result": { "item": "pyrotechnicraft:burst_explosion_pattern" - } + }, + "show_notification": true } \ No newline at end of file diff --git a/src/generated/resources/data/pyrotechnicraft/recipes/extended_fuse.json b/src/generated/resources/data/pyrotechnicraft/recipes/extended_fuse.json index 9b06403..03022fe 100644 --- a/src/generated/resources/data/pyrotechnicraft/recipes/extended_fuse.json +++ b/src/generated/resources/data/pyrotechnicraft/recipes/extended_fuse.json @@ -17,5 +17,6 @@ "result": { "count": 2, "item": "pyrotechnicraft:extended_fuse" - } + }, + "show_notification": true } \ No newline at end of file diff --git a/src/generated/resources/data/pyrotechnicraft/recipes/firecracker.json b/src/generated/resources/data/pyrotechnicraft/recipes/firecracker.json index 1a2d8ba..30289d9 100644 --- a/src/generated/resources/data/pyrotechnicraft/recipes/firecracker.json +++ b/src/generated/resources/data/pyrotechnicraft/recipes/firecracker.json @@ -15,5 +15,6 @@ ], "result": { "item": "pyrotechnicraft:firecracker" - } + }, + "show_notification": true } \ No newline at end of file diff --git a/src/generated/resources/data/pyrotechnicraft/recipes/firework_homing_module.json b/src/generated/resources/data/pyrotechnicraft/recipes/firework_homing_module.json index a82512e..962b66e 100644 --- a/src/generated/resources/data/pyrotechnicraft/recipes/firework_homing_module.json +++ b/src/generated/resources/data/pyrotechnicraft/recipes/firework_homing_module.json @@ -22,5 +22,6 @@ ], "result": { "item": "pyrotechnicraft:firework_homing_module" - } + }, + "show_notification": true } \ No newline at end of file diff --git a/src/generated/resources/data/pyrotechnicraft/recipes/firework_launcher.json b/src/generated/resources/data/pyrotechnicraft/recipes/firework_launcher.json index c97803f..41cda76 100644 --- a/src/generated/resources/data/pyrotechnicraft/recipes/firework_launcher.json +++ b/src/generated/resources/data/pyrotechnicraft/recipes/firework_launcher.json @@ -22,5 +22,6 @@ ], "result": { "item": "pyrotechnicraft:firework_launcher" - } + }, + "show_notification": true } \ No newline at end of file diff --git a/src/generated/resources/data/pyrotechnicraft/recipes/firework_missile_crafting_table.json b/src/generated/resources/data/pyrotechnicraft/recipes/firework_missile_crafting_table.json index 1ecac01..2d95876 100644 --- a/src/generated/resources/data/pyrotechnicraft/recipes/firework_missile_crafting_table.json +++ b/src/generated/resources/data/pyrotechnicraft/recipes/firework_missile_crafting_table.json @@ -15,5 +15,6 @@ ], "result": { "item": "pyrotechnicraft:firework_missile_crafting_table" - } + }, + "show_notification": true } \ No newline at end of file diff --git a/src/generated/resources/data/pyrotechnicraft/recipes/firework_orb_crafting_table.json b/src/generated/resources/data/pyrotechnicraft/recipes/firework_orb_crafting_table.json index ecb2b52..8a7c63a 100644 --- a/src/generated/resources/data/pyrotechnicraft/recipes/firework_orb_crafting_table.json +++ b/src/generated/resources/data/pyrotechnicraft/recipes/firework_orb_crafting_table.json @@ -15,5 +15,6 @@ ], "result": { "item": "pyrotechnicraft:firework_orb_crafting_table" - } + }, + "show_notification": true } \ No newline at end of file diff --git a/src/generated/resources/data/pyrotechnicraft/recipes/firework_orb_shooter.json b/src/generated/resources/data/pyrotechnicraft/recipes/firework_orb_shooter.json index 2a056e5..08110d2 100644 --- a/src/generated/resources/data/pyrotechnicraft/recipes/firework_orb_shooter.json +++ b/src/generated/resources/data/pyrotechnicraft/recipes/firework_orb_shooter.json @@ -16,5 +16,6 @@ ], "result": { "item": "pyrotechnicraft:firework_orb_shooter" - } + }, + "show_notification": true } \ No newline at end of file diff --git a/src/generated/resources/data/pyrotechnicraft/recipes/firework_wrapping_paper.json b/src/generated/resources/data/pyrotechnicraft/recipes/firework_wrapping_paper.json index dd70660..d7e3f65 100644 --- a/src/generated/resources/data/pyrotechnicraft/recipes/firework_wrapping_paper.json +++ b/src/generated/resources/data/pyrotechnicraft/recipes/firework_wrapping_paper.json @@ -23,5 +23,6 @@ "result": { "count": 4, "item": "pyrotechnicraft:firework_wrapping_paper" - } + }, + "show_notification": true } \ No newline at end of file diff --git a/src/generated/resources/data/pyrotechnicraft/recipes/flicker_stick.json b/src/generated/resources/data/pyrotechnicraft/recipes/flicker_stick.json index 576062d..960059c 100644 --- a/src/generated/resources/data/pyrotechnicraft/recipes/flicker_stick.json +++ b/src/generated/resources/data/pyrotechnicraft/recipes/flicker_stick.json @@ -15,5 +15,6 @@ ], "result": { "item": "pyrotechnicraft:flicker_stick" - } + }, + "show_notification": true } \ No newline at end of file diff --git a/src/generated/resources/data/pyrotechnicraft/recipes/homing_array.json b/src/generated/resources/data/pyrotechnicraft/recipes/homing_array.json index 524249b..1d484f3 100644 --- a/src/generated/resources/data/pyrotechnicraft/recipes/homing_array.json +++ b/src/generated/resources/data/pyrotechnicraft/recipes/homing_array.json @@ -22,5 +22,6 @@ ], "result": { "item": "pyrotechnicraft:homing_array" - } + }, + "show_notification": true } \ No newline at end of file diff --git a/src/generated/resources/data/pyrotechnicraft/recipes/instant_fuse.json b/src/generated/resources/data/pyrotechnicraft/recipes/instant_fuse.json index 12bb93d..cbca089 100644 --- a/src/generated/resources/data/pyrotechnicraft/recipes/instant_fuse.json +++ b/src/generated/resources/data/pyrotechnicraft/recipes/instant_fuse.json @@ -17,5 +17,6 @@ "result": { "count": 2, "item": "pyrotechnicraft:instant_fuse" - } + }, + "show_notification": true } \ No newline at end of file diff --git a/src/generated/resources/data/pyrotechnicraft/recipes/regular_fuse.json b/src/generated/resources/data/pyrotechnicraft/recipes/regular_fuse.json index 6434923..f829ddd 100644 --- a/src/generated/resources/data/pyrotechnicraft/recipes/regular_fuse.json +++ b/src/generated/resources/data/pyrotechnicraft/recipes/regular_fuse.json @@ -17,5 +17,6 @@ "result": { "count": 2, "item": "pyrotechnicraft:regular_fuse" - } + }, + "show_notification": true } \ No newline at end of file diff --git a/src/generated/resources/data/pyrotechnicraft/recipes/ring_explosion_pattern.json b/src/generated/resources/data/pyrotechnicraft/recipes/ring_explosion_pattern.json index 9add5e0..1c41df4 100644 --- a/src/generated/resources/data/pyrotechnicraft/recipes/ring_explosion_pattern.json +++ b/src/generated/resources/data/pyrotechnicraft/recipes/ring_explosion_pattern.json @@ -16,5 +16,6 @@ ], "result": { "item": "pyrotechnicraft:ring_explosion_pattern" - } + }, + "show_notification": true } \ No newline at end of file diff --git a/src/generated/resources/data/pyrotechnicraft/recipes/sphere_explosion_pattern.json b/src/generated/resources/data/pyrotechnicraft/recipes/sphere_explosion_pattern.json index bcce11b..6688edd 100644 --- a/src/generated/resources/data/pyrotechnicraft/recipes/sphere_explosion_pattern.json +++ b/src/generated/resources/data/pyrotechnicraft/recipes/sphere_explosion_pattern.json @@ -16,5 +16,6 @@ ], "result": { "item": "pyrotechnicraft:sphere_explosion_pattern" - } + }, + "show_notification": true } \ No newline at end of file diff --git a/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/data/DamageTypeRegistry.java b/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/data/DamageTypeRegistry.java new file mode 100644 index 0000000..87d524e --- /dev/null +++ b/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/data/DamageTypeRegistry.java @@ -0,0 +1,17 @@ +package org.mineplugin.locusazzurro.pyrotechnicraft.data; + +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.damagesource.DamageType; +import org.mineplugin.locusazzurro.pyrotechnicraft.Pyrotechnicraft; + +public class DamageTypeRegistry { + + public static final ResourceKey FIREWORK = register("firework"); + + private static ResourceKey register(String name) + { + return ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(Pyrotechnicraft.MOD_ID, name)); + } + } diff --git a/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/datagen/DataGenerators.java b/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/datagen/DataGenerators.java index 4e04c9b..5a54149 100644 --- a/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/datagen/DataGenerators.java +++ b/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/datagen/DataGenerators.java @@ -1,14 +1,18 @@ package org.mineplugin.locusazzurro.pyrotechnicraft.datagen; import net.minecraft.core.HolderLookup; +import net.minecraft.core.RegistrySetBuilder; +import net.minecraft.core.registries.Registries; import net.minecraft.data.DataGenerator; import net.minecraft.data.PackOutput; +import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider; import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.data.event.GatherDataEvent; import org.mineplugin.locusazzurro.pyrotechnicraft.Pyrotechnicraft; +import java.util.Set; import java.util.concurrent.CompletableFuture; @Mod.EventBusSubscriber(modid = Pyrotechnicraft.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) @@ -16,6 +20,8 @@ public class DataGenerators { final static String MOD_ID = Pyrotechnicraft.MOD_ID; + private static final RegistrySetBuilder BUILDER = new RegistrySetBuilder() + .add(Registries.DAMAGE_TYPE, ModDamageTypes::bootstrap); @SubscribeEvent public static void gatherData(GatherDataEvent event) { DataGenerator generator = event.getGenerator(); @@ -29,5 +35,6 @@ public static void gatherData(GatherDataEvent event) { ModBlockTagsProvider blockTags = new ModBlockTagsProvider(output, lookupProvider, fh); generator.addProvider(event.includeServer(), blockTags); generator.addProvider(event.includeServer(), new ModItemTagsProvider(output, lookupProvider, blockTags, fh)); + generator.addProvider(event.includeServer(), new DatapackBuiltinEntriesProvider(output, event.getLookupProvider(), BUILDER, Set.of(Pyrotechnicraft.MOD_ID))); } } diff --git a/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/datagen/ModDamageTypes.java b/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/datagen/ModDamageTypes.java new file mode 100644 index 0000000..cdebccd --- /dev/null +++ b/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/datagen/ModDamageTypes.java @@ -0,0 +1,12 @@ +package org.mineplugin.locusazzurro.pyrotechnicraft.datagen; + +import net.minecraft.data.worldgen.BootstapContext; +import net.minecraft.world.damagesource.DamageType; +import org.mineplugin.locusazzurro.pyrotechnicraft.data.DamageTypeRegistry; + +public class ModDamageTypes { + protected static void bootstrap(BootstapContext context) + { + context.register(DamageTypeRegistry.FIREWORK, new DamageType("firework", 0.1F)); + } +} diff --git a/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/datagen/ModItemTagsProvider.java b/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/datagen/ModItemTagsProvider.java index b0fa631..38ec3bf 100644 --- a/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/datagen/ModItemTagsProvider.java +++ b/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/datagen/ModItemTagsProvider.java @@ -15,7 +15,7 @@ public class ModItemTagsProvider extends ItemTagsProvider { public ModItemTagsProvider(PackOutput output, CompletableFuture lookupProvider, TagsProvider blockTagProvider, ExistingFileHelper existingFileHelper) { - super(output, lookupProvider, blockTagProvider, DataGenerators.MOD_ID, existingFileHelper); + super(output, lookupProvider, blockTagProvider.contentsGetter(), DataGenerators.MOD_ID, existingFileHelper); } @Override diff --git a/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/event/ModCommonEventHandler.java b/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/event/ModCommonEventHandler.java index af933da..29d0c7f 100644 --- a/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/event/ModCommonEventHandler.java +++ b/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/event/ModCommonEventHandler.java @@ -26,9 +26,7 @@ public static void registerTabs(CreativeModeTabEvent.Register event){ event.registerCreativeModeTab(new ResourceLocation(Pyrotechnicraft.MOD_ID, "firework"), builder -> builder .icon(() -> new ItemStack(ItemRegistry.FIREWORK_MISSILE.get())) .title(Component.translatable("itemGroup.pyrotechnicraft")) - .displayItems((featureFlags, output, hasOp) -> { - ItemRegistry.ITEMS.getEntries().stream().map(RegistryObject::get).forEach(output::accept); - }) + .displayItems((displayParameters, output) -> ItemRegistry.ITEMS.getEntries().stream().map(RegistryObject::get).forEach(output::accept)) ); } diff --git a/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/world/data/damage/DamageSources.java b/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/world/data/damage/DamageSources.java deleted file mode 100644 index e87c6f8..0000000 --- a/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/world/data/damage/DamageSources.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.mineplugin.locusazzurro.pyrotechnicraft.world.data.damage; - -import net.minecraft.world.damagesource.DamageSource; -import net.minecraft.world.entity.Entity; - -public final class DamageSources { - - public static DamageSource fireworkMissile(Entity source){ - return new FireworkMissileDamage(source); - } -} diff --git a/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/world/data/damage/FireworkMissileDamage.java b/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/world/data/damage/FireworkMissileDamage.java deleted file mode 100644 index ab1e869..0000000 --- a/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/world/data/damage/FireworkMissileDamage.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.mineplugin.locusazzurro.pyrotechnicraft.world.data.damage; - -import net.minecraft.world.damagesource.EntityDamageSource; -import net.minecraft.world.entity.Entity; - -import javax.annotation.Nullable; - -public class FireworkMissileDamage extends EntityDamageSource { - - public FireworkMissileDamage(@Nullable Entity source) { - super("fireworkMissile", source); - } - - @Override - public boolean isExplosion() { - return true; - } -} diff --git a/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/world/entity/FireworkStarter.java b/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/world/entity/FireworkStarter.java index e5f8e0d..ad4930c 100644 --- a/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/world/entity/FireworkStarter.java +++ b/src/main/java/org/mineplugin/locusazzurro/pyrotechnicraft/world/entity/FireworkStarter.java @@ -1,5 +1,6 @@ package org.mineplugin.locusazzurro.pyrotechnicraft.world.entity; +import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.network.protocol.Packet; @@ -8,6 +9,7 @@ import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.sounds.SoundSource; +import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.projectile.Projectile; @@ -15,10 +17,10 @@ import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; import net.minecraftforge.network.NetworkHooks; +import org.mineplugin.locusazzurro.pyrotechnicraft.data.DamageTypeRegistry; import org.mineplugin.locusazzurro.pyrotechnicraft.data.EntityTypeRegistry; import org.mineplugin.locusazzurro.pyrotechnicraft.data.SoundEventRegistry; import org.mineplugin.locusazzurro.pyrotechnicraft.world.data.FireworkEngine; -import org.mineplugin.locusazzurro.pyrotechnicraft.world.data.damage.DamageSources; import java.util.List; import java.util.concurrent.atomic.AtomicReference; @@ -55,6 +57,9 @@ public void tick() { CompoundTag payloadListWrap = entityData.get(PAYLOAD_LIST); ListTag payloadList = payloadListWrap.getList("PayloadList", ListTag.TAG_COMPOUND); int fuseDelay = entityData.get(FUSE_DELAY); + var owner = this.getOwner(); + DamageSource damagesource = new DamageSource(this.level.registryAccess().registryOrThrow(Registries.DAMAGE_TYPE).getHolderOrThrow(DamageTypeRegistry.FIREWORK), + this, owner == null ? this : owner); if (!payloadList.isEmpty()){ this.explosionVec = deserializeVec(entityData.get(VEC)); if (fuseDelay > 0){ @@ -68,7 +73,8 @@ public void tick() { double damage = calculateDamage(explosion); List targets = this.level.getEntitiesOfClass(LivingEntity.class, new AABB(position().add(-2, -2, -2), position().add(2, 2, 2))); - targets.forEach(target -> target.hurt(DamageSources.fireworkMissile(this.getOwner()), (float) damage)); + targets.forEach(target -> target.hurt(damagesource, (float) damage)); + //targets.forEach(target -> target.hurt(DamageSources.fireworkMissile(this.getOwner()), (float) damage)); } if (this.life > fuseDelay * payloadList.size() + 10) this.discard(); } @@ -86,7 +92,8 @@ public void tick() { List targets = this.level.getEntitiesOfClass(LivingEntity.class, new AABB(position().add(-2, -2, -2), position().add(2, 2, 2))); double finalTotalDamage = totalDamage; - targets.forEach(target -> target.hurt(DamageSources.fireworkMissile(this.getOwner()), (float) finalTotalDamage)); + targets.forEach(target -> target.hurt(damagesource, (float) finalTotalDamage)); + //targets.forEach(target -> target.hurt(DamageSources.fireworkMissile(this.getOwner()), (float) finalTotalDamage)); this.discard(); } } diff --git a/src/main/resources/assets/pyrotechnicraft/lang/en_us.json b/src/main/resources/assets/pyrotechnicraft/lang/en_us.json index fd2a9f2..af573c1 100644 --- a/src/main/resources/assets/pyrotechnicraft/lang/en_us.json +++ b/src/main/resources/assets/pyrotechnicraft/lang/en_us.json @@ -100,8 +100,8 @@ "data.pyrotechnicraft.homing_system.extent.xlarge": "Very Large", "data.pyrotechnicraft.homing_system.no_info": "N/A", - "death.attack.fireworkMissile": "%1$s went out with a bang from %2$s", - "death.attack.fireworkMissile.item": "%1$ went out with a bang from %2$s using %3$s", + "death.attack.firework": "%1$s went out with a bang from %2$s", + "death.attack.firework.item": "%1$ went out with a bang from %2$s using %3$s", "subtitles.item.firework_launcher.launch": "Firework missile launched", "subtitles.entity.firework_missile.explode": "Firework explodes", diff --git a/src/main/resources/assets/pyrotechnicraft/lang/zh_cn.json b/src/main/resources/assets/pyrotechnicraft/lang/zh_cn.json index e77aa5c..1120a13 100644 --- a/src/main/resources/assets/pyrotechnicraft/lang/zh_cn.json +++ b/src/main/resources/assets/pyrotechnicraft/lang/zh_cn.json @@ -100,8 +100,8 @@ "data.pyrotechnicraft.homing_system.extent.xlarge": "极大", "data.pyrotechnicraft.homing_system.no_info": "无信息", - "death.attack.fireworkMissile": "%1$s 被 %2$s 击中,随着一声巨响灰飞烟灭", - "death.attack.fireworkMissile.item": "%1$s 被 %2$s 用 %3$s 击中,随着一声巨响灰飞烟灭", + "death.attack.firework": "%1$s 被 %2$s 击中,随着一声巨响灰飞烟灭", + "death.attack.firework.item": "%1$s 被 %2$s 用 %3$s 击中,随着一声巨响灰飞烟灭", "subtitles.item.firework_launcher.launch": "烟花导弹:发射", "subtitles.entity.firework_missile.explode": "烟花:爆裂",