Skip to content

Commit

Permalink
Actually consume the configured amount of mana
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealWormbo committed May 24, 2024
1 parent f18aaf2 commit 0819447
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 > 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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit 0819447

Please sign in to comment.