From 2fed3ca4bd53a2ca347baa8147d9310135c9bede Mon Sep 17 00:00:00 2001 From: TheRealWormbo Date: Fri, 24 May 2024 23:44:44 +0200 Subject: [PATCH] Actually consume the configured amount of mana --- .../api/configdata/LooniumStructureConfiguration.java | 5 +++++ .../common/block/flower/functional/LooniumBlockEntity.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Xplat/src/main/java/vazkii/botania/api/configdata/LooniumStructureConfiguration.java b/Xplat/src/main/java/vazkii/botania/api/configdata/LooniumStructureConfiguration.java index 6336fbbe6c..38b5f5e97a 100644 --- a/Xplat/src/main/java/vazkii/botania/api/configdata/LooniumStructureConfiguration.java +++ b/Xplat/src/main/java/vazkii/botania/api/configdata/LooniumStructureConfiguration.java @@ -11,6 +11,7 @@ import net.minecraft.world.level.levelgen.structure.StructureSpawnOverride; import vazkii.botania.api.BotaniaAPI; +import vazkii.botania.common.block.flower.functional.LooniumBlockEntity; import java.util.List; import java.util.Optional; @@ -46,6 +47,10 @@ public class LooniumStructureConfiguration { if (lsc.spawnedMobs != null && lsc.spawnedMobs.isEmpty()) { return DataResult.error(() -> "Spawned mobs cannot be empty"); } + if (lsc.manaCost != null && lsc.manaCost > LooniumBlockEntity.DEFAULT_COST) { + return DataResult.error(() -> "Mana costs above %d are currently not supported" + .formatted(LooniumBlockEntity.DEFAULT_COST)); + } return DataResult.success(lsc); }); public static final ResourceLocation DEFAULT_CONFIG_ID = new ResourceLocation(BotaniaAPI.MODID, "default"); 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 eedff3cc4d..2be8058b53 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 @@ -274,7 +274,7 @@ private void spawnMob(ServerLevel world, LooniumMobSpawnData pickedMobType, world.levelEvent(LevelEvent.PARTICLES_MOBBLOCK_SPAWN, getBlockPos(), 0); world.gameEvent(mob, GameEvent.ENTITY_PLACE, mob.position()); - addMana(-DEFAULT_COST); + addMana(-pickedConfig.manaCost); sync(); }