From 28e5a493155f1e745f2b0a3417bc539eb44fccf7 Mon Sep 17 00:00:00 2001 From: Sollace Date: Fri, 26 Apr 2024 17:05:14 +0100 Subject: [PATCH 1/3] Add ad_astra dimensions to the dimension with no atmosphere tags --- .../unicopia/datagen/Datagen.java | 2 ++ .../tag/UDimensionTypeTagProvider.java | 35 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/UDimensionTypeTagProvider.java diff --git a/src/main/java/com/minelittlepony/unicopia/datagen/Datagen.java b/src/main/java/com/minelittlepony/unicopia/datagen/Datagen.java index 463ddef0..d0ec3073 100644 --- a/src/main/java/com/minelittlepony/unicopia/datagen/Datagen.java +++ b/src/main/java/com/minelittlepony/unicopia/datagen/Datagen.java @@ -17,6 +17,7 @@ import com.minelittlepony.unicopia.datagen.providers.loot.UEntityLootTableProvid import com.minelittlepony.unicopia.datagen.providers.recipe.URecipeProvider; import com.minelittlepony.unicopia.datagen.providers.tag.UBlockTagProvider; import com.minelittlepony.unicopia.datagen.providers.tag.UDamageTypeProvider; +import com.minelittlepony.unicopia.datagen.providers.tag.UDimensionTypeTagProvider; import com.minelittlepony.unicopia.datagen.providers.tag.UEntityTypeTagProvider; import com.minelittlepony.unicopia.datagen.providers.tag.UItemTagProvider; import com.minelittlepony.unicopia.datagen.providers.tag.UStatusEffectTagProvider; @@ -57,6 +58,7 @@ public class Datagen implements DataGeneratorEntrypoint { pack.addProvider(UDamageTypeProvider::new); pack.addProvider(UEntityTypeTagProvider::new); pack.addProvider(UStatusEffectTagProvider::new); + pack.addProvider(UDimensionTypeTagProvider::new); pack.addProvider(UModelProvider::new); pack.addProvider(URecipeProvider::new); diff --git a/src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/UDimensionTypeTagProvider.java b/src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/UDimensionTypeTagProvider.java new file mode 100644 index 00000000..e2e1e274 --- /dev/null +++ b/src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/UDimensionTypeTagProvider.java @@ -0,0 +1,35 @@ +package com.minelittlepony.unicopia.datagen.providers.tag; + +import java.util.concurrent.CompletableFuture; + +import com.minelittlepony.unicopia.UTags; +import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; +import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.RegistryWrapper.WrapperLookup; +import net.minecraft.util.Identifier; +import net.minecraft.world.dimension.DimensionType; + +public class UDimensionTypeTagProvider extends FabricTagProvider { + public UDimensionTypeTagProvider(FabricDataOutput output, CompletableFuture registriesFuture) { + super(output, RegistryKeys.DIMENSION_TYPE, registriesFuture); + } + + @Override + protected void configure(WrapperLookup lookup) { + getOrCreateTagBuilder(UTags.DimensionTypes.HAS_NO_ATMOSPHERE) + .addOptional(new Identifier("ad_astra", "earth_orbit")) + .addOptional(new Identifier("ad_astra", "glacio_orbit")) + .addOptional(new Identifier("ad_astra", "mars_orbit")) + .addOptional(new Identifier("ad_astra", "mercury_orbit")) + .addOptional(new Identifier("ad_astra", "moon")).addOptional(new Identifier("adastra", "moon_orbit")) + .addOptional(new Identifier("ad_astra", "venus_orbit")) + + .addOptional(new Identifier("adastra", "earth_orbit")) + .addOptional(new Identifier("adastra", "glacio_orbit")) + .addOptional(new Identifier("adastra", "mars_orbit")) + .addOptional(new Identifier("adastra", "mercury_orbit")) + .addOptional(new Identifier("adastra", "moon")).addOptional(new Identifier("adastra", "moon_orbit")) + .addOptional(new Identifier("adastra", "venus_orbit")); + } +} From dd4c3f4d75644c82de1a464f4926d1d5ad59339c Mon Sep 17 00:00:00 2001 From: Sollace Date: Fri, 26 Apr 2024 17:19:49 +0100 Subject: [PATCH 2/3] Datagen vanilla damagetype tags and painting variant tags --- .../unicopia/datagen/Datagen.java | 2 ++ .../providers/tag/UDamageTypeProvider.java | 24 +++++++++++++++++++ .../tag/UPaintingVariantTagProvider.java | 23 ++++++++++++++++++ .../unicopia/entity/mob/UEntities.java | 10 +++++++- .../damage_type/avoids_guardian_thorns.json | 15 ------------ .../tags/damage_type/bypasses_armor.json | 19 --------------- .../damage_type/bypasses_invulnerability.json | 6 ----- .../tags/damage_type/bypasses_shield.json | 12 ---------- .../minecraft/tags/damage_type/is_fire.json | 8 ------- .../tags/damage_type/is_lightning.json | 6 ----- .../tags/damage_type/witch_resistant_to.json | 13 ---------- .../tags/painting_variant/placeable.json | 20 ---------------- 12 files changed, 58 insertions(+), 100 deletions(-) create mode 100644 src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/UPaintingVariantTagProvider.java delete mode 100644 src/main/resources/data/minecraft/tags/damage_type/avoids_guardian_thorns.json delete mode 100644 src/main/resources/data/minecraft/tags/damage_type/bypasses_armor.json delete mode 100644 src/main/resources/data/minecraft/tags/damage_type/bypasses_invulnerability.json delete mode 100644 src/main/resources/data/minecraft/tags/damage_type/bypasses_shield.json delete mode 100644 src/main/resources/data/minecraft/tags/damage_type/is_fire.json delete mode 100644 src/main/resources/data/minecraft/tags/damage_type/is_lightning.json delete mode 100644 src/main/resources/data/minecraft/tags/damage_type/witch_resistant_to.json delete mode 100644 src/main/resources/data/minecraft/tags/painting_variant/placeable.json diff --git a/src/main/java/com/minelittlepony/unicopia/datagen/Datagen.java b/src/main/java/com/minelittlepony/unicopia/datagen/Datagen.java index d0ec3073..985be764 100644 --- a/src/main/java/com/minelittlepony/unicopia/datagen/Datagen.java +++ b/src/main/java/com/minelittlepony/unicopia/datagen/Datagen.java @@ -20,6 +20,7 @@ import com.minelittlepony.unicopia.datagen.providers.tag.UDamageTypeProvider; import com.minelittlepony.unicopia.datagen.providers.tag.UDimensionTypeTagProvider; import com.minelittlepony.unicopia.datagen.providers.tag.UEntityTypeTagProvider; import com.minelittlepony.unicopia.datagen.providers.tag.UItemTagProvider; +import com.minelittlepony.unicopia.datagen.providers.tag.UPaintingVariantTagProvider; import com.minelittlepony.unicopia.datagen.providers.tag.UStatusEffectTagProvider; import com.minelittlepony.unicopia.entity.damage.UDamageTypes; import com.minelittlepony.unicopia.server.world.UWorldGen; @@ -59,6 +60,7 @@ public class Datagen implements DataGeneratorEntrypoint { pack.addProvider(UEntityTypeTagProvider::new); pack.addProvider(UStatusEffectTagProvider::new); pack.addProvider(UDimensionTypeTagProvider::new); + pack.addProvider(UPaintingVariantTagProvider::new); pack.addProvider(UModelProvider::new); pack.addProvider(URecipeProvider::new); diff --git a/src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/UDamageTypeProvider.java b/src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/UDamageTypeProvider.java index d0b265b1..a257ccb4 100644 --- a/src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/UDamageTypeProvider.java +++ b/src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/UDamageTypeProvider.java @@ -26,5 +26,29 @@ public class UDamageTypeProvider extends FabricTagProvider { getOrCreateTagBuilder(UTags.DamageTypes.FROM_ROCKS).add(UDamageTypes.ROCK); getOrCreateTagBuilder(UTags.DamageTypes.FROM_HORSESHOES).add(UDamageTypes.HORSESHOE); getOrCreateTagBuilder(UTags.DamageTypes.BREAKS_SUNGLASSES).add(UDamageTypes.BAT_SCREECH, UDamageTypes.RAINBOOM); + + getOrCreateTagBuilder(DamageTypeTags.AVOIDS_GUARDIAN_THORNS).add( + UDamageTypes.EXHAUSTION, UDamageTypes.ALICORN_AMULET, UDamageTypes.ZAP_APPLE, UDamageTypes.KICK, UDamageTypes.SMASH, + UDamageTypes.BAT_SCREECH, UDamageTypes.LOVE_DRAINING, UDamageTypes.LIFE_DRAINING, UDamageTypes.RAINBOOM, UDamageTypes.STEAMROLLER + ); + getOrCreateTagBuilder(DamageTypeTags.BYPASSES_ARMOR).add( + UDamageTypes.EXHAUSTION, UDamageTypes.GAVITY_WELL_RECOIL, UDamageTypes.ALICORN_AMULET, + UDamageTypes.ZAP_APPLE, UDamageTypes.KICK, UDamageTypes.SMASH, UDamageTypes.BAT_SCREECH, + UDamageTypes.LOVE_DRAINING, UDamageTypes.LIFE_DRAINING, UDamageTypes.STEAMROLLER, UDamageTypes.RAINBOOM, + UDamageTypes.SUN, UDamageTypes.SUNLIGHT, UDamageTypes.PETRIFIED + ); + getOrCreateTagBuilder(DamageTypeTags.BYPASSES_INVULNERABILITY).add(UDamageTypes.TRIBE_SWAP); + getOrCreateTagBuilder(DamageTypeTags.BYPASSES_SHIELD).add( + UDamageTypes.EXHAUSTION, UDamageTypes.BAT_SCREECH, UDamageTypes.ALICORN_AMULET, + UDamageTypes.LOVE_DRAINING, UDamageTypes.LIFE_DRAINING, + UDamageTypes.RAINBOOM, UDamageTypes.TRIBE_SWAP + ); + getOrCreateTagBuilder(DamageTypeTags.IS_FIRE).add(UDamageTypes.SUN, UDamageTypes.SUNLIGHT, UDamageTypes.PETRIFIED); + getOrCreateTagBuilder(DamageTypeTags.IS_LIGHTNING).add(UDamageTypes.ZAP_APPLE); + getOrCreateTagBuilder(DamageTypeTags.WITCH_RESISTANT_TO).add( + UDamageTypes.EXHAUSTION, UDamageTypes.ALICORN_AMULET, UDamageTypes.ZAP_APPLE, + UDamageTypes.LOVE_DRAINING, UDamageTypes.LIFE_DRAINING, + UDamageTypes.KICK, UDamageTypes.SMASH, UDamageTypes.STEAMROLLER + ); } } diff --git a/src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/UPaintingVariantTagProvider.java b/src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/UPaintingVariantTagProvider.java new file mode 100644 index 00000000..acd7613d --- /dev/null +++ b/src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/UPaintingVariantTagProvider.java @@ -0,0 +1,23 @@ +package com.minelittlepony.unicopia.datagen.providers.tag; + +import java.util.concurrent.CompletableFuture; + +import com.minelittlepony.unicopia.entity.mob.UEntities; + +import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; +import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; +import net.minecraft.entity.decoration.painting.PaintingVariant; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.RegistryWrapper.WrapperLookup; +import net.minecraft.registry.tag.PaintingVariantTags; + +public class UPaintingVariantTagProvider extends FabricTagProvider { + public UPaintingVariantTagProvider(FabricDataOutput output, CompletableFuture registriesFuture) { + super(output, RegistryKeys.PAINTING_VARIANT, registriesFuture); + } + + @Override + protected void configure(WrapperLookup lookup) { + getOrCreateTagBuilder(PaintingVariantTags.PLACEABLE).add(UEntities.Paintings.REGISTRY.toArray(PaintingVariant[]::new)); + } +} diff --git a/src/main/java/com/minelittlepony/unicopia/entity/mob/UEntities.java b/src/main/java/com/minelittlepony/unicopia/entity/mob/UEntities.java index 8f1237ae..e3f3d9c8 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/mob/UEntities.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/mob/UEntities.java @@ -1,5 +1,7 @@ package com.minelittlepony.unicopia.entity.mob; +import java.util.HashSet; +import java.util.Set; import java.util.function.Predicate; import com.minelittlepony.unicopia.Unicopia; @@ -134,8 +136,14 @@ public interface UEntities { } interface Paintings { + Set REGISTRY = new HashSet<>(); + private static void register(String id, int width, int height) { - Registry.register(Registries.PAINTING_VARIANT, RegistryKey.of(RegistryKeys.PAINTING_VARIANT, Unicopia.id(id)), new PaintingVariant(16 * width, 16 * height)); + REGISTRY.add(Registry.register( + Registries.PAINTING_VARIANT, + RegistryKey.of(RegistryKeys.PAINTING_VARIANT, Unicopia.id(id)), + new PaintingVariant(16 * width, 16 * height) + )); } static void bootstrap() { diff --git a/src/main/resources/data/minecraft/tags/damage_type/avoids_guardian_thorns.json b/src/main/resources/data/minecraft/tags/damage_type/avoids_guardian_thorns.json deleted file mode 100644 index 19e83efb..00000000 --- a/src/main/resources/data/minecraft/tags/damage_type/avoids_guardian_thorns.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "replace": false, - "values": [ - "unicopia:magical_exhaustion", - "unicopia:alicorn_amulet", - "unicopia:zap", - "unicopia:kick", - "unicopia:smash", - "unicopia:bat_screech", - "unicopia:love_draining", - "unicopia:life_draining", - "unicopia:rainboom", - "unicopia:steamroller" - ] -} diff --git a/src/main/resources/data/minecraft/tags/damage_type/bypasses_armor.json b/src/main/resources/data/minecraft/tags/damage_type/bypasses_armor.json deleted file mode 100644 index d2722662..00000000 --- a/src/main/resources/data/minecraft/tags/damage_type/bypasses_armor.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "replace": false, - "values": [ - "unicopia:magical_exhaustion", - "unicopia:gravity_well_recoil", - "unicopia:alicorn_amulet", - "unicopia:zap", - "unicopia:kick", - "unicopia:smash", - "unicopia:bat_screech", - "unicopia:love_draining", - "unicopia:life_draining", - "unicopia:steamroller", - "unicopia:rainboom", - "unicopia:sun", - "unicopia:sunlight", - "unicopia:petrified" - ] -} diff --git a/src/main/resources/data/minecraft/tags/damage_type/bypasses_invulnerability.json b/src/main/resources/data/minecraft/tags/damage_type/bypasses_invulnerability.json deleted file mode 100644 index c1aca849..00000000 --- a/src/main/resources/data/minecraft/tags/damage_type/bypasses_invulnerability.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "replace": false, - "values": [ - "unicopia:tribe_swap" - ] -} diff --git a/src/main/resources/data/minecraft/tags/damage_type/bypasses_shield.json b/src/main/resources/data/minecraft/tags/damage_type/bypasses_shield.json deleted file mode 100644 index f1f01301..00000000 --- a/src/main/resources/data/minecraft/tags/damage_type/bypasses_shield.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "replace": false, - "values": [ - "unicopia:magical_exhaustion", - "unicopia:bat_screech", - "unicopia:alicorn_amulet", - "unicopia:love_draining", - "unicopia:life_draining", - "unicopia:rainboom", - "unicopia:tribe_swap" - ] -} diff --git a/src/main/resources/data/minecraft/tags/damage_type/is_fire.json b/src/main/resources/data/minecraft/tags/damage_type/is_fire.json deleted file mode 100644 index a829ffba..00000000 --- a/src/main/resources/data/minecraft/tags/damage_type/is_fire.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "replace": false, - "values": [ - "unicopia:sun", - "unicopia:sunlight", - "unicopia:petrified" - ] -} diff --git a/src/main/resources/data/minecraft/tags/damage_type/is_lightning.json b/src/main/resources/data/minecraft/tags/damage_type/is_lightning.json deleted file mode 100644 index ccf5e5e7..00000000 --- a/src/main/resources/data/minecraft/tags/damage_type/is_lightning.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "replace": false, - "values": [ - "unicopia:zap" - ] -} diff --git a/src/main/resources/data/minecraft/tags/damage_type/witch_resistant_to.json b/src/main/resources/data/minecraft/tags/damage_type/witch_resistant_to.json deleted file mode 100644 index 9f6dbb76..00000000 --- a/src/main/resources/data/minecraft/tags/damage_type/witch_resistant_to.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "replace": false, - "values": [ - "unicopia:magical_exhaustion", - "unicopia:alicorn_amulet", - "unicopia:zap", - "unicopia:love_draining", - "unicopia:life_draining", - "unicopia:kick", - "unicopia:smash", - "unicopia:steamroller" - ] -} diff --git a/src/main/resources/data/minecraft/tags/painting_variant/placeable.json b/src/main/resources/data/minecraft/tags/painting_variant/placeable.json deleted file mode 100644 index 1ce04bbd..00000000 --- a/src/main/resources/data/minecraft/tags/painting_variant/placeable.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "replace": false, - "values": [ - "unicopia:bloom", - "unicopia:chicken", - "unicopia:bells", - "unicopia:crystal", - "unicopia:harmony", - "unicopia:equality", - "unicopia:solar", - "unicopia:lunar", - "unicopia:platinum", - "unicopia:hurricane", - "unicopia:pudding", - "unicopia:terra", - "unicopia:equestria", - "unicopia:blossom", - "unicopia:shadow" - ] -} From ec8cf37917d6bbf181a30bd1aa6697349e21c0d8 Mon Sep 17 00:00:00 2001 From: Sollace Date: Fri, 26 Apr 2024 17:25:22 +0100 Subject: [PATCH 3/3] Remove duplicate asset --- .../data/c/tags/dimension_type/has_no_atmosphere.json | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 src/main/resources/data/c/tags/dimension_type/has_no_atmosphere.json diff --git a/src/main/resources/data/c/tags/dimension_type/has_no_atmosphere.json b/src/main/resources/data/c/tags/dimension_type/has_no_atmosphere.json deleted file mode 100644 index d275da3f..00000000 --- a/src/main/resources/data/c/tags/dimension_type/has_no_atmosphere.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "replace": false, - "values": [ - ] -}