diff --git a/Xplat/src/generated/resources/.cache/ca0b139d7ffbdcad7e28a9e04c29c4ff458197e3 b/Xplat/src/generated/resources/.cache/ca0b139d7ffbdcad7e28a9e04c29c4ff458197e3 index 6b315e5197..93c4acac23 100644 --- a/Xplat/src/generated/resources/.cache/ca0b139d7ffbdcad7e28a9e04c29c4ff458197e3 +++ b/Xplat/src/generated/resources/.cache/ca0b139d7ffbdcad7e28a9e04c29c4ff458197e3 @@ -1,5 +1,6 @@ // 1.20.1 Botania/Advancements 89bb4518bec139b44a7df0f34040b55587072be9 data/botania/advancements/challenge/alf_portal_bread.json +88699a15ceee5f4d6b3da75b7fc8813d6ed7fecc data/botania/advancements/challenge/all_loonium_mobs.json ffc024a6dff385077c6d09e67cb357e1de0efcf8 data/botania/advancements/challenge/flugel_eye.json 2605d2617560e838fcc9e7dcef7f514f04b7a401 data/botania/advancements/challenge/gaia_guardian_hardmode.json e10869977a695f7df69049ad7e1b0104cefc4c70 data/botania/advancements/challenge/gaia_guardian_no_armor.json diff --git a/Xplat/src/generated/resources/data/botania/advancements/challenge/all_loonium_mobs.json b/Xplat/src/generated/resources/data/botania/advancements/challenge/all_loonium_mobs.json new file mode 100644 index 0000000000..d15af8121b --- /dev/null +++ b/Xplat/src/generated/resources/data/botania/advancements/challenge/all_loonium_mobs.json @@ -0,0 +1,419 @@ +{ + "parent": "botania:challenge/root", + "criteria": { + "minecraft:blaze": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:blaze", + "team": "Loonium Monsters" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:cave_spider": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:cave_spider", + "team": "Loonium Monsters" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:creeper": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:creeper", + "team": "Loonium Monsters" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:drowned": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:drowned", + "team": "Loonium Monsters" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:enderman": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:enderman", + "team": "Loonium Monsters" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:evoker": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:evoker", + "team": "Loonium Monsters" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:guardian": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:guardian", + "team": "Loonium Monsters" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:hoglin": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:hoglin", + "team": "Loonium Monsters" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:husk": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:husk", + "team": "Loonium Monsters" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:piglin": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:piglin", + "team": "Loonium Monsters" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:piglin_brute": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:piglin_brute", + "team": "Loonium Monsters" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:pillager": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:pillager", + "team": "Loonium Monsters" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:shulker": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:shulker", + "team": "Loonium Monsters" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:silverfish": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:silverfish", + "team": "Loonium Monsters" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:skeleton": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:skeleton", + "team": "Loonium Monsters" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:stray": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:stray", + "team": "Loonium Monsters" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:vindicator": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:vindicator", + "team": "Loonium Monsters" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:wither_skeleton": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:wither_skeleton", + "team": "Loonium Monsters" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:zoglin": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:zoglin", + "team": "Loonium Monsters" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:zombie": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:zombie", + "team": "Loonium Monsters" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:zombie_villager": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:zombie_villager", + "team": "Loonium Monsters" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + }, + "minecraft:zombified_piglin": { + "conditions": { + "entity": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "type": "minecraft:zombified_piglin", + "team": "Loonium Monsters" + } + } + ] + }, + "trigger": "minecraft:player_killed_entity" + } + }, + "display": { + "announce_to_chat": true, + "description": { + "translate": "advancement.botania:allLooniumMobs.desc" + }, + "frame": "challenge", + "hidden": false, + "icon": { + "item": "botania:loonium" + }, + "show_toast": true, + "title": { + "translate": "advancement.botania:allLooniumMobs" + } + }, + "requirements": [ + [ + "minecraft:blaze" + ], + [ + "minecraft:cave_spider" + ], + [ + "minecraft:creeper" + ], + [ + "minecraft:drowned" + ], + [ + "minecraft:enderman" + ], + [ + "minecraft:evoker" + ], + [ + "minecraft:guardian" + ], + [ + "minecraft:hoglin" + ], + [ + "minecraft:husk" + ], + [ + "minecraft:piglin" + ], + [ + "minecraft:piglin_brute" + ], + [ + "minecraft:pillager" + ], + [ + "minecraft:shulker" + ], + [ + "minecraft:silverfish" + ], + [ + "minecraft:skeleton" + ], + [ + "minecraft:stray" + ], + [ + "minecraft:vindicator" + ], + [ + "minecraft:wither_skeleton" + ], + [ + "minecraft:zoglin" + ], + [ + "minecraft:zombie_villager" + ], + [ + "minecraft:zombie" + ], + [ + "minecraft:zombified_piglin" + ] + ], + "sends_telemetry_event": true +} \ No newline at end of file diff --git a/Xplat/src/main/java/vazkii/botania/common/block/flower/functional/LooniumBlockEntity.java b/Xplat/src/main/java/vazkii/botania/common/block/flower/functional/LooniumBlockEntity.java index 2be8058b53..d03fb224c1 100644 --- a/Xplat/src/main/java/vazkii/botania/common/block/flower/functional/LooniumBlockEntity.java +++ b/Xplat/src/main/java/vazkii/botania/common/block/flower/functional/LooniumBlockEntity.java @@ -13,12 +13,15 @@ import it.unimi.dsi.fastutil.Pair; import it.unimi.dsi.fastutil.objects.*; +import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.resources.language.I18n; import net.minecraft.core.BlockPos; import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; @@ -42,6 +45,7 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.scores.Team; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -89,6 +93,62 @@ public class LooniumBlockEntity extends FunctionalFlowerBlockEntity { ) .build()); + // this should never collide with the /team command, since space is not allowed in scoreboard team names + public static final String LOONIUM_TEAM_NAME = "Loonium Monsters"; + public static final Team LOONIUM_TEAM = new Team() { + @NotNull + @Override + public String getName() { + return LOONIUM_TEAM_NAME; + } + + @NotNull + @Override + public MutableComponent getFormattedName(Component component) { + return component.copy(); + } + + @Override + public boolean canSeeFriendlyInvisibles() { + return true; + } + + @Override + public boolean isAllowFriendlyFire() { + return true; + } + + @NotNull + @Override + public Visibility getNameTagVisibility() { + return Visibility.ALWAYS; + } + + @NotNull + @Override + public ChatFormatting getColor() { + return ChatFormatting.RESET; + } + + @NotNull + @Override + public Collection getPlayers() { + return List.of(); + } + + @NotNull + @Override + public Visibility getDeathMessageVisibility() { + return Visibility.ALWAYS; + } + + @NotNull + @Override + public CollisionRule getCollisionRule() { + return CollisionRule.ALWAYS; + } + }; + @Nullable private ResourceLocation lootTableOverride; @Nullable diff --git a/Xplat/src/main/java/vazkii/botania/data/AdvancementProvider.java b/Xplat/src/main/java/vazkii/botania/data/AdvancementProvider.java index 74c1bfb535..fceaea3ccd 100644 --- a/Xplat/src/main/java/vazkii/botania/data/AdvancementProvider.java +++ b/Xplat/src/main/java/vazkii/botania/data/AdvancementProvider.java @@ -21,6 +21,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; +import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -31,6 +32,7 @@ import vazkii.botania.common.block.BotaniaBlocks; import vazkii.botania.common.block.BotaniaFlowerBlocks; import vazkii.botania.common.block.block_entity.corporea.CorporeaIndexBlockEntity; +import vazkii.botania.common.block.flower.functional.LooniumBlockEntity; import vazkii.botania.common.entity.BotaniaEntities; import vazkii.botania.common.item.BotaniaItems; import vazkii.botania.common.item.LexicaBotaniaItem; @@ -323,6 +325,31 @@ public void generate(HolderLookup.Provider lookup, Consumer consume public static class BotaniaChallengeAdvancements implements AdvancementSubProvider { + private static final EntityType[] LOONIUM_MOBS_TO_KILL = { + EntityType.BLAZE, + EntityType.CAVE_SPIDER, + EntityType.CREEPER, + EntityType.DROWNED, + EntityType.ENDERMAN, + EntityType.EVOKER, + EntityType.GUARDIAN, + EntityType.HOGLIN, + EntityType.HUSK, + EntityType.PIGLIN, + EntityType.PIGLIN_BRUTE, + EntityType.PILLAGER, + EntityType.SHULKER, + EntityType.SILVERFISH, + EntityType.SKELETON, + EntityType.STRAY, + EntityType.VINDICATOR, + EntityType.WITHER_SKELETON, + EntityType.ZOGLIN, + EntityType.ZOMBIE_VILLAGER, + EntityType.ZOMBIE, + EntityType.ZOMBIFIED_PIGLIN + }; + @Override public void generate(HolderLookup.Provider lookup, Consumer consumer) { Advancement root = Advancement.Builder.advancement() @@ -406,6 +433,23 @@ ContextAwarePredicate.ANY, matchItems(BotaniaItems.pinkinator), LocationPredicat .parent(root) .addCriterion("code_triggered", new ImpossibleTrigger.TriggerInstance()) .save(consumer, challengeId("tiny_potato_birthday")); + addLooniumMobsToKill(Advancement.Builder.advancement()) + .display(simple(BotaniaFlowerBlocks.loonium, "allLooniumMobs", FrameType.CHALLENGE)) + .parent(root) + .requirements(RequirementsStrategy.AND) + .save(consumer, challengeId("all_loonium_mobs")); + } + + private static Advancement.Builder addLooniumMobsToKill(Advancement.Builder builder) { + for (EntityType entityType : LOONIUM_MOBS_TO_KILL) { + builder.addCriterion( + BuiltInRegistries.ENTITY_TYPE.getKey(entityType).toString(), + KilledTrigger.TriggerInstance.playerKilledEntity(EntityPredicate.Builder.entity() + .of(entityType).team(LooniumBlockEntity.LOONIUM_TEAM_NAME)) + ); + } + + return builder; } } diff --git a/Xplat/src/main/java/vazkii/botania/mixin/EntityMixin.java b/Xplat/src/main/java/vazkii/botania/mixin/EntityMixin.java index 1c7cf770cb..0465a5a039 100644 --- a/Xplat/src/main/java/vazkii/botania/mixin/EntityMixin.java +++ b/Xplat/src/main/java/vazkii/botania/mixin/EntityMixin.java @@ -12,6 +12,8 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.scores.Team; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -20,9 +22,11 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import vazkii.botania.common.BotaniaDamageTypes; +import vazkii.botania.common.block.flower.functional.LooniumBlockEntity; import vazkii.botania.common.item.EquestrianVirusItem; import vazkii.botania.common.item.equipment.bauble.CrimsonPendantItem; import vazkii.botania.common.lib.BotaniaTags; +import vazkii.botania.xplat.XplatAbstractions; @Mixin(Entity.class) public abstract class EntityMixin { @@ -49,4 +53,17 @@ private void checkInvulnerabilities(DamageSource source, CallbackInfoReturnable< } } + /** + * Puts Loonium-spawned mobs on their own team. + * This is used both for easier identification in advancements and to prevent in-fighting. + */ + @Inject(at = @At("HEAD"), method = "getTeam", cancellable = true) + private void getLooniumTeam(CallbackInfoReturnable cir) { + if (((Object) this) instanceof Mob self) { + var looniumComponent = XplatAbstractions.INSTANCE.looniumComponent(self); + if (looniumComponent != null && looniumComponent.isSlowDespawn() && !looniumComponent.getDrop().isEmpty()) { + cir.setReturnValue(LooniumBlockEntity.LOONIUM_TEAM); + } + } + } } diff --git a/Xplat/src/main/resources/assets/botania/lang/en_us.json b/Xplat/src/main/resources/assets/botania/lang/en_us.json index 0d07a93a2d..67be938027 100644 --- a/Xplat/src/main/resources/assets/botania/lang/en_us.json +++ b/Xplat/src/main/resources/assets/botania/lang/en_us.json @@ -540,6 +540,8 @@ "advancement.botania:tinyPotatoBirthday": "Blessing", "advancement.botania:tinyPotatoBirthday.desc": "Celebrate Tiny Potato's Birthday on July 19th", + "advancement.botania:allLooniumMobs": "King", + "advancement.botania:allLooniumMobs.desc": "Kill one of every Loonium-spawned monster", "botania.challengelevel.easy": "Easy", "botania.challengelevel.normal": "Normal", diff --git a/Xplat/src/main/resources/omake.md b/Xplat/src/main/resources/omake.md index 6d71abfa25..3ba0deb02d 100644 --- a/Xplat/src/main/resources/omake.md +++ b/Xplat/src/main/resources/omake.md @@ -1207,11 +1207,12 @@ WARNING: Some songs are 18+ and inappropriate for children. | Hand in Hand | Place >255 extra blocks at once with Loki Ring | [https://vocadb.net/S/89726](https://vocadb.net/S/89726) | | Innocentia | Obtain Fruit of Grisaia | [https://vocadb.net/S/13385](https://vocadb.net/S/13385) | | One Step Layered | Obtain Thor Ring | [https://vocadb.net/S/365](https://vocadb.net/S/365) | -| Angel of Death | Obtain Flugel Eye | [https://vocadb.net/S/28559](https://vocadb.net/S/28559) | +| Angel of Death | Obtain Flügel Eye | [https://vocadb.net/S/28559](https://vocadb.net/S/28559) | | A Fake, Fake Psychotropic | Obtain King Key | [https://vocadb.net/S/37948](https://vocadb.net/S/37948) | | Lost Time Memory | Obtain Odin Ring | [https://vocadb.net/S/25896](https://vocadb.net/S/25896) | | Decorator | Use Pinkinator | [https://vocadb.net/S/45245](https://vocadb.net/S/45245) | | Blessing | Wish Tiny Potato happy birthday | [https://vocadb.net/S/50703](https://vocadb.net/S/50703) | +| King | Kill one of every Loonium-spawned monster | [https://vocadb.net/S/290384](https://vocadb.net/S/290384) | ## Favorites Hm? You want to know my favorites?